branch: externals/tempel commit a3b35cf2432b4614aeae7c3382a8b1e7bfaf4002 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Improve tempel-trigger-prefix scanning (See #50) if there is a space after the trigger prefix, completion should not set in. --- tempel.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tempel.el b/tempel.el index 67eb44133d..4a3ed0ca83 100644 --- a/tempel.el +++ b/tempel.el @@ -586,14 +586,14 @@ The completion table specifies the category `tempel'." (defun tempel--prefix-bounds () "Return prefix bounds." (if tempel-trigger-prefix - (save-excursion - (let ((end (point)) - (beg (re-search-backward - (concat (regexp-quote tempel-trigger-prefix) "\\S-*") - (line-beginning-position) 'noerror))) - (when beg - (cons (+ beg (length tempel-trigger-prefix)) end)))) - (bounds-of-thing-at-point 'symbol))) + (let ((end (point)) + (beg (save-excursion + (search-backward tempel-trigger-prefix + (line-beginning-position) 'noerror)))) + (when (and beg (save-excursion + (not (re-search-backward "\\s-" beg 'noerror)))) + (cons (+ beg (length tempel-trigger-prefix)) end))) + (bounds-of-thing-at-point 'symbol))) ;;;###autoload (defun tempel-expand (&optional interactive)