[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 632536ca9c 07/13: Add magit-status-goto-initial
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 632536ca9c 07/13: Add magit-status-goto-initial-section to magit-create-buffer-hook |
Date: |
Fri, 6 May 2022 15:58:12 -0400 (EDT) |
branch: elpa/git-commit
commit 632536ca9c2c7d5d9fe2a90ac102bee3817622a9
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Add magit-status-goto-initial-section to magit-create-buffer-hook
This helps avoid circular dependencies.
---
lisp/magit-mode.el | 4 ----
lisp/magit-status.el | 19 +++++--------------
2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el
index 4b59e291b8..fc34e300c7 100644
--- a/lisp/magit-mode.el
+++ b/lisp/magit-mode.el
@@ -43,8 +43,6 @@
(declare-function magit-process-unset-mode-line-error-status "magit-process"
())
;; For `magit-refresh-get-relative-position'
(declare-function magit-hunk-section-p "magit-diff" (section) t)
-;; For `magit-mode-setup-internal'
-(declare-function magit-status-goto-initial-section "magit-status" ())
;; For `magit-mode'
(defvar bookmark-make-record-function)
(declare-function magit--make-bookmark "magit-bookmark" ())
@@ -627,7 +625,6 @@ your mode instead of adding an entry to this variable.")
(pcase-dolist (`(,var ,val) bindings)
(set (make-local-variable var) val))
(when created
- (magit-status-goto-initial-section)
(run-hooks 'magit-create-buffer-hook)))
(magit-display-buffer buffer)
(with-current-buffer buffer
@@ -665,7 +662,6 @@ locked to its value, which is derived from MODE and ARGS."
(funcall mode)
(magit-xref-setup 'magit-mode-setup-internal args)
(when created
- (magit-status-goto-initial-section)
(run-hooks 'magit-create-buffer-hook)))
(magit-display-buffer buffer)
(with-current-buffer buffer
diff --git a/lisp/magit-status.el b/lisp/magit-status.el
index e928e7c3d5..53a4f17d49 100644
--- a/lisp/magit-status.el
+++ b/lisp/magit-status.el
@@ -403,6 +403,9 @@ Type \\[magit-commit] to create a commit.
\\{magit-status-mode-map}"
:group 'magit-status
(hack-dir-local-variables-non-file-buffer)
+ (when magit-status-initial-section
+ (add-hook 'magit-refresh-buffer-hook
+ #'magit-status-goto-initial-section nil t))
(setq magit--imenu-group-types '(not branch commit)))
(put 'magit-status-mode 'magit-diff-default-arguments
@@ -449,19 +452,7 @@ Type \\[magit-commit] to create a commit.
(magit-run-section-hook 'magit-status-sections-hook)))
(defun magit-status-goto-initial-section ()
- "In a `magit-status-mode' buffer, jump `magit-status-initial-section'.
-Actually doing so is deferred until `magit-refresh-buffer-hook'
-runs `magit-status-goto-initial-section-1'. That function then
-removes itself from the hook, so that this only happens when the
-status buffer is first created."
- (when (and magit-status-initial-section
- (derived-mode-p 'magit-status-mode))
- (add-hook 'magit-refresh-buffer-hook
- #'magit-status-goto-initial-section-1 nil t)))
-
-(defun magit-status-goto-initial-section-1 ()
- "In a `magit-status-mode' buffer, jump `magit-status-initial-section'.
-This function removes itself from `magit-refresh-buffer-hook'."
+ "Jump to the section specified by `magit-status-initial-section'."
(when-let ((section
(--some (if (integerp it)
(nth (1- it)
@@ -476,7 +467,7 @@ This function removes itself from
`magit-refresh-buffer-hook'."
(magit-section-hide section)
(magit-section-show section))))
(remove-hook 'magit-refresh-buffer-hook
- #'magit-status-goto-initial-section-1 t))
+ #'magit-status-goto-initial-section t))
(defun magit-status-maybe-update-revision-buffer (&optional _)
"When moving in the status buffer, update the revision buffer.
- [nongnu] elpa/git-commit updated (ea1d09e0a7 -> 6c98ba3dac), ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit d176c2a278 01/13: magit-custom-initialize-reset: Improve docstring, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit ec64fa4d63 06/13: magit-refresh: No longer hardcode magit-auto-revert-buffers, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 2d679dff02 10/13: Move definition of magit-tramp-process-environment, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit e35f2b9be7 09/13: magit-blame.el: Move internal variables to beginning of file, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 42a954adb4 03/13: Remove unnecessary variable declaration, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit ce29c373b9 08/13: magit-section.el: Move internal variables to beginning of file, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 632536ca9c 07/13: Add magit-status-goto-initial-section to magit-create-buffer-hook,
ELPA Syncer <=
- [nongnu] elpa/git-commit cc07643bb1 12/13: Use fboundp instead of declare-function for magit-blame functions, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 6c98ba3dac 13/13: Use fboundp instead of requiring magit-wip, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 16aa4340c8 02/13: Add missing section headings, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit 85e169736e 05/13: magit-refresh: No longer hardcode dedicated post-command hooks, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit c3268fc69d 04/13: git-commit.el: Rearrange dependencies, ELPA Syncer, 2022/05/06
- [nongnu] elpa/git-commit f365aa48c4 11/13: Move shared infix argument magit:--gpg-sign to magit.el, ELPA Syncer, 2022/05/06