Function: cape-file
cape-file is an autoloaded, interactive and byte-compiled function
defined in cape.el.
Signature
(cape-file &optional INTERACTIVE)
Documentation
Complete file name at point.
See the user option cape-file-directory-must-exist.
If INTERACTIVE is nil the function acts like a Capf.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
;;;###autoload
(defun cape-file (&optional interactive)
"Complete file name at point.
See the user option `cape-file-directory-must-exist'.
If INTERACTIVE is nil the function acts like a Capf."
(interactive (list t))
(if interactive
(cape-interactive '(cape-file-directory-must-exist) #'cape-file)
(pcase-let* ((default-directory (pcase cape-file-directory
('nil default-directory)
((pred stringp) cape-file-directory)
(_ (funcall cape-file-directory))))
(prefix (and cape-file-prefix
(looking-back
(concat
(regexp-opt (ensure-list cape-file-prefix) t)
"[^ \n\t]*")
(pos-bol))
(match-end 1)))
(`(,beg . ,end) (if prefix
(cons prefix (point))
(cape--bounds 'filename)))
(non-essential t)
(file (buffer-substring-no-properties beg end)))
(when (or prefix
(not cape-file-directory-must-exist)
(and (string-search "/" file)
(file-exists-p (file-name-directory
(substitute-in-file-name file)))))
(unless (boundp 'comint-unquote-function)
(require 'comint))
(let ((table (cape--nonessential-table
(completion-table-with-quoting
#'read-file-name-internal
comint-unquote-function
comint-requote-function))))
`( ,beg ,end ,table
:company-location
,(lambda (file)
(let* ((str (buffer-substring-no-properties beg (point)))
(pre (car (completion-boundaries str table nil "")))
(file (file-name-concat (substring str 0 pre) file)))
(and (file-exists-p file) (list file))))
,@(when (or prefix (string-match-p "./" file))
'(:company-prefix-length t))
,@cape--file-properties))))))