From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: [RFC] The "c" Org macro Date: Mon, 22 May 2017 13:00:54 +0000 Message-ID: References: <2ee94a64a94b46259b0da6e7d34675c9@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87y3u7o3dj.fsf@t3610> <87pofjtk4b.fsf@t3610> <2069df8c23bc43f3b04b6e203b96be9d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87r2zvpyst.fsf@delle7240> <8760guib5i.fsf@nicolasgoaziou.fr> <87h90dh1pd.fsf@nicolasgoaziou.fr> <87tw4df6zr.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c1cc542c9918305501c7634" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCmxc-0002ge-Pc for emacs-orgmode@gnu.org; Mon, 22 May 2017 09:01:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCmxP-0007iv-Oc for emacs-orgmode@gnu.org; Mon, 22 May 2017 09:01:20 -0400 Received: from mail-lf0-x234.google.com ([2a00:1450:4010:c07::234]:34206) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCmxP-0007iE-DD for emacs-orgmode@gnu.org; Mon, 22 May 2017 09:01:07 -0400 Received: by mail-lf0-x234.google.com with SMTP id 99so30617655lfu.1 for ; Mon, 22 May 2017 06:01:07 -0700 (PDT) In-Reply-To: <87tw4df6zr.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --94eb2c1cc542c9918305501c7634 Content-Type: text/plain; charset="UTF-8" On Mon, May 22, 2017 at 7:47 AM Nicolas Goaziou wrote: > This shouldn't happen. "1." is defined as paragraph separator (see > `org-element-paragraph-separate' and `org-element--set-regexps) so > auto-fill cannot break a line before this construct. > That's good to know and comforting :) Thanks for the explanation. > Per above, this should not happen. There are cases, however, that can > happen, like the macro in your ECM. Auto-fill cannot tell this is going > to make a numbered bullet. > I just tried this out and it works: diff --git a/lisp/org-element.el b/lisp/org-element.el index c60a56ead..4f4fc1e2c 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -181,7 +181,9 @@ specially in `org-element--object-lex'.") (?\) ")") (?. "\\.") (_ "[.)]"))) (alpha (and org-list-allow-alphabetical "\\|[A-Za-z]"))) (concat "\\(?:[-+*]\\|\\(?:[0-9]+" alpha "\\)" term "\\)" - "\\(?:[ \t]\\|$\\)")) + "\\(?:[ \t]\\|$\\)")) "\\|" + ;; n Macro + "\\(?:{{{n\\)" ;Don't allow auto-fill to put n macros at BOL "\\)\\)") org-element--object-regexp (mapconcat #'identity With that, now the MWE auto-fills as ===== If I wish, I can set that counter value to anything I want, like 7463: {{{n(, 7463)}}}. ===== instead of ===== If I wish, I can set that counter value to anything I want, like 7463: {{{n(, 7463)}}}. ===== and that fixes this problem. -- Kaushal Modi --94eb2c1cc542c9918305501c7634 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, May 22= , 2017 at 7:47 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
This shouldn't happen. "1." is defined as paragraph s= eparator (see
`org-element-paragraph-separate' and `org-element--set-regexps) so
auto-fill cannot break a line before this construct.
<= br>
That's good to know and comforting :) Thanks for the expl= anation.
=C2=A0
Per above, th= is should not happen. There are cases, however, that can
happen, like the macro in your ECM. Auto-fill cannot tell this is going
to make a numbered bullet.

I just tried= this out and it works:

diff --git a/lisp/org= -element.el b/lisp/org-element.el
index c60a56ead..4f4fc1e2c 1006= 44
--- a/lisp/org-element.el
+++ b/lisp/org-element.el<= /div>
@@ -181,7 +181,9 @@ specially in `org-element--object-lex'.&q= uot;)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(?\) ")") (?. "\\.")= (_ "[.)]")))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(alpha (and org-list-al= low-alphabetical "\\|[A-Za-z]")))
=C2=A0 =C2=A0(concat "\\(= ?:[-+*]\\|\\(?:[0-9]+" alpha "\\)" term "\\)"
- = =C2=A0"\\(?:[ \t]\\|$\\)"))
+ =C2=A0"\\(?:[ \t]\\|$\\)&quo= t;)) "\\|"
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0;; n Macro
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0"\\(?:{{{n\\)" ;Don't allow auto-fill to put= n macros at BOL
=C2=A0 "\\)\\)")
=C2=A0 org-element--object-regex= p
=C2=A0= (mapconcat #'identity

With that,= now the MWE auto-fills as

=3D=3D=3D=3D=3D
If I wish, I can set that counter value to anything I want, like
7463: {{{n(, 7463)}}}.
=3D=3D=3D=3D=3D
instead of

=3D=3D=3D=3D=3D
=
If I wish, I can set that counter value to anything I want, like = 7463:=C2=A0
{{{n(, 7463)}}}.
=3D=3D=3D=3D=3D
and that fi= xes this problem.


--

Kaushal Modi

--94eb2c1cc542c9918305501c7634--