From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: function for inserting a block Date: Wed, 15 Nov 2017 21:13:40 +0800 Message-ID: References: <877exghblx.fsf@ericabrahamsen.net> <87k1zsbizs.fsf@ericabrahamsen.net> <87k1zp4rxj.fsf@ericabrahamsen.net> <871slx4j6p.fsf@ericabrahamsen.net> <87376btslq.fsf@nicolasgoaziou.fr> <87vaj7oyxb.fsf@ericabrahamsen.net> <871sl9ow44.fsf@gnu.org> <87fu9pgfkj.fsf@nicolasgoaziou.fr> <87375ouanr.fsf@gmx.us> <871sl8e76c.fsf@nicolasgoaziou.fr> <87y3nfse6m.fsf@gmx.us> <87tvy3sa7m.fsf@gmx.us> <87bmkbflbc.fsf@ericabrahamsen.net> <87po8qscmq.fsf@gmx.us> <87mv3um4c7.fsf@ericabrahamsen.net> <87mv3osftj.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11c0222e7dc1de055e054703" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eExW9-0007Wm-Pp for emacs-orgmode@gnu.org; Wed, 15 Nov 2017 08:14:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eExW8-0006EZ-9g for emacs-orgmode@gnu.org; Wed, 15 Nov 2017 08:14:13 -0500 Received: from mail-ot0-x229.google.com ([2607:f8b0:4003:c0f::229]:56477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eExW8-0006DA-1O for emacs-orgmode@gnu.org; Wed, 15 Nov 2017 08:14:12 -0500 Received: by mail-ot0-x229.google.com with SMTP id j29so16098856oth.13 for ; Wed, 15 Nov 2017 05:14:11 -0800 (PST) In-Reply-To: <87mv3osftj.fsf@ericabrahamsen.net> 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: Eric Abrahamsen Cc: Org-mode --001a11c0222e7dc1de055e054703 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think the function `org-insert-structure-template' also should respect the `org-babel-uppercase-example-markers'. Besides, your new diff does not have a condition on `org-babel-uppercase-example-markers', you just use `upcase-initials` by default. Then the new `tempo` snippets will be uppercase, but the `org-insert-structure-template` inserted templates will be different. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Wed, Nov 15, 2017 at 5:36 AM, Eric Abrahamsen wrote: > "Thomas S. Dye" writes: > > > Eric Abrahamsen writes: > > > >> Rasmus writes: > >> > >>> Hi Eric, > >>> > >>> Eric Abrahamsen writes: > >>> > >>>>> Also, Eric, it seems that org-structure-template-alist only support= s > a > >>>>> single letter for short-hands (the car of an entry in > >>>>> org-structure-template-alist is a char). I used to have blocks lik= e > " >>>>> expanding to an "abstract" special-block, which I guess isn=E2=80= =99t > possible > >>>>> anymore? > >>>> > >>>> I hadn't thought of that. Really, all I ever wanted was to wrap thin= gs > >>>> in blocks... > >>>> > >>>> I don't see any reason why org-structure-template-alist couldn't go > back > >>>> to using string keys. Then we could use read-string, and wouldn't ha= ve > >>>> to have special behavior -- a string that didn't exist in the > >>>> alist could just be used literally to make a block. > >>> > >>> I=E2=80=99d prefer that. For some special blocks, a few characters m= ight > makes it > >>> more intuitive, e.g. "def" =E2=86=92 "definition", "hyp" =E2=86=92 "h= ypothesis" etc. > >> > >> Here's the simplest solution. > >> > >> There still remains the fact that `org-structure-template-alist' has > >> changed format, and `org-try-structure-completion' no longer exists. > >> That may still annoy some people who were using the internals of the > >> process, but... > > > > Would something like this work? > > > > (defun org-try-structure-completion () > > (tempo-complete-tag)) > > Here's the newest version! > > It incorporates Rasmus' org-tempo.el file, with modifications, and > Thomas' suggestion to re-instate `org-try-structure-completion', and, > erm, stardiviner's request to honor > `org-babel-uppercase-example-markers'. > > Remaining issues: > > 1. The "org-include" tempo template doesn't work, for reasons I don't > understand (I've never used tempo before). Nothing happens when I hit > . > 2. Now it seems like there should be completion when prompting for a > string key. Feature creep! But likely worthwhile feature creep. > 3. I've rather rashly renamed the relevant customization options > `org-structure-block-alist' (for blocks added via > `org-insert-structure-template') and `org-structure-keyword-alist' > (for keywords insertable via the tempo system). Perhaps this was a > bad idea. If it's not a bad idea, maybe > `org-insert-structure-template' should be renamed `org-insert-block' > or something like that. > 3. Docs need to be updated. > > Comments welcome! > > Eric > > --001a11c0222e7dc1de055e054703 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think the function `org-insert-structure-template' a= lso should respect the `org-babel-uppercase-example-markers'.
Besi= des, your new diff does not have a condition on `org-babel-uppercase-exampl= e-markers', you just use `upcase-initials` by default. Then the new `te= mpo` snippets will be uppercase, but the `org-insert-structure-template` in= serted templates will be different.

[stardiviner]=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!= >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): = stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchi= ld
Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C= 3 2433
Blog: http://stardiviner.github.io/

