From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 40859@debbugs.gnu.org
Subject: bug#40859: Clicking the wrap-prefix string inside a button causes an error
Date: Sun, 26 Apr 2020 14:27:48 -0400 [thread overview]
Message-ID: <5820e370-0933-be24-daae-0fb52f2d7ee8@gmail.com> (raw)
In-Reply-To: <98b37654-1133-05b7-a7b1-3f32b9a74ad9@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
On 26/04/2020 12.44, Clément Pit-Claudel wrote:
> On 26/04/2020 09.43, Eli Zaretskii wrote:
>>> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
>>> Date: Sat, 25 Apr 2020 23:40:38 -0400
>>>
>>> The following snippet inserts a button with a long label and a wrap-prefix. Clicking the prefix causes an error, whose backtrace is shown below.
>>
>> Isn't that a cockpit error?
>
> Here's a tentative patch, but I can't claim to understand the button.el code well :/
A slightly revised version.
[-- Attachment #2: 0001-Only-treat-display-strings-as-buttons-if-they-have-a.patch --]
[-- Type: text/x-patch, Size: 1400 bytes --]
From fd57a05b6598de77dbf9a7ba66a15dc1cd9568a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= <clement.pitclaudel@live.com>
Date: Sun, 26 Apr 2020 12:41:42 -0400
Subject: [PATCH] Only treat display strings as buttons if they have a 'button
property
* lisp/button.el (push-button): Use posn-point instead of posn-string
if the string doesn't have a 'button property (Bug#40859).
---
lisp/button.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lisp/button.el b/lisp/button.el
index b3afc4eca2..3a6a6de774 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -469,10 +469,12 @@ push-button
;; POS is a mouse event; switch to the proper window/buffer
(let ((posn (event-start pos)))
(with-current-buffer (window-buffer (posn-window posn))
- (if (posn-string posn)
- ;; mode-line, header-line, or display string event.
- (button-activate (posn-string posn) t)
- (push-button (posn-point posn) t))))
+ (let* ((str (posn-string posn))
+ (str-button (and str (get-text-property (cdr str) 'button (car str)))))
+ (if str-button
+ ;; mode-line, header-line, or display string event.
+ (button-activate str t)
+ (push-button (posn-point posn) t)))))
;; POS is just normal position
(let ((button (button-at (or pos (point)))))
(when button
--
2.17.1
next prev parent reply other threads:[~2020-04-26 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-26 3:40 bug#40859: Clicking the wrap-prefix string inside a button causes an error Clément Pit-Claudel
2020-04-26 13:43 ` Eli Zaretskii
2020-04-26 15:59 ` Clément Pit-Claudel
2020-04-26 16:44 ` Clément Pit-Claudel
2020-04-26 18:27 ` Clément Pit-Claudel [this message]
2020-05-09 7:43 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5820e370-0933-be24-daae-0fb52f2d7ee8@gmail.com \
--to=cpitclaudel@gmail.com \
--cc=40859@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).