emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 96e55e6 20/34: [Fix #8] Don't propose Unicode completions


From: Vitalie Spinu
Subject: [elpa] master 96e55e6 20/34: [Fix #8] Don't propose Unicode completions if no Ucode
Date: Tue, 7 May 2019 16:05:28 -0400 (EDT)

branch: master
commit 96e55e64f0d9897cb713e861906da7f2a65b50ef
Author: Vitalie Spinu <address@hidden>
Commit: Vitalie Spinu <address@hidden>

    [Fix #8] Don't propose Unicode completions if no Ucode
---
 company-math.el | 16 +++++++++-------
 readme.md       |  1 -
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/company-math.el b/company-math.el
index 383b4de..be437bb 100644
--- a/company-math.el
+++ b/company-math.el
@@ -82,18 +82,19 @@ list of LaTeX symbols with text property :symbol being the
 corresponding unicode symbol."
   (delq nil
         (mapcar
-         #'(lambda (el)
-             (let* ((tex (substring (nth 1 el) 1))
-                    (ch (and (nth 2 el) (decode-char 'ucs (nth 2 el))))
-                    (symb (and ch (char-to-string ch))))
-               (propertize tex :symbol symb)))
+         (lambda (el)
+           (let* ((tex (substring (nth 1 el) 1))
+                  (ch (and (nth 2 el) (decode-char 'ucs (nth 2 el))))
+                  (symb (and ch (char-to-string ch))))
+             (propertize tex :symbol symb)))
          alist)))
 
 (defconst company-math--symbols
   (delete-dups
    (append (company-math--make-candidates math-symbol-list-basic)
            (company-math--make-candidates math-symbol-list-extended)))
-  "List of math completion candidates.")
+  "List of math completion candidates.
+This list is used by both LaTeX and Unicode company completion.")
 
 (defun company-math--prefix (allow-faces disallow-faces)
   (let* ((face (get-text-property (point) 'face))
@@ -157,7 +158,8 @@ good support for mathematical symbols.
     ;; Space added to ensure that completions are never typed in full.
     ;; See https://github.com/company-mode/company-mode/issues/476
     (candidates (mapcar (lambda (candidate)
-                          (concat candidate " "))
+                          (when (get-text-property 0 :symbol candidate)
+                            (concat candidate " ")))
                         (all-completions arg company-math--symbols)))
     (post-completion (company-math--substitute-unicode
                       (get-text-property 0 :symbol arg)))))
diff --git a/readme.md b/readme.md
index 0cd09cf..2b18dbd 100644
--- a/readme.md
+++ b/readme.md
@@ -28,7 +28,6 @@ You can either register each backend globally:
 ;; global activation of the unicode symbol completion 
 (add-to-list 'company-backends 'company-math-symbols-unicode)
 
-
 ```
 
 or locally per emacs mode:



reply via email to

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