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: Wed, 27 Apr 2016 09:02:36 +0200 Message-ID: <87vb33h6ux.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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1461740615 8763 80.91.229.3 (27 Apr 2016 07:03:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Apr 2016 07:03:35 +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 Wed Apr 27 09:03:19 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 1avJVF-0003ON-O5 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 09:03:17 +0200 Original-Received: from localhost ([::1]:41297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avJVE-0002FY-Sz for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Apr 2016 03:03:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avJVA-0002Bb-1H for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 03:03:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avJV4-00074p-0L for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 03:03:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avJV3-00074i-UP for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 03:03:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1avJV0-0004Me-EK for bug-gnu-emacs@gnu.org; Wed, 27 Apr 2016 03:03: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: Wed, 27 Apr 2016 07:03: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.146174056816755 (code B ref 20871); Wed, 27 Apr 2016 07:03:02 +0000 Original-Received: (at 20871) by debbugs.gnu.org; 27 Apr 2016 07:02:48 +0000 Original-Received: from localhost ([127.0.0.1]:49336 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avJUm-0004MA-3r for submit@debbugs.gnu.org; Wed, 27 Apr 2016 03:02:48 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:56839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avJUk-0004M2-1A for 20871@debbugs.gnu.org; Wed, 27 Apr 2016 03:02:46 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 1B7D4B0D0D2; Wed, 27 Apr 2016 09:02:44 +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 dl-h6XbRG8jk; Wed, 27 Apr 2016 09:02:41 +0200 (CEST) Original-Received: from localhost (98-171.echostar.pl [213.156.98.171]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 078D4B0D0CE; Wed, 27 Apr 2016 09:02:41 +0200 (CEST) User-agent: mu4e 0.9.13; emacs 25.1.50.8 In-reply-to: <83r3e49o4g.fsf@gnu.org> 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:116901 Archived-At: --=-=-= Content-Type: text/plain On 2016-04-17, at 16:49, Eli Zaretskii wrote: >> From: Marcin Borkowski >> Cc: 20871@debbugs.gnu.org >> Date: Sun, 17 Apr 2016 17:34:04 +0200 >> >> In Polish typography, it is customary to foribid line breaks after >> one-letter words (and we have quite a few of them: a, i, o, w, z - they >> are conjunctions or prepositions). And it is not uncommon to have >> a combination of them with a parenthesized remark or something like >> that. That's why allowing a linebreak after, say "(a" when writing >> something in Polish (like an email, for instance) is a bug IMO. >> >> > 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 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? I attach a new patch. Is it better now? Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Add-the-function-fill-polish-nobreak-p.patch >From 6356c46bf6d5c90057b1a756f05c69791c9ff3db 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..0a95290 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:]][[:alpha:]]"))) + (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 --=-=-=--