From f8297b075cbcc484ae8f5cef8917624018264348 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Sat, 14 Mar 2015 22:55:05 -0400 Subject: [PATCH] Small refactor of `spacemacs/config.el` --- spacemacs/config.el | 84 +++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/spacemacs/config.el b/spacemacs/config.el index 6a4a98094..c283ec2bc 100644 --- a/spacemacs/config.el +++ b/spacemacs/config.el @@ -11,9 +11,10 @@ ;;; License: GPLv3 ;; --------------------------------------------------------------------------- -;; Prefixes +;; Prefixes ;; --------------------------------------------------------------------------- +;; We define prefix commands only for the sake of guide-key (setq spacemacs/key-binding-prefixes '(("a" . "applications") ("as" . "applications-shells") ("b" . "buffers") @@ -59,13 +60,14 @@ ;; --------------------------------------------------------------------------- (ido-mode t) -(setq ido-enable-flex-matching t) ;; enable fuzzy matching -(setq ido-save-directory-list-file (concat spacemacs-cache-directory "ido.last")) +(setq ido-save-directory-list-file (concat spacemacs-cache-directory "ido.last") + ;; enable fuzzy matching + ido-enable-flex-matching t) ;; Auto refresh buffers (global-auto-revert-mode 1) ;; Also auto refresh dired, but be quiet about it -(setq global-auto-revert-non-file-buffers t) -(setq auto-revert-verbose nil) +(setq global-auto-revert-non-file-buffers t + auto-revert-verbose nil) ;; activate winner mode use to undo and redo windows layout (winner-mode t) ;; no beep pleeeeeease ! (and no visual blinking too please) @@ -111,8 +113,8 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'." ;; When point is on paranthesis, highlight the matching one (show-paren-mode t) ;; use only spaces and no tabs -(setq-default indent-tabs-mode nil) -(setq default-tab-width 2) +(setq-default indent-tabs-mode nil + default-tab-width 2) ;; turn on electric-indent-mode for both 24.3 and 24.4 (electric-indent-mode) ;; Text @@ -177,22 +179,24 @@ Can be installed with `brew install trash'." (setq custom-file (dotspacemacs/location)) ;; scratch buffer empty (setq initial-scratch-message nil) -(setq redisplay-dont-pause t) ;; don't create backup~ or #auto-save# files -(setq backup-by-copying t) -(setq make-backup-files nil) -(setq auto-save-default nil) -(setq create-lockfiles nil) +(setq backup-by-copying t + make-backup-files nil + auto-save-default nil + create-lockfiles nil) (require 'uniquify) ;; When having windows with repeated filenames, uniquify them ;; by the folder they are in rather those annoying <2>,<3>,.. etc -(setq uniquify-buffer-name-style 'post-forward-angle-brackets) -; don't screw special buffers -(setq uniquify-ignore-buffers-re "^\\*") +(setq uniquify-buffer-name-style 'post-forward-angle-brackets + ;; don't screw special buffers + uniquify-ignore-buffers-re "^\\*") +;; remove annoying ellipsis when printing sexp in message buffer +(setq eval-expression-print-length nil + eval-expression-print-level nil) ;; Save point position between sessions (require 'saveplace) -(setq-default save-place t) -(setq save-place-file (concat spacemacs-cache-directory "places")) +(setq save-place t + save-place-file (concat spacemacs-cache-directory "places")) ;; minibuffer history (require 'savehist) @@ -203,7 +207,7 @@ Can be installed with `brew install trash'." savehist-autosave-interval 60) (savehist-mode +1) -;; auto-save +;; auto-save (let ((autosave-dir (expand-file-name (concat spacemacs-cache-directory "autosave")))) (unless (file-exists-p autosave-dir) @@ -211,22 +215,32 @@ Can be installed with `brew install trash'." (setq auto-save-list-file-prefix (concat autosave-dir "/") auto-save-file-name-transforms `((".*" ,autosave-dir t)))) +;; cache files ;; bookmarks -(setq bookmark-save-flag 1) ;; save after every change -(setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks")) - -;; more cache files - -;; url files -(setq url-configuration-directory (concat spacemacs-cache-directory "url")) -;; eshell files -(setq eshell-directory-name (concat spacemacs-cache-directory "eshell" )) -;; Tramp history -(setq tramp-persistency-file-name (concat spacemacs-cache-directory "tramp")) +(setq bookmark-default-file (concat spacemacs-cache-directory "bookmarks") + ;; save after every change + bookmark-save-flag 1 + url-configuration-directory (concat spacemacs-cache-directory "url") + eshell-directory-name (concat spacemacs-cache-directory "eshell" ) + tramp-persistency-file-name (concat spacemacs-cache-directory "tramp")) ;; increase memory threshold for GC (setq gc-cons-threshold 20000000) +;; seems pointless to warn. There's always undo. +(put 'narrow-to-region 'disabled nil) +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(put 'erase-buffer 'disabled nil) +(put 'scroll-left 'disabled nil) +(put 'dired-find-alternate-file 'disabled nil) +;; remove prompt if the file is opened in other clients +(defun server-remove-kill-buffer-hook () + (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)) +(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook) + +;; The following code is kept as reference ----------------------------------- + ;; ;; save a bunch of variables to the desktop file ;; ;; for lists specify the len of the maximal saved data also ;; (setq desktop-globals-to-save @@ -315,15 +329,3 @@ Can be installed with `brew install trash'." ;; ;; (new-empty-buffer)) ;; ) ;; t) ;; append this hook to the tail - -;; seems pointless to warn. There's always undo. -(put 'narrow-to-region 'disabled nil) -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) -(put 'erase-buffer 'disabled nil) -(put 'scroll-left 'disabled nil) -(put 'dired-find-alternate-file 'disabled nil) -;; remove prompt if the file is opened in other clients -(defun server-remove-kill-buffer-hook () - (remove-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)) -(add-hook 'server-visit-hook 'server-remove-kill-buffer-hook)