From 3fafdc79475957a770832df5a757201e7df867b2 Mon Sep 17 00:00:00 2001 From: dieggsy Date: Sun, 3 Dec 2017 23:57:30 -0500 Subject: [PATCH] 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. --- focus.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/focus.el b/focus.el index 80cda30..008da69 100644 --- a/focus.el +++ b/focus.el @@ -108,7 +108,8 @@ The timer calls `focus-read-only-hide-cursor' after "Return the current thing, based on `focus-mode-to-thing'." (or focus-current-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)))) (defun focus-bounds ()