GNU bug report logs - #76679
31.0.50; forward-sentence not working in the narrowed buffer under c-ts-mode

Previous Next

Package: emacs;

Reported by: lorniu <lorniu <at> gmail.com>

Date: Sun, 2 Mar 2025 10:23:02 UTC

Severity: normal

Tags: moreinfo

Merged with 76497

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76679 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Yuan Fu <casouri <at> gmail.com>, lorniu <lorniu <at> gmail.com>
Subject: bug#76679: 31.0.50; forward-sentence not working in the narrowed buffer under c-ts-mode
Date: Tue, 11 Mar 2025 10:41:22 -0400
Juri Linkov <juri <at> linkov.net> writes:

>>> We agreed that a "sentence" in C-like languages is a thing that
>>> ends with a semicolon (or a comma that separates arguments).
>>>
>>> However, this report raises a different question: whether forward-sentence
>>> should navigate to the end of the narrowed region when the semicolon is hidden?
>>
>> Isn't that what forward-sentence does in e.g. text-mode?  So wouldn't
>> doing that in C-like languages be consistent with that?
>
> When you set the end of the narrowed region at the middle
> of the sentence either in text-mode or in C-like languages,
> then use forward-sentence to move the end of the narrowed region,
> then widen with 'C-x n w', point will be not at the end
> of the sentence.  This behavior makes no sense.
>
> Regardless of the fact that treesit-forward-sentence works
> differently from forward-sentence, their both results make no sense.
>
> There is no meaningful difference whether to keep point at its old
> position as treesit-forward-sentence does, or move point to the
> middle of the sentence as forward-sentence does.
>
> So I think there is no bug here.

Doesn't it make sense to be consistent with `fundamental-mode`?

Consider this case:

    (progn
      (get-buffer-create "mybuf99")
      (pop-to-buffer "mybuf99")
      (erase-buffer)
      (insert "sentence sentence sentence.")
      (goto-char (point-min))
      (narrow-to-region (point-min) 15)
      (forward-sentence)
      (widen))




This bug report was last modified 70 days ago.

Previous Next


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