emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/tty-child-frames d22882e418e: Prevent too early hiding of tty ti


From: Gerd Moellmann
Subject: scratch/tty-child-frames d22882e418e: Prevent too early hiding of tty tips
Date: Sun, 8 Dec 2024 01:02:34 -0500 (EST)

branch: scratch/tty-child-frames
commit d22882e418eb100423c53d90cca257bb0c197b86
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    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.
---
 lisp/tty-tip.el | 24 +++++++++++++++---------
 1 file 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 @@
       (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]