General cleanup

This commit is contained in:
Henrik Lissner 2016-04-05 23:58:32 -04:00
parent 5017fc9c3b
commit 38eaa19dc0
15 changed files with 146 additions and 158 deletions

View file

@ -16,6 +16,7 @@
;;;
(setq-default
idle-update-delay 2 ; update a little less often
ad-redefinition-action 'accept ; silence the advised function warnings
echo-keystrokes 0.02 ; show me what I type
history-length 1000
@ -65,15 +66,62 @@
(set-charset-priority 'unicode)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
;; Ask for confirmation on exit only if there are real buffers left
(when window-system
(setq confirm-kill-emacs
(lambda (_)
(if (narf/get-real-buffers)
(y-or-n-p ">> Gee, I dunno Brain... Are you sure?")
t))))
;;
;; Variables
;;
(defvar narf-leader-prefix "," "Prefix key for <leader> maps")
(defvar narf-localleader-prefix "\\" "Prefix key for <localleader> maps")
;; Buffers/Files
(defvar narf-unreal-buffers '("^ ?\\*.+\\*"
image-mode
dired-mode
reb-mode
messages-buffer-mode)
"A list of regexps or modes whose buffers are considered unreal, and will be
ignored when using `narf:next-real-buffer' and `narf:previous-real-buffer', and
killed by `narf/kill-unreal-buffers'.
`narf:kill-this-buffer' will also gloss over these buffers when finding a new
buffer to display.")
(defvar narf-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
"*Buffer List*" "*Ibuffer*" "*esh command on file*"
"*WoMan-Log*" "*compilation*" "*use-package*"
"*quickrun*" "*eclim: problems*" "*Flycheck errors*"
"*popwin-dummy*" " *NeoTree*"
;; Helm
"*helm*" "*helm recentf*" "*helm projectile*" "*helm imenu*"
"*helm company*" "*helm buffers*" "*Helm Css SCSS*"
"*helm-ag*" "*helm-ag-edit*" "*Helm Swoop*"
"*helm M-x*" "*helm mini*" "*Helm Completions*"
"*Helm Find Files*" "*helm mu*" "*helm mu contacts*"
"*helm-mode-describe-variable*" "*helm-mode-describe-function*"
;; Org
"*Org todo*" "*Org Links*" "*Agenda Commands*")
"List of buffer names to ignore when using `winner-undo', or `winner-redo'")
(defvar narf-cleanup-processes-alist '(("pry" . ruby-mode)
("irb" . ruby-mode)
("ipython" . python-mode))
"An alist of (process-name . major-mode), that `narf:cleanup-processes' checks
before killing processes. If there are no buffers with matching major-modes, it
gets killed.")
(defvar narf-project-root-files
'(".git" ".hg" ".svn" ".project" "local.properties" "project.properties"
"rebar.config" "project.clj" "SConstruct" "pom.xml" "build.sbt"
"build.gradle" "Gemfile" "requirements.txt" "tox.ini" "package.json"
"gulpfile.js" "Gruntfile.js" "bower.json" "composer.json" "Cargo.toml"
"mix.exs")
"A list of files that count as 'project files', which determine whether a
folder is the root of a project or not.")
;; Fringe/margins
(defvar narf-fringe-size 6 "Default width to use for the fringes.")
;;
@ -84,46 +132,17 @@
(unless (require 'autoloads nil t)
(load (concat narf-emacs-dir "/scripts/generate-autoloads.el"))
(require 'autoloads))
(require 'core-vars)
(require 'core-defuns)
(eval-when-compile
(setq use-package-verbose nil)
;; Make any folders needed
(dolist (file '("" "/undo" "/backup"))
(let ((path (concat narf-temp-dir file)))
(unless (file-exists-p path)
(make-directory path t)))))
;; Save history across sessions
(require 'savehist)
(setq savehist-file (concat narf-temp-dir "/savehist")
savehist-save-minibuffer-history t
savehist-additional-variables
'(kill-ring search-ring regexp-search-ring))
(savehist-mode 1)
;; text properties severely bloat the history so delete them (courtesy of PythonNut)
(defun unpropertize-savehist ()
(mapc (lambda (list)
(with-demoted-errors
(when (boundp list)
(set list (mapcar #'substring-no-properties (eval list))))))
'(kill-ring minibuffer-history helm-grep-history helm-ff-history file-name-history
read-expression-history extended-command-history evil-ex-history)))
(add-hook 'kill-emacs-hook #'unpropertize-savehist)
(add-hook 'savehist-save-hook #'unpropertize-savehist)
(require 'recentf)
(setq recentf-save-file (concat narf-temp-dir "/recentf")
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$" "wg-default"
"/company-statistics-cache.el$")
recentf-max-menu-items 0
recentf-max-saved-items 250
recentf-auto-cleanup 600)
(recentf-mode 1)
(mapc (lambda (dir)
(let ((path (concat narf-temp-dir dir)))
(unless (file-exists-p path)
(make-directory path t))))
'("" "/undo" "/backup")))
(use-package persistent-soft
:commands (persistent-soft-store
@ -141,8 +160,6 @@
async-wait
async-inject-variables))
;;
(require (cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32)))