emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/yasnippet 5b1217a 6/8: ; Add some notes about narrowing


From: Stefan Monnier
Subject: [elpa] externals/yasnippet 5b1217a 6/8: ; Add some notes about narrowing, font-lock cc-mode issues
Date: Mon, 15 Mar 2021 22:25:53 -0400 (EDT)

branch: externals/yasnippet
commit 5b1217ab085fab4abeb1118dccb260691b446703
Author: Noam Postavsky <npostavs@users.sourceforge.net>
Commit: Noam Postavsky <npostavs@users.sourceforge.net>

    ; 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.
---
 yasnippet-tests.el | 4 ++++
 yasnippet.el       | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index a780972..e009a72 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -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)
diff --git a/yasnippet.el b/yasnippet.el
index 5b252a2..ac25669 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]