0

I have a link in my org file such as [[https://google.com][mylink]]. When I put the point over "mylink" and run M-x browse-url-at-point my browser opens "http://mylink.com".

Is there a different function or option I should be using to open the link url instead of the link text?

1
  • @Drew typo, thank you.
    – tgrosinger
    Commented Dec 2, 2019 at 18:59

1 Answer 1

2

It appears that the function to call to browse a link in an org-mode file is org-open-at-point which is bound to C-c C-o.

Edit: Regarding the follow-up question about opening an org-mode link in a secondary browser, using another function seems to work:

   (defun org-open-at-point-with-firefox ()                              
    (interactive)                                                         
    (let ((browse-url-browser-function 'browse-url-firefox))              
     (org-open-at-point )))
6
  • Ah, interesting. So my actual end goal here is to define a shortcut which will open a link in a non-default browser. So I was actually using browse-url-chrome since my default browser is Firefox. I don't see any variants/options on org-open-at-point that would allow specifying that. Any suggestions?
    – tgrosinger
    Commented Dec 2, 2019 at 19:08
  • Is there an org-mode bug for org-open-at-point not being able to handle a link where the text matches the URL?
    – Realraptor
    Commented Dec 2, 2019 at 20:19
  • there is a customizable association list org-link-parameters you could edit. you could either change the lambda function passed to the http and https options to use browse-url-chrome or possibly add a new link type you could prefix with chrome:path.to.site or something like that. i think the suggested answer is a good solution as well.
    – shoshin
    Commented Dec 2, 2019 at 20:25
  • something like ("chrome" :follow (lambda (path) (browse-url-chrome (concat "https:" path)))) the downside to this is that you have to make your links specific to using chrome
    – shoshin
    Commented Dec 2, 2019 at 20:31
  • This worked perfectly, thanks @Realraptor
    – tgrosinger
    Commented Dec 2, 2019 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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