From 4b8f101dfb0ef4f1ac418f2170b268565310e0e0 Mon Sep 17 00:00:00 2001 From: hedy Date: Tue, 12 Sep 2023 19:00:27 +0800 Subject: 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. --- cape-char.el | 9 +++++---- 1 file 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 -- cgit v1.0