Last active
September 18, 2019 16:10
-
-
Save soulawaker/538689eef010da3ace731dc6f680a691 to your computer and use it in GitHub Desktop.
Make the persp-mode save|restore nov.el EPUB buffer. Tested in my spacemacs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-eval-after-load "persp-mode" | |
(with-eval-after-load "nov" | |
(add-hook 'persp-save-buffer-functions | |
'(lambda (b) | |
(when (eq 'nov-mode (buffer-local-value 'major-mode b)) | |
`(def-nov-buffer ,(buffer-name b) | |
,(buffer-local-value 'nov-file-name b) | |
,(buffer-local-value 'major-mode b))))) | |
(add-hook 'persp-load-buffer-functions | |
'(lambda (savelist) | |
(when (eq (car savelist) 'def-nov-buffer) | |
(with-current-buffer (get-buffer-create (cadr savelist)) | |
(setq buffer-file-name (expand-file-name (caddr savelist))) | |
(require 'nov) | |
(nov-mode))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment