From 1228134db5d30a3365f3d3f8bba79dc73fb85b85 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Fri, 25 Aug 2017 23:09:43 +0300 Subject: [PATCH] Add desktop saving on exit, set up windows --- .emacs.desktop | 43 +++++++++++++++++++ .emacs.desktop.lock | 1 + behaviour.el | 5 +++ desktops/.emacs.desktop | 55 +++++++++++++++++++++++++ emacs | 2 +- functions.el | 1 + layouts/coding_with_magit.window-layout | 1 + layouts/small_screen.window-layout | 1 + packages.el | 8 ---- windows.el | 31 ++++++++------ 10 files changed, 126 insertions(+), 22 deletions(-) create mode 100644 .emacs.desktop create mode 100644 .emacs.desktop.lock create mode 100644 desktops/.emacs.desktop create mode 100644 layouts/coding_with_magit.window-layout create mode 100644 layouts/small_screen.window-layout diff --git a/.emacs.desktop b/.emacs.desktop new file mode 100644 index 0000000..e53c589 --- /dev/null +++ b/.emacs.desktop @@ -0,0 +1,43 @@ +;; -*- mode: emacs-lisp; coding: emacs-mule; -*- +;; -------------------------------------------------------------------------- +;; Desktop File for Emacs +;; -------------------------------------------------------------------------- +;; Created Fri Aug 25 23:09:02 2017 +;; Desktop file format version 208 +;; Emacs version 25.2.1 + +;; Global section: +(setq desktop-saved-frameset [frameset 1 (22944 33758 121905 0) (desktop . "208") "maciej@INBNOT022.local" nil nil ((((font-backend mac-ct) (fontsize . 0) (font . "-*-Hasklig-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1") (border-width . 0) (internal-border-width . 2) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . "#383838") (background-color . "#f8f8f8") (line-spacing) (left-fringe . 8) (right-fringe . 8) (menu-bar-lines . 0) (tool-bar-lines . 0) (title) (icon-type) (auto-raise) (auto-lower) (cursor-type . box) (scroll-bar-width . 0) (scroll-bar-height . 0) (alpha) (fullscreen . fullboth) (display-type . color) (background-mode . light) (cursor-color . "#ab4642") (environment) (border-color . "#b8b8b8") (frameset--id . "832B-AC8B-938A-1FAC") (frameset--mini t . t) (modeline . t) (minibuffer . t) (unsplittable) (right-divider-width . 0) (bottom-divider-width . 0) (icon-name) (display . "INBNOT022.local") (explicit-name) (tool-bar-position . top) (visibility . t) (height . 75) (width . 282) (left . 1) (top . 6)) ((min-height . 8) (min-width . 20) (min-height-ignore . 4) (min-width-ignore . 11) (min-height-safe . 2) (min-width-safe . 4) (min-pixel-height . 152) (min-pixel-width . 180) (min-pixel-height-ignore . 76) (min-pixel-width-ignore . 99) (min-pixel-height-safe . 38) (min-pixel-width-safe . 36)) vc (pixel-width . 2554) (pixel-height . 1406) (total-width . 284) (total-height . 74) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (hc (pixel-width . 2554) (pixel-height . 1159) (total-width . 284) (total-height . 61) (normal-height . 0.8285714285714285) (normal-width . 1.0) (combination-limit) (leaf (pixel-width . 1683) (pixel-height . 1159) (total-width . 187) (total-height . 61) (normal-height . 1.0) (normal-width . 0.6603260869565217) (parameters (purpose-dedicated . t)) (buffer "functions.el" (selected) (hscroll . 0) (fringes 8 8 nil) (margins 2 . 1) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1453) (start . 1))) (leaf (last . t) (pixel-width . 871) (pixel-height . 1159) (total-width . 97) (total-height . 61) (normal-height . 1.0) (normal-width . 0.33967391304347827) (parameters (purpose-dedicated . t)) (buffer "*pu-dummy-test*" (selected) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1) (start . 1)))) (leaf (last . t) (pixel-width . 2554) (pixel-height . 247) (total-width . 284) (total-height . 13) (normal-height . 0.17142857142857143) (normal-width . 1.0) (parameters (purpose-dedicated . t)) (buffer "*magit: .emacs.d" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 188) (start . 1)))))]) +(setq desktop-missing-file-warning nil) +(setq tags-file-name nil) +(setq tags-table-list nil) +(setq search-ring nil) +(setq regexp-search-ring nil) +(setq register-alist nil) +(setq file-name-history nil) + +;; Buffer section -- buffers listed in same order as in buffer list: +(desktop-create-buffer 208 + "/Users/maciej/.emacs.d/windows.el" + "windows.el" + 'emacs-lisp-mode + '(diff-hl-mode diff-hl-flydiff-mode diff-hl-margin-mode diff-hl-margin-minor-mode linum-mode column-enforce-mode whitespace-mode yas-minor-mode rainbow-delimiters-mode rainbow-mode company-mode projectile-mode undo-tree-mode auto-revert-mode purpose-mode flycheck-mode) + 307 + '(301 nil) + nil + nil + '((tab-width . 2) (buffer-file-coding-system . prefer-utf-8-unix) (overwrite-mode)) + '((mark-ring (242 165)))) + +(desktop-create-buffer 208 + "/Users/maciej/.emacs.d/functions.el" + "functions.el" + 'emacs-lisp-mode + '(diff-hl-mode diff-hl-flydiff-mode diff-hl-margin-mode diff-hl-margin-minor-mode linum-mode column-enforce-mode whitespace-mode yas-minor-mode rainbow-delimiters-mode rainbow-mode company-mode projectile-mode undo-tree-mode auto-revert-mode purpose-mode flycheck-mode) + 1453 + '(1453 nil) + nil + nil + '((tab-width . 2) (buffer-file-coding-system . prefer-utf-8-unix) (overwrite-mode)) + '((mark-ring nil))) + diff --git a/.emacs.desktop.lock b/.emacs.desktop.lock new file mode 100644 index 0000000..57e9f4c --- /dev/null +++ b/.emacs.desktop.lock @@ -0,0 +1 @@ +98515 \ No newline at end of file diff --git a/behaviour.el b/behaviour.el index 930babb..1bc2c5d 100644 --- a/behaviour.el +++ b/behaviour.el @@ -26,6 +26,8 @@ (setq ns-pop-up-frames nil) ; Enable diff highlights (useful for git) +(require 'diff-hl) + (global-diff-hl-mode) (diff-hl-flydiff-mode) (diff-hl-margin-mode) @@ -48,6 +50,9 @@ ;; Trim trailing whitespace on save (add-hook 'before-save-hook 'delete-trailing-whitespace) + +;; Save desktop session on exit +(desktop-save-mode 1) ;;;;;;;;;;;;;;;;;;;;;;;; code behaviour ;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Add ruler at 80, do not wrap lines (can be overwritten later) diff --git a/desktops/.emacs.desktop b/desktops/.emacs.desktop new file mode 100644 index 0000000..4d8bb7e --- /dev/null +++ b/desktops/.emacs.desktop @@ -0,0 +1,55 @@ +;; -*- mode: emacs-lisp; coding: emacs-mule; -*- +;; -------------------------------------------------------------------------- +;; Desktop File for Emacs +;; -------------------------------------------------------------------------- +;; Created Fri Aug 25 23:06:00 2017 +;; Desktop file format version 208 +;; Emacs version 25.2.1 + +;; Global section: +(setq desktop-saved-frameset [frameset 1 (22944 33576 846692 0) (desktop . "208") "maciej@INBNOT022.local" nil nil ((((font-backend mac-ct) (fontsize . 0) (font . "-*-Hasklig-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1") (border-width . 0) (internal-border-width . 2) (vertical-scroll-bars) (horizontal-scroll-bars) (foreground-color . "#383838") (background-color . "#f8f8f8") (line-spacing) (left-fringe . 8) (right-fringe . 8) (menu-bar-lines . 0) (tool-bar-lines . 0) (title) (icon-type) (auto-raise) (auto-lower) (cursor-type . box) (scroll-bar-width . 0) (scroll-bar-height . 0) (alpha) (fullscreen . fullboth) (display-type . color) (background-mode . light) (cursor-color . "#ab4642") (environment) (border-color . "#b8b8b8") (frameset--id . "89A7-C3ED-3B20-205D") (frameset--mini t . t) (height . 75) (width . 282) (modeline . t) (minibuffer . t) (unsplittable) (left . 1) (top . 6) (right-divider-width . 0) (bottom-divider-width . 0) (icon-name) (visibility . t) (display . "INBNOT022.local") (explicit-name) (tool-bar-position . top)) ((min-height . 8) (min-width . 20) (min-height-ignore . 4) (min-width-ignore . 11) (min-height-safe . 2) (min-width-safe . 4) (min-pixel-height . 152) (min-pixel-width . 180) (min-pixel-height-ignore . 76) (min-pixel-width-ignore . 99) (min-pixel-height-safe . 38) (min-pixel-width-safe . 36)) vc (pixel-width . 2554) (pixel-height . 1406) (total-width . 284) (total-height . 74) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (hc (pixel-width . 2554) (pixel-height . 1159) (total-width . 284) (total-height . 61) (normal-height . 0.8285714285714286) (normal-width . 1.0) (combination-limit) (leaf (pixel-width . 1681) (pixel-height . 1159) (total-width . 187) (total-height . 61) (normal-height . 1.0) (normal-width . 0.6576086956521738) (parameters (purpose-dedicated . t)) (buffer "functions.el" (selected . t) (hscroll . 0) (fringes 8 8 nil) (margins 2 . 1) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1451) (start . 1))) (leaf (last . t) (pixel-width . 873) (pixel-height . 1159) (total-width . 97) (total-height . 61) (normal-height . 1.0) (normal-width . 0.3423913043478261) (parameters (purpose-dedicated . t)) (buffer "*pu-dummy-test*" (selected) (hscroll . 0) (fringes 8 8 nil) (margins nil) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1) (start . 1)))) (leaf (last . t) (pixel-width . 2554) (pixel-height . 247) (total-width . 284) (total-height . 13) (normal-height . 0.17142857142857143) (normal-width . 1.0) (parameters (purpose-dedicated . t)) (buffer "*Compile-Log*" (selected) (hscroll . 0) (fringes 8 8 nil) (margins 3) (scroll-bars nil 0 t nil 0 nil) (vscroll . 0) (dedicated) (point . 11070) (start . 10855)))))]) +(setq desktop-missing-file-warning nil) +(setq tags-file-name nil) +(setq tags-table-list nil) +(setq search-ring nil) +(setq regexp-search-ring nil) +(setq register-alist nil) +(setq file-name-history '("~/.emacs.d/desktops")) + +;; Buffer section -- buffers listed in same order as in buffer list: +(desktop-create-buffer 208 + "/Users/maciej/.emacs.d/functions.el" + "functions.el" + 'emacs-lisp-mode + '(diff-hl-mode diff-hl-flydiff-mode diff-hl-margin-mode diff-hl-margin-minor-mode linum-mode column-enforce-mode whitespace-mode yas-minor-mode rainbow-delimiters-mode rainbow-mode company-mode projectile-mode undo-tree-mode auto-revert-mode purpose-mode flycheck-mode) + 1451 + '(1400 nil) + nil + nil + '((tab-width . 2) (buffer-file-coding-system . prefer-utf-8-unix) (overwrite-mode)) + '((mark-ring (1400 1400 1400 1400 1400 1400 1400 1400 1400 1400 1505 1506 1529 1400 1533 1400)))) + +(desktop-create-buffer 208 + "/Users/maciej/.emacs.d/behaviour.el" + "behaviour.el" + 'emacs-lisp-mode + '(diff-hl-mode diff-hl-flydiff-mode diff-hl-margin-mode diff-hl-margin-minor-mode linum-mode column-enforce-mode whitespace-mode yas-minor-mode rainbow-delimiters-mode rainbow-mode company-mode projectile-mode undo-tree-mode auto-revert-mode purpose-mode flycheck-mode) + 3641 + '(3641 nil) + nil + nil + '((tab-width . 2) (buffer-file-coding-system . prefer-utf-8-unix) (overwrite-mode) (truncate-lines . t)) + '((mark-ring (1346 1289 1234 1234 1234)))) + +(desktop-create-buffer 208 + "/Users/maciej/.emacs.d/windows.el" + "windows.el" + 'emacs-lisp-mode + '(diff-hl-mode diff-hl-flydiff-mode diff-hl-margin-mode diff-hl-margin-minor-mode linum-mode column-enforce-mode whitespace-mode yas-minor-mode rainbow-delimiters-mode rainbow-mode company-mode projectile-mode undo-tree-mode auto-revert-mode purpose-mode flycheck-mode) + 1 + '(nil nil) + nil + nil + '((tab-width . 2) (buffer-file-coding-system . prefer-utf-8-unix) (overwrite-mode)) + '((mark-ring nil))) + diff --git a/emacs b/emacs index e2a231d..7a59959 100644 --- a/emacs +++ b/emacs @@ -22,7 +22,7 @@ '(hl-paren-colors (quote ("#ecf0f1" "#ecf0f1" "#c0392b"))) '(package-selected-packages (quote - (window-purpose rspec-mode robe elm-yasnippets elm-mode company-jedi pyenv pyenv-mode toml-mode color-theme-approximate smex yaml-mode web-mode ujelly-theme smart-mode-line scala-mode rvm ruby-end rainbow-mode rainbow-delimiters racer noctilux-theme monokai-theme markdown-mode less-css-mode json-reformat jade-mode indent-guide helm-themes helm-projectile helm-ag haskell-mode haml-mode groovy-mode flycheck flatui-theme exec-path-from-shell evil-nerd-commenter evil-magit evil-leader elpy dumb-jump dockerfile-mode diff-hl column-enforce-mode base16-theme avk-emacs-themes atom-one-dark-theme all-the-icons alchemist aggressive-indent ag))) + (window-purpose))) '(safe-local-variable-values (quote ((encoding . utf-8)))) '(sml/active-background-color "#34495e") '(sml/active-foreground-color "#ecf0f1") diff --git a/functions.el b/functions.el index d8201a3..94f22f4 100644 --- a/functions.el +++ b/functions.el @@ -40,5 +40,6 @@ nil t)) +(add-hook 'kill-emacs-hook 'byte-compile-init-dir) (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save) ;;; functions.el ends here diff --git a/layouts/coding_with_magit.window-layout b/layouts/coding_with_magit.window-layout new file mode 100644 index 0000000..fc07e92 --- /dev/null +++ b/layouts/coding_with_magit.window-layout @@ -0,0 +1 @@ +(t (0 0 284 74) (nil (0 0 284 62) (:purpose code :purpose-dedicated t :width 0.6631205673758865 :height 0.8266666666666667 :edges (0.0 0.0 0.6631205673758865 0.8266666666666667)) (:purpose test :purpose-dedicated t :width 0.34397163120567376 :height 0.8266666666666667 :edges (0.6631205673758865 0.0 1.0070921985815602 0.8266666666666667))) (:purpose tools :purpose-dedicated t :width 1.0070921985815602 :height 0.16 :edges (0.0 0.8266666666666667 1.0070921985815602 0.9866666666666667))) \ No newline at end of file diff --git a/layouts/small_screen.window-layout b/layouts/small_screen.window-layout new file mode 100644 index 0000000..bce5831 --- /dev/null +++ b/layouts/small_screen.window-layout @@ -0,0 +1 @@ +(t (0 0 186 54) (:purpose code :purpose-dedicated t :width 1.0108695652173914 :height 0.8 :edges (0.0 0.0 1.0108695652173914 0.8)) (:purpose tools :purpose-dedicated t :width 1.0108695652173914 :height 0.18181818181818182 :edges (0.0 0.8 1.0108695652173914 0.9818181818181818))) \ No newline at end of file diff --git a/packages.el b/packages.el index 73587ff..943655d 100644 --- a/packages.el +++ b/packages.el @@ -127,18 +127,10 @@ (package-refresh-contents) (package-install 'ujelly-theme)) -(unless (package-installed-p 'avk-emacs-themes) - (package-refresh-contents) - (package-install 'avk-emacs-themes)) - (unless (package-installed-p 'flatui-theme) (package-refresh-contents) (package-install 'flatui-theme)) -(unless (package-installed-p 'all-the-icons) - (package-refresh-contents) - (package-install 'all-the-icons)) - (unless (package-installed-p 'atom-one-dark-theme) (package-refresh-contents) (package-install 'atom-one-dark-theme)) diff --git a/windows.el b/windows.el index d8cdf32..bd767ed 100644 --- a/windows.el +++ b/windows.el @@ -2,25 +2,30 @@ ;;; Commentary: ;;; Windows management things, mostly with purpose ;;; Code: +(require 'window-purpose) (purpose-mode t) +;; Ruby specific (add-to-list 'purpose-user-regexp-purposes '("_spec.rb\\(<.*>\\)?$" . test)) -(add-to-list 'purpose-user-mode-purposes '(ruby-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(yaml-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(emacs-lisp-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(web-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(html-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(scss-mode . test)) -(add-to-list 'purpose-user-mode-purposes '(css-mode . test)) -(add-to-list 'purpose-user-mode-purposes '(javascript-mode . edit)) -(add-to-list 'purpose-user-mode-purposes '(magit-mode . tr)) -(add-to-list 'purpose-user-mode-purposes '(dired-mode . tr)) -(add-to-list 'purpose-user-mode-purposes '(compilation-mode . tr)) -(add-to-list 'purpose-user-mode-purposes '(help-mode . br)) -(add-to-list 'purpose-user-mode-purposes '(special-mode . br)) +(add-to-list 'purpose-user-regexp-purposes + '("COMMIT_EDITMSG\\(<.*>\\)?$" . code)) +(add-to-list 'purpose-user-mode-purposes '(ruby-mode . code)) +(add-to-list 'purpose-user-mode-purposes '(yaml-mode . code)) +;; Tools +(add-to-list 'purpose-user-mode-purposes '(magit-mode . tools)) +(add-to-list 'purpose-user-mode-purposes '(help-mode . tools)) +(add-to-list 'purpose-user-mode-purposes '(helm-mode . tools)) +(add-to-list 'purpose-user-mode-purposes '(compilation-mode . tools)) + +;; Markdown +(add-to-list 'purpose-user-mode-purposes '(markdown-mode . code)) + +;; Elisp +(add-to-list 'purpose-user-mode-purposes '(emacs-lisp-mode . code)) (setq purpose-use-default-configuration nil) (purpose-compile-user-configuration) +(purpose-load-window-layout 'coding_with_magit) ;;; windows.el ends here