diff options
| author | hedy <hedy@tilde.cafe> | 2023-09-12 19:00:27 +0800 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-09-28 06:20:48 +0200 |
| commit | 4b8f101dfb0ef4f1ac418f2170b268565310e0e0 (patch) | |
| tree | 1aea0e1d837e845ed0cebe6e457d91b65ffbd4b2 | |
| parent | 03d8c56c935d38a16ae539a9742d68d3320d8bf2 (diff) | |
char: `*--define` macro: Call translation-hash from within the macro
This lets the translation hash to be computed within the macro rather
than after the macro is expanded.
I kept the name `hash` for the variable symbol to conform to the style
of the other macro variables/functions in let.
| -rw-r--r-- | cape-char.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cape-char.el b/cape-char.el index a5c32f8..cd11dc2 100644 --- a/cape-char.el +++ b/cape-char.el @@ -72,11 +72,12 @@ PREFIX are the prefix characters." (docsig (intern (format "cape--%s-docsig" name))) (exit (intern (format "cape--%s-exit" name))) (properties (intern (format "cape--%s-properties" name))) - (thing-re (concat (regexp-opt (mapcar #'char-to-string prefix)) "[^ \n\t]*" ))) + (thing-re (concat (regexp-opt (mapcar #'char-to-string prefix)) "[^ \n\t]*" )) + (hash-val (cape-char--translation-hash + method + (concat "\\`" (regexp-opt (mapcar #'char-to-string prefix)))))) `(progn - (defvar ,hash (cape-char--translation-hash - ,method - ,(concat "\\`" (regexp-opt (mapcar #'char-to-string prefix))))) + (defvar ,hash ,hash-val) (defcustom ,prefix-required t ,(format "Initial prefix is required for `%s' to trigger." capf) :type 'boolean |
