diff options
| author | Damien Cassou | 2019-06-25 00:55:45 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-06-25 01:31:10 +0200 |
| commit | cf9f481d98c7987d5970e76f38ce6d099907e9d2 (patch) | |
| tree | eda75aa7405634485e4d07bf33190fdc5d4557c9 | |
| parent | 0ef31639593b97d6edc6dd263c915595a8fdc3b1 (diff) | |
| download | emacs-cf9f481d98c7987d5970e76f38ce6d099907e9d2.tar.gz emacs-cf9f481d98c7987d5970e76f38ce6d099907e9d2.zip | |
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).
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 24 |
2 files changed, 26 insertions, 1 deletions
| @@ -812,6 +812,9 @@ early init file. | |||
| 812 | 812 | ||
| 813 | *** New function 'package-activate-all'. | 813 | *** New function 'package-activate-all'. |
| 814 | 814 | ||
| 815 | --- | ||
| 816 | *** Imenu support has been added to `package-menu-mode'. | ||
| 817 | |||
| 815 | ** Info | 818 | ** Info |
| 816 | 819 | ||
| 817 | --- | 820 | --- |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 670831d9630..b60a8a136a1 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -2640,7 +2640,11 @@ Letters do not insert themselves; instead, they are commands. | |||
| 2640 | (setq tabulated-list-padding 2) | 2640 | (setq tabulated-list-padding 2) |
| 2641 | (setq tabulated-list-sort-key (cons "Status" nil)) | 2641 | (setq tabulated-list-sort-key (cons "Status" nil)) |
| 2642 | (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) | 2642 | (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) |
| 2643 | (tabulated-list-init-header)) | 2643 | (tabulated-list-init-header) |
| 2644 | (setf imenu-prev-index-position-function | ||
| 2645 | #'package--imenu-prev-index-position-function) | ||
| 2646 | (setf imenu-extract-index-name-function | ||
| 2647 | #'package--imenu-extract-index-name-function)) | ||
| 2644 | 2648 | ||
| 2645 | (defmacro package--push (pkg-desc status listname) | 2649 | (defmacro package--push (pkg-desc status listname) |
| 2646 | "Convenience macro for `package-menu--generate'. | 2650 | "Convenience macro for `package-menu--generate'. |
| @@ -3671,6 +3675,24 @@ activations need to be changed, such as when `package-load-list' is modified." | |||
| 3671 | ;; End: | 3675 | ;; End: |
| 3672 | ")))) | 3676 | ")))) |
| 3673 | 3677 | ||
| 3678 | (defun package--imenu-prev-index-position-function () | ||
| 3679 | "Move point to previous line in package-menu buffer. | ||
| 3680 | This function is used as a value for | ||
| 3681 | `imenu-prev-index-position-function'." | ||
| 3682 | (unless (bobp) | ||
| 3683 | (forward-line -1))) | ||
| 3684 | |||
| 3685 | (defun package--imenu-extract-index-name-function () | ||
| 3686 | "Return imenu name for line at point. | ||
| 3687 | This function is used as a value for | ||
| 3688 | `imenu-extract-index-name-function'. Point should be at the | ||
| 3689 | beginning of the line." | ||
| 3690 | (let ((package-desc (tabulated-list-get-id))) | ||
| 3691 | (format "%s (%s): %s" | ||
| 3692 | (package-desc-name package-desc) | ||
| 3693 | (package-version-join (package-desc-version package-desc)) | ||
| 3694 | (package-desc-summary package-desc)))) | ||
| 3695 | |||
| 3674 | (provide 'package) | 3696 | (provide 'package) |
| 3675 | 3697 | ||
| 3676 | ;;; package.el ends here | 3698 | ;;; package.el ends here |