perf(org): call yas-reload-all on TAB only once

In cases where the user has an empty snippets library (or no snippets
for the mode at point), the expensive `yas-reload-all` function would be
called each time you press tab.

Fix: #8025
This commit is contained in:
Henrik Lissner 2024-08-26 16:22:32 -04:00
parent d6f5fed4a4
commit 67a516cf0d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -486,7 +486,8 @@ Made for `org-tab-first-hook'."
(evil-emacs-state-p))
(or (and (bound-and-true-p yas--tables)
(gethash major-mode yas--tables))
(progn (yas-reload-all) t))
(with-memoization (get 'yas-reload-all 'reloaded)
(always (yas-reload-all))))
(yas--templates-for-key-at-point))
(yas-expand)
t)