aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Möllmann2024-12-08 06:54:47 +0100
committerGerd Möllmann2024-12-08 07:02:12 +0100
commitd22882e418eb100423c53d90cca257bb0c197b86 (patch)
tree19fd7731a4e7f10677c37e9b2253f764ec4889bf
parent196c761c66d47ff6a93d9134ca73d1c08a9125db (diff)
downloademacs-d22882e418eb100423c53d90cca257bb0c197b86.tar.gz
emacs-d22882e418eb100423c53d90cca257bb0c197b86.zip
Prevent too early hiding of tty tips
* lisp/tty-tip.el (tty-tip--show-timer): Renamed from tty-tip--timeout-id. (tty-tip--hide-timer): New variable. (tty-tip--delete-frame): Cancel hide timer if set. (tty-tip--create-frame): Use run-with-timer instead of run-at-time for consistency.
-rw-r--r--lisp/tty-tip.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/tty-tip.el b/lisp/tty-tip.el
index 728c16b6856..1e44aaba02b 100644
--- a/lisp/tty-tip.el
+++ b/lisp/tty-tip.el
@@ -99,8 +99,16 @@
99 (setf (alist-get 'background-color params) bg)) 99 (setf (alist-get 'background-color params) bg))
100 params)) 100 params))
101 101
102(defvar tty-tip--help-message nil)
103(defvar tty-tip--hide-time nil)
104(defvar tty-tip--show-timer nil)
105(defvar tty-tip--hide-timer nil)
106
102(defun tty-tip--delete-frame () 107(defun tty-tip--delete-frame ()
103 (when tty-tip--frame 108 (when tty-tip--frame
109 (when tty-tip--hide-timer
110 (cancel-timer tty-tip--hide-timer)
111 (setq tty-tip--hide-timer nil))
104 (delete-frame tty-tip--frame) 112 (delete-frame tty-tip--frame)
105 (setq tty-tip--frame nil) 113 (setq tty-tip--frame nil)
106 t)) 114 t))
@@ -144,11 +152,9 @@
144 (y (cdr pos))) 152 (y (cdr pos)))
145 (set-frame-position tty-tip--frame x y)) 153 (set-frame-position tty-tip--frame x y))
146 (make-frame-visible tty-tip--frame) 154 (make-frame-visible tty-tip--frame)
147 (run-at-time x-show-tooltip-timeout nil #'tty-tip--delete-frame)))) 155 (setq tty-tip--hide-timer
148 156 (run-with-timer x-show-tooltip-timeout nil
149(defvar tty-tip--help-message nil) 157 #'tty-tip--delete-frame)))))
150(defvar tty-tip--hide-time nil)
151(defvar tty-tip--timeout-id nil)
152 158
153(defun tty-tip--delay () 159(defun tty-tip--delay ()
154 (if (and tty-tip--hide-time 160 (if (and tty-tip--hide-time
@@ -158,12 +164,12 @@
158 tooltip-delay)) 164 tooltip-delay))
159 165
160(defun tty-tip--cancel-delayed-tip () 166(defun tty-tip--cancel-delayed-tip ()
161 (when tty-tip--timeout-id 167 (when tty-tip--show-timer
162 (cancel-timer tty-tip--timeout-id) 168 (cancel-timer tty-tip--show-timer)
163 (setq tty-tip--timeout-id nil))) 169 (setq tty-tip--show-timer nil)))
164 170
165(defun tty-tip--start-delayed-tip () 171(defun tty-tip--start-delayed-tip ()
166 (setq tty-tip--timeout-id 172 (setq tty-tip--show-timer
167 (run-with-timer (tty-tip--delay) nil 173 (run-with-timer (tty-tip--delay) nil
168 (lambda () 174 (lambda ()
169 (tty-tip--create-frame 175 (tty-tip--create-frame