Noam Postavsky writes: > Hmm, using history expansion would mean typing > > M-p DEL C-a M-f M-d M-d ! ! : $ > > to get > > mv !!:$ two.txt > > vs > > M-p C-a M-f M-d M-d C-k C-y C-y DEL > > to get > > mv two.txtt two.txt > > Hardly seems worth the trouble of learning this syntax (and occasionally > triggering accidentally, which is why I disable it in bash too). Is > having history expansion enabled by default very important? You can > still enable it in your config. I do suppose that is true, but I still find myself preferring history substitution in some cases, such as typing a new command but preserving the last argument. I don't think it's too important that history expansion is enabled by default, but I do think it's important to have it available as an option. I think that turning it off would startle some users, especially because it's featured in some popular 'getting started' articles for eshell (such as this one: https://masteringemacs.org/article/complete-guide-mastering-eshell), but the decision is up to you. I would much prefer a variable (perhaps defaulting to off) to tweak this setting on or of rather than adding/removing a function to the hook. Removing it in the current way makes it feel more 'deprecated' to me, rather than 'disabled by default'. Would you mind if I submitted a patch to add a new `eshell-history-expansion-enabled' variable (or similar)? > I guess it's an improvement on what we have currently (the feature is > rather underspecified). Should we consider also handling spaces like > bash does? In bash I can do this: > > ~/tmp$ echo foo bar > foo bar > ~/tmp$ ^foo bar^blah^ > echo blah > blah > > In eshell (with and without your patch) I get: > > ~/src/emacs $ echo foo bar > ("foo" "bar") > ~/src/emacs $ ^foo bar^blah^ > ^foo: command not found I've attached a new patch which attempts to solve this as well. I'm unfamiliar with eshell internals though, so I'm not sure if it's done properly. Let me know if anyone sees any issues with it! Thanks, -Jay