mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
; Add some notes about narrowing, font-lock cc-mode issues
* yasnippet-tests.el (yas--with-font-locked-temp-buffer) (example-for-issue-474): * yasnippet.el (yas--snippet-create): Add commentary.
This commit is contained in:
parent
1cc1996074
commit
5b1217ab08
@ -855,6 +855,8 @@ mapconcat #'(lambda (arg)
|
||||
|
||||
(defmacro yas--with-font-locked-temp-buffer (&rest body)
|
||||
"Like `with-temp-buffer', but ensure `font-lock-mode'."
|
||||
;; NOTE: Replace all uses of this with `font-lock-ensure' when we
|
||||
;; drop support for Emacs 24.
|
||||
(declare (indent 0) (debug t))
|
||||
(let ((temp-buffer (make-symbol "temp-buffer")))
|
||||
;; NOTE: buffer name must not start with a space, otherwise
|
||||
@ -874,6 +876,8 @@ mapconcat #'(lambda (arg)
|
||||
(kill-buffer ,temp-buffer))))))))
|
||||
|
||||
(ert-deftest example-for-issue-474 ()
|
||||
;; This issue only reproduces in Emacs 24.3, most likely due to some
|
||||
;; bug in the cc-mode included with that Emacs version.
|
||||
(yas--with-font-locked-temp-buffer
|
||||
(c-mode)
|
||||
(yas-minor-mode 1)
|
||||
|
@ -4178,9 +4178,10 @@ Returns the newly created snippet."
|
||||
(run-hook-with-args 'before-change-functions begin end)
|
||||
(let ((before-change-functions nil)
|
||||
(after-change-functions nil))
|
||||
;; Some versions of cc-mode fail when inserting snippet
|
||||
;; content in a narrowed buffer, so make sure to insert
|
||||
;; before narrowing.
|
||||
;; Some versions of cc-mode (might be the one with Emacs
|
||||
;; 24.3 only) fail when inserting snippet content in a
|
||||
;; narrowed buffer, so make sure to insert before
|
||||
;; narrowing.
|
||||
(insert content)
|
||||
(narrow-to-region begin (point))
|
||||
(goto-char (point-min))
|
||||
|
Loading…
x
Reference in New Issue
Block a user