From afff5eeed28140023bf351e87e09ab766bfb0699 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 6 Nov 2018 08:54:51 +0100 Subject: [PATCH] +eyebrowse --- .emacs | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 12 deletions(-) diff --git a/.emacs b/.emacs index dde4911..a14fa62 100644 --- a/.emacs +++ b/.emacs @@ -1,4 +1,4 @@ -;; Toms Emacs Config - portable - version (20181030.01) -*-emacs-lisp-*- +;; Toms Emacs Config - portable - version (20181105.01) -*-emacs-lisp-*- ;; * Introduction ;; This is my emacs config, it is more than twenty years old. It @@ -674,6 +674,10 @@ ;; 20181030.01 ;; - fixed windows hydra flip window call +;; 20181105.01 +;; - added eyebrowse with config and hydra, prefix: C-x C-x + + ;; ** TODO @@ -702,7 +706,7 @@ ;; My emacs config has a version (consisting of a timestamp with a ;; serial), which I display in the mode line. So I can clearly see, if ;; I'm using an outdated config somewhere. -(defvar tvd-emacs-version "20181030.01") +(defvar tvd-emacs-version "20181105.01") ;; -------------------------------------------------------------------------------- @@ -5270,7 +5274,7 @@ _u_: Windows Undo _r_: Windows Redo ^^ _l_: Adjust Background brighter _i_: Invert Colors ^^ _b_: Adjust Background darker -_h_: Toggle Highlight Line Mode +_h_: Toggle Highlight Line Mode ^^ _e_: Eyebrowse Workspaces (C-x C-x) _n_: Toogle Line Number Mode ^^------------------------------------------------------------------------ @@ -5291,6 +5295,7 @@ Reach this hydra with ("d" hydra-windows-resize/body nil) ("w" hydra-windows-resize/body nil) ("s" hydra-windows-resize/body nil) + ("e" hydra-eyebrowse/body nil) ("h" hl-line-mode nil) ("n" linum-mode nil) ("q" nil nil :color red)) @@ -5298,6 +5303,71 @@ Reach this hydra with (global-set-key (kbd "C-x w") 'hydra-windows/body) +;; *** Eyebrowse Workspaces +;; workspace configuration, like desktops. Seems to be a good implementation, w/o save though + +;; "prefix key" has to be set before loading, keep in mind, that +;; if you change it here, you need to change it below as well! +(setq eyebrowse-keymap-prefix (kbd "C-x C-x")) +(global-unset-key (kbd "C-x C-x")) + +(require 'eyebrowse) + +(defun tvd-new-eyebrowse-workspace () + "Create new scratch buffer and ask for a name" + (interactive) + (eyebrowse-rename-window-config (eyebrowse--get 'current-slot) (read-string "Workspace: ")) + (autoscratch-buffer)) + +;; always enable +(eyebrowse-mode t) +(toggle-debug-on-error) +(setq eyebrowse-new-workspace 'tvd-new-eyebrowse-workspace + eyebrowse-switch-back-and-forth t + eyebrowse-wrap-around t + eyebrowse-mode-line-style t + eyebrowse-slot-format "%s:init") + +;; add a hydra, just in case, it contains hydra commands and hints +;; about the actual key bindings, it's also being refered from +;; hydra-window/body with "e" +(defhydra hydra-eyebrowse (:color blue) + " +^Eyebrowse Workspace Management^ +^^-------------------------------------- +_l_: last window (C-x C-x C-x) +_n_: next window (C-x C-x ) +_p_: prev window (C-x C-x ) +_x_: close workspace (C-x C-x q) +_t_: rename workspace (C-x C-x t) +_c_: create workspace (C-x C-x n) + +Use C-x C-x to access eyebrowse directly. +" + ("l" eyebrowse-last-window-config nil) + ("n" eyebrowse-next-window-config nil) + ("p" eyebrowse-prev-window-config nil) + ("x" eyebrowse-close-window-config nil) + ("t" eyebrowse-rename-window-config nil) + ("c" eyebrowse-create-window-config nil) + ("q" nil nil :color red)) + +;;Modifying the eyebrowse keymap directly doesn't work because it's +;; not setup correctly. I sent a pull request to fix this: +;; https://github.com/wasamasa/eyebrowse/pull/94, however, vaslilly choosed +;; not to accept it. So, I need to configure the whole chords for every +;; function I use AND set the "prefix key" using the weird way above +;; (before loading). +(global-set-key (kbd "C-x C-x C-x") 'eyebrowse-last-window-config) +(global-set-key (kbd "C-x C-x ") 'eyebrowse-next-window-config) +(global-set-key (kbd "C-x C-x ") 'eyebrowse-prev-window-config) +(global-set-key (kbd "C-x C-x q") 'eyebrowse-close-window-config) +(global-set-key (kbd "C-x C-x t") 'eyebrowse-rename-window-config) +(global-set-key (kbd "C-x C-x n") 'eyebrowse-create-window-config) +(global-set-key (kbd "C-x C-x ?") 'hydra-eyebrowse/body) + +;; There's also some face config, see defcustom at end of file! + ;; ** Emacs Interface ;; *** Parens @@ -5854,6 +5924,9 @@ converted to PDF at the same location." " [" tvd-emacs-version "] " + ; added because of eyebrowse + mode-line-misc-info + '(:eval (propertize (if (eq defining-kbd-macro t) "[REC]" @@ -5913,15 +5986,7 @@ converted to PDF at the same location." '(outline-4 ((t (:height 1.05 :foreground "DodgerBlue3" :underline t)))) '(region ((t (:foreground "Aquamarine" :background "Darkblue")))) '(secondary-selection ((t (:foreground "Green" :background "darkslateblue")))) - '(wg-command-face ((t nil))) - '(wg-current-workgroup-face ((t nil))) - '(wg-divider-face ((t nil))) - '(wg-filename-face ((t nil))) - '(wg-frame-face ((t nil))) - '(wg-message-face ((t nil))) - '(wg-mode-line-face ((t nil))) - '(wg-other-workgroup-face ((t nil))) - '(wg-previous-workgroup-face ((t nil))) + '(eyebrowse-mode-line-active ((t (:foreground "Blue" :background "White" :bold t)))) '(which-func ((t (:background "blue" :foreground "white")))) '(which-key-key-face ((t (:weight bold)))))