From ea2c64784db6194140a1738bf4051a59f770ccbe Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 7 Aug 2001 09:57:32 +0000 Subject: [PATCH] (forward-sentence): Avoid building a regexp from sentence-end. From Kenichi Handa . --- lisp/ChangeLog | 3 +++ lisp/textmodes/paragraphs.el | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83215282a8e..0514c8b190b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2001-08-07 Gerd Moellmann + * textmodes/paragraphs.el (forward-sentence): Avoid building + a regexp from sentence-end. From Kenichi Handa . + * progmodes/executable.el (executable-set-magic): If executable-find returns a quoted file name, unquote it before inserting it. diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el index 172c2cdf35c..792b3b0cd09 100644 --- a/lisp/textmodes/paragraphs.el +++ b/lisp/textmodes/paragraphs.el @@ -369,10 +369,12 @@ sentences. Also, every paragraph boundary terminates sentences as well." (or arg (setq arg 1)) (let ((opoint (point))) (while (< arg 0) - (let ((par-beg (save-excursion (start-of-paragraph-text) (point)))) - (if (re-search-backward (concat "\\(" sentence-end "\\)[^ \t\n]") - par-beg t) - (goto-char (1- (match-end 0))) + (let ((pos (point)) + (par-beg (save-excursion (start-of-paragraph-text) (point)))) + (if (and (re-search-backward sentence-end par-beg t) + (or (< (match-end 0) pos) + (re-search-backward sentence-end par-beg t))) + (goto-char (match-end 0)) (goto-char par-beg))) (setq arg (1+ arg))) (while (> arg 0) -- 2.39.2