Don't use major-mode syntax-propertize-function

during snippet creation.  The snippet creation manipulates the
syntax-table which can lead to conflicts (see also
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23443).

* yasnippet.el (yas-expand-snippet): Let-bind syntax-propertize-function
to nil and then call syntax-ppss-flush-cache afterwards.
This commit is contained in:
Noam Postavsky 2016-05-12 05:41:08 -04:00
parent 6180cc4059
commit 1b8f5b7a72

View File

@ -3566,14 +3566,21 @@ 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))
(setq snippet (setq snippet
(if expand-env (if expand-env
(eval `(let* ,expand-env (eval `(let* ,expand-env
(insert content) (insert content)
(yas--snippet-create start (point)))) (yas--snippet-create start (point))))
(insert content) (insert content)
(yas--snippet-create start (point)))))) (yas--snippet-create 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.