]> git.eshelyaron.com Git - emacs.git/commitdiff
Provide tool-tip display delays on TTY frames
authorEli Zaretskii <eliz@gnu.org>
Sat, 1 Mar 2025 15:16:08 +0000 (17:16 +0200)
committerEshel Yaron <me@eshelyaron.com>
Tue, 4 Mar 2025 20:57:54 +0000 (21:57 +0100)
* lisp/tooltip.el (tooltip-show, tooltip-hide)
(tooltip-show-help): Support delayed tool-tip display on TTY
frames as well.  (Bug#76653)

* etc/NEWS: Announce the behavior change.

(cherry picked from commit 6a2f6056c5a079a7f3db240171680560a3bd9710)

lisp/tooltip.el

index eb95d99b034d793ecd2caeb4ba0f879f915e2095..0d75ecdba76113a8219dac792fc7b12432666eb7 100644 (file)
@@ -251,7 +251,8 @@ Note that the last two arguments are not respected when
 `use-system-tooltips' is non-nil and Emacs is built with support
 for system tooltips, such as on NS, Haiku, and with the GTK
 toolkit."
-  (if use-echo-area
+  (if (or use-echo-area
+          (not (display-graphic-p)))
       (tooltip-show-help-non-mode text)
     (condition-case error
        (let ((params (copy-sequence tooltip-frame-parameters))
@@ -285,8 +286,13 @@ toolkit."
   "Hide a tooltip, if one is displayed.
 Value is non-nil if tooltip was open."
   (tooltip-cancel-delayed-tip)
-  (when (x-hide-tip)
-    (setq tooltip-hide-time (float-time))))
+  (if (display-graphic-p)
+      (when (x-hide-tip)
+        (setq tooltip-hide-time (float-time)))
+    (let ((msg (current-message)))
+      (message "")
+      (when (not (or (null msg) (equal msg "")))
+        (setq tooltip-hide-time (float-time))))))
 
 \f
 ;;; Debugger-related functions
@@ -386,11 +392,10 @@ It is also called if Tooltip mode is on, for text-only displays."
 (defun tooltip-show-help (msg)
   "Function installed as `show-help-function'.
 MSG is either a help string to display, or nil to cancel the display."
-  (if (and (display-graphic-p)
-           ;; Tooltips can't be displayed on top of the global menu
-           ;; bar on NS.
-           (or (not (eq window-system 'ns))
-               (not (menu-or-popup-active-p))))
+  (if ;; Tooltips can't be displayed on top of the global menu bar on
+      ;; NS.
+      (not (and (eq window-system 'ns)
+                (menu-or-popup-active-p)))
       (let ((previous-help tooltip-help-message))
        (setq tooltip-help-message msg)
        (cond ((null msg)
@@ -408,9 +413,7 @@ MSG is either a help string to display, or nil to cancel the display."
               ;; A different help.  Remove a previous tooltip, and
               ;; display a new one, with some delay.
               (tooltip-hide)
-              (tooltip-start-delayed-tip))))
-    ;; On text-only displays, try `tooltip-show-help-non-mode'.
-    (tooltip-show-help-non-mode msg)))
+              (tooltip-start-delayed-tip))))))
 
 (defun tooltip-help-tips (_event)
   "Hook function to display a help tooltip.