mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +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)
|
(c-mode)
|
||||||
(yas-minor-mode 1)
|
(yas-minor-mode 1)
|
||||||
(insert "#include <foo>\n")
|
(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: "))))
|
(should (string= (yas--buffer-contents) "#include <foo>\nTODO: "))))
|
||||||
|
|
||||||
(ert-deftest example-for-issue-404 ()
|
(ert-deftest example-for-issue-404 ()
|
||||||
|
@ -3911,9 +3911,11 @@ with their evaluated value into `yas--backquote-markers-and-strings'."
|
|||||||
(goto-char (match-beginning 0))
|
(goto-char (match-beginning 0))
|
||||||
(when transformed
|
(when transformed
|
||||||
(let ((marker (make-marker)))
|
(let ((marker (make-marker)))
|
||||||
|
(save-restriction
|
||||||
|
(widen)
|
||||||
(insert "Y") ;; quite horrendous, I love it :)
|
(insert "Y") ;; quite horrendous, I love it :)
|
||||||
(set-marker marker (point))
|
(set-marker marker (point))
|
||||||
(insert "Y")
|
(insert "Y"))
|
||||||
(push (cons marker transformed) yas--backquote-markers-and-strings))))))
|
(push (cons marker transformed) yas--backquote-markers-and-strings))))))
|
||||||
|
|
||||||
(defun yas--restore-backquotes ()
|
(defun yas--restore-backquotes ()
|
||||||
@ -3924,9 +3926,11 @@ with their evaluated value into `yas--backquote-markers-and-strings'."
|
|||||||
(string (cdr marker-and-string)))
|
(string (cdr marker-and-string)))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char marker)
|
(goto-char marker)
|
||||||
|
(save-restriction
|
||||||
|
(widen)
|
||||||
(delete-char -1)
|
(delete-char -1)
|
||||||
(insert string)
|
(insert string)
|
||||||
(delete-char 1)
|
(delete-char 1))
|
||||||
(set-marker marker nil)))))
|
(set-marker marker nil)))))
|
||||||
|
|
||||||
(defun yas--scan-sexps (from count)
|
(defun yas--scan-sexps (from count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user