about summary refs log tree commit diff stats
path: root/lisp/acdw-defaults.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/acdw-defaults.el')
-rw-r--r--lisp/acdw-defaults.el292
1 files changed, 292 insertions, 0 deletions
diff --git a/lisp/acdw-defaults.el b/lisp/acdw-defaults.el new file mode 100644 index 0000000..80b2bcc --- /dev/null +++ b/lisp/acdw-defaults.el
@@ -0,0 +1,292 @@
1;;; acdw-defaults.el --- measured defaults for Emacs -*- lexical-binding: t -*-
2;; by C. Duckworth <acdw@acdw.net>
3
4;;; Commentary:
5
6;; I find myself copy-pasting a lot of "boilerplate" type code when
7;; bankrupting my Emacs config and starting afresh. Instead of doing
8;; that, I'm putting it here, where it'll be easier to include in my
9;; config.
10
11;; Of course, some might say I could just ... stop bankrupting my
12;; Emacs. But like, why would I want to?
13
14;;; Code:
15
16(require 'seq)
17
18(defvar default-ring-max 256
19 "Default maximum for ring variables.")
20
21(unless (boundp 'use-short-answers)
22 (fset 'yes-or-no-p 'y-or-n-p))
23
24(setc async-shell-command-buffer 'new-buffer
25 async-shell-command-display-buffer nil
26 auto-hscroll-mode t
27 auto-window-vscroll nil
28 cursor-in-non-selected-windows 'hollow
29 cursor-type 'bar
30 echo-keystrokes 0.01
31 fast-but-imprecise-scrolling t
32 fill-column 80
33 global-mark-ring-max default-ring-max
34 hscroll-margin 1
35 hscroll-step 1
36 inhibit-startup-screen t
37 initial-buffer-choice t
38 kill-do-not-save-duplicates t
39 kill-read-only-ok t
40 kill-ring-max default-ring-max
41 kmacro-ring-max default-ring-max
42 mark-ring-max default-ring-max
43 read-answer-short t
44 read-process-output-max (* 10 1024 1024)
45 ring-bell-function #'ignore
46 save-interprogram-paste-before-kill t
47 scroll-conservatively 25
48 scroll-margin 0
49 scroll-preserve-screen-position 1
50 scroll-step 1
51 sentence-end-double-space t
52 set-mark-command-repeat-pop t
53 tab-width 8
54 undo-limit (* 10 1024 1024)
55 use-dialog-box nil
56 use-file-dialog nil
57 use-short-answers t
58 window-resize-pixelwise t
59 yank-pop-change-selection t)
60
61;;; Encodings
62
63;; Allegedly, this is the only one you need...
64(set-language-environment "UTF-8")
65;; But I still set all of these, for fun.
66(setq-default buffer-file-coding-system 'utf-8-unix
67 coding-system-for-read 'utf-8-unix
68 coding-system-for-write 'utf-8-unix
69 default-process-coding-system '(utf-8-unix . utf-8-unix)
70 locale-coding-system 'utf-8-unix
71 x-select-request-type '(UTF8_STRING
72 COMPOUND_TEXT
73 TEXT
74 STRING))
75
76(set-charset-priority 'unicode)
77(prefer-coding-system 'utf-8-unix)
78(set-default-coding-systems 'utf-8-unix)
79(set-terminal-coding-system 'utf-8-unix)
80(set-keyboard-coding-system 'utf-8-unix)
81
82(pcase system-type
83 ((or 'ms-dos 'windows-nt)
84 (set-clipboard-coding-system 'utf-16-le)
85 (set-selection-coding-system 'utf-16-le))
86 (_
87 (set-selection-coding-system 'utf-8)
88 (set-clipboard-coding-system 'utf-8)))
89
90;;; Modes
91
92(dolist (enable-mode '(;; Enable these modes on startup
93 delete-selection-mode
94 global-so-long-mode
95 ))
96 (funcall enable-mode +1))
97
98(dolist (disable-mode '(;; Disable these modes on startup
99 horizontal-scroll-bar-mode
100 menu-bar-mode
101 scroll-bar-mode
102 tool-bar-mode
103 tooltip-mode
104 ))
105 (funcall disable-mode -1))
106
107;;; Internal packages
108
109(when (require 'abbrev nil t)
110 (custom-set-variables
111 '(abbrev-file-name (sync/ "abbrev.el"))
112 '(save-abbrevs 'silently)))
113
114(when (require 'autorevert nil t)
115 (custom-set-variables
116 '(auto-revert-verbose nil)
117 '(global-auto-revert-non-file-buffers t))
118 (global-auto-revert-mode +1))
119
120(when (require 'comp nil t)
121 (custom-set-variables
122 '(native-comp-async-report-warnings-errors 'silent)
123 '(native-comp-deferred-compilation t)))
124
125(when (require 'custom nil t)
126 (custom-set-variables
127 '(custom-file (etc/ "custom.el"))))
128
129(when (require 'ediff nil t)
130 (custom-set-variables
131 '(ediff-window-setup-function #'ediff-setup-windows-plain)))
132
133(when (require 'eldoc nil t)
134 (custom-set-variables
135 '(eldoc-echo-area-use-multiline-p nil)
136 '(eldoc-idle-delay 0.1)))
137
138(when (require 'executable nil t)
139 (custom-set-variables
140 '(executable-prefix-env t)))
141
142(when (require 'files nil t)
143 (custom-set-variables
144 '(auto-save-default nil)
145 '(auto-save-interval 1)
146 '(auto-save-no-message t)
147 '(auto-save-timeout 1)
148 '(auto-save-visited-interval 1)
149 '(backup-by-copying t)
150 '(create-lockfiles nil)
151 '(delete-old-versions t)
152 '(find-file-visit-truename t)
153 '(kept-new-versions 8)
154 '(kept-old-versions 8)
155 '(mode-require-final-newline t)
156 '(version-control t)
157 '(view-read-only t))
158 (dolist (h/f
159 '((after-save-hook . executable-make-buffer-file-executable-if-script-p)
160 (find-file-not-found-functions . create-missing-directories)
161 (find-file-hook . +vc-off@remote)))
162 (add-hook (car h/f) (cdr h/f)))
163 (auto-save-visited-mode))
164
165(when (require 'frame nil t)
166 (custom-set-variables
167 '(blink-cursor-blinks 1)
168 '(blink-cursor-interval 0.25)
169 '(blink-cursor-delay 0.25))
170 (blink-cursor-mode))
171
172(when (require 'goto-addr nil t)
173 (if (fboundp 'global-goto-address-mode)
174 (global-goto-address-mode +1)
175 (add-hook 'after-change-major-mode-hook 'goto-address-mode)))
176
177(when (require 'ibuffer nil t)
178 (global-set-key (kbd "C-x C-b") #'ibuffer)
179 (add-hook 'ibuffer-mode-hook #'hl-line-mode))
180
181(when (require 'image nil t)
182 (custom-set-variables
183 '(image-use-external-converter
184 (seq-some #'executable-find '("convert" "gm" "ffmpeg")))))
185
186(when (require 'imenu nil t)
187 (custom-set-variables
188 '(imenu-auto-rescan t)))
189
190(when (require 'isearch nil t)
191 (custom-set-variables
192 '(regexp-search-ring-max default-ring-max)
193 '(search-ring-max default-ring-max)))
194
195(when (require 'minibuffer nil t)
196 (custom-set-variables
197 '(completion-category-defaults nil)
198 '(completion-category-overrides '((file (styles partial-completion))))
199 '(completion-ignore-case t)
200 '(completion-styles '(substring partial-completion))
201 '(enable-recursive-minibuffers t)
202 '(file-name-shadow-properties '(invisible t intangible t))
203 '(minibuffer-eldef-shorten-default t)
204 '(minibuffer-prompt-properties '( read-only t
205 cursor-intangible t
206 face minibuffer-prompt))
207 '(read-buffer-completion-ignore-case t))
208 (file-name-shadow-mode)
209 (minibuffer-electric-default-mode))
210
211(when (require 'mouse nil t)
212 (custom-set-variables
213 '(mouse-drag-copy-region t)
214 '(mouse-wheel-progressive-speed nil)
215 '(mouse-yank-at-point t)))
216
217(when (require 'paren nil t)
218 (custom-set-variables
219 '(show-paren-delay 0.01)
220 '(show-paren-style 'parenthesis)
221 '(show-paren-when-point-in-periphery t)
222 '(show-paren-when-point-inside-paren t))
223 (show-paren-mode)
224 (electric-pair-mode))
225
226(when (require 'recentf nil t)
227 (custom-set-variables
228 '(recentf-save-file (var/ "recentf.el"))
229 '(recentf-max-menu-items default-ring-max)
230 '(recentf-max-saved-items nil)
231 '(recentf-auto-cleanup 'mode))
232 (add-to-list 'recentf-exclude etc/)
233 (add-to-list 'recentf-exclude var/)
234 (add-to-list 'recentf-exclude cache/)
235 (add-to-list 'recentf-exclude "-autoloads.el\\'")
236 (recentf-mode +1))
237
238(when (require 'savehist nil t)
239 (custom-set-variables
240 '(history-length 1024)
241 '(history-delete-duplicates t)
242 '(savehist-file (var/ "savehist.el"))
243 '(savehist-save-minibuffer-history t)
244 '(savehist-autosave-interval 30)
245 ;; Other variables --- don't truncate any of these.
246 ;; `add-to-history' uses the values of these variables unless
247 ;; they're nil, in which case it falls back to `history-length'.
248 '(kill-ring-max default-ring-max)
249 '(mark-ring-max default-ring-max)
250 '(global-mark-ring-max default-ring-max)
251 '(regexp-search-ring-max default-ring-max)
252 '(search-ring-max default-ring-max)
253 '(kmacro-ring-max default-ring-max)
254 '(eww-history-limit default-ring-max))
255 (dolist (var '(global-mark-ring
256 mark-ring
257 kill-ring
258 kmacro-ring
259 regexp-search-ring
260 search-ring))
261 (add-to-list 'savehist-additional-variables var))
262 (savehist-mode +1))
263
264(when (require 'saveplace nil t)
265 (custom-set-variables
266 '(save-place-file (var/ "places.el"))
267 '(save-place-forget-unreadable-files (eq system-type 'gnu/linux)))
268 (save-place-mode 1))
269
270(when (require 'uniquify nil t)
271 (custom-set-variables
272 '(uniquify-after-kill-buffer-p t)
273 '(uniquify-buffer-name-style 'forward)
274 '(uniquify-ignore-buffers-re "^\\*")
275 '(uniquify-separator path-separator)))
276
277(when (require 'vc nil t)
278 (custom-set-variables
279 '(vc-follow-symlinks t)
280 '(vc-make-backup-files t)))
281
282(when (require 'window nil t)
283 (custom-set-variables
284 '(recenter-positions '(top 2 middle bottom))))
285
286;;; New features
287
288(when (fboundp 'pixel-scroll-precision-mode)
289 (pixel-scroll-precision-mode))
290
291(provide 'acdw-defaults)
292;;; acdw-defaults.el ends here