* bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs
@ 2023-09-25 15:10 Madhu
2023-09-26 0:50 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 0:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 5+ messages in thread
From: Madhu @ 2023-09-25 15:10 UTC (permalink / raw)
To: 66192
[-- Attachment #1: Type: Text/Plain, Size: 751 bytes --]
* commit a496509cedb17109d0e6297a74e2ff8ed526333c
|Commit: Po Lu <luangruo@yahoo.com>
|CommitDate: Thu Jan 19 22:19:06 2023 +0800
Introduced a change to lisp/button.el:(push-button) which causes the
following recipe to fail. Consider a buffer with the following
contents:
```
;;text-button
(defvar-keymap my-button-map :parent button-map "<return>" 'push-button)
(setq $but (make-text-button 1 10
'action #'(lambda(b) (message "push-button %S" b))
'keymap my-button-map))
```
evaluating the buffer sets up a text button in the first line. In a gui
emacs Hitting RET on the button fails with an error:
"push-button: Wrong type argument: listp, return".
The following patch fixes it for me but maybe there is some other issue?
[-- Attachment #2: 0001-lisp-button.el-push-button-handle-kbd-return.patch --]
[-- Type: Text/X-Patch, Size: 873 bytes --]
From e69be9cf0af72c5fcda8cda05b50a556741009b2 Mon Sep 17 00:00:00 2001
From: Madhu <enometh@net.meer>
Date: Mon, 25 Sep 2023 20:20:05 +0530
Subject: [PATCH] lisp/button.el: (push-button): handle kbd <return>
---
lisp/button.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/button.el b/lisp/button.el
index b01595943fc..0e98ec722d9 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -492,7 +492,7 @@ push-button
(if str-button
;; mode-line, header-line, or display string event.
(button-activate str t)
- (if (eq (car pos) 'touchscreen-down)
+ (if (and (listp pos) (eq (car pos) 'touchscreen-down))
;; If touch-screen-track tap returns nil, then the
;; tap was cancelled.
(when (touch-screen-track-tap pos)
--
2.39.2.101.g768bb238c4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs
2023-09-25 15:10 bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs Madhu
@ 2023-09-26 0:50 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 0:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 5+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-26 0:50 UTC (permalink / raw)
To: Madhu; +Cc: 66192
Madhu <enometh@meer.net> writes:
> * commit a496509cedb17109d0e6297a74e2ff8ed526333c
> |Commit: Po Lu <luangruo@yahoo.com>
> |CommitDate: Thu Jan 19 22:19:06 2023 +0800
>
> Introduced a change to lisp/button.el:(push-button) which causes the
> following recipe to fail. Consider a buffer with the following
> contents:
>
> ```
> ;;text-button
>
> (defvar-keymap my-button-map :parent button-map "<return>" 'push-button)
> (setq $but (make-text-button 1 10
> 'action #'(lambda(b) (message "push-button %S" b))
> 'keymap my-button-map))
> ```
>
> evaluating the buffer sets up a text button in the first line. In a gui
> emacs Hitting RET on the button fails with an error:
> "push-button: Wrong type argument: listp, return".
>
> The following patch fixes it for me but maybe there is some other issue?
>
>>From e69be9cf0af72c5fcda8cda05b50a556741009b2 Mon Sep 17 00:00:00 2001
> From: Madhu <enometh@net.meer>
> Date: Mon, 25 Sep 2023 20:20:05 +0530
> Subject: [PATCH] lisp/button.el: (push-button): handle kbd <return>
>
> ---
> lisp/button.el | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/button.el b/lisp/button.el
> index b01595943fc..0e98ec722d9 100644
> --- a/lisp/button.el
> +++ b/lisp/button.el
> @@ -492,7 +492,7 @@ push-button
> (if str-button
> ;; mode-line, header-line, or display string event.
> (button-activate str t)
> - (if (eq (car pos) 'touchscreen-down)
> + (if (and (listp pos) (eq (car pos) 'touchscreen-down))
> ;; If touch-screen-track tap returns nil, then the
> ;; tap was cancelled.
> (when (touch-screen-track-tap pos)
Thanks, but I elected to fix this differently. Please test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs
2023-09-25 15:10 bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs Madhu
2023-09-26 0:50 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-26 0:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 1:35 ` Madhu
1 sibling, 1 reply; 5+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-26 0:52 UTC (permalink / raw)
To: Madhu; +Cc: 66192
Please disregard my previous response. Your Emacs appears to be out of
date, given that this was fixed in August.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-26 11:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 15:10 bug#66192: 30.0.50; lisp/buttons.el (push-button) fails to handle the <return> action on gui emacs Madhu
2023-09-26 0:50 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 0:52 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-26 1:35 ` Madhu
2023-09-26 11:38 ` Stefan Kangas
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).