[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 1a53b23645 3/8: Add completion an
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 1a53b23645 3/8: Add completion annotation support from LaTeX-math-list/default |
Date: |
Tue, 28 Dec 2021 04:06:01 -0500 (EST) |
branch: externals/auctex
commit 1a53b236458d195eb7a664a1b645cdfcb96494c8
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
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.
---
latex.el | 14 ++++++++++++++
tex.el | 5 ++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/latex.el b/latex.el
index 6d25559105..e1f217f9ca 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 8acd12f8d3..a1e3b17223 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.
- [AUCTeX-diffs] [elpa] externals/auctex updated (1b05afe088 -> 367b153c1a), Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex 367b153c1a 8/8: Release GNU AUCTeX 13.0.15, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex 1a53b23645 3/8: Add completion annotation support from LaTeX-math-list/default,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex b2a50892b0 4/8: Refactor completion annotation code, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex f999caa1a0 5/8: Fix TeX-complete-make-expert-command-functions, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex bab6bf97b7 1/8: Support enhanced tabular indentation, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex d68d9ad279 7/8: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex 3cf393d43d 6/8: Make preview.sty deal with newer LaTeX hiding \shipout, Tassilo Horn, 2021/12/28
- [AUCTeX-diffs] [elpa] externals/auctex 1dfd31dcf5 2/8: Add an :annotation-function for completion and CAPF, Tassilo Horn, 2021/12/28