("xxx 'quote" . "xxx OKquoteOK"))))
(let ((yas-key-syntaxes '(yas-shortest-key-until-whitespace))
(yas--foobarbaz t) (yas--barbaz t))
- (yas-should-expand '(("foo-barbaz" . "foo-barOKbazOK"))))))))
+ (yas-should-expand '(("foo-barbaz" . "foo-barOKbazOK")))
+ (setq yas-key-syntaxes '(yas-longest-key-from-whitespace))
+ (yas-should-expand '(("foo-barbaz" . "OKfoo-barbazOK"))))))))
\f
;;; Loading
(when (/= (skip-chars-backward "^[:space:]\n" (1- (point))) 0)
'again))
+(defun yas-longest-key-from-whitespace (start-point)
+ "Go back to nearest whitespace, then go forward and return `again' until at START-POINT.
+
+A newline will be considered whitespace even if the mode syntax
+marks it as something else (typically comment ender). Use as
+element of `yas-key-syntaxes'."
+ (if (= (point) start-point)
+ (yas-try-key-from-whitespace start-point)
+ (forward-char))
+ (unless (= original (1+ (point)))
+ 'again))
+
+
\f
;;; User convenience functions, for using in snippet definitions