Function: hsys-org-link-at-p
hsys-org-link-at-p is a byte-compiled function defined in hsys-org.el.
Signature
(hsys-org-link-at-p)
Documentation
Return (start . end) iff point is on a delimited Org mode link, else nil.
Start and end are the buffer positions of the label of the link. This is either the optional description or if none, then the referent, i.e. either [[referent][description]] or [[referent]], sans the outer brackets.
If the link referent is to a HyWikiWord, e.g. [[hy:WikiWord]], or point is on a HyWikiWord in the link description, then ignore this as an Org link (return nil); instead activate it as HyWikiWord reference.
Assume caller has already checked that the current buffer is in
org-mode or is looking for an Org link in a non-Org buffer type.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hsys-org.el
;; Derived in part from `org-open-at-point-global' in "org.el"
(defun hsys-org-link-at-p ()
"Return (start . end) iff point is on a delimited Org mode link, else nil.
Start and end are the buffer positions of the label of the link. This
is either the optional description or if none, then the referent, i.e.
either [[referent][description]] or [[referent]], sans the outer brackets.
If the link referent is to a HyWikiWord, e.g. [[hy:WikiWord]], or point
is on a HyWikiWord in the link description, then ignore this as an Org
link (return nil); instead activate it as HyWikiWord reference.
Assume caller has already checked that the current buffer is in
`org-mode' or is looking for an Org link in a non-Org buffer type."
(unless (or (smart-eolp) (smart-eobp)
;; The types below are handled by Hyperbole ibtypes
(let ((str (hpath:www-at-p)))
(and str
;; If a file link, don't consider a url unless has at
;; least 2 forward slashes after the :.
(if (string-prefix-p "file:/" str)
(string-prefix-p "file://" str)
t)))
(thing-at-point 'email))
(let (start-end)
(and
;; Org will throw a warning that `org-element-property' must be
;; used only within an `org-mode' buffer, but it works in buffers
;; outside of `org-mode' when on an Org link, so just suppress any
;; warning. Using this allows recognition of Org links that are
;; not surrounded by double sqare brackets,
;; e.g. file:my-file::my-text.
(setq start-end
(with-suppressed-warnings
((org-element))
(or
(org-in-regexp
org-link-any-re
(let ((origin (point)))
(max
(save-excursion
(backward-paragraph)
(count-lines
(point)
origin))
(save-excursion
(forward-paragraph)
(count-lines origin
(point))))))
(org-in-regexp org-ts-regexp-both nil t)
(org-in-regexp org-tsr-regexp-both nil t))))
;; Don't treat this as an Org link if its entire description is a
;; HyWikiWord, e.g. [[hy:WikiWord]], [[WikiWord]] or
;; [[link][WikiWord]], as these are handled as implicit buttons.
(let* ((org-link (buffer-substring-no-properties (car start-end) (cdr start-end)))
(wikiword (and org-link (fboundp 'hywiki-word-at) (hywiki-word-at)))
(label-start-end (when wikiword (hsys-org-link-label-start-end)))
(label (car label-start-end)))
(when (and label (string-match-p (concat hywiki-org-link-type ":") label))
(setq label (substring label (1+ (length hywiki-org-link-type)))))
;; If WikiWord is the entire label, ignore it and allow ibtype
;; handling instead
(unless (and wikiword label (string-equal wikiword label))
start-end))))))