mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
Restore syntax-propertize-function before indenting snippet
* yasnippet.el (yas--snippet-parse-create): Some modes require correct syntax-propertizing to indent properly.
This commit is contained in:
parent
63f44b4e48
commit
c5fddf8cec
21
yasnippet.el
21
yasnippet.el
@ -3688,17 +3688,10 @@ considered when expanding the snippet."
|
|||||||
;; them mostly to make the undo information
|
;; them mostly to make the undo information
|
||||||
;;
|
;;
|
||||||
(setq yas--start-column (current-column))
|
(setq yas--start-column (current-column))
|
||||||
(let ((yas--inhibit-overlay-hooks t)
|
(let ((yas--inhibit-overlay-hooks t))
|
||||||
;; Avoid major-mode's syntax propertizing function,
|
|
||||||
;; since we mess with the syntax-table and also
|
|
||||||
;; insert things that are not valid in the
|
|
||||||
;; major-mode language syntax anyway.
|
|
||||||
(syntax-propertize-function nil))
|
|
||||||
(insert content)
|
(insert content)
|
||||||
(setq snippet
|
(setq snippet
|
||||||
(yas--snippet-create expand-env start (point))))
|
(yas--snippet-create expand-env start (point)))))
|
||||||
;; Invalidate any syntax-propertizing done while `syntax-propertize-function' was nil
|
|
||||||
(syntax-ppss-flush-cache start))
|
|
||||||
|
|
||||||
;; stacked-expansion: This checks for stacked expansion, save the
|
;; stacked-expansion: This checks for stacked expansion, save the
|
||||||
;; `yas--previous-active-field' and advance its boundary.
|
;; `yas--previous-active-field' and advance its boundary.
|
||||||
@ -3948,7 +3941,10 @@ expansion.")
|
|||||||
necessary fields, mirrors and exit points.
|
necessary fields, mirrors and exit points.
|
||||||
|
|
||||||
Meant to be called in a narrowed buffer, does various passes"
|
Meant to be called in a narrowed buffer, does various passes"
|
||||||
(let ((parse-start (point)))
|
(let ((parse-start (point))
|
||||||
|
;; Avoid major-mode's syntax propertizing function, since we
|
||||||
|
;; change the syntax-table while calling `scan-sexps'.
|
||||||
|
(syntax-propertize-function nil))
|
||||||
;; Reset the yas--dollar-regions
|
;; Reset the yas--dollar-regions
|
||||||
;;
|
;;
|
||||||
(setq yas--dollar-regions nil)
|
(setq yas--dollar-regions nil)
|
||||||
@ -4011,7 +4007,10 @@ Meant to be called in a narrowed buffer, does various passes"
|
|||||||
;; indent the best we can
|
;; indent the best we can
|
||||||
;;
|
;;
|
||||||
(goto-char parse-start)
|
(goto-char parse-start)
|
||||||
(yas--indent snippet)))
|
;; Invalidate any syntax-propertizing done while
|
||||||
|
;; `syntax-propertize-function' was nil.
|
||||||
|
(syntax-ppss-flush-cache parse-start))
|
||||||
|
(yas--indent snippet))
|
||||||
|
|
||||||
;; HACK: Some implementations of `indent-line-function' (called via
|
;; HACK: Some implementations of `indent-line-function' (called via
|
||||||
;; `indent-according-to-mode') delete text before they insert (like
|
;; `indent-according-to-mode') delete text before they insert (like
|
||||||
|
Loading…
x
Reference in New Issue
Block a user