I'm checking out quail
(set-input-method
) to write some LaTeX snippets (I felt it had some advantages over the others snippet options such as yas-snippets
).
According to the manual:
quail-define-rules is an autoloaded Lisp macro in ‘quail.el’.
(quail-define-rules &rest RULES)
Define translation rules of the current Quail package. Each argument is a list of KEY and TRANSLATION. KEY is a string meaning a sequence of keystrokes to be translated. TRANSLATION is a character, a string, a vector, a Quail map, or a function.
Problem; I cannot implement function on the TRANSLATION
.
The following is my example script:
(require 'quail)
(quail-define-package
"Test-Latex" "Test-Latex" "tltx-" t
"Test-Latex Keyboard Layout"
nil t t t t nil nil nil nil nil t)
(quail-define-rules
("x" "A" ) ;; <======== char works
("a." ["\\alpha"]) ;; <======== string works
("al" ["\\begin{align}\n\n\\end{align}"]) ;; <======== string works
("eq" ["\\begin{equation}\n\n\\end{equation}"]) ;; <======== string works
("Eq" (lambda () ;; <======== function NOT WORKS
(interactive)
(insert "\\begin{equation}\n\n\\end{equation}")
(previous-line)
))
)
Question; How to implement function on the TRANSLATION
in quail-define-rules