mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-25 10:47:00 +00:00
Add a command in package mode for opening home pages directly
* doc/emacs/package.texi (Package Menu): Document it. * lisp/emacs-lisp/package.el (package-browse-url): New command and keystroke (bug#46927).
This commit is contained in:
parent
fd9202304c
commit
0981712e57
@ -126,6 +126,13 @@ line; typing @kbd{x} (see below) will delete the package.
|
||||
@xref{Package Files}, for information about what package deletion
|
||||
entails.
|
||||
|
||||
@item w
|
||||
@kindex w @r{(Package Menu)}
|
||||
@findex package-browse-url
|
||||
Open the home page of the package on the current line in a browser
|
||||
(@code{package-browse-url}). @code{browse-url} is used to open the
|
||||
browser.
|
||||
|
||||
@item ~
|
||||
@kindex ~ @r{(Package Menu)}
|
||||
@findex package-menu-mark-obsolete-for-deletion
|
||||
|
3
etc/NEWS
3
etc/NEWS
@ -1159,6 +1159,9 @@ equivalent to '(map (:sym sym))'.
|
||||
|
||||
** Package
|
||||
|
||||
+++
|
||||
*** New command 'package-browse-url' and keystroke 'w'.
|
||||
|
||||
+++
|
||||
*** New commands to filter the package list.
|
||||
The filter commands are bound to the following keys:
|
||||
|
@ -2731,6 +2731,7 @@ either a full name or nil, and EMAIL is a valid email address."
|
||||
(define-key map "U" 'package-menu-mark-upgrades)
|
||||
(define-key map "r" 'revert-buffer)
|
||||
(define-key map "~" 'package-menu-mark-obsolete-for-deletion)
|
||||
(define-key map "w" 'package-browse-url)
|
||||
(define-key map "x" 'package-menu-execute)
|
||||
(define-key map "h" 'package-menu-quick-help)
|
||||
(define-key map "H" #'package-menu-hide-package)
|
||||
@ -2753,6 +2754,8 @@ either a full name or nil, and EMAIL is a valid email address."
|
||||
"Menu for `package-menu-mode'."
|
||||
'("Package"
|
||||
["Describe Package" package-menu-describe-package :help "Display information about this package"]
|
||||
["Open Package Homepage" package-browse-url
|
||||
:help "Open the homepage of this package"]
|
||||
["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"]
|
||||
"--"
|
||||
["Refresh Package List" revert-buffer
|
||||
@ -4160,6 +4163,22 @@ beginning of the line."
|
||||
(package-version-join (package-desc-version package-desc))
|
||||
(package-desc-summary package-desc))))
|
||||
|
||||
(defun package-browse-url (desc &optional secondary)
|
||||
"Open the home page of the package under point in a browser.
|
||||
`browse-url' is used to determine the browser to be used.
|
||||
If SECONDARY (interactively, the prefix), use the secondary browser."
|
||||
(interactive (list (tabulated-list-get-id)
|
||||
current-prefix-arg)
|
||||
package-menu-mode)
|
||||
(unless desc
|
||||
(user-error "No package here"))
|
||||
(let ((url (cdr (assoc :url (package-desc-extras desc)))))
|
||||
(unless url
|
||||
(user-error "No home page for %s" (package-desc-name desc)))
|
||||
(if secondary
|
||||
(funcall browse-url-secondary-browser-function url)
|
||||
(browse-url url))))
|
||||
|
||||
;;;; Introspection
|
||||
|
||||
(defun package-get-descriptor (pkg-name)
|
||||
|
Loading…
Reference in New Issue
Block a user