From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: function for inserting a block Date: Mon, 23 Oct 2017 10:52:40 +0000 Message-ID: References: <877exghblx.fsf@ericabrahamsen.net> <87ziabepxt.fsf@ericabrahamsen.net> <87bmml2fb0.fsf@ericabrahamsen.net> <87fubuzpsa.fsf@nicolasgoaziou.fr> <874lsabdop.fsf@ericabrahamsen.net> <87vak1l11m.fsf@nicolasgoaziou.fr> <87r2uoc4q7.fsf@ericabrahamsen.net> <87bmllk5xy.fsf@nicolasgoaziou.fr> <878tgmwwsa.fsf@ericabrahamsen.net> <87po9q2e8k.fsf@nicolasgoaziou.fr> <87tvyyvpst.fsf@ericabrahamsen.net> <87fuaiz069.fsf@nicolasgoaziou.fr> <87lgk9eo4d.fsf@ericabrahamsen.net> <87fuahxxvs.fsf@nicolasgoaziou.fr> <87r2u1cuwj.fsf@ericabrahamsen.net> <87infdctzq.fsf@ericabrahamsen.net> <87k1zsbizs.fsf@ericabrahamsen.net> <87k1zp4rxj.fsf@ericabrahamsen.net> <871slx4j6p.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c14e3c2c8c82e055c349f02" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6aLo-0005xI-4Y for emacs-orgmode@gnu.org; Mon, 23 Oct 2017 06:52:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6aLm-0001KH-NQ for emacs-orgmode@gnu.org; Mon, 23 Oct 2017 06:52:56 -0400 Received: from mail-yw0-x22f.google.com ([2607:f8b0:4002:c05::22f]:57248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e6aLm-0001JZ-HA for emacs-orgmode@gnu.org; Mon, 23 Oct 2017 06:52:54 -0400 Received: by mail-yw0-x22f.google.com with SMTP id l32so11650070ywh.13 for ; Mon, 23 Oct 2017 03:52:53 -0700 (PDT) In-Reply-To: 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 , emacs-org list , Carsten Dominik , Nicolas Goaziou --94eb2c14e3c2c8c82e055c349f02 Content-Type: text/plain; charset="UTF-8" On Fri, Oct 20, 2017, 5:43 PM Kaushal Modi wrote: > On Fri, Oct 20, 2017 at 5:15 PM Eric Abrahamsen > wrote: > >> The template really only inserts the block type, not anything specific >> like the source language or export backend. > > > Right, but based on the code you have, you can easily add "SRC org", "SRC > emacs-lisp" to the default value of that list. Looking at that, users can > also get an idea that they can add their favorite languages to that list > too. > > >> I think prompting for >> "second-level" information like that might be a little overkill. >> > > I second that. The first-level prompt also feels a bit slow, honestly, > compared to using easy templates like " (just an example) to insert the, well, EXAMPLE block as usual. But *if > region is selected*, it does the wrapping as in your code. > > This is what I mean (GIF animation): > > https://i.imgur.com/201TISW.gifv > > I use hydra to provide those awesome hints.. but the same can be done > without hydras too. > Hello all, Above, I suggested merging the template insertion function with the current easy template code. With that, the easy template behavior will remain unchanged if no region is selected. But if a region is selected, the same template (example: " -- Kaushal Modi --94eb2c14e3c2c8c82e055c349f02 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Oct 20, 2017, 5:43 PM K= aushal Modi <kaushal.modi@gmai= l.com> wrote:
On Fri, Oct 20, 2017 at 5:15= PM Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
The template really only inserts the block type, not anythi= ng specific
like the source language or export backend.

Right, but based o= n the code you have, you can easily add "SRC org", "SRC emac= s-lisp" to the default value of that list. Looking at that, users can = also get an idea that they can add their favorite languages to that list to= o.
=C2=A0=
I think prompting for
"second-level" information like that might be a little overkill.<= br>

I second that. The first-level prompt also feels a bit slo= w, honestly, compared to using easy templates like "<e". So in= my config, I make "<e" (just an example) to insert the, well,= EXAMPLE block as usual. But *if region is selected*, it does the wrapping = as in your code.

This is what I mean (GIF animatio= n):


I use hydra to provide those awesome hints.. but the same can be do= ne without hydras too.

<= div>Hello all,

Above, I suggested merging the temp= late insertion function with the current easy template code.=C2=A0

With that, the easy template behavior will remain unchange= d if no region is selected. But if a region is selected, the same template = (example: "<e") Will wrap that region with that template.=C2= =A0

I also have a GIF showing that behavior in act= ion (linked in my previous reply).=C2=A0

Benefits:=
- Quicker as there are no prompts.. the user simply types the te= mplate string as configured by them.=C2=A0
- Also one doesn't= need to do a context switch to use a different binding based on if region = is selected or not.=C2=A0

@Eric: I believe you wer= e sort of onboard with this suggestion, just gated by a doubt if this actua= lly can make into master.=C2=A0

So, checking with = Nicolas, and the thread if the proposed behavior change with easy templates= (only when region is selected) would be accepted.=C2=A0
--

Kaushal Modi

--94eb2c14e3c2c8c82e055c349f02--