mirror of
https://github.com/larstvei/Focus.git
synced 2024-11-26 11:38:32 +00:00
Fix #4
This commit is contained in:
parent
0a6e9624ea
commit
b90cfb3c27
19
focus.el
19
focus.el
@ -153,20 +153,23 @@ each command."
|
|||||||
It sets the `focus-pre-overlay' and `focus-post-overlay' to
|
It sets the `focus-pre-overlay' and `focus-post-overlay' to
|
||||||
overlays; these are invisible until `focus-move-focus' is run. It
|
overlays; these are invisible until `focus-move-focus' is run. It
|
||||||
adds `focus-move-focus' to `post-command-hook'."
|
adds `focus-move-focus' to `post-command-hook'."
|
||||||
(setq focus-pre-overlay (make-overlay (point-min) (point-min))
|
(unless (or focus-pre-overlay focus-post-overlay)
|
||||||
focus-post-overlay (make-overlay (point-max) (point-max)))
|
(setq focus-pre-overlay (make-overlay (point-min) (point-min))
|
||||||
(let ((color (focus-make-dim-color)))
|
focus-post-overlay (make-overlay (point-max) (point-max)))
|
||||||
(mapc (lambda (o) (overlay-put o 'face (cons 'foreground-color color)))
|
(let ((color (focus-make-dim-color)))
|
||||||
(list focus-pre-overlay focus-post-overlay)))
|
(mapc (lambda (o) (overlay-put o 'face (cons 'foreground-color color)))
|
||||||
(add-hook 'post-command-hook 'focus-move-focus nil t))
|
(list focus-pre-overlay focus-post-overlay)))
|
||||||
|
(add-hook 'post-command-hook 'focus-move-focus nil t)))
|
||||||
|
|
||||||
(defun focus-terminate ()
|
(defun focus-terminate ()
|
||||||
"This function is run when command `focus-mode' is disabled.
|
"This function is run when command `focus-mode' is disabled.
|
||||||
|
|
||||||
The overlays pointed to by `focus-pre-overlay' and `focus-post-overlay' are
|
The overlays pointed to by `focus-pre-overlay' and `focus-post-overlay' are
|
||||||
deleted, and `focus-move-focus' is removed from `post-command-hook'."
|
deleted, and `focus-move-focus' is removed from `post-command-hook'."
|
||||||
(progn (mapc 'delete-overlay (list 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)))
|
(remove-hook 'post-command-hook 'focus-move-focus t)
|
||||||
|
(setq focus-pre-overlay nil
|
||||||
|
focus-post-overlay nil))
|
||||||
|
|
||||||
(defun focus-goto-thing (bounds)
|
(defun focus-goto-thing (bounds)
|
||||||
"Move point to the middle of BOUNDS."
|
"Move point to the middle of BOUNDS."
|
||||||
|
Loading…
Reference in New Issue
Block a user