[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Side effects in `tooltip-show'
From: |
Po Lu |
Subject: |
Re: Side effects in `tooltip-show' |
Date: |
Mon, 17 Jan 2022 21:29:53 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Po Lu <luangruo@yahoo.com>
>> Cc: emacs-devel@gnu.org
>> Date: Mon, 17 Jan 2022 21:00:46 +0800
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > How about using 'equal' to compare the strings instead? What are the
>> > chances that two help-echo strings of 2 different tooltips will
>> > compare equal without the properties, but not with the properties?
>>
>> That's fine by me as well, but the resulting minor snafu where the
>> tooltip might not be updated if the string contents are identical should
>> be documented somewhere, I think.
>
> In the comments to the code that makes these comparisons, I think.
Thanks. Would you mind if I installed this on the release branch?
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 1cf16fdb5d..1355eecfcd 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -383,9 +383,12 @@ tooltip-show-help
;; Cancel display. This also cancels a delayed tip, if
;; there is one.
(tooltip-hide))
- ((equal-including-properties previous-help msg)
- ;; Same help as before (but possibly the mouse has moved).
- ;; Keep what we have.
+ ((equal previous-help msg)
+ ;; Same help as before (but possibly the mouse has
+ ;; moved or the text properties have changed). Keep
+ ;; what we have. If only text properties have changed,
+ ;; the tooltip won't be updated, but that shouldn't
+ ;; occur often enough to be noticable.
)
(t
;; A different help. Remove a previous tooltip, and
Re: Side effects in `tooltip-show', Pankaj Jangid, 2022/01/18