doomemacs/core/core.el

187 lines
7.4 KiB
EmacsLisp
Raw Normal View History

2015-06-06 18:40:33 +08:00
;;; core.el --- The heart of the beast
2015-06-05 06:23:21 +08:00
;;
2015-06-06 18:40:33 +08:00
;;; Naming conventions:
2015-06-05 06:23:21 +08:00
;;
2015-06-14 23:26:03 +08:00
;; narf-... A public variable/constant or function
;; narf--... An internal variable or function (non-interactive)
;; narf/... An autoloaded interactive function
2015-10-02 01:48:48 +08:00
;; narf:... An ex command
2015-06-14 23:26:03 +08:00
;; narf|... A hook
;; narf*... An advising function
2015-12-09 15:03:13 +08:00
;; narf.... Custom prefix commands
2015-06-14 23:26:03 +08:00
;; ...! Macro
2015-06-05 06:23:21 +08:00
;;
2016-03-04 04:04:14 +08:00
;; You will find all autoloaded function in {core,modules}/defuns/defuns-*.el
;;
2015-10-01 01:47:57 +08:00
;;;
2015-06-05 06:23:21 +08:00
2015-12-12 11:43:55 +08:00
(setq-default
2015-10-02 01:48:48 +08:00
ad-redefinition-action 'accept ; silence the advised function warnings
2015-11-18 10:48:21 +08:00
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
2016-04-09 04:15:37 +08:00
delete-by-moving-to-trash t
echo-keystrokes 0.02 ; show me what I type
2015-06-06 18:40:33 +08: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
2016-04-09 04:15:37 +08:00
enable-recursive-minibuffers nil ; no minibufferception
history-length 1000
idle-update-delay 2 ; update a little less often
2015-10-01 01:47:57 +08:00
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
inhibit-startup-screen t ; don't show emacs start screen
2015-11-18 10:48:21 +08:00
initial-major-mode 'text-mode ; initial scratch buffer mode
2016-04-09 04:15:37 +08:00
initial-scratch-message nil
2015-10-01 01:47:57 +08:00
major-mode 'text-mode
2016-04-09 04:15:37 +08:00
ring-bell-function 'ignore ; silence of the bells!
save-interprogram-paste-before-kill nil
sentence-end-double-space nil
2015-06-06 18:40:33 +08:00
;; remove annoying ellipsis when printing sexp in message buffer
eval-expression-print-length nil
eval-expression-print-level nil
2016-04-09 04:15:37 +08: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 18:40:33 +08:00
bookmark-save-flag t
2016-03-27 12:49:52 +08:00
bookmark-default-file (concat narf-temp-dir "/bookmarks")
2015-11-18 10:48:21 +08:00
;; Disable all backups (that's what git/dropbox are for)
2015-06-06 18:40:33 +08:00
auto-save-default nil
2016-03-27 12:49:52 +08:00
auto-save-list-file-name (concat narf-temp-dir "/autosave")
2015-06-06 18:40:33 +08:00
make-backup-files nil
create-lockfiles nil
2016-03-27 12:49:52 +08:00
backup-directory-alist `((".*" . ,(concat narf-temp-dir "/backup/")))
2015-06-06 18:40:33 +08:00
;; Remember undo history
undo-tree-auto-save-history nil
2016-03-27 12:49:52 +08:00
undo-tree-history-directory-alist `(("." . ,(concat narf-temp-dir "/undo/"))))
2015-06-05 06:23:21 +08:00
2016-03-04 04:04:14 +08:00
;; UTF-8 please
2015-10-01 01:47:57 +08: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-11 12:54:56 +08:00
(set-charset-priority 'unicode)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
2015-10-01 01:47:57 +08:00
2016-04-06 11:58:32 +08:00
;;
;; 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.")
2015-10-01 01:47:57 +08:00
2016-03-04 04:04:14 +08:00
;;
;; Bootstrap
;;
2015-10-01 01:47:57 +08:00
2015-12-23 16:42:47 +08:00
(autoload 'use-package "use-package" "" nil 'macro)
2015-10-01 01:47:57 +08:00
(unless (require 'autoloads nil t)
2016-03-26 13:19:31 +08:00
(load (concat narf-emacs-dir "/scripts/generate-autoloads.el"))
2015-10-01 01:47:57 +08:00
(require 'autoloads))
(require 'core-defuns)
(eval-when-compile
2015-10-26 12:36:23 +08:00
(setq use-package-verbose nil)
2015-10-01 01:47:57 +08:00
;; Make any folders needed
2016-04-06 11:58:32 +08:00
(mapc (lambda (dir)
(let ((path (concat narf-temp-dir dir)))
(unless (file-exists-p path)
(make-directory path t))))
'("" "/undo" "/backup")))
2015-10-28 15:31:51 +08: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 15:18:56 +08:00
persistent-soft-location-destroy)
2016-03-27 12:49:52 +08:00
:init (defvar pcache-directory (concat narf-temp-dir "/pcache/")))
(use-package async
:commands (async-start
async-start-process
async-get
async-wait
async-inject-variables))
2015-12-23 16:42:47 +08:00
(require (cond (IS-MAC 'core-os-osx)
(IS-LINUX 'core-os-linux)
(IS-WINDOWS 'core-os-win32)))
2016-03-04 04:04:14 +08:00
;;
2016-03-28 06:18:43 +08:00
;; We add this to `after-init-hook' to allow errors to stop this advice
(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)))
2016-03-28 06:18:43 +08:00
(when (display-graphic-p)
(require 'server)
(unless (server-running-p)
(server-start)))
(defun display-startup-echo-area-message ()
(message ":: Loaded in %s" (emacs-init-time)))
2015-06-05 06:23:21 +08:00
(provide 'core)
;;; core.el ends here