Function: ghostel--thing-at-point-filename

ghostel--thing-at-point-filename is a natively compiled function defined in ghostel-links.el.

Signature

(ghostel--thing-at-point-filename)

Documentation

Return the file name at point, crossing soft-wrapped rows.

For thing-at-point-provider-alist. On a detected file link the name is the link's text without its :LINE[:COL] tail; elsewhere on a wrapped line, the filename-character run around point.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-links.el
(defun ghostel--thing-at-point-filename ()
  "Return the file name at point, crossing soft-wrapped rows.
For `thing-at-point-provider-alist'.  On a detected file link the
name is the link's text without its `:LINE[:COL]' tail; elsewhere on
a wrapped line, the filename-character run around point."
  (let ((uri (ghostel--link-uri-at-point)))
    (if (and uri (string-prefix-p "fileref:" uri))
        (let ((raw (get-text-property (point) 'ghostel-link-text)))
          ;; OSC 8 spans have no link text; the detection regexes
          ;; guarantee a detected path holds no colon before the tail.
          (when raw
            (if (string-match "\\(?::[0-9]+\\)\\{1,2\\}\\'" raw)
                (substring raw 0 (match-beginning 0))
              raw)))
      (ghostel--joined-token-at-point thing-at-point-file-name-chars))))