summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-12-31 15:45:31 -0600
committerCase Duckworth2021-12-31 15:45:31 -0600
commita5d0c182a514d567bebf99a3fc6a0470f9c06166 (patch)
tree38c9d4e18aef22ad1c156c7b2c5b79b95b4e8c46
parentAdd package-lint-flymake (diff)
downloademacs-a5d0c182a514d567bebf99a3fc6a0470f9c06166.tar.gz
emacs-a5d0c182a514d567bebf99a3fc6a0470f9c06166.zip
Better setup secondary-browser urls
-rw-r--r--init.el21
-rw-r--r--lisp/+browse-url.el11
2 files changed, 15 insertions, 17 deletions
diff --git a/init.el b/init.el index 6aa375a..e5d113b 100644 --- a/init.el +++ b/init.el
@@ -121,22 +121,10 @@
121 #'+browse-url-with-mpv 121 #'+browse-url-with-mpv
122 browse-url-secondary-browser-function) 122 browse-url-secondary-browser-function)
123 args))) 123 args)))
124 (cons (rx ; non-eww-friendly websites 124 (cons (lambda (url) ; non-eww-friendly websites
125 (or 125 (cl-member url +browse-url-secondary-browser-regexps
126 "github.com" 126 :test 'string-match-p))
127 "gitlab.com" 127 #'browse-url-secondary-browser-function)))
128 "google.com"
129 "imgur.com"
130 "pixelfed" "instagram.com" "bibliogram.art"
131 "reddit.com" "teddit.net"
132 "tildes.net"
133 "taskiq"
134 "twitter.com" "nitter.net"
135 "streamable.com"
136 ))
137 browse-url-secondary-browser-function)
138 (cons "." ; everything else
139 #'eww-browse-url)))
140 ;; Transform URLs before passing to `browse-url' 128 ;; Transform URLs before passing to `browse-url'
141 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" 129 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
142 "youtu.be")) 130 "youtu.be"))
@@ -157,7 +145,6 @@
157 (:option calendar-location-name _location-name 145 (:option calendar-location-name _location-name
158 calendar-latitude _location-latitude 146 calendar-latitude _location-latitude
159 calendar-longitude _location-longitude)) 147 calendar-longitude _location-longitude))
160
161(setup compile 148(setup compile
162 (:option compilation-always-kill t 149 (:option compilation-always-kill t
163 compilation-ask-about-save nil 150 compilation-ask-about-save nil
diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index d073d50..83f43cf 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el
@@ -63,6 +63,17 @@ named NAME, defaulting to \"+browse-url-with-VIEWER\", and the variable
63 "Image URL: " 63 "Image URL: "
64 :name "+browse-image-with-mpv") 64 :name "+browse-image-with-mpv")
65 65
66;;; Easily add extra domains to open in `browse-url-secondary-browser-function'
67;; I like to open most websites in eww, but a lot of website on the modern web
68;; just make that hard to do. Right now I have a list in `browse-url-handlers'
69;; with domains in an (rx (or ...)) form, but that's not super easy to config.
70;; With this custom setting, I'm making it a list that'll be way easier to
71;; customize.
72
73(defcustom +browse-url-secondary-browser-regexps nil
74 "List of URL regexps to open with `browse-url-secondary-browser-function'."
75 :type '(repeat regexp))
76
66;;; URL Transformation Functions 77;;; URL Transformation Functions
67;; There's a lot of bad websites out there. Luckily we can easily redirect 78;; There's a lot of bad websites out there. Luckily we can easily redirect
68;; requests to more privacy-respecting, or just less javascript-ridden, sites 79;; requests to more privacy-respecting, or just less javascript-ridden, sites