1
0
Fork 0

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:
Tom Willemse 2023-02-24 23:32:56 -08:00
parent b5b09921e3
commit 6dd72d5323

View file

@ -114,5 +114,18 @@ DESCRIPTION is the text of the news item."
(add-hook 'package-menu-mode-hook 'hl-line-mode) (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) (provide 'oni-package)
;;; oni-package.el ends here ;;; oni-package.el ends here