From 4a3608f5045e534b19020fc4767b7635ebc8d3e4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 6 Sep 2006 16:35:18 +0000 Subject: [PATCH] (fill-single-word-nobreak-p): Allow breaking before last word, if it's not the end of the paragraph. --- lisp/ChangeLog | 3 +++ lisp/textmodes/fill.el | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 55fa2cf011b..1c75e6ec602 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-09-06 Stefan Monnier + * textmodes/fill.el (fill-single-word-nobreak-p): Allow breaking before + last word, if it's not the end of the paragraph. + * files.el (abbreviate-file-name): Don't mistakenly match newlines in file name. diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 95f73b56952..af97ca83e6e 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -292,7 +292,9 @@ act as a paragraph-separator." (defun fill-single-word-nobreak-p () "Don't break a line after the first or before the last word of a sentence." - (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)")) + ;; Actually, allow breaking before the last word of a sentence, so long as + ;; it's not the last word of the paragraph. + (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)[ \t]*$")) (save-excursion (skip-chars-backward " \t") (and (/= (skip-syntax-backward "w") 0) -- 2.39.2