aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorPo Lu2023-03-08 20:07:12 +0800
committerPo Lu2023-03-08 20:07:12 +0800
commitc15f9aee2e6882e6b24bdb87e82f70274c6592ea (patch)
tree99c656a69bcba2a0eebd24e3558a43fab3d81da4 /lisp/textmodes
parentf9e68ed00e469d841c58681cd9d06e3d985614ad (diff)
parent5ff018524c740c77215ddb5d5983dbfcadb05599 (diff)
downloademacs-c15f9aee2e6882e6b24bdb87e82f70274c6592ea.tar.gz
emacs-c15f9aee2e6882e6b24bdb87e82f70274c6592ea.zip
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/paragraphs.el12
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."
476 (skip-chars-backward " \t\n") 476 (skip-chars-backward " \t\n")
477 (goto-char par-end))) 477 (goto-char par-end)))
478 (setq arg (1- arg))) 478 (setq arg (1- arg)))
479 (let ((npoint (constrain-to-field nil opoint t))) 479 (constrain-to-field nil opoint t)))
480 (not (= npoint opoint)))))
481 480
482(defvar forward-sentence-function #'forward-sentence-default-function 481(defvar forward-sentence-function #'forward-sentence-default-function
483 "Function to be used to calculate sentence movements. 482 "Function to be used to calculate sentence movements.
@@ -499,8 +498,13 @@ sentence. Delegates its work to `forward-sentence-function'."
499 (save-restriction 498 (save-restriction
500 (narrow-to-region start end) 499 (narrow-to-region start end)
501 (goto-char (point-min)) 500 (goto-char (point-min))
502 (while (ignore-errors (forward-sentence)) 501 (let* ((prev (point))
503 (setq sentences (1+ sentences))) 502 (next (forward-sentence)))
503 (while (and (not (null next))
504 (not (= prev next)))
505 (setq prev next
506 next (ignore-errors (forward-sentence))
507 sentences (1+ sentences))))
504 ;; Remove last possibly empty sentence 508 ;; Remove last possibly empty sentence
505 (when (/= (skip-chars-backward " \t\n") 0) 509 (when (/= (skip-chars-backward " \t\n") 0)
506 (setq sentences (1- sentences))) 510 (setq sentences (1- sentences)))