diff options
author | Case Duckworth | 2022-02-16 23:14:52 -0600 |
---|---|---|
committer | Case Duckworth | 2022-02-16 23:14:52 -0600 |
commit | 4219f9702bcb33ec6d724e52282af4826cabb4bd (patch) | |
tree | d82606bc79c7f2451307f83851cd1c3efd6ddfbb /init.el | |
parent | Add ecomplete (diff) | |
download | emacs-4219f9702bcb33ec6d724e52282af4826cabb4bd.tar.gz emacs-4219f9702bcb33ec6d724e52282af4826cabb4bd.zip |
Add more domains to browse-url
Honestly, this could be ... bettered.
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/init.el b/init.el index af6daeb..75228cc 100644 --- a/init.el +++ b/init.el | |||
@@ -178,19 +178,18 @@ | |||
178 | ;; Set up external browsing URLs. | 178 | ;; Set up external browsing URLs. |
179 | (add-to-list '+custom-variable-allowlist | 179 | (add-to-list '+custom-variable-allowlist |
180 | '+browse-url-secondary-browser-regexps) | 180 | '+browse-url-secondary-browser-regexps) |
181 | (dolist (domain '("github.com" "twitch.tv" | 181 | (dolist (domain '("github.com" "gitlab.com" "google.com" |
182 | "gitlab.com" | 182 | "imgur.com" "twitch.tv" |
183 | "google.com" | ||
184 | "imgur.com" | ||
185 | "pixelfed" "instagram.com" "bibliogram.art" | 183 | "pixelfed" "instagram.com" "bibliogram.art" |
186 | "reddit.com" "teddit.net" | 184 | "reddit.com" "teddit.net" |
187 | "taskiq" | ||
188 | "twitter.com" "nitter.net" "t.co" | 185 | "twitter.com" "nitter.net" "t.co" |
189 | "streamable.com" "spotify.com" | 186 | "streamable.com" "spotify.com" |
190 | "hetzner.cloud")) | 187 | "hetzner.cloud" |
188 | "melpa.org")) | ||
191 | (add-to-list '+browse-url-secondary-browser-regexps | 189 | (add-to-list '+browse-url-secondary-browser-regexps |
192 | (replace-regexp-in-string "\\." "\\\\." domain))) | 190 | (replace-regexp-in-string "\\." "\\\\." domain))) |
193 | ;; Set up URL handlers. | 191 | ;; Set up URL handlers. |
192 | (require 'chd) | ||
194 | (+browse-url-set-handlers | 193 | (+browse-url-set-handlers |
195 | (list | 194 | (list |
196 | (cons (rx ; images | 195 | (cons (rx ; images |
@@ -211,14 +210,20 @@ | |||
211 | #'+browse-url-with-mpv | 210 | #'+browse-url-with-mpv |
212 | browse-url-secondary-browser-function) | 211 | browse-url-secondary-browser-function) |
213 | args))) | 212 | args))) |
213 | (cons chd/url-regexps #'browse-url-chrome) | ||
214 | (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites | 214 | (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites |
215 | browse-url-secondary-browser-function) | 215 | (lambda (&rest args) |
216 | (apply browse-url-secondary-browser-function args))) | ||
216 | (cons "xkcd\\.com" | 217 | (cons "xkcd\\.com" |
217 | (if (fboundp 'xkcd-get) | 218 | (lambda (&rest args) |
218 | #'+xkcd-get-from-url | 219 | (apply (if (fboundp #'xkcd-get) |
219 | +browse-url-browser-function)) | 220 | (progn (require '+xkcd) |
221 | #'+xkcd-get-from-url) | ||
222 | +browse-url-browser-function) | ||
223 | args))) | ||
220 | (cons "." ; everything else | 224 | (cons "." ; everything else |
221 | +browse-url-browser-function))) | 225 | (lambda (&rest args) |
226 | (apply +browse-url-browser-function args))))) | ||
222 | ;; Transform URLs before passing to `browse-url' | 227 | ;; Transform URLs before passing to `browse-url' |
223 | (:option +browse-url-transformations `((,(rx (or "youtube.com" | 228 | (:option +browse-url-transformations `((,(rx (or "youtube.com" |
224 | "youtu.be")) | 229 | "youtu.be")) |