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