unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: 20871@debbugs.gnu.org
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	[thread overview]
Message-ID: <87shyku4jt.fsf@mbork.pl> (raw)
In-Reply-To: <87wpywhwa8.fsf@mbork.pl> (Marcin Borkowski's message of "Mon, 22 Jun 2015 12:28:31 +0200")

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-fill-single-char-nobreak-p.patch --]
[-- Type: text/x-patch, Size: 1005 bytes --]

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


  reply	other threads:[~2016-04-17  6:34 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 10:19 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
2015-06-22 10:28 ` Marcin Borkowski
2016-04-17  6:34   ` Marcin Borkowski [this message]
2016-04-17 14:57     ` Eli Zaretskii
2016-04-17 15:34       ` Marcin Borkowski
2016-04-17 16:49         ` Eli Zaretskii
2016-04-17 17:41           ` Marcin Borkowski
2016-04-27  7:02           ` Marcin Borkowski
2016-04-27  7:20             ` Eli Zaretskii
2016-04-29 12:18               ` Marcin Borkowski
2016-04-30 11:21                 ` Eli Zaretskii
2016-04-30 12:26                   ` Marcin Borkowski
2016-04-30 12:38                     ` Eli Zaretskii
2016-04-30 16:41                       ` Marcin Borkowski
2016-04-30 17:01                         ` Eli Zaretskii
2016-04-30 18:42                           ` Marcin Borkowski
2016-04-30 19:01                             ` Eli Zaretskii
2017-12-07 13:28                               ` Marcin Borkowski
2017-12-09 11:52                                 ` Eli Zaretskii
2017-12-09 15:45                                   ` Marcin Borkowski
2017-12-19 11:44                                     ` Marcin Borkowski
2017-12-19 16:15                                       ` Eli Zaretskii
2018-01-02  8:55                                         ` Marcin Borkowski
2018-01-13  8:46                                           ` Eli Zaretskii
2018-01-13 16:01                                             ` Marcin Borkowski
2018-01-13 16:53                                               ` Eli Zaretskii
2018-01-13 17:02                                                 ` Eli Zaretskii
2018-01-15  5:13                                                   ` Marcin Borkowski
2018-01-15  5:13                                                 ` Marcin Borkowski
2018-01-15  5:30                                                   ` Marcin Borkowski
2018-01-15 13:07                                                     ` Eli Zaretskii
2018-01-24  9:34                                                       ` Marcin Borkowski
2018-01-24 19:16                                                         ` Eli Zaretskii
2016-04-30 17:42                         ` Drew Adams
2016-04-30 18:24                           ` Eli Zaretskii
2016-04-30 18:41                             ` Marcin Borkowski
2018-02-02  9:18       ` Michal Nazarewicz
     [not found] <9A9C6F59-CB27-42D1-911E-F027B443B9BE@acm.org>
     [not found] ` <8336i1p8zd.fsf@gnu.org>
     [not found]   ` <CA+pa1O3rcDznoR0u8i_AN5iHe9mM+FHqkAO=yVM2Gu5_Gc40jQ@mail.gmail.com>
2019-08-17  6:57     ` Eli Zaretskii
2019-08-17 14:17       ` Marcin Borkowski
2019-08-17 15:04         ` Eli Zaretskii
2019-08-17 15:58           ` Marcin Borkowski
2019-08-19 14:07       ` Michał Nazarewicz
2019-08-19 15:01         ` Eli Zaretskii
2019-08-19 15:36           ` Michał Nazarewicz
2019-08-19 16:16             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shyku4jt.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --cc=20871@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).