Remove focus-any and simply apply derived-mode-p

It already takes multiple modes as arguments, removing the need for
focus-any.
This commit is contained in:
dieggsy 2017-12-04 00:03:32 -05:00
parent 3fafdc7947
commit 045ee6175e
No known key found for this signature in database
GPG Key ID: E99111AEAF94E827

View File

@ -98,18 +98,12 @@ The timer calls `focus-read-only-hide-cursor' after
focus-read-only-blink-timer)) focus-read-only-blink-timer))
(make-local-variable var)) (make-local-variable var))
(defun focus-any (f lst)
"Apply F to each element of LST and return first NON-NIL."
(when lst
(let ((v (funcall f (car lst))))
(if v v (focus-any f (cdr lst))))))
(defun focus-get-thing () (defun focus-get-thing ()
"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 (or (cl-find major-mode modes) (mode (or (cl-find major-mode modes)
(focus-any 'derived-mode-p modes)))) (apply #'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 ()