Closed jwintz closed 7 years ago
I have tried to set persp-filter-save-buffers-functions
to nil
, and if my windows are correctly loaded, their minor mode is not. I have the following snippet in my saved perspective:
(def-buffer "*magit: .prolusion.d" nil magit-status-mode)
And in the window configuration:
(buffer "*magit: .prolusion.d" (selected) (hscroll . 0) (fringes 8 0 nil) (margins nil) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 301) (start . 1))
But the magit buffer is not set up correctly.
I have tried to set persp-filter-save-buffers-functions to nil
This is not so easy. You must define custom save/load functions as shown here: https://github.com/Bad-ptr/persp-mode.el#custom-saveload-buffer-function-example
I can take a look at your wishes, but not on this or next week.)
Meantime you can describe in more detail what do you want. For example if you want to save an *eshell*
buffer you probably want to save a current directory with it, etc.
And what do you expect from saving *compilation*
buffer? Do you want a content(compiler messages) of this buffer to be saved?
Thanks Constantin ! I'm not yet very proficient in emacs lisp but I'll give it a shot.
In the meantime here is what I would like to tweak:
*eshell*
buffers together with their respective mode, names (using multi-eshell
, I have a lot of them) and current directories (I think the history will come for free as it is built-in eshell-mode)*compilation*
buffers together with their respective mode, names, current directories and the build commands, same here, I have a lot of them, distinguished by M-x rename-buffer
*magit*
buffers together with their respective mode (status, log, etc..), names, and current directories. Of course, I nearly have to or three of them per perspective.I added the def-persp-buffer-save/load
function.
Hope it will work for you:
(with-eval-after-load "persp-mode-autoloads"
(def-persp-buffer-save/load :mode 'eshell-mode :tag-symbol 'def-eshell-buffer
:save-vars '(major-mode default-directory))
(def-persp-buffer-save/load :mode 'compilation-mode :tag-symbol 'def-compilation-buffer
:save-vars '(major-mode default-directory compilation-directory compilation-environment compilation-arguments))
(with-eval-after-load "magit-autoloads"
(autoload 'magit-status-mode "magit")
(autoload 'magit-refresh "magit")
(def-persp-buffer-save/load :mode 'magit-status-mode :tag-symbol 'def-magit-status-buffer
:save-vars '(major-mode default-directory)
:after-load-function #'(lambda (b &rest _) (with-current-buffer b (magit-refresh))))))
ok, I consider You are satisfied with it)
As I understand the documentation,
However, to me, the whole point to using perspectives is to get back my
*eshell*
,*magit*
and*compilation*
buffers together with my files, whenever I load a previously saved perspective, cause it saves a lot of time.How can I add functions to save and restore them anyway ?