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

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

[elpa] externals/yasnippet 8ce506e32f: * yasnippet.el (yas--all-parents)


From: ELPA Syncer
Subject: [elpa] externals/yasnippet 8ce506e32f: * yasnippet.el (yas--all-parents): Don't add `fundamental-mode` to itself
Date: Sun, 14 Jan 2024 01:53:09 -0500 (EST)

branch: externals/yasnippet
commit 8ce506e32f629b549fd3be8c466fe87819f54d13
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * yasnippet.el (yas--all-parents): Don't add `fundamental-mode` to itself
    
    Rename `yas--all-children` to `yas--cached-children` since it doesn't
    contain "all" children.
---
 yasnippet.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index 26b8ba9f25..0641d0d355 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -829,7 +829,9 @@ which decides on the snippet to expand.")
                                               (gethash parent yas--parents))))
                                    ap)))
                      (yas--merge-ordered-lists
-                      (cons (append ap '(fundamental-mode)) extras)))
+                      (cons (if (eq (car ap) 'fundamental-mode) ap
+                              (append ap '(fundamental-mode)))
+                            extras)))
                  (cons mode
                        (yas--merge-ordered-lists
                         (mapcar #'yas--all-parents
@@ -842,7 +844,7 @@ which decides on the snippet to expand.")
                                            (when (symbolp alias) alias))
                                         ,@(gethash mode yas--parents)))))))))
           (dolist (parent all-parents)
-            (cl-pushnew mode (get parent 'yas--all-children)))
+            (cl-pushnew mode (get parent 'yas--cached-children)))
           (put mode 'yas--all-parents all-parents)))))
 
 (defun yas--modes-to-activate (&optional mode)
@@ -1857,8 +1859,9 @@ the current buffers contents."
 
 (defun yas--define-parents (mode parents)
   "Add PARENTS to the list of MODE's parents."
-  (dolist (child (get mode 'yas--all-children))
-    (put child 'yas--all-parents nil))  ;Flush the cache for all children.
+  (dolist (child (get mode 'yas--cached-children))
+    (put child 'yas--all-parents nil))  ;Flush the cache for children.
+  (put 'mode 'yas--cached-children nil)
   (puthash mode (cl-remove-duplicates
                  (append parents
                          (gethash mode yas--parents)))



reply via email to

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