Closed LucaMarconato closed 6 years ago
It would be cool if also the buffer compilation and all the similar buffer were restored!
Did you read(and tried) this https://github.com/Bad-ptr/persp-mode.el#custom-saveload-buffer-function-example ? If you have any questions feel free to ask.
Thanks for persp-mode!
Out of the box persp-mode saves an entry like this in persp-confs/persp-auto-save for a shell-mode buffer named "1":
(def-buffer "1" nil shell-mode)
I tried to understand the custom save examples and the undocumented but useful-looking persp-def-buffer-save/load function. After doing:
(persp-def-buffer-save/load
:mode 'shell-mode
:tag-symbol 'def-shell
:save-vars '(major-mode default-directory)
)
it saves an entry like:
(def-shell "1"
((major-mode . shell-mode)
(default-directory . "~/")))
Either of these causes it to complain at startup:
[persp-mode] Error: Can not autoresume perspectives -- (wrong-type-argument processp nil)
It's very common to have shells and many other weird kinds of buffer - it would be great to handle more of them out of the box, and to do something more helpful with unsupported buffers, eg emit a less scary warning on load, or better, skip them when saving.
More examples :-) https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-erc-el-L4 https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-multi-term-el-L5
You need to write a custom load function, to run shell
(not shell-mode
) function for the buffer.
Thanks, I did see those. Actually I'm not even trying to start a shell at this point; I'm ok with an empty buffer and I'm just trying to stop it complaining at load time. Clearly I don't understand the API..
Ok, then you can test the develop branch. With this setup:
(persp-def-buffer-save/load
:mode 'shell-mode
:mode-restore-function #'(lambda (_mode) (shell)) ; or #'identity if you do not want to start shell process
:tag-symbol 'def-shell
:save-vars '(major-mode default-directory))
test the develop branch.
Now it's merged into master. And it seem to work for me.)
Is there any way yo make perspective restore also shell sessions?
However, congratulation for this beautiful package!