emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4467e93 40/51: Use fancy field adjustment for fixed indent


From: Noam Postavsky
Subject: [elpa] master 4467e93 40/51: Use fancy field adjustment for fixed indent too
Date: Sun, 13 May 2018 13:11:45 -0400 (EDT)

branch: master
commit 4467e934f3c16aa9e75dfa3b8b0207e8d498f5df
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Use fancy field adjustment for fixed indent too
    
    * yasnippet.el (yas--indent): When `yas-indent-line' is `fixed',
    instead of calling `indent-to-column' on each line directly, bind
    `indent-line-function' and use `yas--indent-region'.  The latter uses
    some clever tricks to keep field regions from extending into the newly
    created whitespace.
---
 yasnippet.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index 0d41241..1f92adc 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -4303,9 +4303,13 @@ The SNIPPET's markers are preserved."
   ;; Now do stuff for `fixed' and `auto'.
   (save-excursion
     (cond ((eq yas-indent-line 'fixed)
-           (while (and (zerop (forward-line))
-                       (zerop (current-column)))
-             (indent-to-column yas--indent-original-column)))
+           (forward-line 1)
+           (let ((indent-line-function
+                  (lambda ()
+                    (indent-to-column yas--indent-original-column))))
+             (yas--indent-region (line-beginning-position)
+                                 (point-max)
+                                 snippet)))
           ((eq yas-indent-line 'auto)
            (unless yas-also-auto-indent-first-line
              (forward-line 1))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]