3

Suppose I have several browsers running at any given time.

Google Chrome Google Chrome Canary Chromium Opera Safari

How can I indicate in my org mode links

[[https://www.gnu.org/software/emacs/][GNU Emacs]]

which browser should be used when (C-c C-o) opening the link.

What I tried: Read https://orgmode.org/manual/External-links.html

2

You can set up your own protocols in org-link-parameters with org-link-set-parameters.

If you run

(org-link-set-parameters "chrome" :follow (lambda (path) (browse-url-chrome (concat "http:" path))))
(org-link-set-parameters "chromes" :follow (lambda (path) (browse-url-chrome (concat "https:" path))))
(org-link-set-parameters "chromium" :follow (lambda (path) (browse-url-chromium (concat "http:" path))))
(org-link-set-parameters "chromiums" :follow (lambda (path) (browse-url-chromium (concat "https:" path))))

you can use [[chrome://www.gnu.org/software/emacs/][GNU Emacs]] or [[chromes://www.gnu.org/software/emacs/][GNU Emacs]] to open the link with the chrome browser google-chrome

and [[chromium://www.gnu.org/software/emacs/][GNU Emacs]] or [[chromiums://www.gnu.org/software/emacs/][GNU Emacs]] to open the link with the chromium browser chromium.

If you want to choose between different chrome browsers I suggest you copy the function definition of browse-url-chrome from the library browse-url. Paste it into your init file, change the function name, and adapt the function to your purposes. Afterwards you can add link parameters for it.

You find the library browse-url easily with M-x find-library RET... .

You can expand that solution to your likings. For an instance you can add an optional tab-number to the link if the chrome commando has such a parameter. You just have to process this information in your link handler. Note that the link handlers are the lambda expressions in the above example.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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