branch: master commit 0d9d2bad327afc066f3ae26c17d22e84264bac6f Author: Vitalie Spinu <spinu...@gmail.com> Commit: Vitalie Spinu <spinu...@gmail.com>
Don't search for prefix through string boundary --- company-math.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/company-math.el b/company-math.el index e68eedc..7906337 100644 --- a/company-math.el +++ b/company-math.el @@ -139,8 +139,12 @@ corresponding unicode symbol." (memq face allow-faces))))) (when insertp (save-excursion - (when (looking-back regexp (point-at-bol) 'greedy) - (match-string 0)))))) + (let* ((ppss (syntax-ppss)) + (min-point (if (nth 3 ppss) + (max (nth 8 ppss) (point-at-bol)) + (point-at-bol)))) + (when (looking-back regexp min-point 'greedy) + (match-string 0))))))) (defun company-math--substitute-unicode (symbol) "Substitute preceding latex command with with SYMBOL."