2014-11-25 21:15:36 +00:00
|
|
|
(defvar perspectives-packages
|
|
|
|
'(
|
|
|
|
perspective
|
2014-11-25 22:20:11 +00:00
|
|
|
persp-projectile
|
2014-11-25 21:15:36 +00:00
|
|
|
)
|
|
|
|
"List of all packages to install and/or initialize. Built-in packages
|
|
|
|
which require an initialization must be listed explicitly in the list.")
|
|
|
|
|
|
|
|
(defvar perspectives-excluded-packages '()
|
|
|
|
"List of packages to exclude.")
|
|
|
|
|
|
|
|
(defun perspectives/init-perspective ()
|
|
|
|
(use-package perspective
|
2014-11-26 20:00:12 +00:00
|
|
|
:commands (custom-persp
|
|
|
|
persp-add-buffer
|
|
|
|
persp-set-buffer
|
|
|
|
persp-kill
|
|
|
|
persp-remove-buffer
|
|
|
|
persp-cycle-next
|
|
|
|
persp-cycle-prev
|
|
|
|
persp-rename
|
2014-11-28 03:07:02 +00:00
|
|
|
persp-switch
|
|
|
|
projectile-persp-bridge
|
|
|
|
)
|
2014-11-25 21:15:36 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2014-11-26 20:00:12 +00:00
|
|
|
;; muh perspectives
|
|
|
|
(defun custom-persp/emacs ()
|
|
|
|
(interactive)
|
|
|
|
(custom-persp ".emacs.d"
|
|
|
|
(find-file "~/.emacs.d/init.el")))
|
2015-03-13 07:34:27 +00:00
|
|
|
|
2014-11-26 20:00:12 +00:00
|
|
|
(defun custom-persp/org ()
|
|
|
|
(interactive)
|
|
|
|
(custom-persp "@org"
|
|
|
|
(find-file (first org-agenda-files))))
|
|
|
|
|
2015-03-13 07:34:27 +00:00
|
|
|
(defun custom-persp/rcirc ()
|
|
|
|
(interactive)
|
|
|
|
(custom-persp "@RCIRC" (rcirc-config)))
|
|
|
|
(evil-leader/set-key
|
|
|
|
"Poi" 'custom-persp/rcirc)
|
|
|
|
|
2014-12-01 02:05:39 +00:00
|
|
|
(spacemacs/declare-prefix "P" "perspectives")
|
|
|
|
(spacemacs/declare-prefix "Po" "custom-perspectives")
|
2014-11-25 21:15:36 +00:00
|
|
|
(evil-leader/set-key
|
2014-11-26 20:00:12 +00:00
|
|
|
"Pa" 'persp-add-buffer
|
|
|
|
"PA" 'persp-set-buffer
|
|
|
|
"Pc" 'persp-kill
|
|
|
|
"Pk" 'persp-remove-buffer
|
2015-01-09 17:01:44 +00:00
|
|
|
"Pn" 'persp-next
|
2014-11-26 20:00:12 +00:00
|
|
|
"Poe" 'custom-persp/emacs
|
|
|
|
"Poo" 'custom-persp/org
|
2015-01-09 17:01:44 +00:00
|
|
|
"Pp" 'persp-prev
|
2014-11-26 20:00:12 +00:00
|
|
|
"Pr" 'persp-rename
|
|
|
|
"Ps" 'persp-switch))
|
2014-11-25 21:15:36 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2014-11-26 20:00:12 +00:00
|
|
|
(persp-mode t)
|
2014-11-25 21:15:36 +00:00
|
|
|
;; loading code for our custom perspectives
|
|
|
|
;; taken from Magnar Sveen
|
|
|
|
(defmacro custom-persp (name &rest body)
|
|
|
|
`(let ((initialize (not (gethash ,name perspectives-hash)))
|
|
|
|
(current-perspective persp-curr))
|
|
|
|
(persp-switch ,name)
|
|
|
|
(when initialize ,@body)
|
|
|
|
(setq persp-last current-perspective)))
|
|
|
|
;; Jump to last perspective
|
|
|
|
;; taken from Magnar Sveen
|
|
|
|
(defun custom-persp-last ()
|
|
|
|
(interactive)
|
|
|
|
(persp-switch (persp-name persp-last)))
|
2015-01-09 17:01:44 +00:00
|
|
|
;; (defun persp-cycle-next ()
|
|
|
|
;; "Cycle throught the available perspectives."
|
|
|
|
;; (interactive)
|
|
|
|
;; (let ((next-pos (1+ (persp-name persp-curr)))
|
|
|
|
;; (list-size (length (persp-all-names))))
|
|
|
|
;; (cond ((eq 1 list-size) (persp-switch nil))
|
|
|
|
;; ((>= next-pos list-size) (persp-switch (nth 0 (persp-all-names))))
|
|
|
|
;; (t (persp-next)))))
|
|
|
|
;; (defun persp-cycle-prev ()
|
|
|
|
;; "Cycle throught the available perspectives."
|
|
|
|
;; (interactive)
|
|
|
|
;; (let ((next-pos (- (persp-name persp-curr) 1))
|
|
|
|
;; (list-size (length (persp-all-names))))
|
|
|
|
;; (cond ((eq 1 list-size) (persp-switch nil))
|
|
|
|
;; ((< next-pos 0) (persp-switch (nth (- list-size 1) (persp-all-names))))
|
|
|
|
;; (t (persp-prev)))))
|
2014-11-28 03:07:02 +00:00
|
|
|
(eval-after-load 'persp-projectile
|
2014-11-26 20:00:12 +00:00
|
|
|
'(projectile-persp-bridge helm-projectile))
|
2014-11-25 21:15:36 +00:00
|
|
|
)
|
2014-11-26 20:00:12 +00:00
|
|
|
))
|