diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2023-03-08 06:30:18 +0100 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2023-03-08 06:30:18 +0100 |
commit | 5ff018524c740c77215ddb5d5983dbfcadb05599 (patch) | |
tree | ec8fe5ef866c1523c3cfd9145c6d4bfd1af9544f /lisp/textmodes/paragraphs.el | |
parent | 4e8b50ec57bc0d70bdb1279756eec679eb4eab0d (diff) | |
parent | f9b7913656f9e4728a1140b61ddb7f07009e28e6 (diff) | |
download | emacs-5ff018524c740c77215ddb5d5983dbfcadb05599.tar.gz |
Merge from origin/emacs-29
f9b7913656f Fix empty line indentation in c-ts-mode (bug#61997)
90504f9d898 Fix tree-sitter indent preset prev-line (bug#61998)
ed3bab3cc72 Revert 'forward-sentence-default-function' to return poin...
bfe62b10413 ; * etc/NEWS: Fix typos.
3c1693d08b0 Fix Elisp code injection vulnerability in emacsclient-mai...
ab417c8a6ee Fix problem with debuginfod queries in "M-x gdb"
# Conflicts:
# etc/NEWS
Diffstat (limited to 'lisp/textmodes/paragraphs.el')
-rw-r--r-- | lisp/textmodes/paragraphs.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index bf249fdcdfb..6c33380b6bd 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -476,8 +476,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))) (defvar forward-sentence-function #'forward-sentence-default-function "Function to be used to calculate sentence movements. @@ -499,8 +498,13 @@ sentence. Delegates its work to `forward-sentence-function'." (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))) |