diff options
author | Case Duckworth | 2021-08-30 16:37:34 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-30 16:37:34 -0500 |
commit | 4163d8ce1e28b82a542bf26ff649e66c9b4ae59e (patch) | |
tree | a2adb928eeb78a35834bfa745181e0144427a000 | |
parent | Add C-<backspace> to paredit (diff) | |
download | emacs-4163d8ce1e28b82a542bf26ff649e66c9b4ae59e.tar.gz emacs-4163d8ce1e28b82a542bf26ff649e66c9b4ae59e.zip |
Betterize typo-mode
-rw-r--r-- | init.el | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/init.el b/init.el index 08f99b8..856c9c5 100644 --- a/init.el +++ b/init.el | |||
@@ -1762,19 +1762,29 @@ successive invocations." | |||
1762 | ;; MARK) is /not/ an apostrophe. Making it curly is a typographical | 1762 | ;; MARK) is /not/ an apostrophe. Making it curly is a typographical |
1763 | ;; consideration, not an input consideration. (I suppose you could make the | 1763 | ;; consideration, not an input consideration. (I suppose you could make the |
1764 | ;; argument that all of these are typographical considerations, but .. bleh.) | 1764 | ;; argument that all of these are typographical considerations, but .. bleh.) |
1765 | (:bind "'" self-insert-command | 1765 | (define-typo-cycle typo-cycle-apostrophe |
1766 | "`" self-insert-command) | 1766 | "Cycle through apostrophe-like graphemes. |
1767 | If used with a numeric prefix argument N, N apostrophes will be inserted." | ||
1768 | ("'" "′" "″" "’")) | ||
1769 | |||
1770 | (define-typo-cycle typo-cycle-backtick | ||
1771 | "Cycle through backtick and left single quotation mark. | ||
1772 | If used with a numeric prefix argument N, N backticks will be inserted." | ||
1773 | ("`" "‘")) | ||
1774 | |||
1775 | (:bind "'" typo-cycle-apostrophe | ||
1776 | "`" typo-cycle-backtick) | ||
1767 | 1777 | ||
1768 | ;; Enable C-c 8 map in all buffers | 1778 | ;; Enable C-c 8 map in all buffers |
1769 | (typo-global-mode +1) | 1779 | (typo-global-mode +1) |
1770 | 1780 | ||
1771 | (add-hook 'text-mode-hook | 1781 | (add-hook 'text-mode-hook |
1772 | (defun text-mode@typo-unless () | 1782 | (defun text-mode@typo-unless () |
1773 | ;; I use this /instead/ of the provided | 1783 | "Start `typo-mode' UNLESS the buffer matches a predicate." |
1784 | ;; I implement this instead of using | ||
1774 | ;; `typo-disable-electricity-functions' because the latter checks | 1785 | ;; `typo-disable-electricity-functions' because the latter checks |
1775 | ;; on every pertinent keypress. I know I want /no/ typo-ing in | 1786 | ;; on every pertinent keypress. I know I want /no/ typo-ing in |
1776 | ;; these certain buffers, so I won't even turn on the mode. | 1787 | ;; these certain buffers, so I won't even turn on the mode. |
1777 | "Start `typo-mode' UNLESS the buffer matches a predicate." | ||
1778 | (unless (or ; predicates here | 1788 | (unless (or ; predicates here |
1779 | (string-match-p "COMMIT_EDITMSG" | 1789 | (string-match-p "COMMIT_EDITMSG" |
1780 | (or (buffer-name) ""))) | 1790 | (or (buffer-name) ""))) |