On Wed, Nov 15, 2017 at 5:36 AM, Eric Abraha= msen <eric@ericabrahamsen.net> wrote:
"Thomas S. D= ye" <tsd@tsdye.com> writes:=

> Eric Abrahamsen writes:
>
>> Rasmus <rasmus@gmx.us> = writes:
>>
>>> Hi Eric,
>>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>>> Also, Eric, it seems that org-structure-template-alist= only supports a
>>>>> single letter for short-hands (the car of an entry in<= br> >>>>> org-structure-template-alist is a char).=C2=A0 I used = to have blocks like "<ab"
>>>>> expanding to an "abstract" special-block, wh= ich I guess isn=E2=80=99t possible
>>>>> anymore?
>>>>
>>>> I hadn't thought of that. Really, all I ever wanted wa= s to wrap things
>>>> in blocks...
>>>>
>>>> I don't see any reason why org-structure-template-alis= t couldn't go back
>>>> to using string keys. Then we could use read-string, and w= ouldn't have
>>>> to have special <TAB> behavior -- a string that didn= 't exist in the
>>>> alist could just be used literally to make a block.
>>>
>>> I=E2=80=99d prefer that.=C2=A0 For some special blocks, a few = characters might makes it
>>> more intuitive, e.g. "def" =E2=86=92 "definitio= n", "hyp" =E2=86=92 "hypothesis" etc.
>>
>> Here's the simplest solution.
>>
>> There still remains the fact that `org-structure-template-alist= 9; has
>> changed format, and `org-try-structure-completion' no longer e= xists.
>> That may still annoy some people who were using the internals of t= he
>> process, but...
>
> Would something like this work?
>
> (defun org-try-structure-completion ()
>=C2=A0 =C2=A0(tempo-complete-tag))

Here's the newest version!

It incorporates Rasmus' org-tempo.el file, with modifications, and
Thomas' suggestion to re-instate `org-try-structure-completion', and,
erm, stardiviner's request to honor
`org-babel-uppercase-example-markers'.

Remaining issues:

1. The "org-include" tempo template doesn't work, for reasons= I don't
=C2=A0 =C2=A0understand (I've never used tempo before). Nothing happens= when I hit
=C2=A0 =C2=A0<TAB>.
2. Now it seems like there should be completion when prompting for a
=C2=A0 =C2=A0string key. Feature creep! But likely worthwhile feature creep= .
3. I've rather rashly renamed the relevant customization options
=C2=A0 =C2=A0`org-structure-block-alist' (for blocks added via
=C2=A0 =C2=A0`org-insert-structure-template') and `org-structure-k= eyword-alist'
=C2=A0 =C2=A0(for keywords insertable via the tempo system). Perhaps this w= as a
=C2=A0 =C2=A0bad idea. If it's not a bad idea, maybe
=C2=A0 =C2=A0`org-insert-structure-template' should be renamed `or= g-insert-block'
=C2=A0 =C2=A0or something like that.
3. Docs need to be updated.

Comments welcome!

Eric


--001a11c0222e7dc1de055e054703--