diff --git a/yasnippet-tests.el b/yasnippet-tests.el index f87b3d4..c6b878d 100644 --- a/yasnippet-tests.el +++ b/yasnippet-tests.el @@ -229,7 +229,7 @@ (c-mode) (yas-minor-mode 1) (insert "#include \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 \nTODO: ")))) (ert-deftest example-for-issue-404 () diff --git a/yasnippet.el b/yasnippet.el index 43564ff..b4432b8 100644 --- a/yasnippet.el +++ b/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)