Function: klink:at-p
klink:at-p is an autoloaded and byte-compiled function defined in
klink.el.
Signature
(klink:at-p)
Documentation
Return non-nil iff point is within a klink.
See documentation for the actypes::link-to-kotl function for valid klink formats. Value returned is a list of: link-label, link-start-position, and link-end-position, (including delimiters).
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klink.el
;;;###autoload
(defun klink:at-p ()
"Return non-nil iff point is within a klink.
See documentation for the `actypes::link-to-kotl' function for valid klink
formats. Value returned is a list of: link-label, link-start-position, and
link-end-position, (including delimiters)."
(let (bol label-and-pos referent path)
(when (and
;; Avoid false matches in certain modes.
(not (memq major-mode klink:ignore-modes))
;; If this is an OO-Browser listing buffer, ignore anything that
;; looks like a klink, e.g. a C++ <template> class.
(if (fboundp 'br-browser-buffer-p)
(not (br-browser-buffer-p))
t)
;; If in a programming mode, Klinks can occur only within comments.
(if (and (derived-mode-p 'prog-mode)
(not (derived-mode-p 'lisp-interaction-mode))
(not (memq major-mode hui-select-markup-modes)))
;; Next line means point is within a comment
(nth 4 (syntax-ppss))
t)
;; If in a C-based mode, Klinks can occur only within comments.
(if (and (memq major-mode klink:c-style-modes)
(fboundp 'c-within-comment-p))
(or (c-within-comment-p)
(save-excursion
(and (re-search-backward "//\\|\n" nil t) (looking-at "//"))))
t)
;; Don't match to C-style lines like: #include < path >,
;; even if inside a comment.
(if (memq major-mode klink:c-style-modes)
(save-excursion
(beginning-of-line)
(setq bol (point))
(require 'hmouse-tag)
(not (looking-at smart-c-include-regexp)))
t)
(save-excursion
;; Don't match Elisp print objects such as #<buffer>
;; even if inside a comment
(and (search-backward "<" bol t)
(not (eq (preceding-char) ?#))
;; Don't match to \<(explicit)> or <[implicit]> Hyperbole
;; buttons or message attachments such as <#part ...>
(not (memq (char-after (1+ (point))) '(?\( ?\[)))
(not (looking-at "<#part\\s-"))))
(setq label-and-pos (hbut:label-p t "<" ">" t))
(stringp (setq referent (car label-and-pos)))
(setq referent (string-trim referent))
;; Ensure it conforms to some klink specification.
(or (string-match "\\`[ \t]*[-#@|!&]" referent)
(and (or (when (string-match "\\s-*,\\|#[0-9a-z.=]+\\'" referent)
(setq path (substring referent 0 (match-beginning 0)))
(hpath:is-p (expand-file-name path (hbut:get-key-src t t))))
(hpath:is-p (expand-file-name referent (hbut:get-key-src t t))))
(string-match "\\.kot" referent)))
;; Eliminate matches to e-mail addresses like, <user@domain>
(not (string-match "[^<> \t\n\r\f][!&@]" referent))
;; Eliminate matches to URLs but allow for single char Windows path drive prefixes
(not (string-match "\\`[a-zA-Z][a-zA-Z]+:" referent))
;; Don't match to <HTML> and </SGML> type tags
(not (and (memq major-mode hui-select-markup-modes)
;; Assume , followed by a number is a klink.
(not (string-match ",\\s-*[0-9]" referent))
(string-match "\\`[a-zA-Z!/]" referent))))
label-and-pos)))