mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
Closes #474: fix more cc-mode font-lock conflicts
* yasnippet-tests.el (example-for-issue-474): Don't call insert from within backquotes, it's redundant and prevents proper testing of backquote expansion. * yasnippet.el (yas--restore-backquotes, yas--save-backquotes): Ensure the buffer isn't narrowed while modifying it to avoid conflicting with cc-mode fontification.
This commit is contained in:
parent
fe288a156c
commit
763f5faa14
@ -229,7 +229,7 @@
|
||||
(c-mode)
|
||||
(yas-minor-mode 1)
|
||||
(insert "#include <foo>\n")
|
||||
(let ((yas-good-grace nil)) (yas-expand-snippet "`(insert \"TODO: \")`"))
|
||||
(let ((yas-good-grace nil)) (yas-expand-snippet "`\"TODO: \"`"))
|
||||
(should (string= (yas--buffer-contents) "#include <foo>\nTODO: "))))
|
||||
|
||||
(ert-deftest example-for-issue-404 ()
|
||||
|
16
yasnippet.el
16
yasnippet.el
@ -3911,9 +3911,11 @@ with their evaluated value into `yas--backquote-markers-and-strings'."
|
||||
(goto-char (match-beginning 0))
|
||||
(when transformed
|
||||
(let ((marker (make-marker)))
|
||||
(insert "Y") ;; quite horrendous, I love it :)
|
||||
(set-marker marker (point))
|
||||
(insert "Y")
|
||||
(save-restriction
|
||||
(widen)
|
||||
(insert "Y") ;; quite horrendous, I love it :)
|
||||
(set-marker marker (point))
|
||||
(insert "Y"))
|
||||
(push (cons marker transformed) yas--backquote-markers-and-strings))))))
|
||||
|
||||
(defun yas--restore-backquotes ()
|
||||
@ -3924,9 +3926,11 @@ with their evaluated value into `yas--backquote-markers-and-strings'."
|
||||
(string (cdr marker-and-string)))
|
||||
(save-excursion
|
||||
(goto-char marker)
|
||||
(delete-char -1)
|
||||
(insert string)
|
||||
(delete-char 1)
|
||||
(save-restriction
|
||||
(widen)
|
||||
(delete-char -1)
|
||||
(insert string)
|
||||
(delete-char 1))
|
||||
(set-marker marker nil)))))
|
||||
|
||||
(defun yas--scan-sexps (from count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user