[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d218ed8 11/40: Do indent the first line of mirrors, but in
From: |
Noam Postavsky |
Subject: |
[elpa] master d218ed8 11/40: Do indent the first line of mirrors, but in correct order |
Date: |
Wed, 26 Oct 2016 23:06:32 +0000 (UTC) |
branch: master
commit d218ed8b1bf95809edc148e609c59b124598695d
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Do indent the first line of mirrors, but in correct order
This changes the strategy for fixing #712 to a simpler alternative,
which doesn't remove the benefits of indenting single line mirrors.
It reverts the functional parts of commit
351c1e3dcbb73e3154aae0755d5b7016f1561ebc, while keeping the tests.
* yasnippet.el (yas--update-mirrors): Sort mirrors to be updated by
start position.
---
yasnippet-tests.el | 1 +
yasnippet.el | 17 +++++++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index 8da5f7d..219b2b3 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -255,6 +255,7 @@ mapconcat #'(lambda (arg)
(ert-simulate-command '(yas-next-field))
(let ((expected (mapconcat #'identity
'("@bla = bla"
+ ;; assume ruby is always indented to 2 spaces
" @ble = ble"
" @bli = bli")
"\n")))
diff --git a/yasnippet.el b/yasnippet.el
index 57dcdbc..bfe5590 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -4247,7 +4247,11 @@ When multiple expressions are found, only the last one
counts."
(cl-mapcan #'(lambda (field)
(mapcar #'(lambda (mirror)
(cons field mirror))
- (yas--field-mirrors field)))
+ (cl-sort
+ (cl-copy-list
+ (yas--field-mirrors field))
+ #'<
+ :key #'yas--mirror-start)))
(yas--snippet-fields snippet))
;; then sort this list so that entries with mirrors with parent
;; fields appear before. This was important for fixing #290,
and
@@ -4294,13 +4298,10 @@ When multiple expressions are found, only the last one
counts."
(yas--advance-start-maybe (yas--mirror-next mirror) (point))
;; super-special advance
(yas--advance-end-of-parents-maybe mirror-parent-field (point)))
- (let ((yas--inhibit-overlay-hooks t)
- (beg (save-excursion (goto-char (yas--mirror-start mirror))
- (forward-line 1)
- (point)))
- (end (yas--mirror-end mirror)))
- (when (< beg end)
- (yas--indent-region beg end snippet))))))
+ (let ((yas--inhibit-overlay-hooks t))
+ (yas--indent-region (yas--mirror-start mirror)
+ (yas--mirror-end mirror)
+ snippet)))))
(defun yas--field-update-display (field)
"Much like `yas--mirror-update-display', but for fields."
- [elpa] master updated (f06d730 -> 299efcb), Noam Postavsky, 2016/10/26
- [elpa] master bc80f67 01/40: .travis.yml: Don't notify on success, Noam Postavsky, 2016/10/26
- [elpa] master 6b785e1 08/40: Say how to hide the backquote side-effect warning, Noam Postavsky, 2016/10/26
- [elpa] master 1735a28 02/40: Add region contents to new snippet, Noam Postavsky, 2016/10/26
- [elpa] master ee4efdb 05/40: Revert "Separate parsing from evaluation of backquote lisp", Noam Postavsky, 2016/10/26
- [elpa] master 85f39ce 06/40: Warn about backquote exprs modifying the buffer, Noam Postavsky, 2016/10/26
- [elpa] master e21420a 04/40: Separate parsing from evaluation of backquote lisp, Noam Postavsky, 2016/10/26
- [elpa] master c744148 03/40: Make yas-describe-tables easier to use from lisp, Noam Postavsky, 2016/10/26
- [elpa] master d218ed8 11/40: Do indent the first line of mirrors, but in correct order,
Noam Postavsky <=
- [elpa] master 0db65ee 20/40: Don't clobber match data in modification hooks, Noam Postavsky, 2016/10/26
- [elpa] master dc098cf 25/40: Fix yas--message verbosity levels, Noam Postavsky, 2016/10/26
- [elpa] master 5af9276 27/40: Support yas/ symbols in yas-define-menu, Noam Postavsky, 2016/10/26
- [elpa] master ea9581f 22/40: Fix some quoting problems in doc strings, Noam Postavsky, 2016/10/26
- [elpa] master ee6e7a9 09/40: Fix some compilation warnings, Noam Postavsky, 2016/10/26
- [elpa] master 7661dc1 19/40: yasnippet.el (yas-escape-text): No error on nil text, Noam Postavsky, 2016/10/26
- [elpa] master 351c1e3 10/40: Don't indent first line of mirrors, Noam Postavsky, 2016/10/26
- [elpa] master 655bda8 07/40: Merge: restore backquote evaluation behaviour, Noam Postavsky, 2016/10/26
- [elpa] master 8907fd1 14/40: Escape yas-selected-text for new snippet., Noam Postavsky, 2016/10/26
- [elpa] master a4fafc3 16/40: Add test for loading snippet with same uuid, Noam Postavsky, 2016/10/26