aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMarcin Borkowski2016-04-27 08:59:15 +0200
committerMarcin Borkowski2018-01-15 06:25:16 +0100
commita1f257d81c58eb3069928ed584b06c4bcb2c7111 (patch)
tree4dde4cbab4970421245c7dbabf9bce0970bf9d7f /lisp
parent5af5df1f7c20858dab762830e1a94994ceda425b (diff)
downloademacs-a1f257d81c58eb3069928ed584b06c4bcb2c7111.tar.gz
emacs-a1f257d81c58eb3069928ed584b06c4bcb2c7111.zip
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. Fixes bug #20871.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/fill.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index a46f0b2a4cd..6d37be870b2 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -339,6 +339,18 @@ places."
339 (and (memq (preceding-char) '(?\t ?\s)) 339 (and (memq (preceding-char) '(?\t ?\s))
340 (eq (char-syntax (following-char)) ?w))))))) 340 (eq (char-syntax (following-char)) ?w)))))))
341 341
342(defun fill-polish-nobreak-p ()
343 "Return nil if Polish style allows breaking the line at point.
344This function may be used in the `fill-nobreak-predicate' hook.
345It is almost the same as `fill-single-char-nobreak-p', with the
346exception that it does not require the one-letter word to be
347preceded by a space. This blocks line-breaking in cases like
348\"(a jednak)\"."
349 (save-excursion
350 (skip-chars-backward " \t")
351 (backward-char 2)
352 (looking-at "[^[:alpha:]]\\cl")))
353
342(defun fill-single-char-nobreak-p () 354(defun fill-single-char-nobreak-p ()
343 "Return non-nil if a one-letter word is before point. 355 "Return non-nil if a one-letter word is before point.
344This function is suitable for adding to the hook `fill-nobreak-predicate', 356This function is suitable for adding to the hook `fill-nobreak-predicate',