Search code examples
urlemacsorg-mode

How to open multiple URLs at the same time in an Emacs buffer?


I am using the Emacs editor together with the org-mode and evil-mode mainly for text handling and documentation. Often there is a topic where several different URLs to websites belong to.

Example: I have a text snippet on how to install Emacs:

*** install emacs

emacs - I want to try org-mode. What's the shortest path from zero to typing? - Stack Overflow
https://stackoverflow.com/questions/4940680/i-want-to-try-org-mode-whats-the-shortest-path-from-zero-to-typing

Index of /gnu/emacs/windows/emacs-26
http://ftp.gnu.org/gnu/emacs/windows/emacs-26/emacs-26.3-x86_64.zip

Installation target:
file://C:\Lupo_Pensuite\MyApps\emacs

How to
file://C:\Lupo_Pensuite\MyDocs\howto.txt

Is it possible to select the region and all the URLs are opened within my default web browser? And the file link is being opened by Windows Explorer? And the text file is opened with the associated editor?

Or even better: emacs is aware that the a.m. text snippet actually is a org-mode chapter. And regardless where within that chapter the cursor is positioned, something like M-x open-all-links-in-chapter is...opening all mentioned links in the current chapter.

Prio 1: is there something like that existing in emacs/org-mode/evil-mode already?

Prio 2: is there a elisp function you know which can achieve this use case?

Enviroment: Cygwin under Windows 10, emacs 26.3, org-mode 9.1.9


Solution

  • It turns out, that org-mode has this already built-in!

    Today I was browsing the documentation of org-mode, wondering how exactly C-c C-o is working. That key combo is calling the emacs org-mode function "org-open-at-point". org-open-at-point is opening the URL where the cursor (in emacs speak: point) is positioned.

    Now if a C-c C-o is pressed on a heading, then all URL's beneath that heading are opened! Which is exactly what I asked for from the beginning. Thanks a lot, NickD, for your constructive contributions!

    Here the original help text:

    When point is on a headline, display a list of every link in the entry, so it is possible to pick one, or all, of them.