Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
400 stars 44 forks source link

autoresume problem #60

Closed mfiano closed 7 years ago

mfiano commented 7 years ago

I have the following relevant configuration:

(defun my/persp-save-ielm (buffer)
  (with-current-buffer buffer
    (when (string= major-mode "inferior-emacs-lisp-mode")
      `(def-ielm-buffer ,(buffer-name) ,default-directory))))

(defun my/persp-load-ielm (savelist)
  (when (eq (car savelist) 'def-ielm-buffer)
    (with-current-buffer (get-buffer-create (cadr savelist))
      (setq default-directory (caddr savelist))
      (ielm))))

(add-to-list 'persp-load-buffer-functions 'my/persp-save-ielm)
(add-to-list 'persp-load-buffer-functions 'my/persp-load-ielm)

This successfully loads my ielm buffers, however it breaks loading of some other buffers. In Messages I have the following:

[persp-mode] Error: Can not autoresume perspectives -- (wrong-type-argument stringp (def-buffer refile.org /home/axion/org/refile.org org-mode))
Bad-ptr commented 7 years ago

Do you add both save and load functions to the persp-load-buffer-functions?

mfiano commented 7 years ago

Maybe I messed that up. On a side note, I solved it anyway with the nicer def-persp-buffer-save/load

mfiano commented 7 years ago

How would you autoresume buffers such as ERC/circe IRC channel buffers that require a connection?

Bad-ptr commented 7 years ago

I guess you must store server address and channel name for each such buffer. And when you load state just connect to server and join channel. I don't use ERC/circe so I can not say how exactly you must do it.

Bad-ptr commented 7 years ago

Well here is an example of code that do it for erc: https://gist.github.com/Bad-ptr/1aca1ec54c3bdb2ee80996eb2b68ad2d#file-persp-erc-el However I think it is better to use erc-autojoin-channels-alist.

Bad-ptr commented 7 years ago

Closing. If you have questions -- feel free to reopen.