branch: externals/tmr
commit 3f8674546bb4d24ca4bc35a8145f2b8b2eeb893b
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>
tmr: accept optional default in description prompt
---
tmr.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tmr.el b/tmr.el
index 8475258cd3..96237029ab 100644
--- a/tmr.el
+++ b/tmr.el
@@ -323,9 +323,12 @@ If DEFAULT is provided, use that as a default."
(defvar tmr--description-hist '()
"Minibuffer history of `tmr' descriptions.")
-(defun tmr--description-prompt ()
- "Helper prompt for descriptions in `tmr'."
- (let ((def (nth 0 tmr--description-hist)))
+(defun tmr--description-prompt (&optional default)
+ "Helper prompt for descriptions in `tmr'.
+If optional DEFAULT is provided use it as a default. Otherwise
+use the latest input from the `tmr--description-hist', if
+present."
+ (let ((def (or default (nth 0 tmr--description-hist))))
(completing-read
(if def
(format "Description for this tmr [%s]: " def)