diff options
| author | Michal Nazarewicz | 2013-11-03 23:29:59 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-11-03 23:29:59 -0500 |
| commit | 0a749fa0e64fc88bcd1772253774d7e44ecfe8ce (patch) | |
| tree | 214a0cfeb1f5759ffcedd2940ec7852d86920412 | |
| parent | ec79b92bfa0b040917a8f3250fe2f819cd8d92db (diff) | |
| download | emacs-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.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/textmodes/fill.el | 13 |
3 files changed, 24 insertions, 2 deletions
| @@ -180,6 +180,12 @@ some enhancements, like the ability to restore deleted frames. Command | |||
| 180 | ** The default value of `comment-use-global-state' is changed to t, | 180 | ** The default value of `comment-use-global-state' is changed to t, |
| 181 | and this variable has been marked obsolete. | 181 | and this variable has been marked obsolete. |
| 182 | 182 | ||
| 183 | ** `fill-single-char-nobreak-p' prevents fill from breaking a line after | ||
| 184 | a 1-letter word, which is an error according to Polish and | ||
| 185 | Czech typography rules. To globally enable this feature, evaluate: | ||
| 186 | |||
| 187 | (add-hook 'fill-nobreak-predicate 'fill-single-char-nobreak-p) | ||
| 188 | |||
| 183 | 189 | ||
| 184 | * Editing Changes in Emacs 24.4 | 190 | * Editing Changes in Emacs 24.4 |
| 185 | 191 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fb4f29befe1..9ff4ab8f04c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,4 +1,9 @@ | |||
| 1 | 2013-11-03 Nathan Trapuzzano <nbtrap@nbtrap.com> (tiny change) | 1 | 2013-11-04 Michal Nazarewicz <mina86@mina86.com> |
| 2 | |||
| 3 | * textmodes/fill.el (fill-single-char-nobreak-p): New function | ||
| 4 | checking whether point is after a 1-letter word. | ||
| 5 | |||
| 6 | 2013-11-04 Nathan Trapuzzano <nbtrap@nbtrap.com> (tiny change) | ||
| 2 | 7 | ||
| 3 | * progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function): | 8 | * progmodes/cperl-mode.el (cperl-font-lock-fontify-region-function): |
| 4 | Don't infloop when expanding region over `multiline' syntax-type that | 9 | Don't infloop when expanding region over `multiline' syntax-type that |
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. | ||
| 334 | This is used in `fill-nobreak-predicate' to prevent breaking line just | ||
| 335 | after a 1-letter word (usually conjunction or preposition) which is | ||
| 336 | considered 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. |
| 334 | The predicates are called with no arguments, with point at the place to | 344 | The predicates are called with no arguments, with point at the place to |
| 335 | be tested. If it returns t, fill commands do not break the line there." | 345 | be 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." |