2016-05-11 23:53:51 -04:00
|
|
|
;;; core-workgroups.el
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2016-01-02 15:07:01 -05:00
|
|
|
;; I use workgroups to accomplish two things:
|
|
|
|
;; 1. Vim-like tab emulation (type :tabs to see a list of tabs -- maybe I'll add some
|
|
|
|
;; code to make a permanent frame header to display these some day)
|
2016-04-23 22:08:46 -04:00
|
|
|
;; 2. Session persistence (with :ss and :sl)
|
2016-01-02 15:07:01 -05:00
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(defvar doom-wg-frames '()
|
2016-04-20 21:36:32 -04:00
|
|
|
"A list of all the frames opened as separate workgroups. See
|
|
|
|
defuns/defuns-workgroups.el.")
|
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(defvar doom-wg-names '()
|
2016-04-20 21:36:32 -04:00
|
|
|
"A list of fixed names for workgroups. If a name is set, workgroup names aren't
|
|
|
|
automatically renamed to the project name.")
|
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(use-package workgroups2
|
2015-11-30 05:32:55 -05:00
|
|
|
:when (display-graphic-p)
|
2015-06-15 09:05:52 +02:00
|
|
|
:init
|
2015-11-30 05:32:55 -05:00
|
|
|
(setq-default
|
2016-05-20 22:37:30 -04:00
|
|
|
wg-session-file (concat doom-temp-dir "/workgroups/last")
|
|
|
|
wg-workgroup-directory (concat doom-temp-dir "/workgroups/")
|
2016-04-23 22:08:46 -04:00
|
|
|
wg-first-wg-name "*untitled*"
|
2016-03-15 23:33:52 -04:00
|
|
|
wg-session-load-on-start nil
|
2016-04-23 22:08:46 -04:00
|
|
|
wg-mode-line-display-on nil
|
2015-12-11 16:51:04 -05:00
|
|
|
wg-mess-with-buffer-list nil
|
2016-04-23 22:08:46 -04:00
|
|
|
wg-emacs-exit-save-behavior 'save ; Options: 'save 'ask nil
|
2015-11-30 05:32:55 -05:00
|
|
|
wg-workgroups-mode-exit-save-behavior 'save
|
|
|
|
wg-log-level 0
|
|
|
|
|
2016-03-15 23:33:52 -04:00
|
|
|
;; NOTE: Some of these make workgroup-restoration unstable
|
|
|
|
wg-restore-mark t
|
2016-04-23 22:08:46 -04:00
|
|
|
wg-restore-frame-position t
|
2016-03-28 21:40:21 -04:00
|
|
|
wg-restore-remote-buffers nil
|
|
|
|
wg-restore-scroll-bars nil
|
|
|
|
wg-restore-fringes nil
|
|
|
|
wg-restore-margins nil
|
|
|
|
wg-restore-point-max t ; Throws silent errors if non-nil
|
2015-12-29 23:14:24 -05:00
|
|
|
|
2016-05-07 22:05:00 -04:00
|
|
|
wg-list-display-decor-divider " "
|
|
|
|
wg-list-display-decor-left-brace ""
|
|
|
|
wg-list-display-decor-right-brace "| "
|
|
|
|
wg-list-display-decor-current-left ""
|
|
|
|
wg-list-display-decor-current-right ""
|
|
|
|
wg-list-display-decor-previous-left ""
|
|
|
|
wg-list-display-decor-previous-right "")
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(add-hook 'emacs-startup-hook 'workgroups-mode)
|
|
|
|
|
2016-03-01 02:05:04 -05:00
|
|
|
:config
|
2016-05-07 22:05:00 -04:00
|
|
|
;; Remember fixed workgroup names between sessions
|
2016-05-20 22:37:30 -04:00
|
|
|
(push 'doom-wg-names savehist-additional-variables)
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2016-04-20 21:36:32 -04:00
|
|
|
;; `wg-mode-line-display-on' wasn't enough
|
2015-12-21 05:44:44 -05:00
|
|
|
(advice-add 'wg-change-modeline :override 'ignore)
|
2015-11-25 06:00:49 -05:00
|
|
|
|
2016-03-23 11:51:29 -04:00
|
|
|
;; Don't remember popup and neotree windows
|
2016-05-20 22:37:30 -04:00
|
|
|
(add-hook 'kill-emacs-hook 'doom|wg-cleanup)
|
2015-12-29 23:37:43 -05:00
|
|
|
|
2016-04-23 22:08:46 -04:00
|
|
|
(after! projectile
|
|
|
|
;; Create a new workgroup on switch-project
|
2016-05-20 22:37:30 -04:00
|
|
|
(setq projectile-switch-project-action 'doom/wg-projectile-switch-project))
|
2016-04-23 22:08:46 -04:00
|
|
|
|
2015-12-29 23:37:43 -05:00
|
|
|
;; This helps abstract some of the underlying functions away, just in case I want to
|
|
|
|
;; switch to a different package in the future, like persp-mode, eyebrowse or wconf.
|
2016-05-20 22:37:30 -04:00
|
|
|
(defalias 'doom/tab-display 'doom/workgroup-display)
|
|
|
|
(defalias 'doom/helm-tabs 'doom:helm-wg)
|
|
|
|
(defalias 'doom/close-window-or-tab 'doom/close-window-or-workgroup)
|
|
|
|
(defalias 'doom:tab-create 'doom:workgroup-new)
|
|
|
|
(defalias 'doom:tab-rename 'doom:workgroup-rename)
|
|
|
|
(defalias 'doom:kill-tab 'doom:workgroup-delete)
|
|
|
|
(defalias 'doom:kill-other-tabs 'doom:kill-other-workgroups)
|
|
|
|
(defalias 'doom:switch-to-tab 'doom:switch-to-workgroup-at-index)
|
|
|
|
(defalias 'doom:switch-to-tab-left 'wg-switch-to-workgroup-left)
|
|
|
|
(defalias 'doom:switch-to-tab-right 'wg-switch-to-workgroup-right)
|
|
|
|
(defalias 'doom:switch-to-tab-last 'wg-switch-to-previous-workgroup))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2016-05-11 23:53:51 -04:00
|
|
|
(provide 'core-workgroups)
|
|
|
|
;;; core-workgroups.el ends here
|