mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
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.
This commit is contained in:
parent
58b88d8be6
commit
4467e934f3
10
yasnippet.el
10
yasnippet.el
@ -4303,9 +4303,13 @@ The SNIPPET's markers are preserved."
|
|||||||
;; Now do stuff for `fixed' and `auto'.
|
;; Now do stuff for `fixed' and `auto'.
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(cond ((eq yas-indent-line 'fixed)
|
(cond ((eq yas-indent-line 'fixed)
|
||||||
(while (and (zerop (forward-line))
|
(forward-line 1)
|
||||||
(zerop (current-column)))
|
(let ((indent-line-function
|
||||||
(indent-to-column yas--indent-original-column)))
|
(lambda ()
|
||||||
|
(indent-to-column yas--indent-original-column))))
|
||||||
|
(yas--indent-region (line-beginning-position)
|
||||||
|
(point-max)
|
||||||
|
snippet)))
|
||||||
((eq yas-indent-line 'auto)
|
((eq yas-indent-line 'auto)
|
||||||
(unless yas-also-auto-indent-first-line
|
(unless yas-also-auto-indent-first-line
|
||||||
(forward-line 1))
|
(forward-line 1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user