emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 3cfc8458e1: Fix imenu in repository lists


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 3cfc8458e1: Fix imenu in repository lists
Date: Tue, 12 Apr 2022 16:58:18 -0400 (EDT)

branch: elpa/git-commit
commit 3cfc8458e14c705afdfbeb7dcd3d3f43d7479344
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Fix imenu in repository lists
    
    Closes #4658.
---
 lisp/magit-repos.el     | 26 ++++++--------------------
 lisp/magit-submodule.el | 19 ++-----------------
 2 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el
index f8e34ee5d4..2d2022dcce 100644
--- a/lisp/magit-repos.el
+++ b/lisp/magit-repos.el
@@ -274,9 +274,8 @@ If it contains \"%s\" then the directory is substituted for 
that."
   (setq tabulated-list-padding  0)
   (add-hook 'tabulated-list-revert-hook #'magit-repolist-refresh nil t)
   (setq imenu-prev-index-position-function
-        #'magit-imenu--repolist-prev-index-position-function)
-  (setq imenu-extract-index-name-function
-        #'magit-imenu--repolist-extract-index-name-function))
+        #'magit-repolist--imenu-prev-index-position)
+  (setq imenu-extract-index-name-function #'tabulated-list-get-id))
 
 (defun magit-repolist-setup (columns)
   (unless magit-repository-directories
@@ -337,6 +336,10 @@ If it contains \"%s\" then the directory is substituted 
for that."
   (tabulated-list-print t)
   (message "Listing repositories...done"))
 
+(defun magit-repolist--imenu-prev-index-position ()
+  (and (not (bobp))
+       (forward-line -1)))
+
 ;;;; Columns
 
 (defun magit-repolist-make-sorter (sort-predicate convert-cell column-idx)
@@ -469,23 +472,6 @@ 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 515ef421cd..f0893b0844 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -646,9 +646,8 @@ These sections can be expanded to show the respective 
commits."
   (setq tabulated-list-padding 0)
   (add-hook 'tabulated-list-revert-hook #'magit-submodule-list-refresh nil t)
   (setq imenu-prev-index-position-function
-        #'magit-imenu--submodule-prev-index-position-function)
-  (setq imenu-extract-index-name-function
-        #'magit-imenu--submodule-extract-index-name-function))
+        #'magit-repolist--imenu-prev-index-position)
+  (setq imenu-extract-index-name-function #'tabulated-list-get-id))
 
 (defvar-local magit-submodule-list-predicate nil)
 
@@ -691,20 +690,6 @@ 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]