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. 1a53b236458d195eb7a66


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 1a53b236458d195eb7a664a1b645cdfcb96494c8
Date: Wed, 22 Dec 2021 06:04:18 -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  1a53b236458d195eb7a664a1b645cdfcb96494c8 (commit)
      from  1dfd31dcf5ce95419292496fa9254d8ae63594e7 (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 1a53b236458d195eb7a664a1b645cdfcb96494c8
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Wed Dec 22 12:03:15 2021 +0100

    Add completion annotation support from LaTeX-math-list/default
    
    * latex.el (LaTeX--completion-annotation-from-math-menu): New
    function.
    * tex.el (TeX--completion-annotation-function): Use it if bound.

diff --git a/latex.el b/latex.el
index 6d25559..e1f217f 100644
--- a/latex.el
+++ b/latex.el
@@ -5762,6 +5762,20 @@ See also `LaTeX-math-menu'."
                                 (const :tag "none" nil)
                                 (integer :tag "Number")))))
 
+(defun LaTeX--completion-annotation-from-math-menu (sym)
+  "Return a completion annotation for a SYM.
+The annotation is usually a unicode representation of the macro
+SYM's compiled representation, e.g., if SYM is alpha, α is
+returned."
+  (catch 'found
+    (dolist (var (list LaTeX-math-list LaTeX-math-default))
+      (dolist (e var)
+        (when (string= (cadr e) sym)
+          (let ((char (nth 3 e)))
+            (when char
+              (throw 'found
+                     (concat " " (char-to-string char))))))))))
+
 (defvar LaTeX-math-mode-menu)
 (define-minor-mode LaTeX-math-mode
   "A minor mode with easy access to TeX math macros.
diff --git a/tex.el b/tex.el
index 8acd12f..a1e3b17 100644
--- a/tex.el
+++ b/tex.el
@@ -3247,7 +3247,10 @@ Or alternatively:
 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)))))
+    (if ann
+        (concat " " (char-to-string ann))
+      (when (fboundp #'LaTeX--completion-annotation-from-math-menu)
+        (LaTeX--completion-annotation-from-math-menu sym)))))
 
 (defun TeX--completion-at-point ()
   "(La)TeX completion at point function.

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

Summary of changes:
 latex.el | 14 ++++++++++++++
 tex.el   |  5 ++++-
 2 files changed, 18 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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