* 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.
This commit is contained in:
Stefan Monnier 2024-01-14 00:34:22 -05:00
parent d7f55c7501
commit 8ce506e32f

View File

@ -829,7 +829,9 @@ which decides on the snippet to expand.")
(gethash parent yas--parents)))) (gethash parent yas--parents))))
ap))) ap)))
(yas--merge-ordered-lists (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 (cons mode
(yas--merge-ordered-lists (yas--merge-ordered-lists
(mapcar #'yas--all-parents (mapcar #'yas--all-parents
@ -842,7 +844,7 @@ which decides on the snippet to expand.")
(when (symbolp alias) alias)) (when (symbolp alias) alias))
,@(gethash mode yas--parents))))))))) ,@(gethash mode yas--parents)))))))))
(dolist (parent all-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))))) (put mode 'yas--all-parents all-parents)))))
(defun yas--modes-to-activate (&optional mode) (defun yas--modes-to-activate (&optional mode)
@ -1857,8 +1859,9 @@ the current buffers contents."
(defun yas--define-parents (mode parents) (defun yas--define-parents (mode parents)
"Add PARENTS to the list of MODE's parents." "Add PARENTS to the list of MODE's parents."
(dolist (child (get mode 'yas--all-children)) (dolist (child (get mode 'yas--cached-children))
(put child 'yas--all-parents nil)) ;Flush the cache for all children. (put child 'yas--all-parents nil)) ;Flush the cache for children.
(put 'mode 'yas--cached-children nil)
(puthash mode (cl-remove-duplicates (puthash mode (cl-remove-duplicates
(append parents (append parents
(gethash mode yas--parents))) (gethash mode yas--parents)))