about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-03 15:18:05 -0600
committerCase Duckworth2022-01-03 15:18:05 -0600
commit90ce86dc9cd1915c13adeb7e3ea4632f27fe3a5b (patch)
tree45c7ace92c972123e8b1f8c29a9f28f535cb32d8
parentDo pulse-location-mode /after/ init (diff)
downloademacs-90ce86dc9cd1915c13adeb7e3ea4632f27fe3a5b.tar.gz
emacs-90ce86dc9cd1915c13adeb7e3ea4632f27fe3a5b.zip
Fix browse-url urls
-rw-r--r--init.el9
-rw-r--r--lisp/+browse-url.el9
2 files changed, 14 insertions, 4 deletions
diff --git a/init.el b/init.el index 0b1d8b0..261d8c7 100644 --- a/init.el +++ b/init.el
@@ -96,6 +96,7 @@
96 (:require +browse-url) 96 (:require +browse-url)
97 (:option 97 (:option
98 browse-url-browser-function #'eww-browse-url 98 browse-url-browser-function #'eww-browse-url
99 +browse-url-browser-function browse-url-browser-function
99 browse-url-secondary-browser-function (if (executable-find "firefox") 100 browse-url-secondary-browser-function (if (executable-find "firefox")
100 #'browse-url-firefox 101 #'browse-url-firefox
101 #'browse-url-default-browser) 102 #'browse-url-default-browser)
@@ -137,10 +138,10 @@
137 #'+browse-url-with-mpv 138 #'+browse-url-with-mpv
138 browse-url-secondary-browser-function) 139 browse-url-secondary-browser-function)
139 args))) 140 args)))
140 (cons (lambda (url) ; non-eww-friendly websites 141 (cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
141 (cl-member url +browse-url-secondary-browser-regexps 142 browse-url-secondary-browser-function)
142 :test 'string-match-p)) 143 (cons "." ; everything else
143 #'browse-url-secondary-browser-function))) 144 browse-url-browser-function)))
144 ;; Transform URLs before passing to `browse-url' 145 ;; Transform URLs before passing to `browse-url'
145 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com" 146 (:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
146 "youtu.be")) 147 "youtu.be"))
diff --git a/lisp/+browse-url.el b/lisp/+browse-url.el index 83f43cf..89b21e4 100644 --- a/lisp/+browse-url.el +++ b/lisp/+browse-url.el
@@ -74,6 +74,15 @@ named NAME, defaulting to \"+browse-url-with-VIEWER\", and the variable
74 "List of URL regexps to open with `browse-url-secondary-browser-function'." 74 "List of URL regexps to open with `browse-url-secondary-browser-function'."
75 :type '(repeat regexp)) 75 :type '(repeat regexp))
76 76
77;; Because `browse-url-browser-function', when set to an alist, must be of the
78;; form (REGEXP . FUNCTION), I need to convert
79;; `+browse-url-secondary-browser-regexps' into a regexp.
80
81(defun +browse-url-secondary-browser-regexps-combine ()
82 "Combine `+browse-url-secondary-browser-regexps'.
83This combines a list of regexps into one regexp."
84 (mapconcat #'identity +browse-url-secondary-browser-regexps "\\\|"))
85
77;;; URL Transformation Functions 86;;; URL Transformation Functions
78;; There's a lot of bad websites out there. Luckily we can easily redirect 87;; There's a lot of bad websites out there. Luckily we can easily redirect
79;; requests to more privacy-respecting, or just less javascript-ridden, sites 88;; requests to more privacy-respecting, or just less javascript-ridden, sites