[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit f815ea7795 09/10: Disband magit-imenu.el
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit f815ea7795 09/10: Disband magit-imenu.el |
Date: |
Tue, 22 Feb 2022 08:58:20 -0500 (EST) |
branch: elpa/git-commit
commit f815ea7795ac4c84804c58ed32aff679f8bb410e
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Disband magit-imenu.el
Now that the code that was used to support magit-mode-derived modes
has mostly evaporated, it is okay to spread the little code that is
necessary to support other modes across the respective files.
---
default.mk | 1 -
lisp/Makefile | 1 -
lisp/git-rebase.el | 18 ++++++++++
lisp/magit-imenu.el | 96 -------------------------------------------------
lisp/magit-repos.el | 17 +++++++++
lisp/magit-submodule.el | 14 ++++++++
lisp/magit.el | 1 -
7 files changed, 49 insertions(+), 99 deletions(-)
diff --git a/default.mk b/default.mk
index 479225a222..bbfdbbfad3 100644
--- a/default.mk
+++ b/default.mk
@@ -98,7 +98,6 @@ ELS += magit-gitignore.el
ELS += magit-bundle.el
ELS += magit-extras.el
ELS += git-rebase.el
-ELS += magit-imenu.el
ELS += magit-bookmark.el
ELCS = $(ELS:.el=.elc)
ELMS = magit.el $(filter-out $(addsuffix .el,$(PACKAGES)),$(ELS))
diff --git a/lisp/Makefile b/lisp/Makefile
index 065297c68b..4c764fb75d 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -63,7 +63,6 @@ magit-sparse-checkout.elc: magit.elc
magit-bundle.elc: magit.elc
magit-extras.elc: magit.elc magit-merge.elc
git-rebase.elc: magit.elc
-magit-imenu.elc: magit.elc git-rebase.elc
magit-bookmark.elc: magit.elc
magit-obsolete.elc: magit.elc
diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el
index a893a64d26..886156b04d 100644
--- a/lisp/git-rebase.el
+++ b/lisp/git-rebase.el
@@ -828,6 +828,24 @@ By default, this is the same except for the \"pick\"
command."
(add-to-list 'with-editor-file-name-history-exclude git-rebase-filename-regexp)
+;;; Imenu Support
+
+(defun magit-imenu--rebase-prev-index-position-function ()
+ "Move point to previous commit in git-rebase buffer.
+Used as a value for `imenu-prev-index-position-function'."
+ (catch 'found
+ (while (not (bobp))
+ (git-rebase-backward-line)
+ (when (git-rebase-line-p)
+ (throw 'found t)))))
+
+(defun magit-imenu--rebase-extract-index-name-function ()
+ "Return imenu name for line at point.
+Point should be at the beginning of the line. This function
+is used as a value for `imenu-extract-index-name-function'."
+ (buffer-substring-no-properties (line-beginning-position)
+ (line-end-position)))
+
;;; _
(provide 'git-rebase)
;;; git-rebase.el ends here
diff --git a/lisp/magit-imenu.el b/lisp/magit-imenu.el
deleted file mode 100644
index aef6175278..0000000000
--- a/lisp/magit-imenu.el
+++ /dev/null
@@ -1,96 +0,0 @@
-;;; magit-imenu.el --- Integrate Imenu in magit major modes -*-
lexical-binding: t -*-
-
-;; Copyright (C) 2010-2022 The Magit Project Contributors
-;;
-;; You should have received a copy of the AUTHORS.md file which
-;; lists all contributors. If not, see http://magit.vc/authors.
-
-;; Author: Damien Cassou <damien@cassou.me>
-;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
-
-;; SPDX-License-Identifier: GPL-3.0-or-later
-
-;; Magit is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-;;
-;; Magit is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-;; License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with Magit. If not, see http://www.gnu.org/licenses.
-
-;;; Commentary:
-
-;; Emacs' major modes can facilitate navigation in their buffers by
-;; supporting Imenu. In such major modes, launching Imenu (M-x imenu)
-;; makes Emacs display a list of items (e.g., function definitions in
-;; a programming major mode). Selecting an item from this list moves
-;; point to this item.
-
-;;; Code:
-
-(require 'magit)
-(require 'git-rebase)
-
-;;; Submodule list mode
-
-;;;###autoload
-(defun magit-imenu--submodule-prev-index-position-function ()
- "Move point to previous line in magit-submodule-list buffer.
-Used as a value for `imenu-prev-index-position-function'."
- (unless (bobp)
- (forward-line -1)))
-
-;;;###autoload
-(defun magit-imenu--submodule-extract-index-name-function ()
- "Return imenu name for line at point.
-Point should be at the beginning of the line. This function
-is used as a value for `imenu-extract-index-name-function'."
- (car (tabulated-list-get-entry)))
-
-;;; Repolist mode
-
-;;;###autoload
-(defun magit-imenu--repolist-prev-index-position-function ()
- "Move point to previous line in magit-repolist buffer.
-Used as a value for `imenu-prev-index-position-function'."
- (unless (bobp)
- (forward-line -1)))
-
-;;;###autoload
-(defun magit-imenu--repolist-extract-index-name-function ()
- "Return imenu name for line at point.
-Point should be at the beginning of the line. This function
-is used as a value for `imenu-extract-index-name-function'."
- (let ((entry (tabulated-list-get-entry)))
- (format "%s (%s)"
- (car entry)
- (car (last entry)))))
-
-;;; Rebase mode
-
-;;;###autoload
-(defun magit-imenu--rebase-prev-index-position-function ()
- "Move point to previous commit in git-rebase buffer.
-Used as a value for `imenu-prev-index-position-function'."
- (catch 'found
- (while (not (bobp))
- (git-rebase-backward-line)
- (when (git-rebase-line-p)
- (throw 'found t)))))
-
-;;;###autoload
-(defun magit-imenu--rebase-extract-index-name-function ()
- "Return imenu name for line at point.
-Point should be at the beginning of the line. This function
-is used as a value for `imenu-extract-index-name-function'."
- (buffer-substring-no-properties (line-beginning-position)
- (line-end-position)))
-
-;;; _
-(provide 'magit-imenu)
-;;; magit-imenu.el ends here
diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el
index d99373a33a..efd8147ecc 100644
--- a/lisp/magit-repos.el
+++ b/lisp/magit-repos.el
@@ -469,6 +469,23 @@ which only lists the first one found."
(number-to-string n))
(if (> n (or (cadr (assq :normal-count spec)) 0)) 'bold 'shadow)))
+;;;; Imenu Support
+
+(defun magit-imenu--repolist-prev-index-position-function ()
+ "Move point to previous line in magit-repolist buffer.
+Used as a value for `imenu-prev-index-position-function'."
+ (unless (bobp)
+ (forward-line -1)))
+
+(defun magit-imenu--repolist-extract-index-name-function ()
+ "Return imenu name for line at point.
+Point should be at the beginning of the line. This function
+is used as a value for `imenu-extract-index-name-function'."
+ (let ((entry (tabulated-list-get-entry)))
+ (format "%s (%s)"
+ (car entry)
+ (car (last entry)))))
+
;;; Read Repository
(defun magit-read-repository (&optional read-directory-name)
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index ffd2c82216..e818ce64f3 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -684,6 +684,20 @@ These sections can be expanded to show the respective
commits."
"Insert the relative path of the submodule."
(cadr (assq :path spec)))
+;;;; Imenu Support
+
+(defun magit-imenu--submodule-prev-index-position-function ()
+ "Move point to previous line in magit-submodule-list buffer.
+Used as a value for `imenu-prev-index-position-function'."
+ (unless (bobp)
+ (forward-line -1)))
+
+(defun magit-imenu--submodule-extract-index-name-function ()
+ "Return imenu name for line at point.
+Point should be at the beginning of the line. This function
+is used as a value for `imenu-extract-index-name-function'."
+ (car (tabulated-list-get-entry)))
+
;;; Utilities
(defun magit-submodule--maybe-reuse-gitdir (name path)
diff --git a/lisp/magit.el b/lisp/magit.el
index f36f864fda..99374af4c6 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -660,7 +660,6 @@ For X11 something like ~/.xinitrc should work.\n"
(require 'magit-sparse-checkout)
(require 'magit-extras)
(require 'git-rebase)
- (require 'magit-imenu)
(require 'magit-bookmark)))
(with-eval-after-load 'bookmark
- [nongnu] elpa/git-commit updated (9b94654921 -> 3525928602), ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit f321409f4d 01/10: Rename magit-utils.el to magit-base.el, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 50953fc4f0 02/10: Define section classes in magit-base.el, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 3525928602 10/10: magit-stashes-section-map: Bind magit-stash-list, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 9585356e98 03/10: magit-commit-section: New class, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit df50834f24 07/10: magit-imenu--{*}: Rearrange and abbreviate docstrings, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 8fef6b9651 05/10: magit-status-mode: Add more to Imenu index, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 512d78cb3a 08/10: magit-imenu--{*}: Cosmetics, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit f815ea7795 09/10: Disband magit-imenu.el,
ELPA Syncer <=
- [nongnu] elpa/git-commit b563e448c1 06/10: magit-refs-mode: Make Imenu items less noisy, ELPA Syncer, 2022/02/22
- [nongnu] elpa/git-commit 4727dcbe22 04/10: Refactor Imenu support, ELPA Syncer, 2022/02/22