branch: externals/denote-sequence commit a6ef3dfe239cb79787664042d4a395ee1b41679e Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Implement minibuffer history for denote-sequence-depth-prompt --- denote-sequence.el | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/denote-sequence.el b/denote-sequence.el index fdfd8a39db..29adf01edb 100644 --- a/denote-sequence.el +++ b/denote-sequence.el @@ -977,15 +977,24 @@ is ignored." (or sequences (denote-sequence-get-all-sequences)) #'denote-sequence-p :require-match nil 'denote-sequence-history)) -(defun denote-sequence-depth-prompt (&optional prompt-text) +(defvar denote-sequence-depth-history nil + "Minibuffer history of `denote-sequence-depth-prompt'.") + +(defun denote-sequence-depth-prompt (&optional prompt-text default-value) "Prompt for the depth of a sequence. -With optional PROMPT-TEXT use it instead of the generic one." - (read-number - (or prompt-text - (format "Get sequences up to this depth %s: " - (if (eq denote-sequence-scheme 'alphanumeric) - "(e.g. `1a2' is `3' levels of depth)" - "(e.g. `1=1=2' is `3' levels of depth)"))))) +With optional PROMPT-TEXT use it instead of the generic one. + +With optional DEFAULT-VALUE use it as the default minibuffer value, else +use the `car' of `denote-sequence-depth-history', if any." + (let ((default (or default-value (car denote-sequence-depth-history)))) + (read-number + (or prompt-text + (format "Get sequences up to this depth %s: " + (if (eq denote-sequence-scheme 'alphanumeric) + "(e.g. `1a2' is `3' levels of depth)" + "(e.g. `1=1=2' is `3' levels of depth)"))) + default + 'denote-sequence-depth-history))) (defun denote-sequence--get-dired-buffer-name (&optional prefix depth) "Return a string for `denote-sequence-dired' buffer.