aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorMichal Nazarewicz2013-11-03 23:29:59 -0500
committerStefan Monnier2013-11-03 23:29:59 -0500
commit0a749fa0e64fc88bcd1772253774d7e44ecfe8ce (patch)
tree214a0cfeb1f5759ffcedd2940ec7852d86920412 /lisp/textmodes
parentec79b92bfa0b040917a8f3250fe2f819cd8d92db (diff)
downloademacs-0a749fa0e64fc88bcd1772253774d7e44ecfe8ce.tar.gz
emacs-0a749fa0e64fc88bcd1772253774d7e44ecfe8ce.zip
* 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')
-rw-r--r--lisp/textmodes/fill.el13
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."
329 (and (memq (preceding-char) '(?\t ?\s)) 329 (and (memq (preceding-char) '(?\t ?\s))
330 (eq (char-syntax (following-char)) ?w))))))) 330 (eq (char-syntax (following-char)) ?w)))))))
331 331
332(defun fill-single-char-nobreak-p ()
333 "Return t if point is placed just after a 1-letter word.
334This is used in `fill-nobreak-predicate' to prevent breaking line just
335after a 1-letter word (usually conjunction or preposition) which is
336considered composition error in Polish and Czech typography."
337 (save-excursion
338 (skip-chars-backward " \t")
339 (backward-char 2)
340 (looking-at "[[:space:]][[:alpha:]]")))
341
332(defcustom fill-nobreak-predicate nil 342(defcustom fill-nobreak-predicate nil
333 "List of predicates for recognizing places not to break a line. 343 "List of predicates for recognizing places not to break a line.
334The predicates are called with no arguments, with point at the place to 344The predicates are called with no arguments, with point at the place to
335be tested. If it returns t, fill commands do not break the line there." 345be tested. If it returns t, fill commands do not break the line there."
336 :group 'fill 346 :group 'fill
337 :type 'hook 347 :type 'hook
338 :options '(fill-french-nobreak-p fill-single-word-nobreak-p)) 348 :options '(fill-french-nobreak-p fill-single-word-nobreak-p
349 fill-single-char-nobreak-p))
339 350
340(defcustom fill-nobreak-invisible nil 351(defcustom fill-nobreak-invisible nil
341 "Non-nil means that fill commands do not break lines in invisible text." 352 "Non-nil means that fill commands do not break lines in invisible text."