branch: externals/tmr
commit d8afd306f884b523fd3637fde2b9b1c7b416d15f
Author: Damien Cassou <dam...@cassou.me>
Commit: Protesilaos Stavrou <i...@protesilaos.com>
    tmr--read-duration: Introduce an history and a default value
---
 tmr.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tmr.el b/tmr.el
index e0c70e7f2b..4b93941dc2 100644
--- a/tmr.el
+++ b/tmr.el
@@ -253,9 +253,18 @@ Optionally include DESCRIPTION."
                  (format " [%s]" (propertize description 'face 'bold))
                ""))))
 
+(defvar tmr--duration-hist '()
+  "Minibuffer history of `tmr' durations.")
+
 (defun tmr--read-duration ()
   "Ask the user to type a duration."
-  (read-string "N minutes for timer (append `h' or `s' for other units): "))
+  (let ((def (nth 0 tmr--duration-hist)))
+    (read-string
+     (if def
+         (format "N minutes for timer (append `h' or `s' for other units) 
[%s]: " def)
+       "N minutes for timer (append `h' or `s' for other units): ")
+     nil
+     'tmr--duration-hist def)))
 
 (defvar tmr--description-hist '()
   "Minibuffer history of `tmr' descriptions.")

Reply via email to