Allow explicitly setting derived modes in focus-mode-to-thing

Previously, a value for focus-mode-to-thing like:

'((prog-mode . defun)
  (text-mode . sentence)
  (org-mode . paragraph))

Wouldn't work, since org-mode is dervied from text-mode. Now
focus-get-thing checks if the current mode is explicitly in
focus-mode-to-thing before checking if it's a derived mode.
This commit is contained in:
dieggsy 2017-12-03 23:57:30 -05:00
parent a84ade00a2
commit 3fafdc7947
No known key found for this signature in database
GPG Key ID: E99111AEAF94E827

View File

@ -108,7 +108,8 @@ The timer calls `focus-read-only-hide-cursor' after
"Return the current thing, based on `focus-mode-to-thing'." "Return the current thing, based on `focus-mode-to-thing'."
(or focus-current-thing (or focus-current-thing
(let* ((modes (mapcar 'car focus-mode-to-thing)) (let* ((modes (mapcar 'car focus-mode-to-thing))
(mode (focus-any 'derived-mode-p modes))) (mode (or (cl-find major-mode modes)
(focus-any 'derived-mode-p modes))))
(if mode (cdr (assoc mode focus-mode-to-thing)) 'sentence)))) (if mode (cdr (assoc mode focus-mode-to-thing)) 'sentence))))
(defun focus-bounds () (defun focus-bounds ()