From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs 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 Message-ID: <87shyku4jt.fsf@mbork.pl> References: <87y4jchwog.fsf@mbork.pl> <87wpywhwa8.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1460874924 7492 80.91.229.3 (17 Apr 2016 06:35:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Apr 2016 06:35:24 +0000 (UTC) To: 20871@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 17 08:35:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1argIa-0002EP-FH for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Apr 2016 08:35:12 +0200 Original-Received: from localhost ([::1]:40796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1argIZ-0007wC-2R for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Apr 2016 02:35:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1argIV-0007qj-5a for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 02:35:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1argIQ-0003Qt-5d for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 02:35:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1argIQ-0003Qf-2X for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 02:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1argIP-0002oE-PY for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 02:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Apr 2016 06:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20871 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20871-submit@debbugs.gnu.org id=B20871.146087488210765 (code B ref 20871); Sun, 17 Apr 2016 06:35:01 +0000 Original-Received: (at 20871) by debbugs.gnu.org; 17 Apr 2016 06:34:42 +0000 Original-Received: from localhost ([127.0.0.1]:37751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1argI5-0002nZ-N0 for submit@debbugs.gnu.org; Sun, 17 Apr 2016 02:34:41 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:37893) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1argI3-0002nQ-9u for 20871@debbugs.gnu.org; Sun, 17 Apr 2016 02:34:39 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 2D63FACFCF4 for <20871@debbugs.gnu.org>; Sun, 17 Apr 2016 08:34:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KrLDdgQx-piN for <20871@debbugs.gnu.org>; Sun, 17 Apr 2016 08:34:34 +0200 (CEST) Original-Received: from localhost (98-171.echostar.pl [213.156.98.171]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 01946ACFCF0 for <20871@debbugs.gnu.org>; Sun, 17 Apr 2016 08:34:33 +0200 (CEST) In-Reply-To: <87wpywhwa8.fsf@mbork.pl> (Marcin Borkowski's message of "Mon, 22 Jun 2015 12:28:31 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116556 Archived-At: --=-=-= Content-Type: text/plain On 2015-06-22, at 12:28, Marcin Borkowski wrote: > On 2015-06-22, at 12:19, Marcin Borkowski 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-fill-single-char-nobreak-p.patch >From de6c196235ef8abfff52c9cfc3d97a6350e8a5a7 Mon Sep 17 00:00:00 2001 From: Marcin Borkowski 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 --=-=-=--