feat(oni-package): Add keybinding to directly open a package's URL
I frequently want to just open the URL of a package to see the readme and possibly some screenshots. There doesn't appeart to be a built-in keybinding for that.
This commit is contained in:
parent
b5b09921e3
commit
6dd72d5323
1 changed files with 13 additions and 0 deletions
|
@ -114,5 +114,18 @@ DESCRIPTION is the text of the news item."
|
|||
|
||||
(add-hook 'package-menu-mode-hook 'hl-line-mode)
|
||||
|
||||
;; Set up a keybinding to open a package's URL
|
||||
|
||||
(defun oni-package-open-url ()
|
||||
(interactive nil package-menu-mode)
|
||||
(let* ((pkg-desc (tabulated-list-get-id))
|
||||
(url (map-elt (package-desc-extras pkg-desc) :url)))
|
||||
(if url
|
||||
(browse-url url)
|
||||
(error "Package %s doesn't appear to have a url"
|
||||
(package-desc-name pkg-desc)))))
|
||||
|
||||
(define-key package-menu-mode-map (kbd "o") #'oni-package-open-url)
|
||||
|
||||
(provide 'oni-package)
|
||||
;;; oni-package.el ends here
|
||||
|
|
Loading…
Reference in a new issue