Skip to content

Commit

Permalink
(yas-reload-all): Flush the all-parents caches (issue #1194)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
monnier committed Mar 8, 2024
1 parent 15065c3 commit 33587a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion yasnippet-tests.el
Expand Up @@ -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--test-mode")))
(yas-reload-all)
(put 'c-mode 'yas--all-parents nil)
(with-temp-buffer
(let* ((major-mode 'yas--test-mode)
(expected `(fundamental-mode
Expand Down
7 changes: 7 additions & 0 deletions yasnippet.el
Expand Up @@ -824,6 +824,10 @@ which decides on the snippet to expand.")
;; Prevent sharing the tail.
(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)
"Like `derived-mode-all-parents' but obeying `yas--parents'."
(or (get mode 'yas--all-parents) ;; FIXME: Use `with-memoization'?
Expand Down Expand Up @@ -2010,6 +2014,9 @@ prefix argument."
(with-current-buffer buffer
yas--editing-template))
(buffer-list))))

(mapatoms #'yas--flush-all-parents)

;; Warn if there are buffers visiting snippets, since reloading will break
;; any on-line editing of those buffers.
;;
Expand Down

0 comments on commit 33587a8

Please sign in to comment.