conf-perspective.el 610 B

123456789101112131415161718192021222324
  1. ;; Load Perspective
  2. (require 'perspective)
  3. ;; Enable perspective mode
  4. (persp-mode t)
  5. ;; TODO: implement persp-last as before-advice on persp-switch (?)
  6. (defmacro custom-persp (name &rest body)
  7. `(let ((initialize (not (gethash ,name perspectives-hash)))
  8. (current-perspective persp-curr))
  9. (persp-switch ,name)
  10. (when initialize ,@body)
  11. (setq persp-last current-perspective)))
  12. ;; Jump to last perspective
  13. (defun custom-persp-last ()
  14. (interactive)
  15. (persp-switch (persp-name persp-last)))
  16. (define-key persp-mode-map (kbd "C-x p -") 'custom-persp-last)
  17. (provide 'conf-perspective)