Betterize typo-mode

This commit is contained in:
Case Duckworth 2021-08-30 16:37:34 -05:00
parent 323a5525d5
commit 4163d8ce1e
1 changed files with 14 additions and 4 deletions

18
init.el
View File

@ -1762,19 +1762,29 @@ successive invocations."
;; MARK) is /not/ an apostrophe. Making it curly is a typographical
;; consideration, not an input consideration. (I suppose you could make the
;; argument that all of these are typographical considerations, but .. bleh.)
(:bind "'" self-insert-command
"`" self-insert-command)
(define-typo-cycle typo-cycle-apostrophe
"Cycle through apostrophe-like graphemes.
If used with a numeric prefix argument N, N apostrophes will be inserted."
("'" "" "" ""))
(define-typo-cycle typo-cycle-backtick
"Cycle through backtick and left single quotation mark.
If used with a numeric prefix argument N, N backticks will be inserted."
("`" ""))
(:bind "'" typo-cycle-apostrophe
"`" typo-cycle-backtick)
;; Enable C-c 8 map in all buffers
(typo-global-mode +1)
(add-hook 'text-mode-hook
(defun text-mode@typo-unless ()
;; I use this /instead/ of the provided
"Start `typo-mode' UNLESS the buffer matches a predicate."
;; I implement this instead of using
;; `typo-disable-electricity-functions' because the latter checks
;; on every pertinent keypress. I know I want /no/ typo-ing in
;; these certain buffers, so I won't even turn on the mode.
"Start `typo-mode' UNLESS the buffer matches a predicate."
(unless (or ; predicates here
(string-match-p "COMMIT_EDITMSG"
(or (buffer-name) "")))