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

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

[elpa] externals/company-math 585063e03d 1/2: [#20] Detect regexp start


From: ELPA Syncer
Subject: [elpa] externals/company-math 585063e03d 1/2: [#20] Detect regexp start within a symbol
Date: Tue, 6 Dec 2022 16:57:37 -0500 (EST)

branch: externals/company-math
commit 585063e03dd907714fa321ce1d2430f6d715af80
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>

    [#20] Detect regexp start within a symbol
    
          In order to allow for modes where regexp can be part of the symbol
    
          E.g. in org bla\t is a symbol. Thus completion were not started after 
45778f5.
---
 company-math.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/company-math.el b/company-math.el
index 92ec5ac979..c778578cd9 100644
--- a/company-math.el
+++ b/company-math.el
@@ -158,9 +158,13 @@ various faces to allow or disallow completion on."
           (save-match-data
             (when (and bounds
                        (save-excursion
-                         (goto-char (car bounds))
-                         (or (looking-at regexp) ;; symbol might contain 
prefix (like in org)
-                             (looking-back regexp min-point 'greedy))))
+                         (or
+                          ;; start is internal to the symbol (e.g. org symbols 
contain \)
+                          (re-search-backward regexp (car bounds) 'no-error)
+                          (progn
+                            (goto-char (car bounds))
+                            (or (looking-at regexp) ;; symbol might contain 
prefix (like in org)
+                                (looking-back regexp min-point 'greedy))))))
               (buffer-substring-no-properties (match-beginning 0) 
(point)))))))))
 
 (defun company-math--substitute-unicode (symbol)



reply via email to

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