auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1dfd31dcf5ce954192924


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1dfd31dcf5ce95419292496fa9254d8ae63594e7
Date: Tue, 21 Dec 2021 15:00:29 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  1dfd31dcf5ce95419292496fa9254d8ae63594e7 (commit)
      from  bab6bf97b7cd6778c7d2ce9aa8f8ce5d083a8e7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1dfd31dcf5ce95419292496fa9254d8ae63594e7
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Tue Dec 21 20:58:19 2021 +0100

    Add an :annotation-function for completion and CAPF
    
    * tex.el (TeX--completion-annotation-function): New function.
    (TeX--completion-at-point): Use it.
    (TeX--symbol-completion-table): New function.
    (TeX-insert-macro): Use both new functions.

diff --git a/tex.el b/tex.el
index ab6d3d9..8acd12f 100644
--- a/tex.el
+++ b/tex.el
@@ -3242,6 +3242,13 @@ Or alternatively:
                                          (all-completions symbol list nil)))))
         (funcall (nth 1 entry))))))
 
+(defun TeX--completion-annotation-function (sym)
+  "Annotation function for symbol/macro completion.
+Used as `:annotation-function' in `completion-extra-properties'."
+  (let ((ann (cdr (assoc (concat "\\" sym)
+                         tex--prettify-symbols-alist))))
+    (when ann (concat " " (char-to-string ann)))))
+
 (defun TeX--completion-at-point ()
   "(La)TeX completion at point function.
 See `completion-at-point-functions'."
@@ -3253,7 +3260,9 @@ See `completion-at-point-functions'."
                  (end (match-end sub))
                  (symbol (buffer-substring-no-properties begin end))
                  (list (funcall (nth 2 entry))))
-            (list begin end (all-completions symbol list)))
+            (list begin end (all-completions symbol list)
+                  :annotation-function
+                  #'TeX--completion-annotation-function))
         ;; We intentionally don't call the fallback completion functions 
because
         ;; they do completion on their own and don't work too well with things
         ;; like company-mode.  And the default function `ispell-complete-word'
@@ -3322,6 +3331,12 @@ The variable will be temporarily let-bound with the 
necessary value.")
 
 (defvar TeX-macro-history nil)
 
+(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 +3348,16 @@ 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--completion-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))))

-----------------------------------------------------------------------

Summary of changes:
 tex.el | 33 ++++++++++++++++++++++++++-------
 1 file changed, 26 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]