1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Add imenu support to package-menu-mode

* lisp/emacs-list/package.el
(package--imenu-prev-index-position-function
package--imenu-extract-index-name-function): Add Imenu functions
to package-menu-mode (bug#27134).
This commit is contained in:
Damien Cassou 2019-06-25 00:55:45 +02:00 committed by Lars Ingebrigtsen
parent 0ef3163959
commit cf9f481d98
2 changed files with 26 additions and 1 deletions

View File

@ -812,6 +812,9 @@ early init file.
*** New function 'package-activate-all'.
---
*** Imenu support has been added to `package-menu-mode'.
** Info
---

View File

@ -2640,7 +2640,11 @@ Letters do not insert themselves; instead, they are commands.
(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'.
@ -3671,6 +3675,24 @@ activations need to be changed, such as when `package-load-list' is modified."
;; End:
"))))
(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