Finesse `text-mode-hook' vis-a-vis `typo-mode'

Add a predicate to check whether to enable `text-mode' in a given buffer.
E.g., don't enable `text-mode' in COMMIT_EDITMSG buffers.
This commit is contained in:
Case Duckworth 2021-08-17 08:47:57 -05:00
parent 52b48c8d13
commit 24255d15e2
1 changed files with 6 additions and 1 deletions

View File

@ -1404,7 +1404,12 @@ successive invocations."
(add-hook 'ssh-config-mode-hook #'turn-on-font-lock))
(setup (:straight typo)
(:hook-into text-mode))
(add-hook 'text-mode-hook
(defun text-mode@typo-unless ()
"Start `typo-mode' UNLESS the buffer matches a predicate."
(unless (or ; predicates here
(string-match-p "COMMIT_EDITMSG" buffer-file-name))
(typo-mode +1)))))
(setup (:straight undo-fu)
(:global "C-/" undo-fu-only-undo