From 42457d75fc8fefffb203344cec5fe5e9051d4992 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 7 Apr 1995 23:44:45 +0000 Subject: [PATCH] (fill-region): Avoid error on reaching end of buffer. --- lisp/textmodes/fill.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 7571ab5cf4c..656c99f725b 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -402,7 +402,7 @@ space does not end a sentence, so don't break a line there." (not (= ?\n (char-after end))) (not (= end (point-max)))) (goto-char (1+ end))) - (setq end (min (point-max) (1+ end))) + (setq end (if end (min (point-max) (1+ end)) (point-max))) (goto-char initial)) (forward-paragraph 1) (setq end (point)) -- 2.39.5