Function: embark-target-file-at-point

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

Signature

(embark-target-file-at-point)

Documentation

Target file at point.

This function mostly relies on ffap-file-at-point, with the following exceptions:

- In dired-mode, it uses dired-get-filename instead.

- In imaged-dired-thumbnail-mode, it uses
  image-dired-original-file-name instead.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark-target-file-at-point ()
  "Target file at point.
This function mostly relies on `ffap-file-at-point', with the
following exceptions:

- In `dired-mode', it uses `dired-get-filename' instead.

- In `imaged-dired-thumbnail-mode', it uses
  `image-dired-original-file-name' instead."
  (let (file bounds)
    (or (and (derived-mode-p 'dired-mode)
             (setq file (dired-get-filename t 'no-error-if-not-filep))
             (setq bounds
                   (cons
                    (save-excursion (dired-move-to-filename) (point))
                    (save-excursion (dired-move-to-end-of-filename) (point)))))
        (and (derived-mode-p 'image-dired-thumbnail-mode)
             (setq file (image-dired-original-file-name))
             (setq bounds (cons (point) (1+ (point)))))
        (when-let* ((tap-file (thing-at-point 'filename))
                    (_ (not (equal (file-name-base tap-file) tap-file)))
                    (guess (embark-target-guess-file-at-point)))
          (setq file (cadr guess) bounds (cddr guess))))
    (when file
      `(file ,(abbreviate-file-name (expand-file-name file)) ,@bounds))))