diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2024-12-22 18:32:33 +0100 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2024-12-22 18:32:33 +0100 |
| commit | 0d8bf92e638ccdc4dedc07fde0637bbf72e295ec (patch) | |
| tree | 39ad5381996847c1d9ca7a855fae686ca438566d /lisp/magit-submodule.el | |
| parent | 6f07b17393a70b77aa393ddac40b3bcf256a339c (diff) | |
Set tabulated-list-revert-hook using setq-local
It is weird that this is a hook. Usually this is a single function,
which refreshes the entries in the buffer. But because it is a hook,
user could theoretically add additional functions to it, which they
wish run at the same time.
Since the previous commit, `magit-submodule-list-mode' derives from
`magit-repolist-mode', and due to the use of `add-hook' in both mode
functions, we ended up installing two refresh buffers, one of which
is not appropriate.
We could using `remove-hook' and then `add-hook', but it seems cleaner
to use `setq-local'. We make t part of the hook's local value, so any
functions the user added globally are still run. If a user wants to
add additional functions locally, the should probably do that using
`magit-submodule-list-mode-hook'.
Diffstat (limited to 'lisp/magit-submodule.el')
| -rw-r--r-- | lisp/magit-submodule.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el index 0dd0f81..5d0ff7a 100644 --- a/lisp/magit-submodule.el +++ b/lisp/magit-submodule.el @@ -639,7 +639,8 @@ These sections can be expanded to show the respective commits." "Major mode for browsing a list of Git submodules." :interactive nil :group 'magit-repolist - (add-hook 'tabulated-list-revert-hook #'magit-submodule-list-refresh nil t) + (setq-local tabulated-list-revert-hook + (list #'magit-submodule-list-refresh t)) (setq imenu-prev-index-position-function #'magit-repolist--imenu-prev-index-position) (setq imenu-extract-index-name-function #'tabulated-list-get-id)) |
