all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Thibaut Verron <thibaut.verron@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Default setting for sh-maybe-here-document-mode
Date: Fri, 20 Feb 2015 12:08:49 -0500	[thread overview]
Message-ID: <jwvfva0msf7.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAFsi02QzV13xZ+66Yzh9pjjMQJeZPqBcM2UOY1utW8=XeeHbdg@mail.gmail.com> (Thibaut Verron's message of "Fri, 20 Feb 2015 16:49:27 +0100")

>> 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.

> 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.

> 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.

> 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.


        Stefan



  reply	other threads:[~2015-02-20 17:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20  8:19 Default setting for sh-maybe-here-document-mode Thibaut Verron
2015-02-20  8:31 ` Eli Zaretskii
2015-02-20  8:39   ` Thibaut Verron
2015-02-20 13:58 ` Stefan Monnier
2015-02-20 15:49   ` Thibaut Verron
2015-02-20 17:08     ` Stefan Monnier [this message]
2015-02-20 17:23       ` Thibaut Verron
2015-02-22 23:24         ` Stefan Monnier
2015-02-23  8:41           ` Thibaut Verron
2015-02-21  9:12     ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvfva0msf7.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=thibaut.verron@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.