diff --git a/tex.el b/tex.el index ab6d3d9e..c93e723a 100644 --- a/tex.el +++ b/tex.el @@ -3322,6 +3322,17 @@ The variable will be temporarily let-bound with the necessary value.") (defvar TeX-macro-history nil) +(defun TeX--symbol-annotation-function (_sym) + "Annotation function for symbol/macro completion. +Used as `:annotation-function' in `completion-extra-properties'." + "\tTODO") + +(defun TeX--symbol-completion-table () + (completion-table-dynamic + (lambda (_str) + (TeX-symbol-list-filtered)) + t)) + (defun TeX-insert-macro (symbol) "Insert TeX macro SYMBOL with completion. @@ -3333,12 +3344,15 @@ is called with \\[universal-argument]." ;; details. Note that this behavior may be changed in favor of a more ;; flexible solution in the future, therefore we don't document it at the ;; moment. - (interactive (list (completing-read (concat "Macro (default " - TeX-default-macro - "): " - TeX-esc) - (TeX-symbol-list-filtered) nil nil nil - 'TeX-macro-history TeX-default-macro))) + (interactive (list + (let ((completion-extra-properties + (list :annotation-function #'TeX--symbol-annotation-function))) + (completing-read (concat "Macro (default " + TeX-default-macro + "): " + TeX-esc) + (TeX--symbol-completion-table) nil nil nil + 'TeX-macro-history TeX-default-macro)))) (when (called-interactively-p 'any) (setq TeX-default-macro symbol)) (TeX-parse-macro symbol (cdr-safe (assoc symbol (TeX-symbol-list))))