branch: elpa/git-commit commit 56a27154cd68e0e79e62ad29f71be2d5d4f2ecb1 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-status-goto-initial-section: Add to correct hook [1: 632536ca9c] said it was adding this to `magit-create-buffer-hook' but actually added it to `magit-refresh-buffer-hook'. Neither of these two is appropriate. When the former is run, the sections haven't been created yet, and the latter is run on every refresh. Use the new `magit-post-create-buffer-hook' instead. 1: 2022-05-06 632536ca9c2c7d5d9fe2a90ac102bee3817622a9 Add magit-status-goto-initial-section to magit-create-buffer-hook --- lisp/magit-status.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/magit-status.el b/lisp/magit-status.el index 1c6e04a0a8..b2de4d9113 100644 --- a/lisp/magit-status.el +++ b/lisp/magit-status.el @@ -404,7 +404,7 @@ Type \\[magit-commit] to create a commit. :group 'magit-status (hack-dir-local-variables-non-file-buffer) (when magit-status-initial-section - (add-hook 'magit-refresh-buffer-hook + (add-hook 'magit-post-create-buffer-hook #'magit-status-goto-initial-section nil t)) (setq magit--imenu-group-types '(not branch commit))) @@ -465,9 +465,7 @@ Type \\[magit-commit] to create a commit. magit-section-initial-visibility-alist)))) (if (eq vis 'hide) (magit-section-hide section) - (magit-section-show section)))) - (remove-hook 'magit-refresh-buffer-hook - #'magit-status-goto-initial-section t)) + (magit-section-show section))))) (defun magit-status-maybe-update-revision-buffer (&optional _) "When moving in the status buffer, update the revision buffer.