From b21341bd40561165b13c72378cb2fb66836409cc Mon Sep 17 00:00:00 2001 From: Lars Tveito Date: Sun, 24 May 2015 02:04:02 +0200 Subject: [PATCH] Added function for briefly showing the cursor --- focus.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/focus.el b/focus.el index 0c63baf..4a76846 100644 --- a/focus.el +++ b/focus.el @@ -183,6 +183,18 @@ when `focus-read-only-mode' is activated." (when (and focus-read-only-mode (not (null focus-read-only-blink-timer))) (setq focus-read-only-blink-timer nil) (setq cursor-type nil)))) + +(defun focus-read-only-cursor-blink () + "Make the cursor visible for `focus-read-only-blink-seconds'. +This is added to the `pre-command-hook' when +`focus-read-only-mode' is active." + (when (and focus-read-only-mode + (not (member last-command '(focus-next-thing focus-prev-thing)))) + (when focus-read-only-blink-timer (cancel-timer focus-read-only-blink-timer)) + (setq cursor-type t) + (setq focus-read-only-blink-timer + (run-at-time focus-read-only-blink-seconds nil + 'focus-read-only-hide-cursor (current-buffer))))) ;;;###autoload (define-minor-mode focus-mode "Dim the font color of text in surrounding sections."