diff --git a/oni-package.el b/oni-package.el index e277b0e..0a283a8 100644 --- a/oni-package.el +++ b/oni-package.el @@ -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