Function: dired-x-guess-file-name-at-point
dired-x-guess-file-name-at-point is a byte-compiled function defined
in dired-x.el.gz.
This function is obsolete since 29.1; use (thing-at-point 'filename) instead.
Signature
(dired-x-guess-file-name-at-point)
Documentation
Return the filename closest to point, expanded.
Point should be in or after a filename.
Aliases
dired-filename-at-point (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/dired-x.el.gz
(defun dired-x-guess-file-name-at-point ()
"Return the filename closest to point, expanded.
Point should be in or after a filename."
(declare (obsolete "use (thing-at-point 'filename) instead." "29.1"))
(save-excursion
;; First see if just past a filename.
(or (eobp) ; why?
(when (looking-at-p "[] \t\n[{}()]") ; whitespace or some parens
(skip-chars-backward " \n\t\r({[]})")
(or (bobp) (backward-char 1))))
(let ((filename-chars "-.[:alnum:]_/:$+@")
start prefix)
(if (looking-at-p (format "[%s]" filename-chars))
(progn
(skip-chars-backward filename-chars)
(setq start (point)
prefix
;; This is something to do with ange-ftp filenames.
;; It convert foo@bar to /foo@bar.
;; But when does the former occur in dired buffers?
(and (string-match-p
"^\\w+@"
(buffer-substring start (line-end-position)))
"/"))
(if (string-match-p "[/~]" (char-to-string (preceding-char)))
(setq start (1- start)))
(skip-chars-forward filename-chars))
(error "No file found around point!"))
;; Return string.
(expand-file-name (concat prefix (buffer-substring start (point)))))))