summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-21 12:34:07 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-21 12:34:07 +0200
commit87badd749139b5c80897e3409a7a4c4d971262cd (patch)
tree1e355e80425e6468356e5b0971c2c8104302b966
parentf5632a29175f7bfc64d36dc2afdb42e92f421876 (diff)
emacs: Make abbreviations case-sensitive
-rw-r--r--.config/emacs/modules/mm-abbrev.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/.config/emacs/modules/mm-abbrev.el b/.config/emacs/modules/mm-abbrev.el
index 73ca761..7592d3a 100644
--- a/.config/emacs/modules/mm-abbrev.el
+++ b/.config/emacs/modules/mm-abbrev.el
@@ -7,16 +7,20 @@
Expand abbrev DEFINITIONS for the given TABLE. DEFINITIONS are a
sequence of either string pairs mapping an abbreviation to its
expansion, or a string and symbol pair mapping an abbreviation to a
-function."
+function.
+
+After adding all abbreviations to TABLE, this macro marks TABLE as
+case-sensitive to avoid unexpected abbreviation expansions."
(declare (indent 1))
(unless (cl-evenp (length definitions))
(user-error "expected an even-number of elements in DEFINITIONS"))
- (macroexp-progn
- (cl-loop for (abbrev expansion) in (seq-partition definitions 2)
- if (stringp expansion)
- collect (list #'define-abbrev table abbrev expansion)
- else
- collect (list #'define-abbrev table abbrev "" expansion))))
+ `(progn
+ ,@(cl-loop for (abbrev expansion) in (seq-partition definitions 2)
+ if (stringp expansion)
+ collect (list #'define-abbrev table abbrev expansion)
+ else
+ collect (list #'define-abbrev table abbrev "" expansion))
+ (abbrev-table-put ,table :case-fixed t)))
;;; Abbreviation Configuration