Function: denote--rename-get-file-info-from-prompts-or-existing

denote--rename-get-file-info-from-prompts-or-existing is a byte-compiled function defined in denote.el.

Signature

(denote--rename-get-file-info-from-prompts-or-existing FILE)

Documentation

Retrieve existing info from FILE and prompt according to denote-prompts.

It is meant to be combined with denote--rename-file to create renaming commands.

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote--rename-get-file-info-from-prompts-or-existing (file)
  "Retrieve existing info from FILE and prompt according to `denote-prompts'.

It is meant to be combined with `denote--rename-file' to create
renaming commands."
  (let* ((file-in-prompt (propertize (file-relative-name file) 'face 'denote-faces-prompt-current-name))
         (file-type (denote-filetype-heuristics file))
         (date (denote-retrieve-front-matter-date-value file file-type))
         (identifier (or (denote-retrieve-filename-identifier file) ""))
         (title (or (denote-retrieve-title-or-filename file file-type) ""))
         (keywords (denote-extract-keywords-from-path file))
         (signature (or (denote-retrieve-filename-signature file) "")))
    (dolist (prompt denote-prompts)
      (pcase prompt
        ('title
         (setq title (denote-title-prompt
                      title
                      (format "Rename `%s' with TITLE (empty to remove)" file-in-prompt))))
        ('keywords
         (setq keywords (denote-keywords-prompt
                         (format "Rename `%s' with KEYWORDS (empty to remove)" file-in-prompt)
                         (string-join keywords ","))))
        ('signature
         (setq signature (denote-signature-prompt
                          signature
                          (format "Rename `%s' with SIGNATURE (empty to remove)" file-in-prompt))))
        ('identifier
         (setq identifier (denote-identifier-prompt
                           identifier
                           (format "Rename `%s' with IDENTIFIER (empty to remove)" file-in-prompt))))
        ('date
         (setq date (denote-valid-date-p (denote-date-prompt
                                          date
                                          (format "Rename `%s' with DATE" file-in-prompt)))))))
    (list title keywords signature date identifier)))