GNU bug report logs -
#76679
31.0.50; forward-sentence not working in the narrowed buffer under c-ts-mode
Previous Next
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
Message #29 received at 76679 <at> debbugs.gnu.org (full text, mbox):
>> However, this report raises a different question: whether forward-sentence
>> should navigate to the end of the narrowed region when the semicolon is hidden?
>
> Nothing else would make sense. Almost all Emacs commands behave like
> there's nothing beyond the end of the narrowed region. The few
> exceptions are only in very specialized cases, which this one isn't,
> because it's just a movement command.
Ok, this patch provides the same behavior as for forward-sentence:
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 319dc5a41fc..f94c97c2e7c 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3417,9 +3417,10 @@ treesit-forward-sentence
by `text' and `sentence' in `treesit-thing-settings'."
(if (treesit-node-match-p (treesit-node-at (point)) 'text t)
(funcall #'forward-sentence-default-function arg)
- (funcall
- (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
- 'sentence (abs arg))))
+ (or (funcall
+ (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
+ 'sentence (abs arg))
+ (goto-char (if (> arg 0) (point-max) (point-min))))))
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.