GNU bug report logs - #51171
27.2; `forward-word' w/arg bug in narrowed buffer

Previous Next

Package: emacs;

Reported by: Ian Nehera <delta29 <at> shaw.ca>

Date: Wed, 13 Oct 2021 00:21:02 UTC

Severity: normal

Found in version 27.2

Full log


Message #11 received at 51171 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51171 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Ian Nehera <delta29 <at> shaw.ca>
Subject: Re: bug#51171: 27.2; `forward-word' w/arg bug in narrowed buffer
Date: Mon, 12 Sep 2022 14:02:03 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> To reproduce from 'emacs -Q /path/to/dcl.c’ (file attached):
>>    1. M-x `subword-mode' (side question: should C-c C-w still use the
>>       obsolete alias `c-subword-mode'?).
>>    2. Navigate to the function 'int dirdcl(void)' and use
>>       `narrow-to-defun' (C-x n d).
>>    3. From the top of the buffer, use `forward-word' with an arg greater
>>       than 1 (like C-u 2 M-f).
>>    4. Repeat this with C-x z z z z... until you get an error around the
>>       start of the while loop (2nd to last message in list below).
>>    5. Moving point forward then trying the same command again will yield
>>        the last message with a number greater than `point-max' (5741).
>> 
>> Other notes:
>>       - The bug dissapears with a widened buffer or when narrowing to
>>         earlier functions.
>>       - `backward-word’ doesn’t seem to have the same problem.
>>       - I'm reporting this from OSX 10.14.6 (homebrew), but it also occurs on
>>         Arch Linux (emacs being installed from the standard pacman repos).
>
> Stefan, any suggestions wrt this?

The backtrace is:

Debugger entered--Lisp error: (error "Error in syntax_table logic for to-the-end interva...")
  forward-word(2)
  funcall-interactively(forward-word 2)
  call-interactively(forward-word nil nil)

Slightly easier recipe:

Open that file, `M-x subword-mode', and then navigate to

    while (gettoken() == PARENS || TokenType == BRACKETS) {

`C-x n d', put point after BRACKETS and then say `M-2 M-f'.  Then you
get that error message.

Just `M-f' works fine.

I tried to narrow this down to a simpler file, but I was unable to -- it
seems like the error depends on lots of state in that specific file.




This bug report was last modified 2 years and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.