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: Fri, 29 Apr 2016 14:18:34 +0200 Message-ID: <87shy4vc9x.fsf@mbork.pl> References: <87y4jchwog.fsf@mbork.pl> <87wpywhwa8.fsf@mbork.pl> <87shyku4jt.fsf@mbork.pl> <8337qkb7v7.fsf@gnu.org> <87k2jwtfkj.fsf@mbork.pl> <83r3e49o4g.fsf@gnu.org> <87vb33h6ux.fsf@mbork.pl> <83a8kfzff7.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1461932441 7797 80.91.229.3 (29 Apr 2016 12:20:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2016 12:20:41 +0000 (UTC) Cc: 20871@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 29 14:20:30 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 1aw7PI-0007mL-LQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Apr 2016 14:20:28 +0200 Original-Received: from localhost ([::1]:53983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7PE-00034W-Qp for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Apr 2016 08:20:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7OM-0001k1-Gp for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 08:19:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw7Nx-0005VL-SJ for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 08:19:25 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Nx-0005UG-Ol for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 08:19:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aw7Nu-0005YL-BL for bug-gnu-emacs@gnu.org; Fri, 29 Apr 2016 08:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Apr 2016 12:19: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.146193232421321 (code B ref 20871); Fri, 29 Apr 2016 12:19:02 +0000 Original-Received: (at 20871) by debbugs.gnu.org; 29 Apr 2016 12:18:44 +0000 Original-Received: from localhost ([127.0.0.1]:54020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aw7Nc-0005Xo-71 for submit@debbugs.gnu.org; Fri, 29 Apr 2016 08:18:44 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:32775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aw7Na-0005Xg-B7 for 20871@debbugs.gnu.org; Fri, 29 Apr 2016 08:18:43 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 3B536B19D72; Fri, 29 Apr 2016 14:18:40 +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 lFt2qJU6QP0h; Fri, 29 Apr 2016 14:18:37 +0200 (CEST) Original-Received: from localhost (98-171.echostar.pl [213.156.98.171]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 645DDB19D6F; Fri, 29 Apr 2016 14:18:37 +0200 (CEST) In-Reply-To: <83a8kfzff7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 27 Apr 2016 10:20:12 +0300") 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:117152 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-04-27, at 10:20, Eli Zaretskii wrote: >> From: Marcin Borkowski >> Cc: 20871@debbugs.gnu.org >> Date: Wed, 27 Apr 2016 09:02:36 +0200 >>=20 >> >> I see. So you suggest that instead of patching >> >> `fill-single-char-nobreak-p' I should have provided another function, >> >> customized for Polish? >> > >> > Yes, I think so. There's already fill-french-nobreak-p, why shouldn't >> > there be a Polish predicate? >>=20 >> I attach a new patch. Is it better now? > > Yes, thanks. > > Just one comment, for your consideration: > >> + (looking-at "[^[:alpha:]][[:alpha:]]"))) > > You should be aware that starting with Emacs 25.1 [:alpha:] matches a > very large class of characters, some of them having nothing in common > with those used in Polish. So perhaps it is better to use '\cl' > instead, which will only capture Latin characters? Just a thought -- > your call. I guess you are right, Eli - in fact, all one-letter words in Polish are matched by [aiouwz]. I decided to go with \cl, as you suggested, though - this way, the function could be (probably) useful also for Slovaks, for instance. I attach the corrected patch. Just to be sure: in my Emacs, \cl matches also =C4=85, =C4=99, =C5=BC, =C5= =BA, =C3=A1, =C3=B6 etc. Is it intentional? Is it documented somewhere? Thanks and best regards, --=20 Marcin --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-Add-the-function-fill-polish-nobreak-p.patch >From a3b46e0e260f011e9c5257bece8f2fdb123214e5 Mon Sep 17 00:00:00 2001 From: Marcin Borkowski Date: Wed, 27 Apr 2016 08:59:15 +0200 Subject: [PATCH] Add the function `fill-polish-nobreak-p' * lisp/textmodes/fill.el (fill-polish-nobreak-p): Prevent line-breaking after a single-letter word even if this word is not preceded by a space. (Bug #20871) --- lisp/textmodes/fill.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index 173d1c9..80f7e96 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -329,6 +329,18 @@ fill-french-nobreak-p (and (memq (preceding-char) '(?\t ?\s)) (eq (char-syntax (following-char)) ?w))))))) +(defun fill-polish-nobreak-p () + "Return nil if Polish style allows breaking the line at point. +This function may be used in the `fill-nobreak-predicate' hook. +It is almost the same as `fill-single-char-nobreak-p', with the +exception that it does not require the one-letter word to be +preceded by a space. This blocks line-breaking in cases like +\"(a jednak)\"." + (save-excursion + (skip-chars-backward " \t") + (backward-char 2) + (looking-at "[^[:alpha:]]\\cl"))) + (defun fill-single-char-nobreak-p () "Return non-nil if a one-letter word is before point. This function is suitable for adding to the hook `fill-nobreak-predicate', -- 2.4.3 --=-=-=--