diff --git a/etc/NEWS b/etc/NEWS index 2a973b77827..7145b9eb09e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1346,6 +1346,12 @@ change the selection rules. ** Miscellaneous +--- +*** 'tooltip-mode' now shows tooltips after delay on TTY frames. +Display of tooltips on text-only terminals now happens after +'tooltip-delay' as it does on GUI terminals. To get back the old +behavior, customize the value of 'tooltip-delay' to zero. + --- *** cdl.el is now obsolete. Use 'shell-command' and 'shell-command-on-region' instead. diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 482af3bd7bf..51a9841b49f 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -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)))))) ;;; 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.