From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Vincent_Bela=EFche?= Subject: RE: Alinea filling (hanlding of explicit line-breaks) Date: Sat, 12 Mar 2011 22:09:36 +0100 Message-ID: <801v2cnizz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org To: Stefan Monnier , Karl Berry Cc: Org mode , emacs-devel@gnu.org List-Id: emacs-orgmode.gnu.org Karl: I put you in the loop for info, because in Texinfo mode I think that @* is used as an alinea separator similar to \\ in Org mode. > From: monnier@iro.umontreal.ca > To: vincent.b.1@hotmail.fr > Date: Wed, 16 Feb 2011 10:02:37 -0500 > CC: emacs-orgmode@gnu.org; emacs-devel@gnu.org > Subject: Re: Alinea filling (hanlding of explicit line-breaks) > > >> An important question here is: is it important for M-} to ignore those \\? > > I guess so, this is the current default Org behaviour anyhow. > > Good. > > > as far as I understand, it would be anyhow possible to move point on > > an alinea-by-alinea basis just by configuring the tailing \\ as > > anohter paragraph separator. > > Actually, no, because paragraph-separate would cause the whole line > that ends with \\ to be treated as not being part of a paragraph, and > paragraph-start wouldn't be appropriate either. Hence the "good" > above :-( > > >> Of course fill-paragraph-function sucks because it only applies to > >> fill-paragraph and not to fill-region. > > > Do you mean that `fill-paragraph-function' is some kind of obsolete > > feature and that people should use another kind of hook, and if so > > which one? > > Yes and no: there is no replacement for it. There is > fill-forward-paragraph-function, which can handle some of the cases > for which fill-paragraph-function has been used, but there would need > to be something like a fill-region-as-paragraph-function and we don't > have that yet :-( > > > Stefan > Hello Stefan & al, I have implemented the thing locally on my machine. It works well but there is still something missing: the line containing the `\\' alinea separtor is not filled. Here is what I did: + In org-set-autofill-regexps function I added (org-set-local 'fill-forward-paragraph-function 'org-fill-foward-paragraph) + I created the following function: (defun org-fill-foward-paragraph (&optional arg) (let ((paragraph-separate (concat ".*\\\\$\\|" paragraph-separate ))) (forward-paragraph arg) )) Note that I my 7.01h version of org --- which is older than the latest one --- org-fill-paragraph is roughly like this: (defun org-fill-paragraph (&optional justify) "Re-align a table, pass through to fill-paragraph if no table." (let ((table-p (org-at-table-p)) (table.el-p (org-at-table.el-p))) (cond ((and (equal (char-after (point-at-bol)) ?*) (save-excursion (goto-char (point-at-bol)) (looking-at outline-regexp))) t) ; skip headlines (table.el-p t) ; skip table.el tables (table-p (org-table-align) t) ; align org-mode tables (t nil); let fill.el do the job ))) That is to say there is a case where org lets fill.el do the job, while in a later version (e.g. 7.4) org does some "\\\\$" detection on its own without the use of the fill-forward-paragraph-function. So, after more thinking about it the problem is the following: the fill-forward-paragraph has only one parameter which is the paragraph number --- with n = 0 => current --- but for finding the paragraph boundary we need *two* parameter => 1st argument: paragraph number => 2nd argument: whether we want to point at the beginning the paragraph or to the end of the paragraph. => maybe paragraph-separate could be a list of 3 items (REGEXP BEG END) where REGEXP is the usual regexp matching the separator, and BEG and END when non nil are function to go the the beginning of next or to the end of previous assuming that the match data corresponds to a match of REGEXP. This way would be really the most flexible. VBR, Vincent