From 507f3720bf6b2387874ed5bb5616894c47b4933b Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 10 Aug 2017 11:53:00 +0100 Subject: [PATCH] spaceline improved. lxdrive indicator added to spaceline --- config/fg42.user.el | 2 ++ lib/extensions/editor/init.el | 47 +++++++++++++++++++------- lib/extensions/editor/lxdrive-mode.el | 7 ++-- lib/extensions/editor/spaceline-alt.el | 38 ++++++++++----------- 4 files changed, 59 insertions(+), 35 deletions(-) diff --git a/config/fg42.user.el b/config/fg42.user.el index fa4e45c..cb3d322 100644 --- a/config/fg42.user.el +++ b/config/fg42.user.el @@ -1,3 +1,5 @@ +;; Uncomment this for debugging purposes +;;(setq debug-on-error t) ;; THEME ;; ===== ;; Load the default theme diff --git a/lib/extensions/editor/init.el b/lib/extensions/editor/init.el index 0ec5438..5f6c6ea 100644 --- a/lib/extensions/editor/init.el +++ b/lib/extensions/editor/init.el @@ -1,4 +1,4 @@ -; Customizations -------------------------------------------- +;; Customizations -------------------------------------------- (defcustom fg42-todo-file "~/.TODO.org" "Path to your TODO file. You can use a tramp address here as well." :type 'string @@ -31,8 +31,8 @@ (require 'extensions/editor/utils) ;; Font Configuration ----------------------------------- - (add-to-list 'default-frame-alist '(font . "Fira Mono" )) - (set-face-attribute 'default t :font "Fira Mono" ) + (add-to-list 'default-frame-alist '(font . "Fira Mono")) + (set-face-attribute 'default t :font "Fira Mono") ;; ------------------------------------------------------ (cheatsheet-add :group '--HELP-- @@ -64,7 +64,31 @@ "A really cool mode line alternative which borrowed from awesome spacemacs" (require 'spaceline-config) (require 'extensions/editor/spaceline-alt) + + ;; TODO: Move this to somewhere propriate + ;; Modeline indicator for lxdrive + (spaceline-define-segment lxdrive + "lxdrive indicator on spaceline." + (if (and (boundp 'lxdrive-minor-mode) lxdrive-minor-mode) + (all-the-icons-faicon "arrows" :height 0.8 :v-adjust 0.1 :face 'all-the-icons-lgreen) + (all-the-icons-faicon "pencil" :height 0.8 :v-adjust 0.1 :face 'all-the-icons-blue))) + + (spaceline-compile + "ati" + '( + ((ati-modified ati-window-numbering ati-buffer-size) :face highlight-face :skip-alternate t) + ((ati-projectile ati-mode-icon ati-buffer-id) :face default-face) + ((ati-process ati-position ati-region-info) :face highlight-face :separator " | ") + ((ati-vc-icon ati-flycheck-status ati-(point)ackage-updates purpose) :separator " · " :face other-face) + ;; ((minor-modes) :face default-face) + ) + + '(((lxdrive ati-time) :separator " | " :face default-face))) + + + (setq-default mode-line-format '("%e" (:eval (spaceline-ml-ati))))) + ;;(spaceline-emacs-theme)) ;; Tramp configuration ------------------------------------- @@ -179,8 +203,7 @@ (flx-ido-mode 1) (setq ido-use-faces nil) - (setq ido-use-filename-at-point nil) - + (setq ido-use-filename-at-point nil) (setq ido-enable-flex-matching t) (ido-vertical-mode 1)) @@ -227,8 +250,8 @@ ;; Session Management --------------------------------------- (ability desktop-mode () - "Save your current working buffers and restore later" - (desktop-save-mode 1)) + "Save your current working buffers and restore later" + (desktop-save-mode 1)) ;; Backup files --------------------------------------------- ;; Put them in one nice place if possible @@ -236,11 +259,11 @@ (setq backup-directory-alist '(("." . "~/.backup"))) (make-directory "~/.backup")) - (setq backup-by-copying t ; Don't delink hardlinks - delete-old-versions t ; Clean up the backups - version-control t ; Use version numbers on backups, - kept-new-versions 3 ; keep some new versions - kept-old-versions 2) ; and some old ones, too + (setq backup-by-copying t) ; Don't delink hardlinks + delete-old-versions t ; Clean up the backups + version-control t ; Use version numbers on backups, + kept-new-versions 3 ; keep some new versions + kept-old-versions 2 ; and some old ones, too ;; get rid of yes-or-no questions - y or n is enough (defalias 'yes-or-no-p 'y-or-n-p) diff --git a/lib/extensions/editor/lxdrive-mode.el b/lib/extensions/editor/lxdrive-mode.el index ceb3350..9ee4906 100644 --- a/lib/extensions/editor/lxdrive-mode.el +++ b/lib/extensions/editor/lxdrive-mode.el @@ -3,18 +3,18 @@ ;;; Code: (setq original-global-map global-map) +(boundp 'lxdrive-minor-mode) (defun turn-off-lxdrive () "Toggle lxdrive mode" (interactive) - (message "Turning lxdrive OFF") (lxdrive-minor-mode nil) + (setq lxdrive-minor-mode nil) (use-global-map original-global-map)) (defun turn-on-lxdrive () "Toggle lxdrive mode" (interactive) - (message "Turning lxdrive ON") (lxdrive-minor-mode t) (use-global-map lxdrive-mode-map)) @@ -76,7 +76,6 @@ (define-minor-mode lxdrive-minor-mode "A minor mode so that my key settings override annoying major modes." - :init-value t :lighter " lx") @@ -89,6 +88,6 @@ ;;(lxdrive-minor-mode 1) (global-set-key (kbd "ESC ESC") 'turn-on-lxdrive) (global-set-key (kbd "M-SPC") 'turn-on-lxdrive) - +(spaceline-toggle-lxdrive-on) (provide 'extensions/editor/lxdrive-mode) ;;; lxdrive-mode ends here diff --git a/lib/extensions/editor/spaceline-alt.el b/lib/extensions/editor/spaceline-alt.el index 789a97c..afd7d1e 100644 --- a/lib/extensions/editor/spaceline-alt.el +++ b/lib/extensions/editor/spaceline-alt.el @@ -350,26 +350,26 @@ the directions of the separator." (define-separator "right-1" "left" 'powerline-active2 'powerline-active1) (define-separator "right-2" "left" 'powerline-active1 'mode-line) -(spaceline-compile - "ati" - '( - ((ati-modified ati-window-numbering ati-buffer-size) :face highlight-face :skip-alternate t) - ;; left-active-3 - ati-left-1-separator - ((ati-projectile ati-mode-icon ati-buffer-id) :face default-face) - ati-left-2-separator - ((ati-process ati-position ati-region-info) :face highlight-face :separator " | ") - ati-left-3-separator - ati-left-inactive-separator - ((ati-vc-icon ati-flycheck-status ati-package-updates purpose) :separator " · " :face other-face) - ati-left-4-separator) +;; (spaceline-compile +;; "ati" +;; '( +;; ((ati-modified ati-window-numbering ati-buffer-size) :face highlight-face :skip-alternate t) +;; ;; left-active-3 +;; ati-left-1-separator +;; ((ati-projectile ati-mode-icon ati-buffer-id) :face default-face) +;; ati-left-2-separator +;; ((ati-process ati-position ati-region-info) :face highlight-face :separator " | ") +;; ati-left-3-separator +;; ati-left-inactive-separator +;; ((ati-vc-icon ati-flycheck-status ati-package-updates purpose) :separator " · " :face other-face) +;; ati-left-4-separator) - '(ati-right-1-separator - ((ati-suntime ati-weather) :separator " · " :face other-face) - ati-right-2-separator - ati-right-inactive-separator - ((ati-battery-status ati-time) :separator " | " :face other-face) - )) +;; '(ati-right-1-separator +;; ((ati-suntime ati-weather) :separator " · " :face other-face) +;; ati-right-2-separator +;; ati-right-inactive-separator +;; ((ati-battery-status ati-time) :separator " | " :face other-face) +;; )) ;; (setq mode-line-format '("%e" (:eval (spaceline-ml-main))))