[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 ed3bab3cc72: Revert 'forward-sentence-default-function' to retu
From: |
Eli Zaretskii |
Subject: |
emacs-29 ed3bab3cc72: Revert 'forward-sentence-default-function' to return point (bug#62027) |
Date: |
Tue, 7 Mar 2023 14:32:04 -0500 (EST) |
branch: emacs-29
commit ed3bab3cc728f19f8691024a3b77e178cf1945e6
Author: Manuel Giraud <manuel@ledu-giraud.fr>
Commit: Eli Zaretskii <eliz@gnu.org>
Revert 'forward-sentence-default-function' to return point (bug#62027)
* lisp/textmodes/paragraphs.el
(forward-sentence-default-function): Revert to return the
position of point.
(count-sentences): Adapt to this change.
---
lisp/textmodes/paragraphs.el | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index 73abb155aaa..a9e28a3275b 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -477,8 +477,7 @@ sentences. Also, every paragraph boundary terminates
sentences as well."
(skip-chars-backward " \t\n")
(goto-char par-end)))
(setq arg (1- arg)))
- (let ((npoint (constrain-to-field nil opoint t)))
- (not (= npoint opoint)))))
+ (constrain-to-field nil opoint t)))
(defun count-sentences (start end)
"Count sentences in current buffer from START to END."
@@ -488,8 +487,13 @@ sentences. Also, every paragraph boundary terminates
sentences as well."
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
- (while (ignore-errors (forward-sentence))
- (setq sentences (1+ sentences)))
+ (let* ((prev (point))
+ (next (forward-sentence)))
+ (while (and (not (null next))
+ (not (= prev next)))
+ (setq prev next
+ next (ignore-errors (forward-sentence))
+ sentences (1+ sentences))))
;; Remove last possibly empty sentence
(when (/= (skip-chars-backward " \t\n") 0)
(setq sentences (1- sentences)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 ed3bab3cc72: Revert 'forward-sentence-default-function' to return point (bug#62027),
Eli Zaretskii <=