diff options
Diffstat (limited to 'basics.el')
-rw-r--r-- | basics.el | 170 |
1 files changed, 88 insertions, 82 deletions
diff --git a/basics.el b/basics.el index 3b24a68..7b4b1fd 100644 --- a/basics.el +++ b/basics.el | |||
@@ -29,61 +29,61 @@ | |||
29 | :ensure t :demand t | 29 | :ensure t :demand t |
30 | :preface | 30 | :preface |
31 | (setq-default no-littering-etc-directory etc/ | 31 | (setq-default no-littering-etc-directory etc/ |
32 | no-littering-var-directory etc/)) | 32 | no-littering-var-directory etc/)) |
33 | 33 | ||
34 | ;;; Settings | 34 | ;;; Settings |
35 | 35 | ||
36 | ;; Async | 36 | ;; Async |
37 | (setq-default async-shell-command-buffer 'new-buffer | 37 | (setq-default async-shell-command-buffer 'new-buffer |
38 | async-shell-command-display-buffer nil) | 38 | async-shell-command-display-buffer nil) |
39 | 39 | ||
40 | ;; Scrolling | 40 | ;; Scrolling |
41 | (setq-default auto-hscroll-mode t | 41 | (setq-default auto-hscroll-mode t |
42 | auto-window-vscroll nil | 42 | auto-window-vscroll nil |
43 | fast-but-imprecise-scrolling t | 43 | fast-but-imprecise-scrolling t |
44 | hscroll-margin 1 | 44 | hscroll-margin 1 |
45 | hscroll-step 1 | 45 | hscroll-step 1 |
46 | scroll-conservatively 25 | 46 | scroll-conservatively 25 |
47 | scroll-margin 0 | 47 | scroll-margin 0 |
48 | scroll-preserve-screen-position 1 | 48 | scroll-preserve-screen-position 1 |
49 | scroll-step 1) | 49 | scroll-step 1) |
50 | (scroll-bar-mode -1) | 50 | (scroll-bar-mode -1) |
51 | (horizontal-scroll-bar-mode -1) | 51 | (horizontal-scroll-bar-mode -1) |
52 | (pixel-scroll-precision-mode) | 52 | (pixel-scroll-precision-mode) |
53 | 53 | ||
54 | ;; Cursor | 54 | ;; Cursor |
55 | (setq-default cursor-in-non-selected-windows 'hollow | 55 | (setq-default cursor-in-non-selected-windows 'hollow |
56 | cursor-type 'bar | 56 | cursor-type 'bar |
57 | blink-cursor-blinks 1 | 57 | blink-cursor-blinks 1 |
58 | blink-cursor-interval 0.25 | 58 | blink-cursor-interval 0.25 |
59 | blink-cursor-delay 0.25) | 59 | blink-cursor-delay 0.25) |
60 | (blink-cursor-mode) | 60 | (blink-cursor-mode) |
61 | 61 | ||
62 | ;; Mouse | 62 | ;; Mouse |
63 | (setq-default mouse-drag-copy-region t | 63 | (setq-default mouse-drag-copy-region t |
64 | mouse-wheel-progressive-speed nil | 64 | mouse-wheel-progressive-speed nil |
65 | mouse-yank-at-point t) | 65 | mouse-yank-at-point t) |
66 | 66 | ||
67 | ;; Dialogs | 67 | ;; Dialogs |
68 | (unless (boundp 'use-short-answers) | 68 | (unless (boundp 'use-short-answers) |
69 | (fset 'yes-or-no-p 'y-or-n-p)) | 69 | (fset 'yes-or-no-p 'y-or-n-p)) |
70 | 70 | ||
71 | (setq-default read-answer-short t | 71 | (setq-default read-answer-short t |
72 | use-dialog-box nil | 72 | use-dialog-box nil |
73 | use-file-dialog nil | 73 | use-file-dialog nil |
74 | use-short-answers t) | 74 | use-short-answers t) |
75 | 75 | ||
76 | ;; Minibuffer | 76 | ;; Minibuffer |
77 | (setq-default completion-ignore-case t | 77 | (setq-default completion-ignore-case t |
78 | read-buffer-completion-ignore-case t | 78 | read-buffer-completion-ignore-case t |
79 | read-file-name-completion-ignore-case t | 79 | read-file-name-completion-ignore-case t |
80 | completions-detailed t | 80 | completions-detailed t |
81 | enable-recursive-minibuffers t | 81 | enable-recursive-minibuffers t |
82 | file-name-shadow-properties '(invisible t intangible t) | 82 | file-name-shadow-properties '(invisible t intangible t) |
83 | minibuffer-eldef-shorten-default t | 83 | minibuffer-eldef-shorten-default t |
84 | minibuffer-prompt-properties '( read-only t | 84 | minibuffer-prompt-properties '( read-only t |
85 | cursor-intangible t | 85 | cursor-intangible t |
86 | face minibuffer-prompt)) | 86 | face minibuffer-prompt)) |
87 | (file-name-shadow-mode) | 87 | (file-name-shadow-mode) |
88 | (minibuffer-electric-default-mode) | 88 | (minibuffer-electric-default-mode) |
89 | 89 | ||
@@ -98,15 +98,15 @@ | |||
98 | 98 | ||
99 | (require 'savehist) | 99 | (require 'savehist) |
100 | (setq-default history-length 1024 | 100 | (setq-default history-length 1024 |
101 | history-delete-duplicates t | 101 | history-delete-duplicates t |
102 | ;; savehist-file (etc/ "savehist.el") | 102 | ;; savehist-file (etc/ "savehist.el") |
103 | savehist-save-minibuffer-history t | 103 | savehist-save-minibuffer-history t |
104 | savehist-autosave-interval 30) | 104 | savehist-autosave-interval 30) |
105 | (savehist-mode) | 105 | (savehist-mode) |
106 | 106 | ||
107 | ;; Killing and yanking | 107 | ;; Killing and yanking |
108 | (setq-default kill-do-not-save-duplicates t | 108 | (setq-default kill-do-not-save-duplicates t |
109 | kill-read-only-ok t | 109 | kill-read-only-ok t |
110 | ;; XXX: This setting causes an error message the first time it's | 110 | ;; XXX: This setting causes an error message the first time it's |
111 | ;; called: "Selection owner couldn't convert: TIMESTAMP". I have | 111 | ;; called: "Selection owner couldn't convert: TIMESTAMP". I have |
112 | ;; absolutely no idea why I get this error, but it's generated in | 112 | ;; absolutely no idea why I get this error, but it's generated in |
@@ -114,12 +114,12 @@ | |||
114 | ;; do anything else with it, so for now, I'll just live with the | 114 | ;; do anything else with it, so for now, I'll just live with the |
115 | ;; message. | 115 | ;; message. |
116 | save-interprogram-paste-before-kill t | 116 | save-interprogram-paste-before-kill t |
117 | yank-pop-change-selection t) | 117 | yank-pop-change-selection t) |
118 | (delete-selection-mode) | 118 | (delete-selection-mode) |
119 | 119 | ||
120 | ;; Notifying the user | 120 | ;; Notifying the user |
121 | (setq-default echo-keystrokes 0.01 | 121 | (setq-default echo-keystrokes 0.01 |
122 | ring-bell-function #'ignore) | 122 | ring-bell-function #'ignore) |
123 | 123 | ||
124 | ;; Point and mark | 124 | ;; Point and mark |
125 | (setq-default set-mark-command-repeat-pop t) | 125 | (setq-default set-mark-command-repeat-pop t) |
@@ -129,8 +129,8 @@ | |||
129 | 129 | ||
130 | ;; Startup | 130 | ;; Startup |
131 | (setq-default inhibit-startup-screen t | 131 | (setq-default inhibit-startup-screen t |
132 | initial-buffer-choice t | 132 | initial-buffer-choice t |
133 | initial-scratch-message nil) | 133 | initial-scratch-message nil) |
134 | 134 | ||
135 | (define-advice startup-echo-area-message (:override ()) | 135 | (define-advice startup-echo-area-message (:override ()) |
136 | (if (get-buffer "*Warnings*") | 136 | (if (get-buffer "*Warnings*") |
@@ -143,15 +143,15 @@ | |||
143 | 143 | ||
144 | ;; Text editing | 144 | ;; Text editing |
145 | (setq-default fill-column 80 | 145 | (setq-default fill-column 80 |
146 | sentence-end-double-space t | 146 | sentence-end-double-space t |
147 | tab-width 8 | 147 | tab-width 8 |
148 | tab-always-indent 'complete) | 148 | tab-always-indent 'complete) |
149 | (global-so-long-mode) | 149 | (global-so-long-mode) |
150 | 150 | ||
151 | (setq-default show-paren-delay 0.01 | 151 | (setq-default show-paren-delay 0.01 |
152 | show-paren-style 'parenthesis | 152 | show-paren-style 'parenthesis |
153 | show-paren-when-point-in-periphery t | 153 | show-paren-when-point-in-periphery t |
154 | show-paren-when-point-inside-paren t) | 154 | show-paren-when-point-inside-paren t) |
155 | (show-paren-mode) | 155 | (show-paren-mode) |
156 | (electric-pair-mode) | 156 | (electric-pair-mode) |
157 | 157 | ||
@@ -177,33 +177,33 @@ | |||
177 | 177 | ||
178 | ;; Abbrev | 178 | ;; Abbrev |
179 | (setq-default abbrev-file-name (sync/ "abbrev.el") | 179 | (setq-default abbrev-file-name (sync/ "abbrev.el") |
180 | save-abbrevs 'silently) | 180 | save-abbrevs 'silently) |
181 | 181 | ||
182 | ;; Files | 182 | ;; Files |
183 | (setq-default auto-revert-verbose nil | 183 | (setq-default auto-revert-verbose nil |
184 | global-auto-revert-non-file-buffers t | 184 | global-auto-revert-non-file-buffers t |
185 | create-lockfiles nil | 185 | create-lockfiles nil |
186 | find-file-visit-truename t | 186 | find-file-visit-truename t |
187 | mode-require-final-newline t | 187 | mode-require-final-newline t |
188 | view-read-only t | 188 | view-read-only t |
189 | save-silently t) | 189 | save-silently t) |
190 | (global-auto-revert-mode) | 190 | (global-auto-revert-mode) |
191 | 191 | ||
192 | (setq-default auto-save-default nil | 192 | (setq-default auto-save-default nil |
193 | auto-save-interval 1 | 193 | auto-save-interval 1 |
194 | auto-save-no-message t | 194 | auto-save-no-message t |
195 | auto-save-timeout 1 | 195 | auto-save-timeout 1 |
196 | auto-save-visited-interval 1 | 196 | auto-save-visited-interval 1 |
197 | remote-file-name-inhibit-auto-save-visited t) | 197 | remote-file-name-inhibit-auto-save-visited t) |
198 | (add-to-list 'auto-save-file-name-transforms | 198 | (add-to-list 'auto-save-file-name-transforms |
199 | `(".*" ,(etc/ "auto-save/" t) t)) | 199 | `(".*" ,(etc/ "auto-save/" t) t)) |
200 | (auto-save-visited-mode) | 200 | (auto-save-visited-mode) |
201 | 201 | ||
202 | (setq-default backup-by-copying t | 202 | (setq-default backup-by-copying t |
203 | version-control t | 203 | version-control t |
204 | kept-new-versions 8 | 204 | kept-new-versions 8 |
205 | kept-old-versions 8 | 205 | kept-old-versions 8 |
206 | delete-old-versions t) | 206 | delete-old-versions t) |
207 | 207 | ||
208 | (require 'recentf) | 208 | (require 'recentf) |
209 | (setq-default ;; recentf-save-file (etc/ "recentf" t) | 209 | (setq-default ;; recentf-save-file (etc/ "recentf" t) |
@@ -218,7 +218,7 @@ | |||
218 | (require 'saveplace) | 218 | (require 'saveplace) |
219 | (setq-default ;; save-place-file (etc/ "places.el") | 219 | (setq-default ;; save-place-file (etc/ "places.el") |
220 | save-place-forget-unreadable-files (eq system-type | 220 | save-place-forget-unreadable-files (eq system-type |
221 | 'gnu/linux)) | 221 | 'gnu/linux)) |
222 | (save-place-mode) | 222 | (save-place-mode) |
223 | 223 | ||
224 | (require 'uniquify) | 224 | (require 'uniquify) |
@@ -228,12 +228,18 @@ | |||
228 | uniquify-separator path-separator) | 228 | uniquify-separator path-separator) |
229 | 229 | ||
230 | (setq-local vc-follow-symlinks t | 230 | (setq-local vc-follow-symlinks t |
231 | vc-make-backup-files t) | 231 | vc-make-backup-files t) |
232 | |||
233 | ;; Whitespace | ||
234 | (require 'whitespace) | ||
235 | (setq-default whitespace-style | ||
236 | '(face trailing tabs space-after-tab space-before-tab tab-mark)) | ||
237 | (global-whitespace-mode) | ||
232 | 238 | ||
233 | ;; Native compilation | 239 | ;; Native compilation |
234 | (setq-default native-comp-async-report-warnings-errors 'silent | 240 | (setq-default native-comp-async-report-warnings-errors 'silent |
235 | native-comp-deferred-compilation t | 241 | native-comp-deferred-compilation t |
236 | native-compile-target-directory (etc/ "eln" t)) | 242 | native-compile-target-directory (etc/ "eln" t)) |
237 | (add-to-list 'native-comp-eln-load-path native-compile-target-directory) | 243 | (add-to-list 'native-comp-eln-load-path native-compile-target-directory) |
238 | (when (fboundp 'startup-redirect-eln-cache) | 244 | (when (fboundp 'startup-redirect-eln-cache) |
239 | (startup-redirect-eln-cache native-compile-target-directory)) | 245 | (startup-redirect-eln-cache native-compile-target-directory)) |
@@ -302,13 +308,13 @@ N spaces." | |||
302 | #'+lisp-comment-or-uncomment-sexp))) | 308 | #'+lisp-comment-or-uncomment-sexp))) |
303 | 309 | ||
304 | (define-key emacs-lisp-mode-map (kbd "C-c C-c") | 310 | (define-key emacs-lisp-mode-map (kbd "C-c C-c") |
305 | #'eval-defun) | 311 | #'eval-defun) |
306 | (define-key emacs-lisp-mode-map (kbd "C-c C-k") | 312 | (define-key emacs-lisp-mode-map (kbd "C-c C-k") |
307 | #'elisp-eval-region-or-buffer) | 313 | #'elisp-eval-region-or-buffer) |
308 | (define-key lisp-interaction-mode-map (kbd "C-c C-c") | 314 | (define-key lisp-interaction-mode-map (kbd "C-c C-c") |
309 | #'eval-defun) | 315 | #'eval-defun) |
310 | (define-key lisp-interaction-mode-map (kbd "C-c C-k") | 316 | (define-key lisp-interaction-mode-map (kbd "C-c C-k") |
311 | #'elisp-eval-region-or-buffer) | 317 | #'elisp-eval-region-or-buffer) |
312 | (define-advice eval-region (:around (orig start end &rest args) pulse) | 318 | (define-advice eval-region (:around (orig start end &rest args) pulse) |
313 | (apply orig start end args) | 319 | (apply orig start end args) |
314 | (pulse-momentary-highlight-region start end)) | 320 | (pulse-momentary-highlight-region start end)) |
@@ -320,17 +326,17 @@ N spaces." | |||
320 | (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) | 326 | (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) |
321 | 327 | ||
322 | (add-hook 'find-file-not-found-functions | 328 | (add-hook 'find-file-not-found-functions |
323 | (defun create-missing-directories () | 329 | (defun create-missing-directories () |
324 | "Automatically create missing directories." | 330 | "Automatically create missing directories." |
325 | (let ((target-dir (file-name-directory buffer-file-name))) | 331 | (let ((target-dir (file-name-directory buffer-file-name))) |
326 | (unless (file-exists-p target-dir) | 332 | (unless (file-exists-p target-dir) |
327 | (make-directory target-dir :parents))))) | 333 | (make-directory target-dir :parents))))) |
328 | 334 | ||
329 | (add-hook 'find-file-hook | 335 | (add-hook 'find-file-hook |
330 | (defun vc-remote-off () | 336 | (defun vc-remote-off () |
331 | "Turn VC off when remote." | 337 | "Turn VC off when remote." |
332 | (when (file-remote-p (buffer-file-name)) | 338 | (when (file-remote-p (buffer-file-name)) |
333 | (setq-local vc-handled-backends nil)))) | 339 | (setq-local vc-handled-backends nil)))) |
334 | 340 | ||
335 | ;;; Advice | 341 | ;;; Advice |
336 | 342 | ||
@@ -555,15 +561,15 @@ See also `with-region-or-to-eol'." | |||
555 | ;; Optionally make narrowing help available in the minibuffer. | 561 | ;; Optionally make narrowing help available in the minibuffer. |
556 | ;; You may want to use `embark-prefix-help-command' or which-key instead. | 562 | ;; You may want to use `embark-prefix-help-command' or which-key instead. |
557 | (define-key consult-narrow-map (vconcat consult-narrow-key "?") | 563 | (define-key consult-narrow-map (vconcat consult-narrow-key "?") |
558 | #'consult-narrow-help)) | 564 | #'consult-narrow-help)) |
559 | 565 | ||
560 | (use-package orderless | 566 | (use-package orderless |
561 | :ensure t :demand t | 567 | :ensure t :demand t |
562 | :init | 568 | :init |
563 | (setopt completion-styles '(substring orderless basic) | 569 | (setopt completion-styles '(substring orderless basic) |
564 | completion-category-defaults nil | 570 | completion-category-defaults nil |
565 | completion-category-overrides | 571 | completion-category-overrides |
566 | '((file (styles basic partial-completion))))) | 572 | '((file (styles basic partial-completion orderless))))) |
567 | 573 | ||
568 | (use-package marginalia | 574 | (use-package marginalia |
569 | :ensure t :demand t | 575 | :ensure t :demand t |
@@ -593,8 +599,8 @@ See also `with-region-or-to-eol'." | |||
593 | :ensure t | 599 | :ensure t |
594 | :config | 600 | :config |
595 | (setq undo-fu-session-incompatible-files | 601 | (setq undo-fu-session-incompatible-files |
596 | '("/COMMIT_EDITMSG\\'" | 602 | '("/COMMIT_EDITMSG\\'" |
597 | "/git-rebase-todo\\'")) | 603 | "/git-rebase-todo\\'")) |
598 | (global-undo-fu-session-mode)) | 604 | (global-undo-fu-session-mode)) |
599 | 605 | ||
600 | ;;; basics.el ends here | 606 | ;;; basics.el ends here |