Function: denote-select-from-files-prompt

denote-select-from-files-prompt is a byte-compiled function defined in denote.el.

Signature

(denote-select-from-files-prompt FILES &optional PROMPT-TEXT)

Documentation

Prompt for linked file among FILES.

Show relative file names and then return the absolute version of the selected one.

With optional PROMPT-TEXT use it for the minibuffer prompt instead of the generic one.

Aliases

denote-select-linked-file-prompt (obsolete since 4.1.0)

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote-select-from-files-prompt (files &optional prompt-text)
  "Prompt for linked file among FILES.
Show relative file names and then return the absolute version of the
selected one.

With optional PROMPT-TEXT use it for the minibuffer prompt instead of
the generic one."
  (let* ((roots (denote-directories))
         (single-dir-p (null (cdr roots)))
         (file-names (if single-dir-p
                         (mapcar
                          (lambda (file)
                            (denote--get-file-name-relative-to-directories file roots))
                          files)
                       files))
         (selected (completing-read
                    (format-prompt (or prompt-text "Select file among files") nil)
                    (apply 'denote-get-completion-table file-names denote-file-prompt-extra-metadata)
                    nil t nil 'denote-link-find-file-history)))
    (if single-dir-p
        (expand-file-name selected (car roots))
      selected)))