]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent too early hiding of tty tips
authorGerd Möllmann <gerd@gnu.org>
Sun, 8 Dec 2024 05:54:47 +0000 (06:54 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 14:54:50 +0000 (15:54 +0100)
* 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)

lisp/tty-tip.el

index 728c16b6856bc78f9cff329f8fe5c4b610a767c1..1e44aaba02bbd39ad9a7d678fc14d28e3c75f35a 100644 (file)
       (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))
              (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
     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