2015-04-19 03:40:24 +00:00
|
|
|
(setq perspectives-packages
|
2014-11-25 21:15:36 +00:00
|
|
|
'(
|
|
|
|
perspective
|
2014-11-25 22:20:11 +00:00
|
|
|
persp-projectile
|
2015-04-19 03:40:24 +00:00
|
|
|
))
|
2014-11-25 21:15:36 +00:00
|
|
|
|
|
|
|
(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
|
2015-03-14 00:06:56 +00:00
|
|
|
;; persp-cycle-next
|
|
|
|
;; persp-cycle-prev
|
2014-11-26 20:00:12 +00:00
|
|
|
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"
|
2015-03-21 13:55:49 +00:00
|
|
|
(find-file (locate-user-emacs-file "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)
|
2015-03-16 02:39:27 +00:00
|
|
|
(custom-persp "@RCIRC" (spacemacs/rcirc nil)))
|
2015-03-13 07:34:27 +00:00
|
|
|
|
2015-03-15 04:51:22 +00:00
|
|
|
(spacemacs/declare-prefix "L" "layouts")
|
|
|
|
(spacemacs/declare-prefix "Lo" "custom-perspectives")
|
2014-11-25 21:15:36 +00:00
|
|
|
(evil-leader/set-key
|
2015-03-15 04:51:22 +00:00
|
|
|
"La" 'persp-add-buffer
|
|
|
|
"LA" 'persp-set-buffer
|
|
|
|
"Lc" 'persp-kill
|
|
|
|
"Lk" 'persp-remove-buffer
|
|
|
|
"Ln" 'persp-next
|
|
|
|
"Loe" 'custom-persp/emacs
|
|
|
|
"Loi" 'custom-persp/rcirc
|
|
|
|
"Loo" 'custom-persp/org
|
|
|
|
"Lp" 'persp-prev
|
|
|
|
"Lr" 'persp-rename
|
|
|
|
"Ls" '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)))
|
2015-03-14 00:06:56 +00:00
|
|
|
|
2015-07-28 14:01:30 +00:00
|
|
|
(add-hook 'emacs-startup-hook '(lambda ()
|
2015-03-14 00:06:56 +00:00
|
|
|
(persp-rename "@spacemacs")))
|
2014-11-25 21:15:36 +00:00
|
|
|
;; Jump to last perspective
|
|
|
|
;; taken from Magnar Sveen
|
|
|
|
(defun custom-persp-last ()
|
|
|
|
(interactive)
|
|
|
|
(persp-switch (persp-name persp-last)))
|
2015-03-14 00:06:56 +00:00
|
|
|
|
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-25 21:15:36 +00:00
|
|
|
)
|
2014-11-26 20:00:12 +00:00
|
|
|
))
|
2015-03-14 00:06:56 +00:00
|
|
|
|
|
|
|
(defun perspectives/init-persp-projectile ()
|
|
|
|
(use-package persp-projectile
|
2015-03-15 04:34:57 +00:00
|
|
|
:if perspective-enable-persp-projectile
|
2015-03-14 00:06:56 +00:00
|
|
|
:config
|
2015-03-15 04:34:57 +00:00
|
|
|
(progn
|
2015-03-14 00:06:56 +00:00
|
|
|
(projectile-persp-bridge helm-projectile-switch-project)
|
|
|
|
|
|
|
|
(evil-leader/set-key
|
2015-04-03 22:28:15 +00:00
|
|
|
"pp" 'spacemacs/persp-switch-project)
|
2015-03-14 00:06:56 +00:00
|
|
|
|
|
|
|
(defun spacemacs/persp-switch-project ()
|
|
|
|
(interactive)
|
|
|
|
(evil-leader/set-key
|
2015-04-03 22:28:15 +00:00
|
|
|
"pp" 'helm-projectile-switch-project)
|
2015-03-14 00:06:56 +00:00
|
|
|
(find-file "~/.spacemacs")
|
|
|
|
(helm-projectile-switch-project)
|
|
|
|
(persp-add-buffer "*spacemacs*")
|
2015-03-15 04:34:57 +00:00
|
|
|
(persp-kill "@spacemacs")))))
|