[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bd3572a 36/42: Handle multiple uses of yas-auto-next
From: |
Noam Postavsky |
Subject: |
[elpa] master bd3572a 36/42: Handle multiple uses of yas-auto-next |
Date: |
Sun, 22 Dec 2019 17:38:03 -0500 (EST) |
branch: master
commit bd3572a9b392ce01ca60fb1e5f115a452827c37f
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Handle multiple uses of yas-auto-next
* yasnippet.el (yas--auto-next): Loop again after moving to the next
field.
* yasnippet-tests.el (auto-next-field): Test for multiple
yas-auto-next uses.
---
yasnippet-tests.el | 8 ++++++--
yasnippet.el | 9 +++++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index cdd42bf..6a306ee 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -694,7 +694,11 @@ mapconcat #'(lambda (arg)
(prin1-to-string '(yas-auto-next
(yas-choose-value
"bar" "foo")))
- "} baz ${2:quinn} quinn")))))
+ "} ${2:$$"
+ (prin1-to-string '(yas-auto-next
+ (yas-choose-value
+ "too" "foo")))
+ "} baz ${3:quinn} quinn")))))
(yas-reload-all)
(ruby-mode)
(yas-minor-mode 1)
@@ -702,7 +706,7 @@ mapconcat #'(lambda (arg)
(yas-mock-insert "snip")
(ert-simulate-command '(yas-expand))
(yas-mock-insert "quux")
- (should (equal "foo bar baz quux quinn" (buffer-string)))))))
+ (should (equal "foo bar too baz quux quinn" (buffer-string)))))))
;;; Snippet expansion and character escaping
diff --git a/yasnippet.el b/yasnippet.el
index 67cecb8..25bf4cc 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3039,8 +3039,13 @@ snippet field. The arguments are the same as
`completing-read'.
(defun yas--auto-next ()
"Helper for `yas-auto-next'."
- (remove-hook 'post-command-hook #'yas--auto-next t)
- (yas-next-field))
+ (cl-loop
+ do (progn (remove-hook 'post-command-hook #'yas--auto-next t)
+ (yas-next-field))
+ ;; The transform in the next field may have requested auto-next as
+ ;; well. Call it ourselves, since the command loop itself won't
+ ;; recheck the value of post-command-hook while running it.
+ while (memq #'yas--auto-next post-command-hook)))
(defmacro yas-auto-next (&rest body)
"Automatically advance to next field after eval'ing BODY."
- [elpa] master 189f737 26/42: * doc/faq.org: Note that Flyspell problem is (now fixed) Emacs bug., (continued)
- [elpa] master 189f737 26/42: * doc/faq.org: Note that Flyspell problem is (now fixed) Emacs bug., Noam Postavsky, 2019/12/22
- [elpa] master ffce236 30/42: Do auto indentation only in post command hook, Noam Postavsky, 2019/12/22
- [elpa] master 760f77a 12/42: Test for mirroring more than one field, Noam Postavsky, 2019/12/22
- [elpa] master 0f05a75 14/42: Add yas-completing-read, Noam Postavsky, 2019/12/22
- [elpa] master 03aa561 19/42: * doc/snippet-organization.org: Fix typo., Noam Postavsky, 2019/12/22
- [elpa] master 9f51cf2 17/42: Register snippet movement comments for eldoc, Noam Postavsky, 2019/12/22
- [elpa] master 6a738b5 29/42: ; doc/faq.org: Fix example keybinding code., Noam Postavsky, 2019/12/22
- [elpa] master 476bc77 35/42: Fix snippet undo, Noam Postavsky, 2019/12/22
- [elpa] master c432e78 31/42: Fix field adjustment on deletion, Noam Postavsky, 2019/12/22
- [elpa] master f056a4d 33/42: Minor code shuffling and commenting, Noam Postavsky, 2019/12/22
- [elpa] master bd3572a 36/42: Handle multiple uses of yas-auto-next,
Noam Postavsky <=
- [elpa] master e45e3de 34/42: * doc/faq.org: yas-prev should be yas-prev-field, Noam Postavsky, 2019/12/22
- [elpa] master a66f15e 38/42: Fix yas-insert-snippet for keyless snippets, Noam Postavsky, 2019/12/22
- [elpa] master d91dd66 37/42: * yasnippet.el (yas--extra-modes): Move alias before def, Noam Postavsky, 2019/12/22
- [elpa] master 1bee3a3 39/42: Fix #979: grok curly braces with LSP-style escaping, Noam Postavsky, 2019/12/22
- [elpa] master 3bf9a3b 41/42: Release 0.14.0, Noam Postavsky, 2019/12/22
- [elpa] master 4046f61 40/42: * yasnippet.el (yas-field-highlight-face): Remove redundant quote., Noam Postavsky, 2019/12/22
- [elpa] master 32f3512 42/42: * packages/yasnippet: Merge 0.14.0 from upstream., Noam Postavsky, 2019/12/22