branch: externals/company-math
commit 585063e03dd907714fa321ce1d2430f6d715af80
Author: Vitalie Spinu <[email protected]>
Commit: Vitalie Spinu <[email protected]>
[#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)