I'm trying to customize WWW url browsing in one specific mode.
Looking at the documentation for browse-url
led me to believe this could be achieved as follows with browse-url-browser-function
:
(defun flooose-elfeed-browse-url (url &rest c)
(interactive)
(let ((tmp-dir (make-temp-file (buffer-name) t)))
(message (format "Using %s for ephemeral firefox profile" tmp-dir))
(setq browse-url-firefox-arguments `("--profile" ,tmp-dir))
(browse-url-firefox url c)))
(add-hook 'elfeed-show-mode-hook
(lambda ()
(message "setting elfeed locals")
(make-local-variable 'browse-url-browser-function)
(setq browse-url-browser-function 'flooose-elfeed-browse-url)))
While this sort of works, the problem is that the newly created firefox window doesn't get focus, instead I get a notification from my desktop environment about the new window.
Using browse-url
directly doesn't have this effect, the url is opened in a new tab in the default profile of my firefox and firefox gains focus.
I use browse-url-firefox
because leaving browse-url-browser-function
at it's default (browse-url-default-browser
) leaves my browse-url-firefox-arguments
ignored.
I also didn't see any options in the firefox cli documentation.