diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2013-11-03 23:29:59 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-11-03 23:29:59 -0500 |
commit | 0a749fa0e64fc88bcd1772253774d7e44ecfe8ce (patch) | |
tree | 214a0cfeb1f5759ffcedd2940ec7852d86920412 /lisp/textmodes/fill.el | |
parent | ec79b92bfa0b040917a8f3250fe2f819cd8d92db (diff) | |
download | emacs-0a749fa0e64fc88bcd1772253774d7e44ecfe8ce.tar.gz |
* lisp/textmodes/fill.el (fill-single-char-nobreak-p): New function
checking whether point is after a 1-letter word.
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r-- | lisp/textmodes/fill.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 119b4b04593..73b9362da76 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -329,13 +329,24 @@ places." (and (memq (preceding-char) '(?\t ?\s)) (eq (char-syntax (following-char)) ?w))))))) +(defun fill-single-char-nobreak-p () + "Return t if point is placed just after a 1-letter word. +This is used in `fill-nobreak-predicate' to prevent breaking line just +after a 1-letter word (usually conjunction or preposition) which is +considered composition error in Polish and Czech typography." + (save-excursion + (skip-chars-backward " \t") + (backward-char 2) + (looking-at "[[:space:]][[:alpha:]]"))) + (defcustom fill-nobreak-predicate nil "List of predicates for recognizing places not to break a line. The predicates are called with no arguments, with point at the place to be tested. If it returns t, fill commands do not break the line there." :group 'fill :type 'hook - :options '(fill-french-nobreak-p fill-single-word-nobreak-p)) + :options '(fill-french-nobreak-p fill-single-word-nobreak-p + fill-single-char-nobreak-p)) (defcustom fill-nobreak-invisible nil "Non-nil means that fill commands do not break lines in invisible text." |