branch: master commit d982b701fc4dc2e37e1a02b0aed2f0f713d9bf68 Author: Noam Postavsky <npost...@users.sourceforge.net> Commit: Noam Postavsky <npost...@users.sourceforge.net>
Fix edge case in yas-longest-key-from-whitespace * yasnippet.el (yas-longest-key-from-whitespace): don't try again if start-point is on whitespace. * yasnippet-tests.el (complicated-yas-key-syntaxes): check edge case. --- yasnippet-tests.el | 3 ++- yasnippet.el | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/yasnippet-tests.el b/yasnippet-tests.el index d090c51..4b3a440 100644 --- a/yasnippet-tests.el +++ b/yasnippet-tests.el @@ -351,7 +351,8 @@ TODO: correct this bug!" (yas--foobarbaz t) (yas--barbaz t)) (yas-should-expand '(("foo-barbaz" . "foo-barOKbazOK"))) (setq yas-key-syntaxes '(yas-longest-key-from-whitespace)) - (yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK")))))))) + (yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK") + ("foo " . "foo ")))))))) ;;; Loading diff --git a/yasnippet.el b/yasnippet.el index 900d326..ea5fe33 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -2749,7 +2749,7 @@ marks it as something else (typically comment ender)." (if (= (point) start-point) (yas-try-key-from-whitespace start-point) (forward-char)) - (unless (= original (1+ (point))) + (unless (<= start-point (1+ (point))) 'again))