From: Gerd Möllmann Date: Sun, 8 Dec 2024 05:54:47 +0000 (+0100) Subject: Prevent too early hiding of tty tips X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0cdc83137a268ea4ee09b6d251060da7f3a57ce8;p=emacs.git 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. (cherry picked from commit d22882e418eb100423c53d90cca257bb0c197b86) --- 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 @@ (setf (alist-get 'background-color params) bg)) params)) +(defvar tty-tip--help-message nil) +(defvar tty-tip--hide-time nil) +(defvar tty-tip--show-timer nil) +(defvar tty-tip--hide-timer nil) + (defun tty-tip--delete-frame () (when tty-tip--frame + (when tty-tip--hide-timer + (cancel-timer tty-tip--hide-timer) + (setq tty-tip--hide-timer nil)) (delete-frame tty-tip--frame) (setq tty-tip--frame nil) t)) @@ -144,11 +152,9 @@ (y (cdr pos))) (set-frame-position tty-tip--frame x y)) (make-frame-visible tty-tip--frame) - (run-at-time x-show-tooltip-timeout nil #'tty-tip--delete-frame)))) - -(defvar tty-tip--help-message nil) -(defvar tty-tip--hide-time nil) -(defvar tty-tip--timeout-id nil) + (setq tty-tip--hide-timer + (run-with-timer x-show-tooltip-timeout nil + #'tty-tip--delete-frame))))) (defun tty-tip--delay () (if (and tty-tip--hide-time @@ -158,12 +164,12 @@ tooltip-delay)) (defun tty-tip--cancel-delayed-tip () - (when tty-tip--timeout-id - (cancel-timer tty-tip--timeout-id) - (setq tty-tip--timeout-id nil))) + (when tty-tip--show-timer + (cancel-timer tty-tip--show-timer) + (setq tty-tip--show-timer nil))) (defun tty-tip--start-delayed-tip () - (setq tty-tip--timeout-id + (setq tty-tip--show-timer (run-with-timer (tty-tip--delay) nil (lambda () (tty-tip--create-frame