diff options
Diffstat (limited to 'lisp/+link-hint.el')
-rw-r--r-- | lisp/+link-hint.el | 83 |
1 files changed, 56 insertions, 27 deletions
diff --git a/lisp/+link-hint.el b/lisp/+link-hint.el index 469ed15..0e0b9b1 100644 --- a/lisp/+link-hint.el +++ b/lisp/+link-hint.el | |||
@@ -87,33 +87,62 @@ with the KEYWORD." | |||
87 | +link-hint-open-secondary-types | 87 | +link-hint-open-secondary-types |
88 | :multiple t) | 88 | :multiple t) |
89 | 89 | ||
90 | (defun +link-hint-open-secondary-setup (&optional types) | 90 | (progn |
91 | "Define the `:open-secondary' link-hint type for TYPES. | 91 | (dolist |
92 | If TYPES is nil, define it for `+link-hint-open-secondary-types'." | 92 | (type |
93 | (dolist (type (or types +link-hint-open-secondary-types)) | 93 | '(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)) |
94 | (link-hint-define-type type | 94 | (link-hint-define-type type :download |
95 | :open-secondary browse-url-secondary-browser-function | 95 | (function +browse-url-download) |
96 | :open-secondary-multiple t))) | 96 | :download-multiple t)) |
97 | 97 | (defun +link-hint-open:download nil "Download a link to `eww-download-directory'. | |
98 | (defun +link-hint-open-secondary () | 98 | |
99 | "Open a link in the secondary browser." | 99 | Defined by `+link-hint-define'." |
100 | (interactive) | 100 | (interactive) |
101 | (avy-with link-hint-open-link | 101 | (avy-with link-hint-open-link |
102 | (link-hint--one :open-secondary))) | 102 | (link-hint--one :download))) |
103 | 103 | (defun +link-hint-open-multiple:download nil "Open multiple links with `+link-hint-open:download'. | |
104 | (defun +link-hint-open-chrome-setup (&optional types) | 104 | |
105 | "Define the `:open-chrome' link-hint type for TYPES. | 105 | Defined by `+link-hint-define'." |
106 | If TYPES is nil, define it for `+link-hint-open-secondary-types'." | 106 | (avy-with link-hint-open-multiple-links |
107 | (dolist (type (or types +link-hint-open-secondary-types)) | 107 | (link-hint--multiple :download))) |
108 | (link-hint-define-type type | 108 | (defun +link-hint-open-all:download nil "Open all visible links with `+link-hint-open:download'. |
109 | :open-chrome #'browse-url-chrome | 109 | |
110 | :open-chrome-multiple t))) | 110 | Defined by `+link-hint-define'." |
111 | 111 | (avy-with link-hint-open-all-links | |
112 | (defun +link-hint-open-chrome () | 112 | (link-hint--all :download)))) |
113 | "Open a link with chrome." | 113 | |
114 | (interactive) | 114 | ;; (defun +link-hint-open-secondary-setup (&optional types) |
115 | (avy-with link-hint-open-link | 115 | ;; "Define the `:open-secondary' link-hint type for TYPES. |
116 | (link-hint--one :open-chrome))) | 116 | ;; If TYPES is nil, define it for `+link-hint-open-secondary-types'." |
117 | ;; (dolist (type (or types +link-hint-open-secondary-types)) | ||
118 | ;; (link-hint-define-type type | ||
119 | ;; :open-secondary browse-url-secondary-browser-function | ||
120 | ;; :open-secondary-multiple t))) | ||
121 | |||
122 | ;; (defun +link-hint-open-secondary () | ||
123 | ;; "Open a link in the secondary browser." | ||
124 | ;; (interactive) | ||
125 | ;; (avy-with link-hint-open-link | ||
126 | ;; (link-hint--one :open-secondary))) | ||
127 | |||
128 | (+link-hint-define-keyword :chrome #'browse-url-chrome | ||
129 | "Open a link with `browse-url-chrome'." | ||
130 | +link-hint-open-secondary-types | ||
131 | :multiple t) | ||
132 | |||
133 | ;; (defun +link-hint-open-chrome-setup (&optional types) | ||
134 | ;; "Define the `:open-chrome' link-hint type for TYPES. | ||
135 | ;; If TYPES is nil, define it for `+link-hint-open-secondary-types'." | ||
136 | ;; (dolist (type (or types +link-hint-open-secondary-types)) | ||
137 | ;; (link-hint-define-type type | ||
138 | ;; :open-chrome #'browse-url-chrome | ||
139 | ;; :open-chrome-multiple t))) | ||
140 | |||
141 | ;; (defun +link-hint-open-chrome () | ||
142 | ;; "Open a link with chrome." | ||
143 | ;; (interactive) | ||
144 | ;; (avy-with link-hint-open-link | ||
145 | ;; (link-hint--one :open-chrome))) | ||
117 | 146 | ||
118 | (defun +link-hint-open-link (prefix) | 147 | (defun +link-hint-open-link (prefix) |
119 | "Open a link. | 148 | "Open a link. |