emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114933: * lisp/textmodes/fill.el (fill-single-char-


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114933: * lisp/textmodes/fill.el (fill-single-char-nobreak-p): New function
Date: Mon, 04 Nov 2013 04:30:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114933
revision-id: address@hidden
parent: address@hidden
author: Michal Nazarewicz <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sun 2013-11-03 23:29:59 -0500
message:
  * lisp/textmodes/fill.el (fill-single-char-nobreak-p): New function
  checking whether point is after a 1-letter word.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/textmodes/fill.el         fill.el-20091113204419-o5vbwnq5f7feedwu-127
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-11-04 01:36:14 +0000
+++ b/etc/NEWS  2013-11-04 04:29:59 +0000
@@ -180,6 +180,12 @@
 ** The default value of `comment-use-global-state' is changed to t,
 and this variable has been marked obsolete.
 
+** `fill-single-char-nobreak-p' prevents fill from breaking a line after
+a 1-letter word, which is an error according to Polish and
+Czech typography rules.  To globally enable this feature, evaluate:
+
+  (add-hook 'fill-nobreak-predicate 'fill-single-char-nobreak-p)
+
 
 * Editing Changes in Emacs 24.4
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-04 03:44:23 +0000
+++ b/lisp/ChangeLog    2013-11-04 04:29:59 +0000
@@ -1,4 +1,9 @@
-2013-11-03  Nathan Trapuzzano  <address@hidden>  (tiny change)
+2013-11-04  Michal Nazarewicz  <address@hidden>
+
+       * textmodes/fill.el (fill-single-char-nobreak-p): New function
+       checking whether point is after a 1-letter word.
+
+2013-11-04  Nathan Trapuzzano  <address@hidden>  (tiny change)
 
        * progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function):
        Don't infloop when expanding region over `multiline' syntax-type that

=== modified file 'lisp/textmodes/fill.el'
--- a/lisp/textmodes/fill.el    2013-08-23 15:31:45 +0000
+++ b/lisp/textmodes/fill.el    2013-11-04 04:29:59 +0000
@@ -329,13 +329,24 @@
              (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."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]