(yas-reload-all): Flush the all-parents caches (issue #1194)

* yasnippet.el (yas--flush-all-parents): New function.
(yas-reload-all): Use it.

* yasnippet.el (issue-492-and-494): Don't flush the all=parents cache any
more since `yas-reload-all` does it for us.
This commit is contained in:
Stefan Monnier 2024-03-08 03:15:33 -05:00
parent 15065c36b4
commit 33587a8551
2 changed files with 7 additions and 1 deletions

View File

@ -1438,7 +1438,6 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
(yas-with-snippet-dirs '((".emacs.d/snippets" (yas-with-snippet-dirs '((".emacs.d/snippets"
("yas--test-mode"))) ("yas--test-mode")))
(yas-reload-all) (yas-reload-all)
(put 'c-mode 'yas--all-parents nil)
(with-temp-buffer (with-temp-buffer
(let* ((major-mode 'yas--test-mode) (let* ((major-mode 'yas--test-mode)
(expected `(fundamental-mode (expected `(fundamental-mode

View File

@ -824,6 +824,10 @@ which decides on the snippet to expand.")
;; Prevent sharing the tail. ;; Prevent sharing the tail.
(append lists '(()) ))))))) (append lists '(()) )))))))
(defun yas--flush-all-parents (mode)
(if (get mode 'yas--all-parents)
(put mode 'yas--all-parents nil)))
(defun yas--all-parents (mode) (defun yas--all-parents (mode)
"Like `derived-mode-all-parents' but obeying `yas--parents'." "Like `derived-mode-all-parents' but obeying `yas--parents'."
(or (get mode 'yas--all-parents) ;; FIXME: Use `with-memoization'? (or (get mode 'yas--all-parents) ;; FIXME: Use `with-memoization'?
@ -2010,6 +2014,9 @@ prefix argument."
(with-current-buffer buffer (with-current-buffer buffer
yas--editing-template)) yas--editing-template))
(buffer-list)))) (buffer-list))))
(mapatoms #'yas--flush-all-parents)
;; Warn if there are buffers visiting snippets, since reloading will break ;; Warn if there are buffers visiting snippets, since reloading will break
;; any on-line editing of those buffers. ;; any on-line editing of those buffers.
;; ;;