From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.devel Subject: Re: Default setting for sh-maybe-here-document-mode Date: Fri, 20 Feb 2015 18:23:10 +0100 Message-ID: References: Reply-To: thibaut.verron@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d0438eb6db38389050f884f09 X-Trace: ger.gmane.org 1424453029 30909 80.91.229.3 (20 Feb 2015 17:23:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Feb 2015 17:23:49 +0000 (UTC) Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 20 18:23:44 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 1YOrIh-0001yi-7S for ged-emacs-devel@m.gmane.org; Fri, 20 Feb 2015 18:23:39 +0100 Original-Received: from localhost ([::1]:33387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOrIg-0007VH-Jq for ged-emacs-devel@m.gmane.org; Fri, 20 Feb 2015 12:23:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOrIb-0007UE-AT for emacs-devel@gnu.org; Fri, 20 Feb 2015 12:23:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOrIZ-0005kF-Rw for emacs-devel@gnu.org; Fri, 20 Feb 2015 12:23:33 -0500 Original-Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:52158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOrIZ-0005k4-HX for emacs-devel@gnu.org; Fri, 20 Feb 2015 12:23:31 -0500 Original-Received: by mail-wi0-f175.google.com with SMTP id r20so4496711wiv.2 for ; Fri, 20 Feb 2015 09:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=AJKygl+TayL1uwQytGJ7A1fgAbNJEMboJNy76cHD3QY=; b=0zXH22FOXLLo4Lcl+Xq1fVC1DBR5TGtCgam1c5RZJnjJriGl3DQbbKNpl3VYXfhB5A B9Qxq+Wa+4DYq518eqKw05P1YBt16EqMiz3Es94QFcXeu+8gn4Gkoz2x+n3dLgtzbAXn PL35B8VvaTS++byBKcQyIotM7oHTs9H3OU9VPF1j6Cglm8/tdbf2lsu5949gP8I9KTNu 9eGwVbOwJ4dKWkWqdkflV085NXU51gJa4KnfrvdC29VZly12wB0kTY8v4QzLF0z8kVlm 6Jkn+FLNdnSdF2nw944qC9xm1SOT2wjjJ1gBa9iNY89AqN30HVz15Ico7AjqCjs6SNlE /BAg== X-Received: by 10.180.90.197 with SMTP id by5mr21643653wib.70.1424453010685; Fri, 20 Feb 2015 09:23:30 -0800 (PST) Original-Received: by 10.27.179.17 with HTTP; Fri, 20 Feb 2015 09:23:10 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22f 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:183329 Archived-At: --f46d0438eb6db38389050f884f09 Content-Type: text/plain; charset=UTF-8 2015-02-20 18:08 GMT+01:00 Stefan Monnier : > >> Hmm... indeed, maybe it should be a global minor mode? > > And auto-loaded? > > I think we could make it so that (setq sh-electric-here-document-mode > nil) in your ~/.emacs would be sufficient. > > Autoloading it and having users put (sh-electric-here-document-mode -1) > in their ~/.emacs means that those users end up loading > sh-script.el eagerly. > > > This could work. Another option would be to reenable the binding on > > '<' (see just below), and let users who do not want the behavior use > > self-insert-command. > > No, using post-self-insert-hook instead of a key-binding was the main > motivation behind the change. Reverting this is not an option. > Now I am curious, I'll probably dive in the mailing list history to find out more about this motivation. > > > It is very easy: try to feed a single line to a command, using a > > here-string. In other words, try to enter > > command <<< "line of text" > > Ah, right, I remember this now (obviously, I never use it myself). > > Could you file a bug report for it? I think the feature was developed > at a time where <<< didn't exist, and accommodating <<< will require > some rethinking. > Sure thing. > > > This use-case can be accommodated with this piece of code: > > http://emacs.stackexchange.com/a/5338/184 > > It still fails in case the here-document is supposed to start with a <, > > which is reasonable, but would probably be even more confusing as a > default. > > It's also rather jarring to have a "big" chunk of text be inserted > there, and it may not occur to the user than hitting a third < will get > her what she wanted. > > > Another use-case, even if you never use here-strings, is that you want to > > enter a single <, but enter << instead. You would expect this mistake > to be > > corrected with a single backspace, but it's not. > > We could special case this, potentially, but at the same time `undo' is > your friend. I know, but for some reason I can't get the hang of using undo in the flow of writing text. > > > By the way, we could design it so that the feature is still accessible, > but > > through more conventional entry points, for example by pressing TAB with > > point after << . > > Right, or we could trigger the heredoc template after `< < SPC' rather > than just after '< <'. In any case, given the use of <<< I agree that > the current moment at which heredoc is triggered is inappropriate. > This is a good idea, but in this case you also need to include < < - as a trigger. Thibaut --f46d0438eb6db38389050f884f09 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
2015= -02-20 18:08 GMT+01:00 Stefan Monnier <monnier@iro.umontreal.ca= >:
>> Hm= m... indeed, maybe it should be a global minor mode?
> And auto-loaded?

I think we could make it so that (setq sh-electric-here-document-mod= e
nil) in your ~/.emacs would be sufficient.

Autoloading it and having users put (sh-electric-here-document-mode -1)
in their ~/.emacs means that those users end up loading
sh-script.el eagerly.

> This could work. Another option would be to reenable the binding on > '<' (see just below), and let users who do not want the beh= avior use
> self-insert-command.

No, using post-self-insert-hook instead of a key-binding was the mai= n
motivation behind the change.=C2=A0 Reverting this is not an option.

Now I am curious, I'll probably dive in t= he mailing list history to find out more about this motivation.
= =C2=A0

> It is very easy: try to feed a single line to a command, using a
> here-string. In other words, try to enter
>=C2=A0 =C2=A0 =C2=A0command <<< "line of text"

Ah, right, I remember this now (obviously, I never use it myself).
Could you file a bug report for it?=C2=A0 I think the feature was developed=
at a time where <<< didn't exist, and accommodating <<&l= t; will require
some rethinking.

Sure thing.
= =C2=A0

> This use-case can be accommodated with this piece of code:
> http://emacs.stackexchange.com/a/5338/184
> It still fails in case the here-document is supposed to start with a &= lt;,
> which is reasonable, but would probably be even more confusing as a de= fault.

It's also rather jarring to have a "big" chunk of text= be inserted
there, and it may not occur to the user than hitting a third < will get<= br> her what she wanted.

> Another use-case, even if you never use here-strings, is that you want= to
> enter a single <, but enter << instead.=C2=A0 You would expec= t this mistake to be
> corrected with a single backspace, but it's not.

We could special case this, potentially, but at the same time `undo&= #39; is
your friend.

I know, but for some reason I = can't get the hang of using undo in the flow of writing text. =C2=A0
=C2=A0

> By the way, we could design it so that the feature is still accessible= , but
> through more conventional entry points, for example by pressing TAB wi= th
> point after << .

Right, or we could trigger the heredoc template after `< < SPC= ' rather
than just after '< <'.=C2=A0 In any case, given the use of &l= t;<< I agree that
the current moment at which heredoc is triggered is inappropriate.

This is a good idea, but in this case you also = need to include < < - as a trigger.

Thibaut<= /div>
--f46d0438eb6db38389050f884f09--