unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 70682@debbugs.gnu.org
Cc: Po Lu <luangruo@yahoo.com>
Subject: bug#70682: 30.0.50; wrong-type-argument error on widget-button--check-and-call-button
Date: Tue, 30 Apr 2024 21:18:05 +0200	[thread overview]
Message-ID: <b49f1dd4-e108-41fd-9c5d-cc0e7d0ff570@orange.fr> (raw)

Hello,

I sometimes encounter the below error when I click on a push-button widget.
Here is an example.

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p t)
   widget-button--check-and-call-button((down-mouse-1 (#<window 16 on test-widget-button-click> 3 (29 . 11) 20874080 nil 3 (2 . 0) nil (5 . 11) (12 . 26))) (push-button :tag "TEST" :action test-widget-button-press :button-overlay #<overlay from 1 to 7 in test-widget-button-click> :from #<marker (moves after insertion) at 1 in test-widget-button-click> :to #<marker at 7 in test-widget-button-click>))
   widget-button-click((down-mouse-1 (#<window 16 on test-widget-button-click> 3 (29 . 11) 20874080 nil 3 (2 . 0) nil (5 . 11) (12 . 26))))
   funcall-interactively(widget-button-click (down-mouse-1 (#<window 16 on test-widget-button-click> 3 (29 . 11) 20874080 nil 3 (2 . 0) nil (5 . 11) (12 . 26))))
   call-interactively(widget-button-click nil nil)
   command-execute(widget-button-click)

It seems the problem is due to this commit:

author	Po Lu <luangruo@yahoo.com>	2024-04-16 15:38:53 +0800
commit	f5e0fb11dbf4d2cc5d7ceabcec7600556fb12843 (patch)

Fix touch screen hscroll when initiated from widgets
* lisp/wid-edit.el (widget-button--check-and-call-button):
Return to the position of point during the tracking loop if a
touch event is canceled.


The issue is that on some cases the below catch statement (line 1109),
whose value now set the variable newpoint, returns t instead of a valid
buffer position:

     (setq newpoint
           (catch 'button-press-cancelled
     ...
       
The culprit is at line 1156:

                               (while (not (widget-button-release-event-p event))
                                 (setq event (read--potential-mouse-event))
                                 (when (and mouse-1 (mouse-movement-p event))
                                   (push event unread-command-events)
                                   (setq event oevent)
                                   (throw 'button-press-cancelled t)) <<<<<<<<<

The below simple patch fixed the issue for me:

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 2d82fbe7c89..3b467434d29 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1153,7 +1153,7 @@ widget-button--check-and-call-button
                                  (when (and mouse-1 (mouse-movement-p event))
                                    (push event unread-command-events)
                                    (setq event oevent)
-                                  (throw 'button-press-cancelled t))
+                                  (throw 'button-press-cancelled nil))
                                  (unless (or (integerp event)
                                              (memq (car event)
                                                    '(switch-frame select-window))


Thanks!

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
  3.24.41, cairo version 1.18.0) of 2024-04-30
Repository revision: b36fd07560fd12c5e819e808a6f0eb9579f77c25
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Fedora Linux 39 (KDE Plasma)

Configured using:
  'configure --prefix=/home/dponce --with-x-toolkit=gtk3 --with-cairo-xcb
  --with-native-compilation=no
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LC_TIME: fr_FR.utf8
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix





             reply	other threads:[~2024-04-30 19:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 19:18 David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-05-01  0:53 ` bug#70682: 30.0.50; wrong-type-argument error on widget-button--check-and-call-button Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-01  7:06   ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-01  7:15     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-01  8:09     ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=b49f1dd4-e108-41fd-9c5d-cc0e7d0ff570@orange.fr \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70682@debbugs.gnu.org \
    --cc=da_vid@orange.fr \
    --cc=luangruo@yahoo.com \
    /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).