emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/focus 307df45c69 51/82: Fix #5


From: ELPA Syncer
Subject: [nongnu] elpa/focus 307df45c69 51/82: Fix #5
Date: Tue, 6 Sep 2022 04:58:57 -0400 (EDT)

branch: elpa/focus
commit 307df45c69d3a830b4caee8c418a3feff522f13a
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>

    Fix #5
---
 focus.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/focus.el b/focus.el
index 0695179e17..2670dbb47d 100644
--- a/focus.el
+++ b/focus.el
@@ -166,10 +166,11 @@ adds `focus-move-focus' to `post-command-hook'."
 
 The overlays pointed to by `focus-pre-overlay' and `focus-post-overlay' are
 deleted, and `focus-move-focus' is removed from `post-command-hook'."
-  (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
-  (remove-hook 'post-command-hook 'focus-move-focus t)
-  (setq focus-pre-overlay  nil
-        focus-post-overlay nil))
+  (when (and focus-pre-overlay focus-post-overlay)
+    (mapc 'delete-overlay (list focus-pre-overlay focus-post-overlay))
+    (remove-hook 'post-command-hook 'focus-move-focus t)
+    (setq focus-pre-overlay  nil
+          focus-post-overlay nil)))
 
 (defun focus-goto-thing (bounds)
   "Move point to the middle of BOUNDS."
@@ -261,6 +262,10 @@ up the `focus-read-only-blink-timer' and hooks."
   :keymap (let ((map (make-sparse-keymap)))
             (define-key map (kbd "C-c C-q") 'focus-read-only-mode)
             map)
+  (unless (and (color-defined-p (face-attribute 'default :background))
+               (color-defined-p (face-attribute 'default :foreground)))
+    (message "Can't enable focus mode when no theme is loaded.")
+    (setq focus-mode nil))
   (if focus-mode (focus-init) (focus-terminate)))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]