[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a sing
From: |
Marcin Borkowski |
Subject: |
bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren |
Date: |
Sun, 17 Apr 2016 08:34:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
On 2015-06-22, at 12:28, Marcin Borkowski <mbork@mbork.pl> wrote:
> On 2015-06-22, at 12:19, Marcin Borkowski <mbork@mbork.pl> wrote:
>
>> Hello,
>>
>> today I found that fill-single-char-nobreak-p is just a bit too
>> simplistic. When point is after e.g. the string " (a", it returns nil
>> instead of t. I am not sure which characters should be added to the
>> regex, but at least the opening paren (and maybe bracket) should be
>> there, so I'd change the regex into [[:space:]][[(]*[[:alpha:]]. (Two
>> or more opening parens/brackets are unlikely, but when in doubt, I guess
>> it's better to return t than nil than the other way round.)
>>
>> Best regards,
>
> Just noticed that there is a hardcoded (backward-char 2), so it
> seems that adding a few characters to the regex is not enough. Maybe
> looking-back is the way to go (though it might slow filling down)?
> I don't know.
Hi there,
so here's a patch for the bug I reported some time ago. Please review
both the patch and the commit message (I'm still learning to write
them...).
Best,
--
Marcin
>From de6c196235ef8abfff52c9cfc3d97a6350e8a5a7 Mon Sep 17 00:00:00 2001
From: Marcin Borkowski <mbork@mbork.pl>
Date: Sun, 17 Apr 2016 08:30:49 +0200
Subject: [PATCH] Fix `fill-single-char-nobreak-p'
* lisp/textmodes/fill.el (fill-single-char-nobreak-p): make space after
opening paren and a single-letter word unbreakable (Bug#20871)
---
lisp/textmodes/fill.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 173d1c9..bade8fa 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -337,7 +337,10 @@ fill-single-char-nobreak-p
(save-excursion
(skip-chars-backward " \t")
(backward-char 2)
- (looking-at "[[:space:]][[:alpha:]]")))
+ (or (looking-at "[[:space:]][[:alpha:]]")
+ (progn
+ (backward-char 1)
+ (looking-at "[[:space:]]([[:alpha:]]")))))
(defcustom fill-nobreak-predicate nil
"List of predicates for recognizing places not to break a line.
--
2.4.3
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren,
Marcin Borkowski <=
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Eli Zaretskii, 2016/04/17
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Marcin Borkowski, 2016/04/17
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Eli Zaretskii, 2016/04/17
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Marcin Borkowski, 2016/04/17
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Marcin Borkowski, 2016/04/27
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Eli Zaretskii, 2016/04/27
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Marcin Borkowski, 2016/04/29
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Eli Zaretskii, 2016/04/30
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Marcin Borkowski, 2016/04/30
- bug#20871: 25.0.50; fill-single-char-nobreak-p does not recognize a single-letter word when it is preceded by an open paren, Eli Zaretskii, 2016/04/30