From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: fill-paragraph ill designed Date: Wed, 26 Aug 2015 09:08:41 +0200 Message-ID: <87bndule6e.fsf@gnu.org> References: <55DC2621.4030905@online.de> <55DD5D02.9090407@online.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1440572953 18302 80.91.229.3 (26 Aug 2015 07:09:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2015 07:09:13 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, Stefan Monnier To: Andreas =?utf-8?Q?R=C3=B6hler?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 26 09:09:05 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZUUpV-0005vy-LT for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2015 09:09:05 +0200 Original-Received: from localhost ([::1]:36427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUUpV-00056V-6q for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2015 03:09:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUUpD-00054d-Q5 for emacs-devel@gnu.org; Wed, 26 Aug 2015 03:08:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUUp8-0006VE-Mx for emacs-devel@gnu.org; Wed, 26 Aug 2015 03:08:47 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:44514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUUp8-0006Uu-Hp; Wed, 26 Aug 2015 03:08:42 -0400 Original-Received: from thinkpad-t440p (dhcp220.uni-koblenz.de [141.26.71.220]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 02A181A8361; Wed, 26 Aug 2015 09:08:41 +0200 (CEST) Mail-Followup-To: Andreas =?utf-8?Q?R=C3=B6hler?= , rms@gnu.org, Stefan Monnier , emacs-devel@gnu.org In-Reply-To: <55DD5D02.9090407@online.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6hler\?\= \=\?utf-8\?Q\?\=22's\?\= message of "Wed, 26 Aug 2015 08:30:26 +0200") User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189189 Archived-At: Andreas R=C3=B6hler writes: >> There is a lot of ugliness in the way fill-paragraph works, but >> developing a replacement that works ok in practice is harder than it >> looks. I recall a time that we tried. > > What would prevent switching the clauses as suggested? IMO, it makes completely sense that `fill-paragraph' delegates to `fill-region' if the region is active so that not every mode-specific `fill-paragraph-function' has to do that on its own. What I think is wrong is the way `fill-region' works right now. Why doesn't it move over the paragraphs in the active region using `fill-forward-paragraph' (which can be defined mode-specific using `fill-forward-paragraph-function'), and then call `fill-paragraph-function' on each paragraph? The current behavior is ok when there is no `fill-paragraph-function', but if there is, then it should be used. That would allow mode authors to define a custom `fill-paragraph-function' (and a `fill-forward-paragraph-function' if needed), and then multi-paragraph filling would just work. If there are good reasons for the way it is currently implemented, then the docs should at least document how a mode author should implement region/multi-paragraph filling. The function `LaTeX-fill-forward-paragraph' in my previous mail seems to work, but it relies on completely undocumented behavior: (1) `fill-forward-paragraph-function' only speaks of moving over paragraphs, but `LaTeX-fill-forward-paragraph' fills while moving. (2) `LaTeX-fill-forward-paragraph' also moves point one char more than required in order not to trap into the last `fill-region' condition which would call `fill-region-as-paragraph' and then destroy the correct filling again. Bye, Tassilo