Clean up core.el; move *doom* config to core-scratch
This commit is contained in:
parent
51d16734ed
commit
566111abaf
2 changed files with 135 additions and 139 deletions
205
core/core.el
205
core/core.el
|
@ -11,56 +11,7 @@
|
|||
;; doom.... Custom prefix commands
|
||||
;; ...! Macro or shortcut alias
|
||||
;;
|
||||
;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
|
||||
;;
|
||||
;;;
|
||||
|
||||
(setq-default
|
||||
;; stop package.el from being annoying. I rely solely on Cask.
|
||||
package--init-file-ensured t
|
||||
package-enable-at-startup nil
|
||||
package-archives
|
||||
'(("gnu" . "http://elpa.gnu.org/packages/")
|
||||
("melpa" . "http://melpa.org/packages/")
|
||||
("org" . "http://orgmode.org/elpa/"))
|
||||
|
||||
ad-redefinition-action 'accept ; silence the advised function warnings
|
||||
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
|
||||
delete-by-moving-to-trash t
|
||||
echo-keystrokes 0.02 ; show me what I type
|
||||
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
|
||||
enable-recursive-minibuffers nil ; no minibufferception
|
||||
idle-update-delay 2 ; update a little less often
|
||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
||||
major-mode 'text-mode
|
||||
ring-bell-function 'ignore ; silence of the bells!
|
||||
save-interprogram-paste-before-kill nil
|
||||
sentence-end-double-space nil
|
||||
confirm-nonexistent-file-or-buffer t
|
||||
|
||||
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties
|
||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
|
||||
bookmark-save-flag t
|
||||
bookmark-default-file (concat doom-temp-dir "/bookmarks")
|
||||
|
||||
;; Disable all backups (that's what git/dropbox are for)
|
||||
history-length 1000
|
||||
vc-make-backup-files nil
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (concat doom-temp-dir "/autosave")
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
backup-directory-alist `((".*" . ,(concat doom-temp-dir "/backup/")))
|
||||
|
||||
;; Remember undo history
|
||||
undo-tree-auto-save-history nil
|
||||
undo-tree-history-directory-alist `(("." . ,(concat doom-temp-dir "/undo/"))))
|
||||
;;; Autoloaded functions are in {core,modules}/defuns/defuns-*.el
|
||||
|
||||
;; UTF-8 please
|
||||
(setq locale-coding-system 'utf-8) ; pretty
|
||||
|
@ -71,43 +22,81 @@
|
|||
(set-charset-priority 'unicode)
|
||||
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
|
||||
|
||||
(setq-default major-mode 'text-mode)
|
||||
;; stop package.el from being annoying. I rely solely on Cask.
|
||||
(setq package--init-file-ensured t
|
||||
package-enable-at-startup nil
|
||||
package-archives
|
||||
'(("gnu" . "http://elpa.gnu.org/packages/")
|
||||
("melpa" . "http://melpa.org/packages/")
|
||||
("org" . "http://orgmode.org/elpa/")))
|
||||
|
||||
;; Core variables
|
||||
(setq ad-redefinition-action 'accept ; silence the advised function warnings
|
||||
compilation-always-kill t ; kill compl. process before spawning another
|
||||
compilation-ask-about-save nil ; save all buffers before compiling
|
||||
compilation-scroll-output t ; scroll with output while compiling
|
||||
delete-by-moving-to-trash t
|
||||
echo-keystrokes 0.02 ; show me what I type
|
||||
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
|
||||
enable-recursive-minibuffers nil ; no minibufferception
|
||||
idle-update-delay 2 ; update a little less often
|
||||
inhibit-startup-echo-area-message "hlissner" ; username shuts up emacs
|
||||
ring-bell-function 'ignore ; silence of the bells!
|
||||
save-interprogram-paste-before-kill nil
|
||||
sentence-end-double-space nil
|
||||
confirm-nonexistent-file-or-buffer t
|
||||
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
|
||||
minibuffer-prompt-properties
|
||||
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
|
||||
;; persistent bookmarks
|
||||
bookmark-save-flag t
|
||||
bookmark-default-file (concat doom-temp-dir "/bookmarks")
|
||||
;; Disable backups (that's what git/dropbox are for)
|
||||
history-length 1000
|
||||
vc-make-backup-files nil
|
||||
auto-save-default nil
|
||||
auto-save-list-file-name (concat doom-temp-dir "/autosave")
|
||||
make-backup-files nil
|
||||
create-lockfiles nil
|
||||
backup-directory-alist `((".*" . ,(concat doom-temp-dir "/backup/")))
|
||||
;; Remember undo history
|
||||
undo-tree-auto-save-history nil
|
||||
undo-tree-history-directory-alist `(("." . ,(concat doom-temp-dir "/undo/"))))
|
||||
|
||||
|
||||
;;
|
||||
;; Variables
|
||||
;;
|
||||
|
||||
(defvar doom-unreal-buffers '("^ ?\\*.+\\*"
|
||||
image-mode
|
||||
dired-mode
|
||||
reb-mode
|
||||
messages-buffer-mode)
|
||||
(defvar doom-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 `doom:next-real-buffer' and `doom:previous-real-buffer' (or
|
||||
killed by `doom/kill-unreal-buffers', or after `doom/kill-real-buffer').")
|
||||
|
||||
(defvar doom-ignore-buffers '("*Completions*" "*Compile-Log*" "*inferior-lisp*"
|
||||
"*Fuzzy Completions*" "*Apropos*" "*Help*" "*cvs*"
|
||||
"*Buffer List*" "*Ibuffer*" "*NeoTree*" "
|
||||
*NeoTree*" "*esh command on file*" "*WoMan-Log*"
|
||||
"*compilation*" "*use-package*" "*quickrun*"
|
||||
"*eclim: problems*" "*Flycheck errors*"
|
||||
"*popwin-dummy*"
|
||||
;; 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*")
|
||||
(defvar doom-ignore-buffers
|
||||
'("*Completions*" "*Compile-Log*" "*inferior-lisp*" "*Fuzzy Completions*"
|
||||
"*Apropos*" "*Help*" "*cvs*" "*Buffer List*" "*Ibuffer*" "*NeoTree*"
|
||||
"*NeoTree*" "*esh command on file*" "*WoMan-Log*" "*compilation*"
|
||||
"*use-package*" "*quickrun*" "*eclim: problems*" "*Flycheck errors*"
|
||||
"*popwin-dummy*"
|
||||
;; 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 doom-cleanup-processes-alist '(("pry" . ruby-mode)
|
||||
("irb" . ruby-mode)
|
||||
("ipython" . python-mode))
|
||||
(defvar doom-cleanup-processes-alist
|
||||
'(("pry" . ruby-mode)
|
||||
("irb" . ruby-mode)
|
||||
("ipython" . python-mode))
|
||||
"An alist of (process-name . major-mode), that `doom:cleanup-processes' checks
|
||||
before killing processes. If there are no buffers with matching major-modes, it
|
||||
gets killed.")
|
||||
|
@ -193,69 +182,6 @@ enable multiple minor modes for the same regexp.")
|
|||
|
||||
(add-hook 'find-file-hook 'doom|enable-minor-mode-maybe)
|
||||
|
||||
|
||||
;;
|
||||
(setq initial-major-mode 'doom-mode
|
||||
initial-scratch-message nil
|
||||
inhibit-startup-screen t) ; don't show emacs start screen
|
||||
|
||||
(defvar doom-buffer-name "*doom*" "")
|
||||
(defvar doom-buffer nil "")
|
||||
(define-derived-mode doom-mode text-mode "DOOM"
|
||||
"Major mode for special DOOM buffers.")
|
||||
|
||||
(add-hook 'after-init-hook 'doom-mode-init)
|
||||
(defun doom-mode-init (&optional auto-detect-frame)
|
||||
(let ((old-scratch (get-buffer "*scratch*")))
|
||||
(when old-scratch
|
||||
(with-current-buffer old-scratch
|
||||
(rename-buffer doom-buffer-name)
|
||||
(setq doom-buffer old-scratch))))
|
||||
(unless doom-buffer
|
||||
(setq doom-buffer (get-buffer-create doom-buffer-name)))
|
||||
(with-current-buffer doom-buffer
|
||||
(doom-mode)
|
||||
(erase-buffer)
|
||||
(insert
|
||||
(let* ((auto-detect-frame (or auto-detect-frame (not (display-graphic-p))))
|
||||
(width (- (if auto-detect-frame (window-width) (cdr (assq 'width default-frame-alist))) 3))
|
||||
(lead (make-string (truncate (/ (- width 78) 2)) ? )))
|
||||
(concat
|
||||
(propertize
|
||||
(concat
|
||||
(make-string (min 3 (/ (if auto-detect-frame (window-height) (cdr (assq 'height default-frame-alist))) 5)) ?\n)
|
||||
lead "================= =============== =============== ======== ========\n"
|
||||
lead "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //\n"
|
||||
lead "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||\n"
|
||||
lead "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||\n"
|
||||
lead "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||\n"
|
||||
lead "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||\n"
|
||||
lead "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||\n"
|
||||
lead "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||\n"
|
||||
lead "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||\n"
|
||||
lead "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||\n"
|
||||
lead "|| `' || || `' || || `' || || | \\ / | ||\n"
|
||||
lead "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||\n"
|
||||
lead "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||\n"
|
||||
lead "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||\n"
|
||||
lead "|| .==' _-' '-__\\._-' '-_./__-' `' |. /| | ||\n"
|
||||
lead "||.==' _-' `' | /==.||\n"
|
||||
lead "==' _-' E M A C S \\/ `==\n"
|
||||
lead "\\ _-' `-_ /\n"
|
||||
lead " `'' ``'")
|
||||
'face 'font-lock-comment-face)
|
||||
"\n\n"
|
||||
(propertize
|
||||
(s-center (1- width) (format "Press `,m` to open recent files, or `,E` to access emacs.d"
|
||||
emacs-end-time))
|
||||
'face 'font-lock-keyword-face)
|
||||
(if emacs-end-time
|
||||
(concat
|
||||
"\n\n"
|
||||
(s-trim-right (s-center (- width 2) (format "Loaded in %.3fs" emacs-end-time))))
|
||||
""))))
|
||||
(doom|update-scratch-buffer-cwd)))
|
||||
|
||||
(add-hook! after-init
|
||||
;; We add this to `after-init-hook' to allow errors to stop it
|
||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
||||
|
@ -265,6 +191,7 @@ enable multiple minor modes for the same regexp.")
|
|||
;; Prevent any auto-displayed text...
|
||||
(advice-add 'display-startup-echo-area-message :override 'ignore)
|
||||
(setq emacs-end-time (float-time (time-subtract (current-time) emacs-start-time)))
|
||||
(doom-mode-init)
|
||||
(message ""))
|
||||
|
||||
(provide 'core)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue