reddit / emacs

Eshell, history expansion commands fail with "command not found"

mjgasc · 2022-12-15 07:37
Hi. I'm studying eshell and I've found problems when using history expansion. Commands like !n or !! fail to expand to the referred command. This is what I mean: ~ $ history 1 pwd 2 ls -l 3 date 4 history ~ $ !! !!: command not found ~ $ !2 !2: command not found That was run on an eshell session, emacs 28.1 (built myself from source with default options) started with --no-init-file option. There's something I'm doing wrong ? Thanks in advance.
oantolin · 2022-12-15 13:37
eshell does not have that feature.
gusbrs · 2022-12-15 14:35
I think it does, though. As usual eshell documentation is scant, but it is included in Mickey's guide to it: https://www.masteringemacs.org/article/complete-guide-mastering-eshell. Taking a look at `(info "(eshell) History")`, it seems this is not enabled by default and we need `(add-hook 'eshell-expand-input-functions 'eshell-expand-history-references)`.
oantolin · 2022-12-15 14:37
Woah, cool! I did not remember that at all even though I did read and love Petersen's guide. That guide is what convinced me to buy his book.
mjgasc · 2022-12-15 14:41
Thank you!
gusbrs · 2022-12-15 14:42
Yeah, I never miss his posts. ;-)