From 9b3ce6252115980802adaa562af575bcd73a2c55 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 7 Oct 2017 15:04:37 +0300 Subject: [PATCH] New defcustom 'tooltip-resize-echo-area' * lisp/tooltip.el (tooltip-resize-echo-area): New defcustom. (tooltip-show-help-non-mode): Use it to avoid truncating the tooltip text in the echo area. (Bug#28724) * etc/NEWS: Mention 'tooltip-resize-echo-area'. --- etc/NEWS | 6 ++++++ lisp/tooltip.el | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 15661808c76..f961928ffdf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -31,6 +31,12 @@ When you add a new item, use the appropriate mark if you are sure it applies, * Changes in Emacs 27.1 +--- +** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text +on GUI frames when tooltips are displayed in the echo area. Instead, +it resizes the echo area as needed to accommodate the full tool-tip +text. + +++ ** New function 'logcount' calculates an integer's Hamming weight. diff --git a/lisp/tooltip.el b/lisp/tooltip.el index 18ddd25703c..44b6938a6fd 100644 --- a/lisp/tooltip.el +++ b/lisp/tooltip.el @@ -155,6 +155,18 @@ This variable is obsolete; instead of setting it to t, disable (make-obsolete-variable 'tooltip-use-echo-area "disable Tooltip mode instead" "24.1" 'set) +(defcustom tooltip-resize-echo-area nil + "If non-nil, using the echo area for tooltips will resize the echo area. +By default, when the echo area is used for displaying tooltips, +the tooltip text is truncated if it exceeds a single screen line. +When this variable is non-nil, the text is not truncated; instead, +the echo area is resized as needed to accommodate the full text +of the tooltip. +This variable has effect only on GUI frames." + :type 'boolean + :group 'tooltip + :version "27.1") + ;;; Variables that are not customizable. @@ -347,7 +359,8 @@ It is also called if Tooltip mode is on, for text-only displays." (current-message)))) (setq tooltip-previous-message (current-message))) (setq tooltip-help-message help) - (let ((message-truncate-lines t) + (let ((message-truncate-lines + (or (not (display-graphic-p)) (not tooltip-resize-echo-area))) (message-log-max nil)) (message "%s" help))) ((stringp tooltip-previous-message) -- 2.39.5