summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-11-21 21:52:06 +0000
committerjao <jao@gnu.org>2020-11-21 21:52:06 +0000
commit6f5fc433b4b60f1b68dc407eef0b38dc8dc5d4ed (patch)
treea7685a47d7f029e0899cba576693cb0368a5a726
parent776cfd788ed89a4705155fa077f2d8dd21ae50e2 (diff)
downloadelibs-6f5fc433b4b60f1b68dc407eef0b38dc8dc5d4ed.tar.gz
elibs-6f5fc433b4b60f1b68dc407eef0b38dc8dc5d4ed.tar.bz2
jao-minibuffer: notification timeout
-rw-r--r--misc/jao-minibuffer.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/misc/jao-minibuffer.el b/misc/jao-minibuffer.el
index 132566a..7104544 100644
--- a/misc/jao-minibuffer.el
+++ b/misc/jao-minibuffer.el
@@ -29,6 +29,7 @@
(defvar jao-minibuffer-align-right-p t)
(defvar jao-minibuffer-right-margin (if window-system 0 1))
(defvar jao-minibuffer-maximized-frames-p t)
+(defvar jao-minibuffer-notification-timeout 5)
(defconst jao-minibuffer--name " *Minibuf-0*")
@@ -72,9 +73,21 @@
(defun jao-minibuffer-add-variable (variable-name &optional append)
(add-to-list 'jao-minibuffer-info `(:eval ,variable-name) append))
+(defvar jao-minibuffer--notification-timer nil)
+
+(defun jao-minibuffer--start-notification-timer (timeout)
+ (interactive)
+ (when jao-minibuffer--notification-timer
+ (cancel-timer jao-minibuffer--notification-timer))
+ (setq jao-minibuffer--notification-timer
+ (run-with-idle-timer (or timeout jao-minibuffer-notification-timeout)
+ nil
+ 'jao-minibuffer-pop-notification)))
+
;;;###autoload
-(defun jao-minibuffer-push-notification (msg)
+(defun jao-minibuffer-push-notification (msg &optional timeout)
(setq jao-minibuffer-notification msg)
+ (jao-minibuffer--start-notification-timer timeout)
(jao-minibuffer-refresh))
;;;###autoload