Move command prompt into denote.el; rename it; document everything

This commit is contained in:
Protesilaos Stavrou 2023-09-20 17:44:23 +03:00
parent 57b417b6d6
commit cd47e8bf45
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
3 changed files with 26 additions and 29 deletions

View file

@ -908,13 +908,10 @@ prompts for a directory among ~denote-silo-extras-directories~ and runs
the ~denote-open-or-create~ command from there.
#+findex: denote-silo-extras-select-silo-then-command
#+vindex: denote-silo-extras-commands
The command ~denote-silo-extras-select-silo-then-command~ prompts with
minibuffer completion for a directory among ~denote-silo-extras-directories~.
Once the user selects a silo, a second prompt asks for a Denote
note-creation command to call from inside that silo ([[#h:17896c8c-d97a-4faa-abf6-31df99746ca6][Points of entry]]).
The list of available commands is specified in the user option
~denote-silo-extras-commands~.
** Exclude certain directories from all operations
:PROPERTIES:
@ -3680,6 +3677,11 @@ might change them without further notice.
~denote-date-prompt-use-org-read-date~ is non-nil. It requires Org
([[#h:e7ef08d6-af1b-4ab3-bb00-494a653e6d63][The denote-date-prompt-use-org-read-date option]]).
#+findex: denote-command-prompt
+ Function ~denote-command-prompt~ :: Prompt for command among
~denote-commands-for-new-notes~ ([[#h:17896c8c-d97a-4faa-abf6-31df99746ca6][Points of entry]]). [ Part of
{{{development-version}}}. ]
#+findex: denote-prompt-for-date-return-id
+ Function ~denote-prompt-for-date-return-id~ :: Use
~denote-date-prompt~ and return it as ~denote-id-format~.

View file

@ -51,20 +51,6 @@ as the variable `denote-directory'."
:link '(info-link "(denote) Maintain separate directories for notes")
:type '(repeat directory))
(defcustom denote-silo-extras-commands
'(denote
denote-date
denote-subdirectory
denote-template
denote-type
denote-signature)
"List of commands to call after selecting a silo.
This is used by the `denote-silo-extras-select-silo-then-command'
command."
:group 'denote-silo-extras
:link '(info-link "(denote) Maintain separate directories for notes")
:type '(repeat function))
(defvar denote-silo-extras--directory-history nil
"Minibuffer history for `denote-silo-extras--directory-prompt'.")
@ -76,17 +62,6 @@ command."
denote-silo-extras-directories nil :require-match
nil 'denote-silo-extras--directory-history)))
(defvar denote-silo-extras--command-history nil
"Minibuffer history for `denote-silo-extras--command-prompt'.")
(defun denote-silo-extras--command-prompt ()
"Prompt for command among `denote-silo-extras-commands'."
(let ((default (car denote-silo-extras--command-history)))
(completing-read
(format-prompt "Run command in silo" default)
denote-silo-extras-commands nil :require-match
nil 'denote-silo-extras--command-history)))
;;;###autoload
(defun denote-silo-extras-create-note (&optional silo)
"Select SILO and run `denote' in it.
@ -117,7 +92,7 @@ COMMAND is one among `denote-silo-extras-commands'."
(interactive
(list
(denote-silo-extras--directory-prompt)
(denote-silo-extras--command-prompt)))
(denote-command-prompt)))
(let ((denote-user-enforced-denote-directory silo))
(call-interactively command)))

View file

@ -1697,6 +1697,26 @@ The meaning of FILES is the same as in `denote--id-exists-p'."
'denote-barf-duplicate-id
"1.0.0")
(defconst denote-commands-for-new-notes
'(denote
denote-date
denote-subdirectory
denote-template
denote-type
denote-signature)
"List of commands for `denote-command-prompt' that create a new note.")
(defvar denote--command-prompt-history nil
"Minibuffer history for `denote-command-prompt'.")
(defun denote-command-prompt ()
"Prompt for command among `denote-commands-for-new-notes'."
(let ((default (car denote--command-prompt-history)))
(completing-read
(format-prompt "Run command in silo" default)
denote-commands-for-new-notes nil :require-match
nil 'denote--command-prompt-history)))
;;;;; The `denote' command and its prompts
;;;###autoload