5

In my Emacs I have set browse-url-browser-function to eww and org-open-at-point (org-return) will open my links using eww as expected. However, I would like to configure org-mode so that when I press prefix + return (C-u RET) the link is opened using an external browser instead, is this possible without modifying org-open-at-point?

I already have a helper function, user/browse-url-external, that I use in other modes to open URL at-point in an external browser instead of eww. It doesn't work with links in org-mode since browse-url only sees the descriptive text and not the hyperlink.

7

That's not directly possible, since org-open-at-point already uses the prefix argument for something else. But of course there's nothing preventing you from wrapping org-open-at-point with your own code:

(defun my-org-open-at-point (&optional arg)
  (interactive "P")
  (if (not arg)
      (org-open-at-point)
      (let ((browse-url-browser-function #'browse-url-chromium))
        (org-open-at-point))))

and binding it to C-c C-o:

(define-key org-mode-map (kbd "C-c C-o") #'my-org-open-at-point)

Note that I didn't just advise org-open-at-point, since I'm a little nervous about changing its behaviour — it might break some other parts of Org.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.