all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
@ 2024-03-22 14:45 Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-22 15:36 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-22 14:45 UTC (permalink / raw)
  To: 69943

[-- Attachment #1: Type: text/plain, Size: 1798 bytes --]

0. emacs -Q

1. Evaluate the following sexp:

(let ((buf (get-buffer-create "*Widget Test*")))
  (switch-to-buffer buf)
  (dolist (el '("First" "Second" "Third"))
    (widget-create 'push-button el))
  (use-local-map widget-keymap)
  (widget-setup)
  (goto-char (point-min)))

Now the current buffer is *Widget Test* containing three push-button
widgets labeled "First", "Second", and "Third", and point is at the
start of the first widget, at BOB.

2. Hit the TAB key (bound to widget-forward) three times: this moves
point successively from "First" to "Second" to "Third" and then back to
"First" -- but on returning to the initial position after the third TAB,
a beginning-of-buffer error is also signaled.

3. Likewise, hitting S-TAB (bound to widget-backward) three times moves
backwards across the widgets, from "Third" to "Second" to "First", again
signaling a beginning-of-buffer error after the last S-TAB.

These beginning-of-buffer errors are due to widget-move (the workhorse
behind widget-forward and widget-backward) calling backward-char in a
loop without checking for BOB.  The attached patch fixes this.  The
patch also includes additions to widget-test-widget-move (from which
most of the above sexp was taken) that test moving to a widget at BOB.
(If the patch is acceptable, whoever commits it should use the correct
bug# before pushing it, or I can do that myself.)


2024-03-22  Stephen Berman  <stephen.berman@gmx.net>

Prevent error on tabbing to widget at beginning of buffer (bug#xxxxx)

* lisp/wid-edit.el (widget-move): Don't move backward when at
beginning of buffer, and keep point on widget's left side.

* test/lisp/wid-edit-tests.el (widget-test-widget-move): Adds
checks that moving to a widget at beginning of buffer does not
signal a beginning-of-buffer error.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: widget-move.diff --]
[-- Type: text/x-patch, Size: 1445 bytes --]

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 172da3db1e0..948a9ed06a5 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1276,9 +1276,9 @@ widget-move
 	  (unless (eq new old)
 	    (setq arg (1+ arg))))))
     (let ((new (widget-tabable-at)))
-      (while (eq (widget-tabable-at) new)
+      (while (and (eq (widget-tabable-at) new) (not (bobp)))
 	(backward-char)))
-    (forward-char))
+    (unless (bobp) (forward-char)))
   (unless suppress-echo
     (widget-echo-help (point)))
   (run-hooks 'widget-move-hook))
diff --git a/test/lisp/wid-edit-tests.el b/test/lisp/wid-edit-tests.el
index 4b049478b29..3aef683f15e 100644
--- a/test/lisp/wid-edit-tests.el
+++ b/test/lisp/wid-edit-tests.el
@@ -336,7 +336,13 @@ widget-test-widget-move
     (widget-forward 2)
     (forward-char)
     (widget-backward 1)
-    (should (string= "Second" (widget-value (widget-at))))))
+    (should (string= "Second" (widget-value (widget-at))))
+    ;; Check that moving to a widget at beginning of buffer does not
+    ;; signal a beginning-of-buffer error (bug#xxxxx).
+    (widget-backward 1)   ; Should not signal beginning-of-buffer error.
+    (widget-forward 2)
+    (should (string= "Third" (widget-value (widget-at))))
+    (widget-forward 1)))  ; Should not signal beginning-of-buffer error.

 (ert-deftest widget-test-color-match ()
   "Test that the :match function for the color widget works."

[-- Attachment #3: Type: text/plain, Size: 746 bytes --]



In GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.18.0) of 2024-03-22 built on strobelfs2
Repository revision: c1530a2e4973005633ebe00d447f1f3aa1200301
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101009
System Description: Linux From Scratch r12.0-112

Configured using:
 'configure -C --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-03-22 14:45 bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-22 15:36 ` Eli Zaretskii
  2024-04-01 15:20   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-03-22 15:36 UTC (permalink / raw)
  To: Stephen Berman, Mauro Aranda; +Cc: 69943

> Date: Fri, 22 Mar 2024 15:45:16 +0100
> From:  Stephen Berman via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> 0. emacs -Q
> 
> 1. Evaluate the following sexp:
> 
> (let ((buf (get-buffer-create "*Widget Test*")))
>   (switch-to-buffer buf)
>   (dolist (el '("First" "Second" "Third"))
>     (widget-create 'push-button el))
>   (use-local-map widget-keymap)
>   (widget-setup)
>   (goto-char (point-min)))
> 
> Now the current buffer is *Widget Test* containing three push-button
> widgets labeled "First", "Second", and "Third", and point is at the
> start of the first widget, at BOB.
> 
> 2. Hit the TAB key (bound to widget-forward) three times: this moves
> point successively from "First" to "Second" to "Third" and then back to
> "First" -- but on returning to the initial position after the third TAB,
> a beginning-of-buffer error is also signaled.
> 
> 3. Likewise, hitting S-TAB (bound to widget-backward) three times moves
> backwards across the widgets, from "Third" to "Second" to "First", again
> signaling a beginning-of-buffer error after the last S-TAB.
> 
> These beginning-of-buffer errors are due to widget-move (the workhorse
> behind widget-forward and widget-backward) calling backward-char in a
> loop without checking for BOB.  The attached patch fixes this.  The
> patch also includes additions to widget-test-widget-move (from which
> most of the above sexp was taken) that test moving to a widget at BOB.
> (If the patch is acceptable, whoever commits it should use the correct
> bug# before pushing it, or I can do that myself.)

Mauro, any comments to the proposed patch?

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-03-22 15:36 ` Eli Zaretskii
@ 2024-04-01 15:20   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-01 15:37     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-01 15:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69943, Mauro Aranda

On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> Date: Fri, 22 Mar 2024 15:45:16 +0100
>> From:  Stephen Berman via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> 0. emacs -Q
>>
>> 1. Evaluate the following sexp:
>>
>> (let ((buf (get-buffer-create "*Widget Test*")))
>>   (switch-to-buffer buf)
>>   (dolist (el '("First" "Second" "Third"))
>>     (widget-create 'push-button el))
>>   (use-local-map widget-keymap)
>>   (widget-setup)
>>   (goto-char (point-min)))
>>
>> Now the current buffer is *Widget Test* containing three push-button
>> widgets labeled "First", "Second", and "Third", and point is at the
>> start of the first widget, at BOB.
>>
>> 2. Hit the TAB key (bound to widget-forward) three times: this moves
>> point successively from "First" to "Second" to "Third" and then back to
>> "First" -- but on returning to the initial position after the third TAB,
>> a beginning-of-buffer error is also signaled.
>>
>> 3. Likewise, hitting S-TAB (bound to widget-backward) three times moves
>> backwards across the widgets, from "Third" to "Second" to "First", again
>> signaling a beginning-of-buffer error after the last S-TAB.
>>
>> These beginning-of-buffer errors are due to widget-move (the workhorse
>> behind widget-forward and widget-backward) calling backward-char in a
>> loop without checking for BOB.  The attached patch fixes this.  The
>> patch also includes additions to widget-test-widget-move (from which
>> most of the above sexp was taken) that test moving to a widget at BOB.
>> (If the patch is acceptable, whoever commits it should use the correct
>> bug# before pushing it, or I can do that myself.)
>
> Mauro, any comments to the proposed patch?

No comments yet, or did I miss them?  If not, any objections to
installing the patch?

Steve Berman





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-01 15:20   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-01 15:37     ` Eli Zaretskii
  2024-04-01 15:41       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-04-01 15:37 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 69943, maurooaranda

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
> Date: Mon, 01 Apr 2024 17:20:04 +0200
> 
> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > Mauro, any comments to the proposed patch?
> 
> No comments yet, or did I miss them?

You didn't.

> If not, any objections to installing the patch?

Let's give Mauro a few more days to chime in.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-01 15:37     ` Eli Zaretskii
@ 2024-04-01 15:41       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-04-06  8:57         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-01 15:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69943, maurooaranda

On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
>> Date: Mon, 01 Apr 2024 17:20:04 +0200
>>
>> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>>
>> > Mauro, any comments to the proposed patch?
>>
>> No comments yet, or did I miss them?
>
> You didn't.
>
>> If not, any objections to installing the patch?
>
> Let's give Mauro a few more days to chime in.

Sure.

Steve Berman





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-01 15:41       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-04-06  8:57         ` Eli Zaretskii
  2024-04-18  8:59           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-04-06  8:57 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 69943, maurooaranda

Ping! Mauro, can you please chime in?

> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: maurooaranda@gmail.com,  69943@debbugs.gnu.org
> Date: Mon, 01 Apr 2024 17:41:36 +0200
> 
> On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
> 
> >> From: Stephen Berman <stephen.berman@gmx.net>
> >> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
> >> Date: Mon, 01 Apr 2024 17:20:04 +0200
> >>
> >> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> >>
> >> > Mauro, any comments to the proposed patch?
> >>
> >> No comments yet, or did I miss them?
> >
> > You didn't.
> >
> >> If not, any objections to installing the patch?
> >
> > Let's give Mauro a few more days to chime in.
> 
> Sure.
> 
> Steve Berman
> 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-06  8:57         ` Eli Zaretskii
@ 2024-04-18  8:59           ` Eli Zaretskii
  2024-04-18 10:09             ` Mauro Aranda
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-04-18  8:59 UTC (permalink / raw)
  To: maurooaranda; +Cc: 69943, stephen.berman

Ping! Ping!

> Cc: 69943@debbugs.gnu.org, maurooaranda@gmail.com
> Date: Sat, 06 Apr 2024 11:57:31 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Ping! Mauro, can you please chime in?
> 
> > From: Stephen Berman <stephen.berman@gmx.net>
> > Cc: maurooaranda@gmail.com,  69943@debbugs.gnu.org
> > Date: Mon, 01 Apr 2024 17:41:36 +0200
> > 
> > On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> > >> From: Stephen Berman <stephen.berman@gmx.net>
> > >> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
> > >> Date: Mon, 01 Apr 2024 17:20:04 +0200
> > >>
> > >> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > >>
> > >> > Mauro, any comments to the proposed patch?
> > >>
> > >> No comments yet, or did I miss them?
> > >
> > > You didn't.
> > >
> > >> If not, any objections to installing the patch?
> > >
> > > Let's give Mauro a few more days to chime in.
> > 
> > Sure.
> > 
> > Steve Berman
> > 
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-18  8:59           ` Eli Zaretskii
@ 2024-04-18 10:09             ` Mauro Aranda
  2024-04-18 11:35               ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Mauro Aranda @ 2024-04-18 10:09 UTC (permalink / raw)
  To: Eli Zaretskii, stephen.berman; +Cc: 69943

Eli Zaretskii <eliz@gnu.org> writes:

 > Ping! Ping!
 >
 >> Cc: 69943@debbugs.gnu.org, maurooaranda@gmail.com
 >> Date: Sat, 06 Apr 2024 11:57:31 +0300
 >> From: Eli Zaretskii <eliz@gnu.org>
 >>
 >> Ping! Mauro, can you please chime in?
 >>
 >> > From: Stephen Berman <stephen.berman@gmx.net>
 >> > Cc: maurooaranda@gmail.com,  69943@debbugs.gnu.org
 >> > Date: Mon, 01 Apr 2024 17:41:36 +0200
 >> >
 >> > On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
 >> >
 >> > >> From: Stephen Berman <stephen.berman@gmx.net>
 >> > >> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
 >> > >> Date: Mon, 01 Apr 2024 17:20:04 +0200
 >> > >>
 >> > >> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> 
wrote:
 >> > >>
 >> > >> > Mauro, any comments to the proposed patch?
 >> > >>

Looks good to me.  Sorry for the delay.






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-18 10:09             ` Mauro Aranda
@ 2024-04-18 11:35               ` Eli Zaretskii
  2024-04-18 13:37                 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-04-18 11:35 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 69943, stephen.berman

> Date: Thu, 18 Apr 2024 07:09:56 -0300
> Cc: 69943@debbugs.gnu.org
> From: Mauro Aranda <maurooaranda@gmail.com>
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
>  > Ping! Ping!
>  >
>  >> Cc: 69943@debbugs.gnu.org, maurooaranda@gmail.com
>  >> Date: Sat, 06 Apr 2024 11:57:31 +0300
>  >> From: Eli Zaretskii <eliz@gnu.org>
>  >>
>  >> Ping! Mauro, can you please chime in?
>  >>
>  >> > From: Stephen Berman <stephen.berman@gmx.net>
>  >> > Cc: maurooaranda@gmail.com,  69943@debbugs.gnu.org
>  >> > Date: Mon, 01 Apr 2024 17:41:36 +0200
>  >> >
>  >> > On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
>  >> >
>  >> > >> From: Stephen Berman <stephen.berman@gmx.net>
>  >> > >> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
>  >> > >> Date: Mon, 01 Apr 2024 17:20:04 +0200
>  >> > >>
>  >> > >> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> 
> wrote:
>  >> > >>
>  >> > >> > Mauro, any comments to the proposed patch?
>  >> > >>
> 
> Looks good to me.  Sorry for the delay.

Thanks.  Stephen, feel free to install and close the bug.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error
  2024-04-18 11:35               ` Eli Zaretskii
@ 2024-04-18 13:37                 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-04-18 13:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69943-done, Mauro Aranda

On Thu, 18 Apr 2024 14:35:50 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> Date: Thu, 18 Apr 2024 07:09:56 -0300
>> Cc: 69943@debbugs.gnu.org
>> From: Mauro Aranda <maurooaranda@gmail.com>
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>>  > Ping! Ping!
>>  >
>>  >> Cc: 69943@debbugs.gnu.org, maurooaranda@gmail.com
>>  >> Date: Sat, 06 Apr 2024 11:57:31 +0300
>>  >> From: Eli Zaretskii <eliz@gnu.org>
>>  >>
>>  >> Ping! Mauro, can you please chime in?
>>  >>
>>  >> > From: Stephen Berman <stephen.berman@gmx.net>
>>  >> > Cc: maurooaranda@gmail.com,  69943@debbugs.gnu.org
>>  >> > Date: Mon, 01 Apr 2024 17:41:36 +0200
>>  >> >
>>  >> > On Mon, 01 Apr 2024 18:37:35 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
>>  >> >
>>  >> > >> From: Stephen Berman <stephen.berman@gmx.net>
>>  >> > >> Cc: Mauro Aranda <maurooaranda@gmail.com>,  69943@debbugs.gnu.org
>>  >> > >> Date: Mon, 01 Apr 2024 17:20:04 +0200
>>  >> > >>
>>  >> > >> On Fri, 22 Mar 2024 17:36:31 +0200 Eli Zaretskii <eliz@gnu.org> 
>> wrote:
>>  >> > >>
>>  >> > >> > Mauro, any comments to the proposed patch?
>>  >> > >>
>> 
>> Looks good to me.  Sorry for the delay.
>
> Thanks.  Stephen, feel free to install and close the bug.

Done as commit 94dec953179 to master and bug closed.  Thanks.

Steve Berman





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-04-18 13:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-22 14:45 bug#69943: 30.0.50; Tabbing through widgets can signal beginning-of-buffer error Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-22 15:36 ` Eli Zaretskii
2024-04-01 15:20   ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-01 15:37     ` Eli Zaretskii
2024-04-01 15:41       ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-06  8:57         ` Eli Zaretskii
2024-04-18  8:59           ` Eli Zaretskii
2024-04-18 10:09             ` Mauro Aranda
2024-04-18 11:35               ` Eli Zaretskii
2024-04-18 13:37                 ` Stephen Berman via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.