Function: embark-target-guess-file-at-point

embark-target-guess-file-at-point is a byte-compiled function defined in embark.el.

Signature

(embark-target-guess-file-at-point)

Documentation

Target the file guessed by ffap at point.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark-target-guess-file-at-point ()
  "Target the file guessed by `ffap' at point."
  (when-let* ((tap-file (thing-at-point 'filename))
              (_ (not (ffap-url-p tap-file))) ; no URLs, those have a target finder
              (bounds (bounds-of-thing-at-point 'filename))
              (file (ffap-file-at-point)))
    ;; ffap doesn't make bounds available, so we use
    ;; thingatpt bounds, which might be a little off
    ;; adjust bounds if thingatpt gobbled punctuation around file
    (when (or (string-match (regexp-quote file) tap-file)
              (string-match (regexp-quote (file-name-base file)) tap-file))
      (setq bounds (cons (+ (car bounds) (match-beginning 0))
                         (- (cdr bounds) (- (length tap-file)
                                            (match-end 0))))))
    `(file ,(abbreviate-file-name (expand-file-name file)) ,@bounds)))