From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii 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 17:57:48 +0300 Message-ID: <8337qkb7v7.fsf@gnu.org> References: <87y4jchwog.fsf@mbork.pl> <87wpywhwa8.fsf@mbork.pl> <87shyku4jt.fsf@mbork.pl> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1460905164 6113 80.91.229.3 (17 Apr 2016 14:59:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Apr 2016 14:59:24 +0000 (UTC) Cc: 20871@debbugs.gnu.org To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 17 16:59: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 1aroAK-0006CQ-FQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Apr 2016 16:59:12 +0200 Original-Received: from localhost ([::1]:47369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aroAJ-0004QG-Tq for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Apr 2016 10:59:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aroAF-0004NT-Nw for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 10:59:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aroAA-0005sa-NS for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 10:59:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aroAA-0005sU-Jy for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 10:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aroAA-0008BI-CE for bug-gnu-emacs@gnu.org; Sun, 17 Apr 2016 10:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Apr 2016 14:59:02 +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.146090509631390 (code B ref 20871); Sun, 17 Apr 2016 14:59:02 +0000 Original-Received: (at 20871) by debbugs.gnu.org; 17 Apr 2016 14:58:16 +0000 Original-Received: from localhost ([127.0.0.1]:38567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aro9Q-0008AE-IO for submit@debbugs.gnu.org; Sun, 17 Apr 2016 10:58:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aro9P-00089z-Ay for 20871@debbugs.gnu.org; Sun, 17 Apr 2016 10:58:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aro9E-0005mY-Ns for 20871@debbugs.gnu.org; Sun, 17 Apr 2016 10:58:10 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aro9E-0005mU-KI; Sun, 17 Apr 2016 10:58:04 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4608 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aro9D-0006Pm-Vp; Sun, 17 Apr 2016 10:58:04 -0400 In-reply-to: <87shyku4jt.fsf@mbork.pl> (message from Marcin Borkowski on Sun, 17 Apr 2016 08:34:30 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:116563 Archived-At: > From: Marcin Borkowski > Date: Sun, 17 Apr 2016 08:34:30 +0200 > > >> 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. Could you please elaborate on the bug itself? See, the function in question, fill-single-char-nobreak-p, is documented as a possible value to use in the fill hook, for a very specific purpose. If you are saying that it doesn't fulfill that purpose well enough, please show a use case where it fails to do that. At least the situation you described, with " (a", doesn't seem to fit the use cases which this function is supposed to cover, since the parenthesis makes a 2-character sequence, whereas fill-single-char-nobreak-p aims to support isolated one-character words. I also am not sure I understand what is so special about '(' that it has to be hard-coded here. What about '[' or '{' or '<' (or any other punctuation character, for that matter)? > Please review both the patch and the commit message (I'm still > learning to write them...). The commit message should begin with a capital letter. Also, I think this variant is more clear: Don't break after a single-character word that follows an opening parenthesis. Thanks.