* bug#27134: 25.2; Add imenu support to package-menu-mode
@ 2017-05-29 18:39 Damien Cassou
2019-06-24 22:56 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Damien Cassou @ 2017-05-29 18:39 UTC (permalink / raw)
To: 27134
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
This commit adds Imenu support to package-menu-mode to rapidly go
to any package through the standard Imenu interface.
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-imenu-support-to-package-menu-mode.patch --]
[-- Type: text/x-patch, Size: 2136 bytes --]
From c86ded55ec0e97cd464a47299ec8130b8a04f038 Mon Sep 17 00:00:00 2001
From: Damien Cassou <damien@cassou.me>
Date: Mon, 29 May 2017 20:36:02 +0200
Subject: [PATCH] Add imenu support to package-menu-mode
* lisp/emacs-list/package.el (package--imenu-prev-index-position-function
package--imenu-extract-index-name-function): Imenu functions in
package-menu-mode.
---
lisp/emacs-lisp/package.el | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index cb8e2d6..40595ff 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2551,7 +2551,11 @@ (define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
(setq tabulated-list-padding 2)
(setq tabulated-list-sort-key (cons "Status" nil))
(add-hook 'tabulated-list-revert-hook 'package-menu--refresh nil t)
- (tabulated-list-init-header))
+ (tabulated-list-init-header)
+ (setf imenu-prev-index-position-function
+ #'package--imenu-prev-index-position-function)
+ (setf imenu-extract-index-name-function
+ #'package--imenu-extract-index-name-function))
(defmacro package--push (pkg-desc status listname)
"Convenience macro for `package-menu--generate'.
@@ -3461,6 +3465,24 @@ (defun package-list-packages-no-fetch ()
(interactive)
(list-packages t))
+(defun package--imenu-prev-index-position-function ()
+ "Move point to previous line in package-menu buffer.
+This function is used as a value for
+`imenu-prev-index-position-function'."
+ (unless (bobp)
+ (forward-line -1)))
+
+(defun package--imenu-extract-index-name-function ()
+ "Return imenu name for line at point.
+This function is used as a value for
+`imenu-extract-index-name-function'. Point should be at the
+beginning of the line."
+ (let ((package-desc (tabulated-list-get-id)))
+ (format "%s (%s): %s"
+ (package-desc-name package-desc)
+ (package-version-join (package-desc-version package-desc))
+ (package-desc-summary package-desc))))
+
(provide 'package)
;;; package.el ends here
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#27134: 25.2; Add imenu support to package-menu-mode
2017-05-29 18:39 bug#27134: 25.2; Add imenu support to package-menu-mode Damien Cassou
@ 2019-06-24 22:56 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-24 22:56 UTC (permalink / raw)
To: Damien Cassou; +Cc: 27134
Damien Cassou <damien@cassou.me> writes:
> This commit adds Imenu support to package-menu-mode to rapidly go to
> any package through the standard Imenu interface.
Sounds like a good idea to me, so I've now applied your patch to the
trunk (and added a NEWS entry).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-24 22:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-29 18:39 bug#27134: 25.2; Add imenu support to package-menu-mode Damien Cassou
2019-06-24 22:56 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).