Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Restored shell buffers have no processes #139

Open
khtan opened this issue Mar 30, 2023 · 6 comments
Open

Question: Restored shell buffers have no processes #139

khtan opened this issue Mar 30, 2023 · 6 comments

Comments

@khtan
Copy link

khtan commented Mar 30, 2023

Hi,

I am using the latest Spacemacs 0.999.0@28.2 which bundles persp-mode by default.
Emacs: 28.2 on Windows 10
persp-mode.el: 3.0.7 ( which I believe is the latest )

Part of my workspace consists of several shell buffers with their own default directories.
I used persp-mode to save my perspectives. When I load them back, all the shell buffers have no processes.

I believed this problem was fixed in [[https://github.com//issues/76][Restoring shell #76]] way back in 2017. If that is so, am I missing something simple?

Thanks for a very useful tool.

@Bad-ptr
Copy link
Owner

Bad-ptr commented Apr 2, 2023

What command do you use to start "shell" buffers? Is it the M-x shell RET?
Do you have this https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-shell-el in your config?

Maybe you get some related output in *Messages* buffer?

You can try the following:

  1. Add this to config:
(with-eval-after-load "persp-mode"
(persp-def-buffer-save/load
 :mode 'shell-mode
 :mode-restore-function #'(lambda (_mode) (message "[ATTENTION]: Restoring shell proces for %S buffer" (current-buffer)) (shell))
 :tag-symbol 'def-shell
 :save-vars '(major-mode default-directory)))
  1. Restart Emacs
  2. Create some shell buffers
  3. Save perspectives to file
  4. kill shell buffers
  5. Try to load perspectives from file
  6. Try to restart emacs and see if it will be autorestored.

@khtan
Copy link
Author

khtan commented Apr 5, 2023

Yes, I am creating M-x shell and then renaming them to keep them distinct.

Thank you for your information. It is almost working.
I am using Spacemacs, so I placed the code snippet in .spacemacs dotspacemacs/user-config() section.

I created a shell, set its working directory to "~/bin" and named it S-bin
I created and saved a perspective called 'test' and added S-bin to the perspective.
When I restart Spacemacs and loaded the perspective 'test', I get 2 buffers:

  • shell * Shell:run ~/bin
    S-bin 0 Fundamental

So S-bin did not get associated with the shell.

I have uploaded the test file below.
To allow the 'test' file to be uploaded, I've renamed it 'test.txt'.

test.txt

@Bad-ptr
Copy link
Owner

Bad-ptr commented Apr 5, 2023

But after restart do you have any messages in *Messages* buffer starting with:
[ATTENTION]: Restoring shell proces for

@khtan
Copy link
Author

khtan commented Apr 5, 2023

Yes, my Messages buffer does say:
[ATTENTION]: Restoring shell proces for #<buffer S-bin> buffer

@khtan
Copy link
Author

khtan commented Apr 9, 2023

Hello, sorry I am not a developer and cannot do much. Just a ping to see if the information revealed anything? Thanks

@Bad-ptr
Copy link
Owner

Bad-ptr commented Apr 12, 2023

Maybe it is somehow related to Windows or Spacemacs, or both.
I just tried it with my config on Linux and it works.
Sorry, I can not test it with spacemacs on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants