4

I have a list of www addresses as a list like:

- https://www.nytimes.com
- https://www.foxnews.com

and so on. I can open single elements with the command org-open-at-point which is bound to the key sequence C-c C-o. A Firefox tab will open on the correct address.

However, how could I mark a list and open all of them each on a single tab?

Tobias
  • 32,569
  • 1
  • 34
  • 75
Pierre B
  • 381
  • 1
  • 4

2 Answers2

2

The following lisp code lets org-open-at-point open all links within the active region. It behaves like the original version if region is not active.

If you want to use the code paste it in your init file and re-start emacs.

(defun orgTZA-open-at-point-ad (oldfun &rest args)
  "Just `org-open-at-point'.
If region is active open all links in region."
  (if (use-region-p)
      (save-excursion
    (save-restriction
      (narrow-to-region (region-beginning) (region-end))
      (goto-char (point-min))
      (while (progn
           (org-next-link)
           (null org-link-search-failed))
        (apply oldfun args))))
    (apply oldfun args)))

(advice-add #'org-open-at-point :around #'orgTZA-open-at-point-ad)
Tobias
  • 32,569
  • 1
  • 34
  • 75
  • While this works (thanks for that!), it is slow in Emacs 28.2, waiting ~2-4 seconds after opening each link in Firefox 108.0.1 before opening the next (at least on Ubuntu 22.04). Any idea how to speed up? – holocronweaver Dec 20 '22 at 19:45
1

Org mode can to this natively:

* Some heading
- [[https://www.nytimes.com][link 1]]
- [[https://www.foxnews.com][link 2]]

Do C-c C-o RET on the heading, it will open the two pages on the default browser.

crocefisso
  • 1,141
  • 7
  • 15