>From 6356c46bf6d5c90057b1a756f05c69791c9ff3db Mon Sep 17 00:00:00 2001 From: Marcin Borkowski Date: Wed, 27 Apr 2016 08:59:15 +0200 Subject: [PATCH] Add the function `fill-polish-nobreak-p' * lisp/textmodes/fill.el (fill-polish-nobreak-p): Prevent line-breaking after a single-letter word even if this word is not preceded by a space. (Bug #20871) --- lisp/textmodes/fill.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 173d1c9..0a95290 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -329,6 +329,18 @@ fill-french-nobreak-p (and (memq (preceding-char) '(?\t ?\s)) (eq (char-syntax (following-char)) ?w))))))) +(defun fill-polish-nobreak-p () + "Return nil if Polish style allows breaking the line at point. +This function may be used in the `fill-nobreak-predicate' hook. +It is almost the same as `fill-single-char-nobreak-p', with the +exception that it does not require the one-letter word to be +preceded by a space. This blocks line-breaking in cases like +\"(a jednak)\"." + (save-excursion + (skip-chars-backward " \t") + (backward-char 2) + (looking-at "[^[:alpha:]][[:alpha:]]"))) + (defun fill-single-char-nobreak-p () "Return non-nil if a one-letter word is before point. This function is suitable for adding to the hook `fill-nobreak-predicate', -- 2.4.3