[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tmr d8afd306f8 2/3: tmr--read-duration: Introduce an hi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tmr d8afd306f8 2/3: tmr--read-duration: Introduce an history and a default value |
Date: |
Fri, 6 May 2022 06:57:59 -0400 (EDT) |
branch: externals/tmr
commit d8afd306f884b523fd3637fde2b9b1c7b416d15f
Author: Damien Cassou <damien@cassou.me>
Commit: Protesilaos Stavrou <info@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.")