2015-06-06 06:40:33 -04:00
|
|
|
;;; core.el --- The heart of the beast
|
2015-06-04 18:23:21 -04:00
|
|
|
;;
|
2015-06-06 06:40:33 -04:00
|
|
|
;;; Naming conventions:
|
2015-06-04 18:23:21 -04:00
|
|
|
;;
|
2015-06-14 17:26:03 +02:00
|
|
|
;; narf-... A public variable/constant or function
|
|
|
|
;; narf--... An internal variable or function (non-interactive)
|
|
|
|
;; narf/... An autoloaded interactive function
|
2015-10-01 13:48:48 -04:00
|
|
|
;; narf:... An ex command
|
2015-06-14 17:26:03 +02:00
|
|
|
;; narf|... A hook
|
|
|
|
;; narf*... An advising function
|
2015-12-09 02:03:13 -05:00
|
|
|
;; narf.... Custom prefix commands
|
2015-06-14 17:26:03 +02:00
|
|
|
;; ...! Macro
|
2015-06-04 18:23:21 -04:00
|
|
|
;;
|
2016-03-03 15:04:14 -05:00
|
|
|
;; You will find all autoloaded function in {core,modules}/defuns/defuns-*.el
|
|
|
|
;;
|
2015-09-30 13:47:57 -04:00
|
|
|
;;;
|
2015-06-04 18:23:21 -04:00
|
|
|
|
2015-12-11 22:43:55 -05:00
|
|
|
(setq-default
|
2015-10-01 13:48:48 -04:00
|
|
|
ad-redefinition-action 'accept ; silence the advised function warnings
|
2015-11-17 21:48:21 -05:00
|
|
|
echo-keystrokes 0.02 ; show me what I type
|
|
|
|
history-length 1000
|
|
|
|
ring-bell-function 'ignore ; silence of the bells!
|
|
|
|
save-interprogram-paste-before-kill nil
|
|
|
|
sentence-end-double-space nil
|
|
|
|
enable-recursive-minibuffers nil ; no minibufferception
|
|
|
|
compilation-always-kill t ; kill compilation process before spawning another
|
|
|
|
compilation-ask-about-save nil ; save all buffers before compiling
|
|
|
|
compilation-scroll-output t ; scroll with output while compiling
|
2015-06-06 06:40:33 -04:00
|
|
|
ediff-diff-options "-w"
|
|
|
|
ediff-split-window-function 'split-window-horizontally ; side-by-side diffs
|
|
|
|
ediff-window-setup-function 'ediff-setup-windows-plain ; no extra frames
|
2015-09-30 13:47:57 -04:00
|
|
|
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
|
|
|
inhibit-startup-screen t ; don't show emacs start screen
|
|
|
|
initial-scratch-message nil
|
2015-11-17 21:48:21 -05:00
|
|
|
initial-major-mode 'text-mode ; initial scratch buffer mode
|
2015-09-30 13:47:57 -04:00
|
|
|
major-mode 'text-mode
|
2015-06-06 06:40:33 -04:00
|
|
|
|
2015-09-30 13:47:57 -04:00
|
|
|
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
|
|
|
minibuffer-prompt-properties '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
;; remove annoying ellipsis when printing sexp in message buffer
|
|
|
|
eval-expression-print-length nil
|
|
|
|
eval-expression-print-level nil
|
|
|
|
|
|
|
|
bookmark-save-flag t
|
2015-10-28 03:31:51 -04:00
|
|
|
bookmark-default-file (concat narf-temp-dir "bookmarks")
|
2015-11-17 21:48:21 -05:00
|
|
|
|
|
|
|
;; Disable all backups (that's what git/dropbox are for)
|
2015-06-06 06:40:33 -04:00
|
|
|
auto-save-default nil
|
2015-10-28 03:31:51 -04:00
|
|
|
auto-save-list-file-name (concat narf-temp-dir "autosave")
|
2015-06-06 06:40:33 -04:00
|
|
|
make-backup-files nil
|
|
|
|
create-lockfiles nil
|
2015-10-06 20:27:18 -04:00
|
|
|
backup-directory-alist `((".*" . ,(concat narf-temp-dir "backup/")))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
|
|
;; Remember undo history
|
2016-03-09 21:39:21 -05:00
|
|
|
undo-tree-auto-save-history nil
|
2015-10-06 20:27:18 -04:00
|
|
|
undo-tree-history-directory-alist `(("." . ,(concat narf-temp-dir "undo/"))))
|
2015-06-04 18:23:21 -04:00
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
;; UTF-8 please
|
2015-09-30 13:47:57 -04:00
|
|
|
(setq locale-coding-system 'utf-8) ; pretty
|
|
|
|
(set-terminal-coding-system 'utf-8) ; pretty
|
|
|
|
(set-keyboard-coding-system 'utf-8) ; pretty
|
|
|
|
(set-selection-coding-system 'utf-8) ; please
|
|
|
|
(prefer-coding-system 'utf-8) ; with sugar on top
|
2016-03-10 23:54:56 -05:00
|
|
|
(set-charset-priority 'unicode)
|
|
|
|
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
|
|
|
|
|
2015-09-30 13:47:57 -04:00
|
|
|
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
|
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
;; 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))))
|
2015-09-30 13:47:57 -04:00
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
|
|
|
|
;;
|
|
|
|
;; Bootstrap
|
|
|
|
;;
|
2015-09-30 13:47:57 -04:00
|
|
|
|
2015-12-23 03:42:47 -05:00
|
|
|
(autoload 'use-package "use-package" "" nil 'macro)
|
|
|
|
(require 'dash)
|
|
|
|
|
2015-09-30 13:47:57 -04:00
|
|
|
(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
|
2015-10-26 00:36:23 -04:00
|
|
|
(setq use-package-verbose nil)
|
2015-09-30 13:47:57 -04:00
|
|
|
|
|
|
|
;; Make any folders needed
|
|
|
|
(dolist (file '("" "undo" "backup"))
|
|
|
|
(let ((path (concat narf-temp-dir file)))
|
|
|
|
(unless (file-exists-p path)
|
|
|
|
(make-directory path t)))))
|
|
|
|
|
2015-06-06 06:40:33 -04:00
|
|
|
;; Save history across sessions
|
2015-10-28 03:31:51 -04:00
|
|
|
(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)
|
|
|
|
|
2015-11-17 02:08:35 -05:00
|
|
|
(use-package persistent-soft
|
|
|
|
:commands (persistent-soft-store
|
|
|
|
persistent-soft-fetch
|
|
|
|
persistent-soft-exists-p
|
|
|
|
persistent-soft-flush
|
|
|
|
persistent-soft-location-readable
|
2015-11-17 02:18:56 -05:00
|
|
|
persistent-soft-location-destroy)
|
2015-11-21 16:22:40 -05:00
|
|
|
:init (defvar pcache-directory (concat narf-temp-dir "pcache/")))
|
2015-11-17 02:08:35 -05:00
|
|
|
|
|
|
|
(use-package async
|
|
|
|
:commands (async-start
|
|
|
|
async-start-process
|
|
|
|
async-get
|
|
|
|
async-wait
|
|
|
|
async-inject-variables))
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
;;
|
2015-12-23 03:42:47 -05:00
|
|
|
(require (cond (IS-MAC 'core-os-osx)
|
|
|
|
(IS-LINUX 'core-os-linux)
|
|
|
|
(IS-WINDOWS 'core-os-win32)))
|
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
|
|
|
|
;;
|
|
|
|
;; Allow errors to stop this from happening
|
2016-01-29 07:09:53 -05:00
|
|
|
(add-hook! after-init
|
|
|
|
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
|
|
|
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
|
|
|
(cl-flet ((process-list ())) ad-do-it)))
|
|
|
|
|
|
|
|
(require 'server)
|
|
|
|
(unless (server-running-p)
|
|
|
|
(server-start))
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
(provide 'core)
|
|
|
|
;;; core.el ends here
|