Function: org-next-link
org-next-link is an autoloaded, interactive and byte-compiled function
defined in ol.el.gz.
Signature
(org-next-link &optional SEARCH-BACKWARD)
Documentation
Move forward to the next link.
If the link is in hidden text, expose it. When SEARCH-BACKWARD is non-nil, move backward.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/ol.el.gz
;;; Interactive Functions
;;;###autoload
(defun org-next-link (&optional search-backward)
"Move forward to the next link.
If the link is in hidden text, expose it. When SEARCH-BACKWARD
is non-nil, move backward."
(interactive)
(let ((pos (point))
(search-fun (if search-backward #'re-search-backward
#'re-search-forward)))
;; Tweak initial position. If last search failed, wrap around.
;; Otherwise, make sure we do not match current link.
(cond
((not (and org-link--search-failed (eq this-command last-command)))
(cond
((and (not search-backward) (looking-at org-link-any-re))
(goto-char (match-end 0)))
(search-backward
(pcase (org-in-regexp org-link-any-re nil t)
(`(,beg . ,_) (goto-char beg))
(_ nil)))
(t nil)))
(search-backward
(goto-char (point-max))
(message "Link search wrapped back to end of buffer"))
(t
(goto-char (point-min))
(message "Link search wrapped back to beginning of buffer")))
(setq org-link--search-failed nil)
(catch :found
(while (funcall search-fun org-link-any-re nil t)
(let ((context (save-excursion
(unless search-backward (forward-char -1))
(org-element-context))))
(pcase (org-element-lineage context 'link t)
(`nil nil)
(link
(goto-char (org-element-begin link))
(when (org-invisible-p) (org-fold-show-context 'link-search))
(throw :found t)))))
(goto-char pos)
(setq org-link--search-failed t)
(message "No further link found"))))