[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 280ece2 131/177: Add yas-shortest-key-until-whitespace
From: |
João Távora |
Subject: |
[elpa] master 280ece2 131/177: Add yas-shortest-key-until-whitespace |
Date: |
Sat, 28 Mar 2015 15:41:25 +0000 |
branch: master
commit 280ece2af4be2b51629557944feb4f6e36b751f3
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Add yas-shortest-key-until-whitespace
Example yas-key-syntaxes function.
* yasnippet.el (yas-shortest-key-until-whitespace): new function.
* yasnippet-tests.el (complicated-yas-key-syntaxes): test it.
---
yasnippet-tests.el | 5 ++++-
yasnippet.el | 9 +++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index ae7a8d1..8a845dc 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -346,7 +346,10 @@ TODO: correct this bug!"
(yas-should-expand '(("foo-barbaz" . "foo-barOKbazOK")))))
(let ((yas-key-syntaxes '(yas-try-key-from-whitespace)))
(yas-should-expand '(("xxx\n'quote" . "xxx\nOKquoteOK")
- ("xxx 'quote" . "xxx OKquoteOK"))))))))
+ ("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"))))))))
;;; Loading
diff --git a/yasnippet.el b/yasnippet.el
index 741ab61..e006d52 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -2737,6 +2737,15 @@ marks it as something else (typically comment ender).
Use as
element of `yas-key-syntaxes'."
(skip-chars-backward "^[:space:]\n"))
+(defun yas-shortest-key-until-whitespace ()
+ "Return `again' until at whitespace.
+
+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'."
+ (when (/= (skip-chars-backward "^[:space:]\n" (1- (point))) 0)
+ 'again))
+
;;; User convenience functions, for using in snippet definitions
- [elpa] master 4ccf133 114/177: Merge pull request #476 from npostavs/cc-fontify2, (continued)
- [elpa] master 4ccf133 114/177: Merge pull request #476 from npostavs/cc-fontify2, João Távora, 2015/03/28
- [elpa] master f176027 118/177: Restore backquotes lost in rst -> org translation, João Távora, 2015/03/28
- [elpa] master 580e5c6 116/177: Don't lose error message when yas-good-grace is t, João Távora, 2015/03/28
- [elpa] master 4c16eae 119/177: Document uuid directive, João Távora, 2015/03/28
- [elpa] master fe288a1 121/177: Fix publishing with org 7.9, João Távora, 2015/03/28
- [elpa] master e1ed662 125/177: Allow jit loading interactively, João Távora, 2015/03/28
- [elpa] master e53ec1e 124/177: Make snippets submodule track master, update it, João Távora, 2015/03/28
- [elpa] master f98c527 123/177: Replace text -> yas-text in documentation, João Távora, 2015/03/28
- [elpa] master 763f5fa 122/177: Closes #474: fix more cc-mode font-lock conflicts, João Távora, 2015/03/28
- [elpa] master 2b24aea 126/177: Merge pull request #493 from npostavs/ijit, João Távora, 2015/03/28
- [elpa] master 280ece2 131/177: Add yas-shortest-key-until-whitespace,
João Távora <=
- [elpa] master 0b7b34a 127/177: Closes #492, closes #494: Consider defalias when calculating parent modes, João Távora, 2015/03/28
- [elpa] master 7761dee 128/177: Closes #497: Allow functions as elements in yas-key-syntaxes, João Távora, 2015/03/28
- [elpa] master faed106 129/177: * yasnippet.el (yas-key-syntaxes): Improve documentation., João Távora, 2015/03/28
- [elpa] master de34d91 130/177: Closes #470, handle non-whitespace newlines, João Távora, 2015/03/28
- [elpa] master 6b04dad 120/177: Document type directive, João Távora, 2015/03/28
- [elpa] master 10ecde1 132/177: Pass start point to yas-key-syntaxes functions, João Távora, 2015/03/28
- [elpa] master 47a3d5f 134/177: Fix yas-key-syntaxes example functions docstrings., João Távora, 2015/03/28
- [elpa] master d982b70 135/177: Fix edge case in yas-longest-key-from-whitespace, João Távora, 2015/03/28
- [elpa] master 5d10b5d 133/177: Add yas-longest-key-from-whitespace, João Távora, 2015/03/28
- [elpa] master f7ef023 137/177: Prevent disabling errors from recent `yas-current-syntaxes` logic, João Távora, 2015/03/28