我想在文档的本地Emacs中定义一个缩写,即:
到目前为止,我所拥有的是:
%%% eval: (define-abbrev-table 'latex-mode-abbrev-table '(("tc" "triangular clique" nil 0)))
但这不符合我的要求......,
答案 0 :(得分:0)
这个怎么样:
(defun set-local-abbrevs (abbrevs)
"Add ABBREVS to `local-abbrev-table' and make it buffer local.
ABBREVS should be a list of abbrevs as passed to `define-abbrev-table'.
The `local-abbrev-table' will be replaced by a copy with the new
abbrevs added, so that it is not the same as the abbrev table used
in other buffers with the same `major-mode'."
(let* ((bufname (buffer-name))
(prefix (substring (md5 bufname) 0 (length bufname)))
(tblsym (intern (concat prefix "-abbrev-table"))))
(set tblsym (copy-abbrev-table local-abbrev-table))
(dolist (abbrev abbrevs)
(define-abbrev (eval tblsym)
(car abbrev)
(cadr abbrev)
(caddr abbrev)))
(setq-local local-abbrev-table (eval tblsym))))
然后:
(set-local-abbrevs '(("tc" "triangular clique" nil)))