diff options
author | Case Duckworth | 2021-12-31 15:45:06 -0600 |
---|---|---|
committer | Case Duckworth | 2021-12-31 15:45:06 -0600 |
commit | 04f87d9d59f8ca090a064ef0f8f8bcbf69d00de2 (patch) | |
tree | 735fa16457dc3d7a5773f8a4d9d5dcf1c7515be8 | |
parent | Change loading message to be a temp message (diff) | |
download | emacs-04f87d9d59f8ca090a064ef0f8f8bcbf69d00de2.tar.gz emacs-04f87d9d59f8ca090a064ef0f8f8bcbf69d00de2.zip |
Add link-hint
-rw-r--r-- | init.el | 6 | ||||
-rw-r--r-- | lisp/+link-hint.el | 58 |
2 files changed, 64 insertions, 0 deletions
diff --git a/init.el b/init.el index 1390e5c..3498950 100644 --- a/init.el +++ b/init.el | |||
@@ -810,6 +810,12 @@ See also `crux-reopen-as-root-mode'." | |||
810 | org-agenda-mode | 810 | org-agenda-mode |
811 | tabulated-list-mode)) | 811 | tabulated-list-mode)) |
812 | 812 | ||
813 | (setup (:straight link-hint) | ||
814 | (:require +link-hint) | ||
815 | (+link-hint-setup-open-secondary) | ||
816 | (:option link-hint-avy-style 'at-full) | ||
817 | (:+key "M-l" #'+link-hint-open-link)) | ||
818 | |||
813 | (setup (:straight marginalia) | 819 | (setup (:straight marginalia) |
814 | (marginalia-mode +1)) | 820 | (marginalia-mode +1)) |
815 | 821 | ||
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 @@ | |||
1 | ;;; +link-hint.el -*- lexical-binding: t; -*- | ||
2 | |||
3 | ;;; Code: | ||
4 | |||
5 | (require 'link-hint) | ||
6 | |||
7 | (defgroup +link-hint nil | ||
8 | "Extra customizations for `link-hint'." | ||
9 | :group 'link-hint) | ||
10 | |||
11 | (defcustom +link-hint-open-secondary-types '(gnus-w3m-image-url | ||
12 | gnus-w3m-url | ||
13 | markdown-link | ||
14 | mu4e-attachment | ||
15 | mu4e-url | ||
16 | notmuch-hello | ||
17 | nov-link | ||
18 | org-link | ||
19 | shr-url | ||
20 | text-url | ||
21 | w3m-link | ||
22 | w3m-message-link) | ||
23 | "Link types to define `:open-secondary' for.") | ||
24 | |||
25 | (defun +link-hint-setup-open-secondary (&optional types) | ||
26 | "Define the `:open-secondary' link-hint type for TYPES. | ||
27 | If TYPES is nil, define it for `+link-hint-open-secondary-types'." | ||
28 | (dolist (type (or types +link-hint-open-secondary-types)) | ||
29 | (link-hint-define-type type | ||
30 | :open-secondary browse-url-secondary-browser-function | ||
31 | :open-secondary-multiple t))) | ||
32 | |||
33 | (defun +link-hint-open-link (prefix) | ||
34 | "Open a link. | ||
35 | Without a PREFIX, open using `browse-url-browser-function'; with | ||
36 | a PREFIX, use `browse-url-secondary-browser-function'." | ||
37 | (interactive "P") | ||
38 | (avy-with link-hint-open-link | ||
39 | (link-hint--one (if prefix :open-secondary :open)))) | ||
40 | |||
41 | (defun +link-hint-open-multiple-links (prefix) | ||
42 | "Open multiple links. | ||
43 | Without a PREFIX, open using `browse-url-browser-function'; with | ||
44 | a PREFIX, use `browse-url-secondary-browser-function'." | ||
45 | (interactive "P") | ||
46 | (avy-with link-hint-open-multiple-links | ||
47 | (link-hint--one (if prefix :open-secondary :open)))) | ||
48 | |||
49 | (defun +link-hint-open-all-links (prefix) | ||
50 | "Open all visible links. | ||
51 | Without a PREFIX, open using `browse-url-browser-function'; with | ||
52 | a PREFIX, use `browse-url-secondary-browser-function'." | ||
53 | (interactive "P") | ||
54 | (avy-with link-hint-open-all-links | ||
55 | (link-hint--one (if prefix :open-secondary :open)))) | ||
56 | |||
57 | (provide '+link-hint) | ||
58 | ;;; +link-hint.el ends here | ||