engine-mode
engine-mode copied to clipboard
The `:browser` feature doesn't work when `browse-url-handlers` is defined
I've configured this engine:
(setq engine/browser-function #'browse-url-firefox)
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
:browser 'eww-browse-url
:keybinding "d")
I guess the expected behavior is to open the duckduckgo URL with EWW, and all other engines's URLs with Firefox, but is not what I'm experiencing (some engines are using EWW, some are using Chrome, some Firefox..) I then found that engine/execute-search
uses browse-url
; looking into this function I see
(function (or (browse-url-select-handler url)
browse-url-browser-function))
So the :browser
feature in engine-mode will work until the browse-url-handlers
is nil
. Is this the expected behavior? If so, can we make more explicit in the documentation? Otherwise, this patch in the engine/execute/search
fixes the issue.
(defun engine/execute-search (search-engine-url browser-function search-term)
"Display the results of the query."
(interactive)
(let ((browse-url-handlers nil) ;; <-- THIS IS THE FIX
(browse-url-browser-function browser-function))
(browse-url
(format-spec search-engine-url
(format-spec-make ?s (url-hexify-string search-term))))))