Major refactor of Doom core files
- Remove core-os and move many of its settings out to other core libraries, where they belong - Significantly improve commenting & compartmentalization of many settings - Correct some mis-named public hooks (that were named as if they were private) - Move the vast majority of optimizations to "Optimizations" section in core.el - Don't activate xclip-mode or osx-clipboard-mode if we're accessing Emacs through an SSH connection (does more bad than good there) - Add fast-but-imprecise-scrolling = t - Set bidi-display-reordering = 'left-to-right, at the recommendation of an Emacs dev. Apparently setting it to nil is undefined, as Emacs is designed to always assume it's set; setting it explicitly to left-to-right will still do what was originally intended by turning it off: to reduce line/text scans for bidirectional text, which gives us a moderate boost in general runtime snappiness - Set inhibit-compacting-fon-caches = t on windows (where it struggles especially with icon fonts) - Disables "literal" mode for very large files (because I will be backporting so-long.el from Emacs 27 in the next commit)
This commit is contained in:
parent
81ab3dbc5d
commit
fdcb259bcd
9 changed files with 417 additions and 297 deletions
|
@ -1,55 +1,57 @@
|
||||||
;;; core-editor.el -*- lexical-binding: t; -*-
|
;;; core-editor.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defvar doom-detect-indentation-excluded-modes '(fundamental-mode)
|
||||||
|
"A list of major modes in which indentation should be automatically
|
||||||
|
detected.")
|
||||||
|
|
||||||
(defvar-local doom-inhibit-indent-detection nil
|
(defvar-local doom-inhibit-indent-detection nil
|
||||||
"A buffer-local flag that indicates whether `dtrt-indent' should try to detect
|
"A buffer-local flag that indicates whether `dtrt-indent' should try to detect
|
||||||
indentation settings or not. This should be set by editorconfig if it
|
indentation settings or not. This should be set by editorconfig if it
|
||||||
successfully sets indent_style/indent_size.")
|
successfully sets indent_style/indent_size.")
|
||||||
|
|
||||||
(defvar doom-detect-indentation-excluded-modes '(fundamental-mode)
|
|
||||||
"A list of major modes in which indentation should be automatically
|
|
||||||
detected.")
|
|
||||||
|
|
||||||
(setq-default
|
;;
|
||||||
large-file-warning-threshold 15000000
|
;;; Formatting
|
||||||
vc-follow-symlinks t
|
|
||||||
;; Save clipboard contents into kill-ring before replacing them
|
|
||||||
save-interprogram-paste-before-kill t
|
|
||||||
;; Bookmarks
|
|
||||||
bookmark-default-file (concat doom-etc-dir "bookmarks")
|
|
||||||
bookmark-save-flag t
|
|
||||||
;; Formatting
|
|
||||||
delete-trailing-lines nil
|
|
||||||
fill-column 80
|
|
||||||
sentence-end-double-space nil
|
|
||||||
word-wrap t
|
|
||||||
;; Scrolling
|
|
||||||
hscroll-margin 2
|
|
||||||
hscroll-step 1
|
|
||||||
scroll-conservatively 1001
|
|
||||||
scroll-margin 0
|
|
||||||
scroll-preserve-screen-position t
|
|
||||||
mouse-wheel-scroll-amount '(5 ((shift) . 2))
|
|
||||||
mouse-wheel-progressive-speed nil ; don't accelerate scrolling
|
|
||||||
;; Whitespace (see `editorconfig')
|
|
||||||
indent-tabs-mode nil
|
|
||||||
require-final-newline t
|
|
||||||
tab-always-indent t
|
|
||||||
tab-width 4
|
|
||||||
tabify-regexp "^\t* [ \t]+" ; for :retab
|
|
||||||
;; Wrapping
|
|
||||||
truncate-lines t
|
|
||||||
truncate-partial-width-windows 50)
|
|
||||||
|
|
||||||
;; Remove hscroll-margin in shells, otherwise it causes jumpiness
|
;; Indentation
|
||||||
(setq-hook! '(eshell-mode-hook term-mode-hook) hscroll-margin 0)
|
(setq-default tab-width 4
|
||||||
|
tab-always-indent t
|
||||||
|
indent-tabs-mode nil
|
||||||
|
fill-column 80)
|
||||||
|
|
||||||
(def-advice! doom--optimize-literal-mode-for-large-files-a (buffer)
|
;; Word wrapping
|
||||||
:filter-return #'find-file-noselect-1
|
(setq-default word-wrap t
|
||||||
(with-current-buffer buffer
|
truncate-lines t
|
||||||
(when find-file-literally
|
truncate-partial-width-windows nil)
|
||||||
(setq buffer-read-only t)
|
|
||||||
(buffer-disable-undo))
|
(setq sentence-end-double-space nil
|
||||||
buffer))
|
delete-trailing-lines nil
|
||||||
|
require-final-newline t
|
||||||
|
tabify-regexp "^\t* [ \t]+") ; for :retab
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Clipboard / kill-ring
|
||||||
|
|
||||||
|
;; Eliminate duplicates in the kill ring. That is, if you kill the
|
||||||
|
;; same thing twice, you won't have to use M-y twice to get past it
|
||||||
|
;; to older entries in the kill ring.
|
||||||
|
(setq kill-do-not-save-duplicates t)
|
||||||
|
|
||||||
|
;;
|
||||||
|
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
||||||
|
|
||||||
|
;; Save clipboard contents into kill-ring before replacing them
|
||||||
|
(setq save-interprogram-paste-before-kill t)
|
||||||
|
|
||||||
|
;; Fix the clipboard in terminal or daemon Emacs (non-GUI)
|
||||||
|
(add-hook 'tty-setup-hook
|
||||||
|
(defun doom-init-clipboard-in-tty-emacs-h ()
|
||||||
|
(unless (getenv "SSH_CONNECTION")
|
||||||
|
(cond (IS-MAC
|
||||||
|
(if (require 'osx-clipboard nil t) (osx-clipboard-mode)))
|
||||||
|
((executable-find "xclip")
|
||||||
|
(if (require 'xclip nil t) (xclip-mode)))))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -93,6 +95,10 @@ detected.")
|
||||||
(doom-auto-revert-buffer-h))))))
|
(doom-auto-revert-buffer-h))))))
|
||||||
|
|
||||||
|
|
||||||
|
(after! bookmark
|
||||||
|
(setq bookmark-save-flag t))
|
||||||
|
|
||||||
|
|
||||||
(def-package! recentf
|
(def-package! recentf
|
||||||
;; Keep track of recently opened files
|
;; Keep track of recently opened files
|
||||||
:defer-incrementally (easymenu tree-widget timer)
|
:defer-incrementally (easymenu tree-widget timer)
|
||||||
|
@ -134,6 +140,7 @@ detected.")
|
||||||
(add-hook 'kill-emacs-hook #'recentf-cleanup)
|
(add-hook 'kill-emacs-hook #'recentf-cleanup)
|
||||||
(quiet! (recentf-mode +1))))
|
(quiet! (recentf-mode +1))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! savehist
|
(def-package! savehist
|
||||||
;; persist variables across sessions
|
;; persist variables across sessions
|
||||||
:defer-incrementally (custom)
|
:defer-incrementally (custom)
|
||||||
|
@ -167,6 +174,7 @@ detected.")
|
||||||
(if buffer-file-name (ignore-errors (recenter))))
|
(if buffer-file-name (ignore-errors (recenter))))
|
||||||
(save-place-mode +1))
|
(save-place-mode +1))
|
||||||
|
|
||||||
|
|
||||||
(def-package! server
|
(def-package! server
|
||||||
:when (display-graphic-p)
|
:when (display-graphic-p)
|
||||||
:after-call (pre-command-hook after-find-file focus-out-hook)
|
:after-call (pre-command-hook after-find-file focus-out-hook)
|
||||||
|
|
|
@ -73,10 +73,11 @@ If any hook returns non-nil, all hooks after it are ignored.")
|
||||||
;;
|
;;
|
||||||
;;; General + leader/localleader keys
|
;;; General + leader/localleader keys
|
||||||
|
|
||||||
(require 'general)
|
(use-package general
|
||||||
;; Convenience aliases
|
:config
|
||||||
(defalias 'define-key! #'general-def)
|
;; Convenience aliases
|
||||||
(defalias 'unmap! #'general-unbind)
|
(defalias 'define-key! #'general-def)
|
||||||
|
(defalias 'unmap! #'general-unbind))
|
||||||
|
|
||||||
;; `map!' uses this instead of `define-leader-key!' because it consumes 20-30%
|
;; `map!' uses this instead of `define-leader-key!' because it consumes 20-30%
|
||||||
;; more startup time, so we reimplement it ourselves.
|
;; more startup time, so we reimplement it ourselves.
|
||||||
|
@ -216,7 +217,7 @@ localleader prefix."
|
||||||
(?g . global))
|
(?g . global))
|
||||||
"A list of cons cells that map a letter to a evil state symbol.")
|
"A list of cons cells that map a letter to a evil state symbol.")
|
||||||
|
|
||||||
(defun doom--keyword-to-states (keyword)
|
(defun doom--map-keyword-to-states (keyword)
|
||||||
"Convert a KEYWORD into a list of evil state symbols.
|
"Convert a KEYWORD into a list of evil state symbols.
|
||||||
|
|
||||||
For example, :nvi will map to (list 'normal 'visual 'insert). See
|
For example, :nvi will map to (list 'normal 'visual 'insert). See
|
||||||
|
@ -307,7 +308,9 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
|
||||||
doom--map-forms)))
|
doom--map-forms)))
|
||||||
(_
|
(_
|
||||||
(condition-case _
|
(condition-case _
|
||||||
(doom--map-def (pop rest) (pop rest) (doom--keyword-to-states key) desc)
|
(doom--map-def (pop rest) (pop rest)
|
||||||
|
(doom--map-keyword-to-states key)
|
||||||
|
desc)
|
||||||
(error
|
(error
|
||||||
(error "Not a valid `map!' property: %s" key)))
|
(error "Not a valid `map!' property: %s" key)))
|
||||||
(setq desc nil))))
|
(setq desc nil))))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; core-lib.el -*- lexical-binding: t; -*-
|
;;; core-lib.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(let ((load-path doom-site-load-path))
|
(let ((load-path doom--initial-load-path))
|
||||||
(require 'subr-x)
|
(require 'subr-x)
|
||||||
(require 'cl-lib))
|
(require 'cl-lib))
|
||||||
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
;;; core-os.el -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; clipboard
|
|
||||||
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
|
||||||
|
|
||||||
;; fewer opts to process for systems that don't need them
|
|
||||||
(unless IS-MAC (setq command-line-ns-option-alist nil))
|
|
||||||
(unless IS-LINUX (setq command-line-x-option-alist nil))
|
|
||||||
|
|
||||||
;; Fix the clipboard in terminal or daemon Emacs (non-GUI)
|
|
||||||
(defun doom-init-clipboard-in-tty-emacs-h ()
|
|
||||||
(if IS-MAC
|
|
||||||
(if (require 'osx-clipboard nil t) (osx-clipboard-mode))
|
|
||||||
(if (require 'xclip nil t) (xclip-mode))))
|
|
||||||
(add-hook 'tty-setup-hook #'doom-init-clipboard-in-tty-emacs-h)
|
|
||||||
|
|
||||||
;; Enable mouse in terminal Emacs
|
|
||||||
(add-hook 'tty-setup-hook #'xterm-mouse-mode)
|
|
||||||
|
|
||||||
;; stop copying each visual state move to the clipboard:
|
|
||||||
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
|
||||||
;; grokked from: http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
|
||||||
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
|
||||||
|
|
||||||
(cond (IS-MAC
|
|
||||||
(setq mac-command-modifier 'super
|
|
||||||
mac-option-modifier 'meta
|
|
||||||
;; sane trackpad/mouse scroll settings
|
|
||||||
mac-redisplay-dont-reset-vscroll t
|
|
||||||
mac-mouse-wheel-smooth-scroll nil
|
|
||||||
;; Curse Lion and its sudden but inevitable fullscreen mode!
|
|
||||||
;; NOTE Meaningless to railwaycat's emacs-mac build
|
|
||||||
ns-use-native-fullscreen nil
|
|
||||||
;; Visit files opened outside of Emacs in existing frame, rather
|
|
||||||
;; than a new one
|
|
||||||
ns-pop-up-frames nil)
|
|
||||||
|
|
||||||
;; Syncs ns frame parameters with theme (and fixes mismatching text color
|
|
||||||
;; in the frame title)
|
|
||||||
(when (and (or (daemonp)
|
|
||||||
(display-graphic-p))
|
|
||||||
(require 'ns-auto-titlebar nil t))
|
|
||||||
(add-hook 'doom-load-theme-hook #'ns-auto-titlebar-mode)))
|
|
||||||
|
|
||||||
(IS-LINUX
|
|
||||||
(setq x-gtk-use-system-tooltips nil ; native tooltips are ugly!
|
|
||||||
x-underline-at-descent-line t)) ; draw underline lower
|
|
||||||
|
|
||||||
(IS-WINDOWS
|
|
||||||
(setq w32-get-true-file-attributes nil) ; fix file io slowdowns
|
|
||||||
(when (display-graphic-p)
|
|
||||||
(setenv "GIT_ASKPASS" "git-gui--askpass"))))
|
|
||||||
|
|
||||||
(provide 'core-os)
|
|
||||||
;;; core-os.el ends here
|
|
294
core/core-ui.el
294
core/core-ui.el
|
@ -51,10 +51,6 @@ examples.
|
||||||
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
It is recommended you don't set specify a font-size, as to inherit `doom-font's
|
||||||
size.")
|
size.")
|
||||||
|
|
||||||
(defvar doom--prefer-theme-elc nil
|
|
||||||
"If non-nil, `load-theme' will prefer the compiled theme (unlike its default
|
|
||||||
behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Custom hooks
|
;;; Custom hooks
|
||||||
|
@ -152,86 +148,74 @@ read-only or not file-visiting."
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; General configuration
|
;;; General UX
|
||||||
|
|
||||||
(setq-default
|
;; Simpler confirmation prompt when killing Emacs
|
||||||
ansi-color-for-comint-mode t
|
(setq confirm-kill-emacs #'doom-quit-p)
|
||||||
bidi-display-reordering nil ; disable bidirectional text for tiny performance boost
|
|
||||||
blink-matching-paren nil ; don't blink--too distracting
|
(setq uniquify-buffer-name-style 'forward
|
||||||
compilation-always-kill t ; kill compilation process before starting another
|
;; no beeping or blinking please
|
||||||
compilation-ask-about-save nil ; save all buffers on `compile'
|
ring-bell-function #'ignore
|
||||||
compilation-scroll-output 'first-error
|
visible-bell nil)
|
||||||
confirm-nonexistent-file-or-buffer t
|
|
||||||
confirm-kill-emacs #'doom-quit-p ; custom confirmation when killing Emacs
|
|
||||||
cursor-in-non-selected-windows nil ; hide cursors in other windows
|
|
||||||
custom-theme-directory (expand-file-name "themes/" doom-private-dir)
|
|
||||||
display-line-numbers-width 3
|
|
||||||
echo-keystrokes 0.02
|
|
||||||
enable-recursive-minibuffers nil
|
|
||||||
frame-inhibit-implied-resize t
|
|
||||||
frame-title-format '("%b – Doom Emacs") ; simple name in frame title
|
|
||||||
;; remove continuation arrow on right fringe
|
|
||||||
fringe-indicator-alist
|
|
||||||
(delq (assq 'continuation fringe-indicator-alist)
|
|
||||||
fringe-indicator-alist)
|
|
||||||
highlight-nonselected-windows nil
|
|
||||||
image-animate-loop t
|
|
||||||
indicate-buffer-boundaries nil
|
|
||||||
indicate-empty-lines nil
|
|
||||||
max-mini-window-height 0.3
|
|
||||||
mode-line-default-help-echo nil ; disable mode-line mouseovers
|
|
||||||
mouse-yank-at-point t ; middle-click paste at point, not at click
|
|
||||||
show-help-function nil ; hide :help-echo text
|
|
||||||
use-dialog-box nil ; always avoid GUI
|
|
||||||
uniquify-buffer-name-style 'forward
|
|
||||||
visible-cursor nil
|
|
||||||
x-stretch-cursor nil
|
|
||||||
;; Favor vertical splits
|
|
||||||
split-width-threshold 160
|
|
||||||
split-height-threshold nil
|
|
||||||
;; `pos-tip' defaults
|
|
||||||
pos-tip-internal-border-width 6
|
|
||||||
pos-tip-border-width 1
|
|
||||||
;; no beeping or blinking please
|
|
||||||
ring-bell-function #'ignore
|
|
||||||
visible-bell nil
|
|
||||||
;; don't resize emacs in steps, it looks weird
|
|
||||||
window-resize-pixelwise t
|
|
||||||
frame-resize-pixelwise t)
|
|
||||||
;; y/n instead of yes/no
|
|
||||||
(fset #'yes-or-no-p #'y-or-n-p)
|
|
||||||
;; Truly silence startup message
|
|
||||||
(fset #'display-startup-echo-area-message #'ignore)
|
|
||||||
;; relegate tooltips to echo area only
|
|
||||||
(if (bound-and-true-p tooltip-mode) (tooltip-mode -1))
|
|
||||||
;; enabled by default; no thanks, too distracting
|
|
||||||
(blink-cursor-mode -1)
|
|
||||||
;; Handle ansi codes in compilation buffer
|
|
||||||
(add-hook 'compilation-filter-hook #'doom|apply-ansi-color-to-compilation-buffer)
|
|
||||||
;; Make `next-buffer', `other-buffer', etc. ignore unreal buffers.
|
|
||||||
(add-to-list 'default-frame-alist '(buffer-predicate . doom-buffer-frame-predicate))
|
|
||||||
;; Prevent the glimpse of un-styled Emacs by setting these early.
|
|
||||||
(add-to-list 'default-frame-alist '(tool-bar-lines . 0))
|
|
||||||
(add-to-list 'default-frame-alist '(menu-bar-lines . 0))
|
|
||||||
(add-to-list 'default-frame-alist '(vertical-scroll-bars))
|
|
||||||
;; prompts the user for confirmation when deleting a non-empty frame
|
|
||||||
(global-set-key [remap delete-frame] #'doom/delete-frame)
|
|
||||||
;; don't resize minibuffer for large text
|
|
||||||
(setq resize-mini-windows nil)
|
|
||||||
;; Except when it's asking for input
|
|
||||||
(setq-hook! 'minibuffer-setup-hook resize-mini-windows 'grow-only)
|
|
||||||
|
|
||||||
;; Use `show-trailing-whitespace' instead of `whitespace-mode' because it's
|
;; Use `show-trailing-whitespace' instead of `whitespace-mode' because it's
|
||||||
;; faster (implemented in C). But try to only enable it in editing buffers.
|
;; faster (implemented in C). But try to only enable it in editing buffers.
|
||||||
(setq-default show-trailing-whitespace nil)
|
(setq-default show-trailing-whitespace nil)
|
||||||
(add-hook! (prog-mode text-mode conf-mode) #'doom-enable-show-trailing-whitespace-h)
|
(add-hook! (prog-mode text-mode conf-mode)
|
||||||
|
(defun doom-enable-show-trailing-whitespace-h ()
|
||||||
|
(setq show-trailing-whitespace t)))
|
||||||
|
|
||||||
;; The native border "consumes" a pixel of the fringe on righter-most splits,
|
;; middle-click paste at point, not at click
|
||||||
;; `window-divider' does not. Available since Emacs 25.1.
|
(setq mouse-yank-at-point t)
|
||||||
(setq-default window-divider-default-places t
|
|
||||||
window-divider-default-bottom-width 1
|
;; Enable mouse in terminal Emacs
|
||||||
window-divider-default-right-width 1)
|
(add-hook 'tty-setup-hook #'xterm-mouse-mode)
|
||||||
(add-hook 'doom-init-ui-hook #'window-divider-mode)
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Scrolling
|
||||||
|
|
||||||
|
(setq hscroll-margin 2
|
||||||
|
hscroll-step 1
|
||||||
|
scroll-conservatively 1001
|
||||||
|
scroll-margin 0
|
||||||
|
scroll-preserve-screen-position t
|
||||||
|
;; mouse
|
||||||
|
mouse-wheel-scroll-amount '(5 ((shift) . 2))
|
||||||
|
mouse-wheel-progressive-speed nil) ; don't accelerate scrolling
|
||||||
|
|
||||||
|
;; Remove hscroll-margin in shells, otherwise it causes jumpiness
|
||||||
|
(setq-hook! '(eshell-mode-hook term-mode-hook) hscroll-margin 0)
|
||||||
|
|
||||||
|
(when IS-MAC
|
||||||
|
;; sane trackpad/mouse scroll settings
|
||||||
|
(setq mac-redisplay-dont-reset-vscroll t
|
||||||
|
mac-mouse-wheel-smooth-scroll nil))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Cursor
|
||||||
|
|
||||||
|
;; Don't blink the cursor, it's too distracting.
|
||||||
|
(blink-cursor-mode -1)
|
||||||
|
|
||||||
|
;; Don't blink the paren matching the one at point, it's too distracting.
|
||||||
|
(setq blink-matching-paren nil)
|
||||||
|
|
||||||
|
(setq visible-cursor nil)
|
||||||
|
|
||||||
|
;; Don't stretch the cursor to fit wide characters, it is disorienting,
|
||||||
|
;; especially for tabs.
|
||||||
|
(setq x-stretch-cursor nil)
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Buffers
|
||||||
|
|
||||||
|
;; Make `next-buffer', `other-buffer', etc. ignore unreal buffers.
|
||||||
|
(push '(buffer-predicate . doom-buffer-frame-predicate) default-frame-alist)
|
||||||
|
|
||||||
|
(setq confirm-nonexistent-file-or-buffer t)
|
||||||
|
|
||||||
(def-advice! doom-switch-to-fallback-buffer-maybe-a (orig-fn)
|
(def-advice! doom-switch-to-fallback-buffer-maybe-a (orig-fn)
|
||||||
"Switch to `doom-fallback-buffer' if on last real buffer.
|
"Switch to `doom-fallback-buffer' if on last real buffer.
|
||||||
|
@ -267,9 +251,128 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
((funcall orig-fn)))))
|
((funcall orig-fn)))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Fringes
|
||||||
|
|
||||||
|
;; Reduce the clutter in the fringes; we'd like to reserve that space for more
|
||||||
|
;; useful information, like git-gutter and flycheck.
|
||||||
|
(setq indicate-buffer-boundaries nil
|
||||||
|
indicate-empty-lines nil)
|
||||||
|
|
||||||
|
;; remove continuation arrow on right fringe
|
||||||
|
(delq! 'continuation fringe-indicator-alist 'assq)
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Windows/frames
|
||||||
|
|
||||||
|
;; A simple frame title
|
||||||
|
(setq frame-title-format '("%b – Doom Emacs")
|
||||||
|
icon-title-format frame-title-format)
|
||||||
|
|
||||||
|
;; Don't resize emacs in steps, it looks weird.
|
||||||
|
(setq window-resize-pixelwise t
|
||||||
|
frame-resize-pixelwise t)
|
||||||
|
|
||||||
|
(unless EMACS27+ ; We already do this in early-init.el
|
||||||
|
;; Disable tool and scrollbars; Doom encourages keyboard-centric workflows, so
|
||||||
|
;; these are just clutter (the scrollbar also impacts Emacs' performance).
|
||||||
|
(push '(menu-bar-lines . 0) default-frame-alist)
|
||||||
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||||
|
(push '(vertical-scroll-bars) default-frame-alist))
|
||||||
|
|
||||||
|
;; Sets `ns-appearance' and `ns-transparent-titlebar' on GUI frames (and fixes
|
||||||
|
;; mismatching text color in the frame title)
|
||||||
|
(when IS-MAC
|
||||||
|
;; Curse Lion and its sudden but inevitable fullscreen mode!
|
||||||
|
;; NOTE Meaningless to railwaycat's emacs-mac build
|
||||||
|
(setq ns-use-native-fullscreen nil
|
||||||
|
;; Visit files opened outside of Emacs in existing frame, rather than a
|
||||||
|
;; new one
|
||||||
|
ns-pop-up-frames nil)
|
||||||
|
|
||||||
|
(and (or (daemonp)
|
||||||
|
(display-graphic-p))
|
||||||
|
(require 'ns-auto-titlebar nil t))
|
||||||
|
|
||||||
|
(add-hook 'after-make-frame-functions
|
||||||
|
(defun doom-init-menu-bar-in-gui-frames-h (frame)
|
||||||
|
"On MacOS, the menu bar isn't part of the frame. Disabling it makes MacOS
|
||||||
|
treat Emacs as a non-application window."
|
||||||
|
(when (display-graphic-p frame)
|
||||||
|
(set-frame-parameter frame 'menu-bar-lines 1)))))
|
||||||
|
|
||||||
|
;; The native border "consumes" a pixel of the fringe on righter-most splits,
|
||||||
|
;; `window-divider' does not. Available since Emacs 25.1.
|
||||||
|
(setq window-divider-default-places t
|
||||||
|
window-divider-default-bottom-width 1
|
||||||
|
window-divider-default-right-width 1)
|
||||||
|
(add-hook 'doom-init-ui-hook #'window-divider-mode)
|
||||||
|
|
||||||
|
;; Prompt the user for confirmation when deleting a non-empty frame
|
||||||
|
(global-set-key [remap delete-frame] #'doom/delete-frame)
|
||||||
|
|
||||||
|
;; always avoid GUI
|
||||||
|
(setq use-dialog-box nil)
|
||||||
|
;; Don't display floating tooltips; display their contents in the echo-area.
|
||||||
|
(if (bound-and-true-p tooltip-mode) (tooltip-mode -1))
|
||||||
|
;; native linux tooltips are ugly
|
||||||
|
(when IS-LINUX
|
||||||
|
(setq x-gtk-use-system-tooltips nil))
|
||||||
|
|
||||||
|
;; Favor vertical splits over horizontal ones
|
||||||
|
(setq split-width-threshold 160
|
||||||
|
split-height-threshold nil)
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Minibuffer
|
||||||
|
|
||||||
|
;; Allow for minibuffer-ception. Sometimes we need another minibuffer command
|
||||||
|
;; _while_ we're in the minibuffer.
|
||||||
|
(setq enable-recursive-minibuffers t)
|
||||||
|
|
||||||
|
;; Show current key-sequence in minibuffer, like vim does. Any feedback after
|
||||||
|
;; typing is better UX than no feedback at all.
|
||||||
|
(setq echo-keystrokes 0.02)
|
||||||
|
|
||||||
|
;; Expand the minibuffer to fit multi-line text displayed in the echo-area. This
|
||||||
|
;; doesn't look too great with direnv, however...
|
||||||
|
(setq resize-mini-windows 'grow-only
|
||||||
|
;; But don't let the minibuffer grow beyond this size
|
||||||
|
max-mini-window-height 0.15)
|
||||||
|
|
||||||
|
;; Disable help mouse-overs for mode-line segments (i.e. :help-echo text).
|
||||||
|
;; They're generally unhelpful and only add confusing visual clutter.
|
||||||
|
(setq mode-line-default-help-echo nil
|
||||||
|
show-help-function nil)
|
||||||
|
|
||||||
|
;; y/n is easier to type than yes/no
|
||||||
|
(fset #'yes-or-no-p #'y-or-n-p)
|
||||||
|
|
||||||
|
;; Try really hard to keep the cursor from getting stuck in the read-only prompt
|
||||||
|
;; portion of the minibuffer.
|
||||||
|
(setq minibuffer-prompt-properties '(read-only t intangible t cursor-intangible t face minibuffer-prompt))
|
||||||
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Built-in packages
|
;;; Built-in packages
|
||||||
|
|
||||||
|
;;;###package ansi-color
|
||||||
|
(setq ansi-color-for-comint-mode t)
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! compile
|
||||||
|
:defer t
|
||||||
|
:config
|
||||||
|
(setq compilation-always-kill t ; kill compilation process before starting another
|
||||||
|
compilation-ask-about-save nil ; save all buffers on `compile'
|
||||||
|
compilation-scroll-output 'first-error)
|
||||||
|
;; Handle ansi codes in compilation buffer
|
||||||
|
(add-hook 'compilation-filter-hook #'doom-apply-ansi-color-to-compilation-buffer-h))
|
||||||
|
|
||||||
|
|
||||||
(def-package! ediff
|
(def-package! ediff
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
|
@ -293,8 +396,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
;; Highlights the current line
|
;; Highlights the current line
|
||||||
:hook ((prog-mode text-mode conf-mode) . hl-line-mode)
|
:hook ((prog-mode text-mode conf-mode) . hl-line-mode)
|
||||||
:config
|
:config
|
||||||
;; PERF Not having to render the hl-line overlay in multiple buffers offers a
|
;; Not having to render the hl-line overlay in multiple buffers offers a tiny
|
||||||
;; tiny performance boost. I also don't need to see it in other buffers.
|
;; performance boost. I also don't need to see it in other buffers.
|
||||||
(setq hl-line-sticky-flag nil
|
(setq hl-line-sticky-flag nil
|
||||||
global-hl-line-sticky-flag nil)
|
global-hl-line-sticky-flag nil)
|
||||||
|
|
||||||
|
@ -340,11 +443,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(newline-mark ?\n [?¬ ?\n])
|
(newline-mark ?\n [?¬ ?\n])
|
||||||
(space-mark ?\ [?·] [?.])))
|
(space-mark ?\ [?·] [?.])))
|
||||||
|
|
||||||
;; Disable these because whitespace should be customized programmatically
|
|
||||||
;; (through `whitespace-style'), and not through these commands.
|
|
||||||
(put 'whitespace-toggle-options 'disabled t)
|
|
||||||
(put 'global-whitespace-toggle-options 'disabled t)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Third party packages
|
;;; Third party packages
|
||||||
|
@ -356,8 +454,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
(def-advice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args)
|
(def-advice! doom--disable-all-the-icons-in-tty-a (orig-fn &rest args)
|
||||||
"all-the-icons doesn't work in the terminal, so we \"disable\" them."
|
"all-the-icons doesn't work in the terminal, so we \"disable\" them."
|
||||||
:around '(all-the-icons-octicon all-the-icons-material
|
:around '(all-the-icons-octicon all-the-icons-material
|
||||||
all-the-icons-faicon all-the-icons-fileicon
|
all-the-icons-faicon all-the-icons-fileicon
|
||||||
all-the-icons-wicon all-the-icons-alltheicon)
|
all-the-icons-wicon all-the-icons-alltheicon)
|
||||||
(if (display-graphic-p)
|
(if (display-graphic-p)
|
||||||
(apply orig-fn args)
|
(apply orig-fn args)
|
||||||
"")))
|
"")))
|
||||||
|
@ -371,15 +469,24 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
|
||||||
:hook ((prog-mode conf-mode) . highlight-numbers-mode)
|
:hook ((prog-mode conf-mode) . highlight-numbers-mode)
|
||||||
:config (setq highlight-numbers-generic-regexp "\\_<[[:digit:]]+\\(?:\\.[0-9]*\\)?\\_>"))
|
:config (setq highlight-numbers-generic-regexp "\\_<[[:digit:]]+\\(?:\\.[0-9]*\\)?\\_>"))
|
||||||
|
|
||||||
|
;;;###package image
|
||||||
|
(setq image-animate-loop t)
|
||||||
|
|
||||||
;;;###package rainbow-delimiters
|
;;;###package rainbow-delimiters
|
||||||
;; Helps us distinguish stacked delimiter pairs, especially in parentheses-drunk
|
;; Helps us distinguish stacked delimiter pairs, especially in parentheses-drunk
|
||||||
;; languages like Lisp.
|
;; languages like Lisp.
|
||||||
(setq rainbow-delimiters-max-face-count 3)
|
(setq rainbow-delimiters-max-face-count 3)
|
||||||
|
|
||||||
|
;;;###package pos-tip
|
||||||
|
(setq pos-tip-internal-border-width 6
|
||||||
|
pos-tip-border-width 1)
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Line numbers
|
;;; Line numbers
|
||||||
|
|
||||||
|
(setq-default display-line-numbers-width 3)
|
||||||
|
|
||||||
;; line numbers in most modes
|
;; line numbers in most modes
|
||||||
(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook)
|
(add-hook! '(prog-mode-hook text-mode-hook conf-mode-hook)
|
||||||
#'display-line-numbers-mode)
|
#'display-line-numbers-mode)
|
||||||
|
@ -431,7 +538,7 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
||||||
(setq nlinum-format-function #'doom-nlinum-format-fn)
|
(setq nlinum-format-function #'doom-nlinum-format-fn)
|
||||||
|
|
||||||
(add-hook 'nlinum-mode-hook
|
(add-hook 'nlinum-mode-hook
|
||||||
(defun doom--init-nlinum-width-h ()
|
(defun doom-init-nlinum-width-h ()
|
||||||
"Calculate line number column width beforehand (optimization)."
|
"Calculate line number column width beforehand (optimization)."
|
||||||
(setq nlinum--width
|
(setq nlinum--width
|
||||||
(length (save-excursion (goto-char (point-max))
|
(length (save-excursion (goto-char (point-max))
|
||||||
|
@ -464,6 +571,13 @@ character that looks like a space that `whitespace-mode' won't affect.")
|
||||||
;;
|
;;
|
||||||
;;; Theme & font
|
;;; Theme & font
|
||||||
|
|
||||||
|
;; Underline looks a bit better when drawn lower
|
||||||
|
(setq x-underline-at-descent-line t)
|
||||||
|
|
||||||
|
(defvar doom--prefer-theme-elc nil
|
||||||
|
"If non-nil, `load-theme' will prefer the compiled theme (unlike its default
|
||||||
|
behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
|
||||||
|
|
||||||
(defun doom-init-fonts-h ()
|
(defun doom-init-fonts-h ()
|
||||||
"Loads fonts.
|
"Loads fonts.
|
||||||
|
|
||||||
|
@ -575,10 +689,6 @@ it to fix all that visual noise."
|
||||||
(funcall orig-fn)))
|
(funcall orig-fn)))
|
||||||
(add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a))
|
(add-function :around whitespace-enable-predicate #'doom-disable-whitespace-mode-in-childframes-a))
|
||||||
|
|
||||||
;; Don't allow cursor to enter the prompt
|
|
||||||
(setq minibuffer-prompt-properties '(read-only t intangible t cursor-intangible t face minibuffer-prompt))
|
|
||||||
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
|
||||||
|
|
||||||
;; Don't display messages in the minibuffer when using the minibuffer
|
;; Don't display messages in the minibuffer when using the minibuffer
|
||||||
(defmacro doom-silence-motion-key (command key)
|
(defmacro doom-silence-motion-key (command key)
|
||||||
(let ((key-command (intern (format "doom/silent-%s" command))))
|
(let ((key-command (intern (format "doom/silent-%s" command))))
|
||||||
|
|
234
core/core.el
234
core/core.el
|
@ -114,106 +114,160 @@ users).")
|
||||||
;;
|
;;
|
||||||
;;; Emacs core configuration
|
;;; Emacs core configuration
|
||||||
|
|
||||||
|
;; Reduce debug output, well, unless we've asked for it.
|
||||||
|
(setq debug-on-error doom-debug-mode
|
||||||
|
jka-compr-verbose doom-debug-mode)
|
||||||
|
|
||||||
;; UTF-8 as the default coding system
|
;; UTF-8 as the default coding system
|
||||||
(when (fboundp 'set-charset-priority)
|
(when (fboundp 'set-charset-priority)
|
||||||
(set-charset-priority 'unicode)) ; pretty
|
(set-charset-priority 'unicode)) ; pretty
|
||||||
(prefer-coding-system 'utf-8) ; pretty
|
(prefer-coding-system 'utf-8) ; pretty
|
||||||
(setq locale-coding-system 'utf-8) ; please
|
(setq locale-coding-system 'utf-8) ; please
|
||||||
|
;; Except for the clipboard on Windows, where its contents could be in an
|
||||||
|
;; encoding that's wider than utf-8, so we let Emacs/the OS decide what encoding
|
||||||
|
;; to use.
|
||||||
(unless IS-WINDOWS
|
(unless IS-WINDOWS
|
||||||
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
(setq selection-coding-system 'utf-8)) ; with sugar on top
|
||||||
|
|
||||||
(setq-default
|
;; Disable warnings from legacy advice system. They aren't useful, and we can't
|
||||||
ad-redefinition-action 'accept ; silence redefined function warnings
|
;; often do anything about them besides changing packages upstream
|
||||||
apropos-do-all t ; make `apropos' more useful
|
(setq ad-redefinition-action 'accept)
|
||||||
auto-mode-case-fold nil
|
|
||||||
autoload-compute-prefixes nil
|
|
||||||
debug-on-error doom-debug-mode
|
|
||||||
jka-compr-verbose doom-debug-mode ; silence compression messages
|
|
||||||
ffap-machine-p-known 'reject ; don't ping things that look like domain names
|
|
||||||
find-file-visit-truename t ; resolve symlinks when opening files
|
|
||||||
idle-update-delay 1 ; update ui slightly less often
|
|
||||||
;; be quiet at startup; don't load or display anything unnecessary
|
|
||||||
inhibit-startup-message t
|
|
||||||
inhibit-startup-echo-area-message user-login-name
|
|
||||||
inhibit-default-init t
|
|
||||||
initial-major-mode 'fundamental-mode
|
|
||||||
initial-scratch-message nil
|
|
||||||
;; History & backup settings (save nothing, that's what git is for)
|
|
||||||
auto-save-default nil
|
|
||||||
create-lockfiles nil
|
|
||||||
history-length 500
|
|
||||||
make-backup-files nil ; don't create backup~ files
|
|
||||||
;; byte compilation
|
|
||||||
byte-compile-verbose doom-debug-mode
|
|
||||||
byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local)
|
|
||||||
;; security
|
|
||||||
gnutls-verify-error (not (getenv "INSECURE")) ; you shouldn't use this
|
|
||||||
tls-checktrust gnutls-verify-error
|
|
||||||
tls-program (list "gnutls-cli --x509cafile %t -p %p %h"
|
|
||||||
;; compatibility fallbacks
|
|
||||||
"gnutls-cli -p %p %h"
|
|
||||||
"openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof")
|
|
||||||
;; Don't store authinfo in plain text!
|
|
||||||
auth-sources (list (expand-file-name "authinfo.gpg" doom-etc-dir)
|
|
||||||
"~/.authinfo.gpg")
|
|
||||||
;; Don't litter `doom-emacs-dir'
|
|
||||||
abbrev-file-name (concat doom-local-dir "abbrev.el")
|
|
||||||
async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log")
|
|
||||||
auto-save-list-file-name (concat doom-cache-dir "autosave")
|
|
||||||
backup-directory-alist (list (cons "." (concat doom-cache-dir "backup/")))
|
|
||||||
custom-file (concat doom-private-dir "init.el")
|
|
||||||
desktop-dirname (concat doom-etc-dir "desktop")
|
|
||||||
desktop-base-file-name "autosave"
|
|
||||||
desktop-base-lock-name "autosave-lock"
|
|
||||||
pcache-directory (concat doom-cache-dir "pcache/")
|
|
||||||
request-storage-directory (concat doom-cache-dir "request")
|
|
||||||
server-auth-dir (concat doom-cache-dir "server/")
|
|
||||||
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
|
|
||||||
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")
|
|
||||||
tramp-backup-directory-alist backup-directory-alist
|
|
||||||
tramp-persistency-file-name (concat doom-cache-dir "tramp-persistency.el")
|
|
||||||
url-cache-directory (concat doom-cache-dir "url/")
|
|
||||||
url-configuration-directory (concat doom-etc-dir "url/")
|
|
||||||
gamegrid-user-score-file-directory (concat doom-etc-dir "games/"))
|
|
||||||
|
|
||||||
(defun doom*symbol-file (orig-fn symbol &optional type)
|
;; Make apropos omnipotent. It's more useful this way.
|
||||||
"If a `doom-file' symbol property exists on SYMBOL, use that instead of the
|
(setq apropos-do-all t)
|
||||||
original value of `symbol-file'."
|
|
||||||
(or (if (symbolp symbol) (get symbol 'doom-file))
|
;; Don't make a second case-insensitive pass over `auto-mode-alist'. If it has
|
||||||
(funcall orig-fn symbol type)))
|
;; to, it's our (the user's) failure. One case for all!
|
||||||
(advice-add #'symbol-file :around #'doom*symbol-file)
|
(setq auto-mode-case-fold nil)
|
||||||
|
|
||||||
|
;; Enable all disabled commands.
|
||||||
|
(setq disabled-command-function nil)
|
||||||
|
|
||||||
|
;; Display the bare minimum at startup. We don't need all that noise. The
|
||||||
|
;; dashboard/empty scratch buffer is good enough.
|
||||||
|
(setq inhibit-startup-message t
|
||||||
|
inhibit-startup-echo-area-message user-login-name
|
||||||
|
inhibit-default-init t
|
||||||
|
initial-major-mode 'fundamental-mode
|
||||||
|
initial-scratch-message nil)
|
||||||
|
(fset #'display-startup-echo-area-message #'ignore)
|
||||||
|
|
||||||
|
;; Emacs "updates" its ui more often than it needs to, so we slow it down
|
||||||
|
;; slightly, from 0.5s:
|
||||||
|
(setq idle-update-delay 1)
|
||||||
|
|
||||||
|
;; Don't autosave files or create lock/history/backup files. The
|
||||||
|
;; editor doesn't need to hold our hands so much. We'll rely on git
|
||||||
|
;; and our own good fortune instead. Fingers crossed!
|
||||||
|
(setq auto-save-default nil
|
||||||
|
create-lockfiles nil
|
||||||
|
make-backup-files nil
|
||||||
|
;; But have a place to store them in case we do use them...
|
||||||
|
auto-save-list-file-name (concat doom-cache-dir "autosave")
|
||||||
|
backup-directory-alist `(("." . ,(concat doom-cache-dir "backup/"))))
|
||||||
|
|
||||||
|
;; Emacs is a huge security vulnerability, what with all the dependencies it
|
||||||
|
;; pulls in from all corners of the globe. Let's at least try to be more
|
||||||
|
;; discerning.
|
||||||
|
(setq gnutls-verify-error (not (getenv "INSECURE"))
|
||||||
|
tls-checktrust gnutls-verify-error
|
||||||
|
tls-program '("gnutls-cli --x509cafile %t -p %p %h"
|
||||||
|
;; compatibility fallbacks
|
||||||
|
"gnutls-cli -p %p %h"
|
||||||
|
"openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof"))
|
||||||
|
|
||||||
|
;; Emacs stores authinfo in HOME and in plaintext. Let's not do that, mkay? This
|
||||||
|
;; file usually stores usernames, passwords, and other such treasures for the
|
||||||
|
;; aspiring malicious third party.
|
||||||
|
(setq auth-sources (list (expand-file-name "authinfo.gpg" doom-etc-dir)
|
||||||
|
"~/.authinfo.gpg"))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;; Resolve symlinks when opening files, so that any operations are conducted
|
||||||
;;; Minor mode version of `auto-mode-alist'
|
;; from the file's true directory (like `find-file').
|
||||||
|
(setq find-file-visit-truename t)
|
||||||
|
|
||||||
(defvar doom-auto-minor-mode-alist '()
|
;; Disable the warning "X and Y are the same file". It's fine to ignore this
|
||||||
"Alist mapping filename patterns to corresponding minor mode functions, like
|
;; warning as it will redirect you to the existing buffer anyway.
|
||||||
`auto-mode-alist'. All elements of this alist are checked, meaning you can
|
(setq find-file-suppress-same-file-warnings t)
|
||||||
enable multiple minor modes for the same regexp.")
|
|
||||||
|
|
||||||
(defun doom-enable-minor-mode-maybe-h ()
|
;; Create missing directories when we open a file that doesn't exist under a
|
||||||
"Check file name against `doom-auto-minor-mode-alist'."
|
;; directory tree that may not exist.
|
||||||
(when (and buffer-file-name doom-auto-minor-mode-alist)
|
(add-hook 'find-file-not-found-functions
|
||||||
(let ((name buffer-file-name)
|
(defun doom-create-missing-directories-h ()
|
||||||
(remote-id (file-remote-p buffer-file-name))
|
"Automatically create missing directories when creating new files."
|
||||||
(alist doom-auto-minor-mode-alist))
|
(let ((parent-directory (file-name-directory buffer-file-name)))
|
||||||
;; Remove backup-suffixes from file name.
|
(when (and (not (file-exists-p parent-directory))
|
||||||
(setq name (file-name-sans-versions name))
|
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
||||||
;; Remove remote file name identification.
|
(make-directory parent-directory t)))))
|
||||||
(when (and (stringp remote-id)
|
|
||||||
(string-match (regexp-quote remote-id) name))
|
;; Emacs on Windows frequently confuses HOME (C:\Users\<NAME>) and APPDATA,
|
||||||
(setq name (substring name (match-end 0))))
|
;; causing `abbreviate-home-dir' to produce incorrect paths.
|
||||||
(while (and alist (caar alist) (cdar alist))
|
(when IS-WINDOWS
|
||||||
(if (string-match-p (caar alist) name)
|
(setq abbreviated-home-dir "\\`'"))
|
||||||
(funcall (cdar alist) 1))
|
|
||||||
(setq alist (cdr alist))))))
|
;; Don't litter `doom-emacs-dir'
|
||||||
(add-hook 'find-file-hook #'doom-enable-minor-mode-maybe-h)
|
(setq abbrev-file-name (concat doom-local-dir "abbrev.el")
|
||||||
|
async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log")
|
||||||
|
bookmark-default-file (concat doom-etc-dir "bookmarks")
|
||||||
|
custom-file (concat doom-private-dir "init.el")
|
||||||
|
custom-theme-directory (concat doom-private-dir "themes/")
|
||||||
|
desktop-dirname (concat doom-etc-dir "desktop")
|
||||||
|
desktop-base-file-name "autosave"
|
||||||
|
desktop-base-lock-name "autosave-lock"
|
||||||
|
pcache-directory (concat doom-cache-dir "pcache/")
|
||||||
|
request-storage-directory (concat doom-cache-dir "request")
|
||||||
|
server-auth-dir (concat doom-cache-dir "server/")
|
||||||
|
shared-game-score-directory (concat doom-etc-dir "shared-game-score/")
|
||||||
|
tramp-auto-save-directory (concat doom-cache-dir "tramp-auto-save/")
|
||||||
|
tramp-backup-directory-alist backup-directory-alist
|
||||||
|
tramp-persistency-file-name (concat doom-cache-dir "tramp-persistency.el")
|
||||||
|
url-cache-directory (concat doom-cache-dir "url/")
|
||||||
|
url-configuration-directory (concat doom-etc-dir "url/")
|
||||||
|
gamegrid-user-score-file-directory (concat doom-etc-dir "games/"))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Optimizations
|
;;; Optimizations
|
||||||
|
|
||||||
|
;; Disable bidirectional text rendering for a modest performance boost. Of
|
||||||
|
;; course, this renders Emacs unable to detect/display right-to-left languages
|
||||||
|
;; (sorry!), but for us left-to-right language speakers/writers, it's a boon.
|
||||||
|
(setq-default bidi-display-reordering 'left-to-right)
|
||||||
|
|
||||||
|
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
|
||||||
|
;; in non-focused windows.
|
||||||
|
(setq-default cursor-in-non-selected-windows nil)
|
||||||
|
(setq highlight-nonselected-windows nil)
|
||||||
|
|
||||||
|
;; More performant rapid scrolling over unfontified regions. May cause brief
|
||||||
|
;; spells of inaccurate fontification immediately after scrolling.
|
||||||
|
(setq fast-but-imprecise-scrolling t)
|
||||||
|
|
||||||
|
;; Resizing the Emacs frame can be a terribly expensive part of changing the
|
||||||
|
;; font. By inhibiting this, we easily halve startup times with fonts that are
|
||||||
|
;; larger than the system default.
|
||||||
|
(setq frame-inhibit-implied-resize t)
|
||||||
|
|
||||||
|
;; Don't ping things that look like domain names.
|
||||||
|
(setq ffap-machine-p-known 'reject)
|
||||||
|
|
||||||
|
;; Performance on Windows is considerably worse than elsewhere. We'll need
|
||||||
|
;; everything we can get.
|
||||||
|
(when IS-WINDOWS
|
||||||
|
;; Reduce the workload when doing file IO
|
||||||
|
(setq w32-get-true-file-attributes nil)
|
||||||
|
|
||||||
|
;; Font compacting can be terribly expensive, especially for rendering icon
|
||||||
|
;; fonts on Windows. Whether it has a noteable affect on Linux and Mac hasn't
|
||||||
|
;; been determined.
|
||||||
|
(setq inhibit-compacting-font-caches t))
|
||||||
|
|
||||||
|
;; Remove command line options that aren't relevant to our current OS; that
|
||||||
|
;; means less to process at startup.
|
||||||
|
(unless IS-MAC (setq command-line-ns-option-alist nil))
|
||||||
|
(unless IS-LINUX (setq command-line-x-option-alist nil))
|
||||||
|
|
||||||
;; This is consulted on every `require', `load' and various path/io functions.
|
;; This is consulted on every `require', `load' and various path/io functions.
|
||||||
;; You get a minor speed up by nooping this.
|
;; You get a minor speed up by nooping this.
|
||||||
(setq file-name-handler-alist nil)
|
(setq file-name-handler-alist nil)
|
||||||
|
@ -293,14 +347,6 @@ enable multiple minor modes for the same regexp.")
|
||||||
(doom-run-local-var-hooks-h)))
|
(doom-run-local-var-hooks-h)))
|
||||||
'append)
|
'append)
|
||||||
|
|
||||||
(add-hook 'find-file-not-found-functions
|
|
||||||
(defun doom-create-missing-directories-h ()
|
|
||||||
"Automatically create missing directories when creating new files."
|
|
||||||
(let ((parent-directory (file-name-directory buffer-file-name)))
|
|
||||||
(when (and (not (file-exists-p parent-directory))
|
|
||||||
(y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
|
|
||||||
(make-directory parent-directory t)))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Incremental lazy-loading
|
;;; Incremental lazy-loading
|
||||||
|
|
|
@ -4,12 +4,6 @@
|
||||||
;; core.el
|
;; core.el
|
||||||
(package! dotenv-mode)
|
(package! dotenv-mode)
|
||||||
|
|
||||||
;; core-os.el
|
|
||||||
(if (not IS-MAC)
|
|
||||||
(package! xclip)
|
|
||||||
(package! osx-clipboard)
|
|
||||||
(package! ns-auto-titlebar))
|
|
||||||
|
|
||||||
;; core-ui.el
|
;; core-ui.el
|
||||||
(package! all-the-icons)
|
(package! all-the-icons)
|
||||||
(package! hide-mode-line)
|
(package! hide-mode-line)
|
||||||
|
@ -26,10 +20,13 @@
|
||||||
(package! command-log-mode)
|
(package! command-log-mode)
|
||||||
(package! dtrt-indent)
|
(package! dtrt-indent)
|
||||||
(package! helpful)
|
(package! helpful)
|
||||||
|
(package! ns-auto-titlebar :ignore (not IS-MAC))
|
||||||
(package! pcre2el)
|
(package! pcre2el)
|
||||||
(package! smartparens)
|
(package! smartparens)
|
||||||
|
(package! osx-clipboard :ignore (not IS-MAC))
|
||||||
(package! undo-tree)
|
(package! undo-tree)
|
||||||
(package! ws-butler)
|
(package! ws-butler)
|
||||||
|
(package! xclip :ignore IS-LINUX)
|
||||||
|
|
||||||
;; core-projects.el
|
;; core-projects.el
|
||||||
(package! projectile)
|
(package! projectile)
|
||||||
|
|
|
@ -49,6 +49,12 @@ directives. By default, this only recognizes C directives.")
|
||||||
|
|
||||||
(put 'evil-define-key* 'lisp-indent-function 'defun)
|
(put 'evil-define-key* 'lisp-indent-function 'defun)
|
||||||
|
|
||||||
|
;; stop copying each visual state move to the clipboard:
|
||||||
|
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
||||||
|
;; grokked from:
|
||||||
|
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
||||||
|
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
||||||
|
|
||||||
;; Start help-with-tutorial in emacs state
|
;; Start help-with-tutorial in emacs state
|
||||||
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
|
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(setq vc-make-backup-files nil)
|
(when IS-WINDOWS
|
||||||
|
(setenv "GIT_ASKPASS" "git-gui--askpass"))
|
||||||
|
|
||||||
|
|
||||||
|
(setq vc-make-backup-files nil
|
||||||
|
vc-follow-symlinks t)
|
||||||
|
|
||||||
|
|
||||||
(after! git-timemachine
|
(after! git-timemachine
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue