Fix bug related to post-command-hook

The `post-command-hook` was made `permanent-local` in order to keep
focus mode enabled when changing major mode. Other modes relies on the
`post-command-hook` to be cleared on major mode change, causing
problems. This fix rather uses the `permanent-local-hook` to tag
functions that should not be removed from hooks.

This fixes abo-abo/swiper#755. It might fix bugs I have not been able to
reproduce, namely #10, #8 and a followup in #7.
This commit is contained in:
Lars Tveito 2016-11-06 16:02:58 +01:00
parent 741a945866
commit ffd97a5a36

View File

@ -95,9 +95,15 @@ The timer calls `focus-read-only-hide-cursor' after
(dolist (var '(focus-current-thing (dolist (var '(focus-current-thing
focus-pre-overlay focus-pre-overlay
focus-post-overlay focus-post-overlay
post-command-hook)) focus-mode
focus-read-only-mode))
(put var 'permanent-local t)) (put var 'permanent-local t))
(dolist (var '(focus-read-only-cursor-blink
focus-read-only-terminate
focus-move-focus))
(put var 'permanent-local-hook t))
(defun focus-any (f lst) (defun focus-any (f lst)
"Apply F to each element of LST and return first NON-NIL." "Apply F to each element of LST and return first NON-NIL."
(when lst (when lst