Add other link types

This commit is contained in:
Case Duckworth 2022-02-06 22:17:44 -06:00
parent a43c72e5c8
commit f8e5e64308
1 changed files with 23 additions and 1 deletions

View File

@ -25,7 +25,7 @@
(defvar +link-hint-map (make-sparse-keymap)
"Keymap for `link-hint' functionality.")
(defun +link-hint-setup-open-secondary (&optional types)
(defun +link-hint-open-secondary-setup (&optional types)
"Define the `:open-secondary' link-hint type for TYPES.
If TYPES is nil, define it for `+link-hint-open-secondary-types'."
(dolist (type (or types +link-hint-open-secondary-types))
@ -33,6 +33,12 @@ If TYPES is nil, define it for `+link-hint-open-secondary-types'."
:open-secondary browse-url-secondary-browser-function
:open-secondary-multiple t)))
(defun +link-hint-open-secondary ()
"Open a link in the secondary browser."
(interactive)
(avy-with link-hint-open-link
(link-hint--one :open-secondary)))
(defun +link-hint-open-link (prefix)
"Open a link.
Without a PREFIX, open using `browse-url-browser-function'; with
@ -57,5 +63,21 @@ a PREFIX, use `browse-url-secondary-browser-function'."
(avy-with link-hint-open-all-links
(link-hint--one (if prefix :open-secondary :open))))
;;; Pocket-reader.el integration
(defun +link-hint-pocket-add-setup (&optional types)
"Define the `:pocket-add' link-hint type for TYPES.
If TYPES is nil, define it for `link-hint-types'."
(dolist (type (or types link-hint-types))
(link-hint-define-type type
:pocket-add #'pocket-reader-generic-add-link
:pocket-add-multiple t)))
(defun +link-hint-pocket-add ()
"Add a link to the Pocket reader."
(interactive)
(avy-with link-hint-open-link
(link-hint--one :pocket-add)))
(provide '+link-hint)
;;; +link-hint.el ends here