Closed bandali0 closed 1 month ago
I can confirm that if I open Eshell via SPC a s e
(spacemacs/shell-pop-eshell
) then the history isn't saved when exiting the shell. However, if I open the shell via M-x eshell
, then it does save the history when exiting the shell.
After running SPC a s e
and closing the Eshell buffer with C-d
, I invoked M-x shell-pop
directly to get an Eshell buffer, and its history as well wasn't saved after I exited with C-d
. (I checked if history was saved by opening a new M-x eshell
and pressing M-p
.)
Perhaps a problem with shell-pop
or with our configuration of shell-pop
, or perhaps Eshell doesn't work well with the buffer name given by shell-pop
(a somewhat wild guess). If anyone wants to investigate this, sounds like an interesting bug.
@aminb are you still experiencing this on the latest develop branch?
I just tested it. This bug is still there.
Sorry @thornjad I've long since stopped using spacemacs, and now use my own emacs configuration. For what it's worth, eshell history works fine with vanilla emacs + my configs.
I found the reason. Its the value of eshell-exit-hook
that is the problem. In the popup buffer its value is:
(shell-pop--kill-and-delete-window eshell-write-history eshell-write-last-dir-ring t)
While in normal M-x eshell
its:
(eshell-write-history eshell-write-last-dir-ring t)
I think I found the problem. However I am not a elisp programmer, so I am not sure if my solution is the correct one.
Spacemacs shell layer uses 'shell-pop' extension.
In this file: https://github.com/kyagi/shell-pop-el/blob/master/shell-pop.el
in the 'shell-pop--set-exit-action' function on line 262... changing:
(add-hook 'eshell-exit-hook 'shell-pop--kill-and-delete-window nil t)
to
(add-hook 'eshell-exit-hook 'shell-pop--kill-and-delete-window t t)
This changed it so that add-hook appends the function to the hook list. So now 'eshell-exit-hook' gets set to:
(eshell-write-history eshell-write-last-dir-ring t shell-pop--kill-and-delete-window)
So I think that what was happening is that the eshell was exiting before it had a chance to write the history. Changing the order of the hooks now allows eshell to save it's history before the frame is deleted.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
I am still experiencing this issue but it appears there have been no responses on the issue in the upstream repo.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
I am experiencing this issue today. It's still not resolved.
Still there and not fixed upstream maybe we can find a workaround
I have added a workaround to Spacemacs circumventing the bug in the ticket. The issue is indeed that the window is set before the store history calls in the shutdown hook.
Description :octocat:
Eshell doesn't remember history
Reproduction guide :beetle:
M-m a s e
(start Eshell)pwd
,ls
,uname
)C-d
(exit the Eshell)M-m a s e
(start Eshell again)M-p
Observed behaviour: :eyes: :broken_heart:
M-p
results in displaying Empty input ring in the minibar.~/.emacs.d/.cache/eshell/
has no files)Expected behaviour: :heart: :smile:
M-p
should go back through the history.System Info :computer:
Backtrace :paw_prints: