From 04f87d9d59f8ca090a064ef0f8f8bcbf69d00de2 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 31 Dec 2021 15:45:06 -0600 Subject: Add link-hint --- lisp/+link-hint.el | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lisp/+link-hint.el (limited to 'lisp') diff --git a/lisp/+link-hint.el b/lisp/+link-hint.el new file mode 100644 index 0000000..e9d215a --- /dev/null +++ b/lisp/+link-hint.el @@ -0,0 +1,58 @@ +;;; +link-hint.el -*- lexical-binding: t; -*- + +;;; Code: + +(require 'link-hint) + +(defgroup +link-hint nil + "Extra customizations for `link-hint'." + :group 'link-hint) + +(defcustom +link-hint-open-secondary-types '(gnus-w3m-image-url + gnus-w3m-url + markdown-link + mu4e-attachment + mu4e-url + notmuch-hello + nov-link + org-link + shr-url + text-url + w3m-link + w3m-message-link) + "Link types to define `:open-secondary' for.") + +(defun +link-hint-setup-open-secondary (&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)) + (link-hint-define-type type + :open-secondary browse-url-secondary-browser-function + :open-secondary-multiple t))) + +(defun +link-hint-open-link (prefix) + "Open a link. +Without a PREFIX, open using `browse-url-browser-function'; with +a PREFIX, use `browse-url-secondary-browser-function'." + (interactive "P") + (avy-with link-hint-open-link + (link-hint--one (if prefix :open-secondary :open)))) + +(defun +link-hint-open-multiple-links (prefix) + "Open multiple links. +Without a PREFIX, open using `browse-url-browser-function'; with +a PREFIX, use `browse-url-secondary-browser-function'." + (interactive "P") + (avy-with link-hint-open-multiple-links + (link-hint--one (if prefix :open-secondary :open)))) + +(defun +link-hint-open-all-links (prefix) + "Open all visible links. +Without a PREFIX, open using `browse-url-browser-function'; with +a PREFIX, use `browse-url-secondary-browser-function'." + (interactive "P") + (avy-with link-hint-open-all-links + (link-hint--one (if prefix :open-secondary :open)))) + +(provide '+link-hint) +;;; +link-hint.el ends here -- cgit 1.4.1-21-gabe81