branch: externals/denote commit cd47e8bf454d79476b6f8c829a6ab0cbf2d8ebff Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Move command prompt into denote.el; rename it; document everything --- README.org | 8 +++++--- denote-silo-extras.el | 27 +-------------------------- denote.el | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/README.org b/README.org index 5c5cda86c8..0088a0dad9 100644 --- a/README.org +++ b/README.org @@ -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~. diff --git a/denote-silo-extras.el b/denote-silo-extras.el index a198ca1411..ed1287686c 100644 --- a/denote-silo-extras.el +++ b/denote-silo-extras.el @@ -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))) diff --git a/denote.el b/denote.el index cac07e97b3..acc92251d4 100644 --- a/denote.el +++ b/denote.el @@ -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