summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.md219
-rw-r--r--config.org2
-rw-r--r--init.el8
3 files changed, 204 insertions, 25 deletions
diff --git a/README.md b/README.md index 1be56dd..a35da41 100644 --- a/README.md +++ b/README.md
@@ -167,6 +167,18 @@ when it errors.
167### Remove the bell 167### Remove the bell
168 168
169 (cuss visible-bell (not (string= (system-name) "larry"))) 169 (cuss visible-bell (not (string= (system-name) "larry")))
170
171 (defun acdw/ring-bell-function ()
172 "Custom bell-ringing function."
173 (let ((orig-face (face-foreground 'mode-line)))
174 (set-face-foreground 'modeline "#F2804F")
175 (run-with-idle-timer
176 0.1 nil
177 (lambda (fg)
178 (set-face-foreground 'mode-line fg))
179 orig-face)))
180
181 (cuss ring-bell-function #'acdw/ring-bell-function)
170 182
171 183
172### Tell Ediff to setup windows better 184### Tell Ediff to setup windows better
@@ -274,6 +286,49 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
274 (winner-mode +1)) 286 (winner-mode +1))
275 287
276 288
289### Windmove
290
291 (cuss windmove-create-window t
292 "Create windows in a direction if they don't exist.")
293 (cuss windomove-wrap-around t
294 "Wrap window movements around frame edges.")
295
296 (windmove-default-keybindings)
297
298
299### Pop some buffers up in the same window
300
301from [link0ff](https://github.com/link0ff/emacs-init).
302
303 (push `(,(rx bos
304 "*"
305 (or "Help" "Apropos" "Colors" "Buffer List" "Command History"
306 "Dictionary" "Locate" "Messages" "Proced" "eww" "snd"
307 (and "gud-" (+ (any "a-z0-9")))
308 "compilation" "grep" "erlang" "haskell"
309 ;; Handle both "*shell*" and e.g. "*emacs-shell*"
310 ;; generated by `project-shell':
311 (and (? (* nonl) "-") "shell")
312 "Shell Command Output"
313 (and "SQL: " (+ (any "A-za-z")))
314 "Diff" "vc-dir" "vc-log" "vc-search-log")
315 "*"
316 ;; Uniquifed buffer name with optional suffix in angle brackets
317 (? (and "<" (+ (not (any ">"))) ">"))
318 eos)
319 display-buffer-same-window
320 (inhibit-same-window . nil))
321 display-buffer-alist)
322
323 (defun display-buffer-from-help-p (_buffer-name _action)
324 (unless current-prefix-arg
325 (with-current-buffer (window-buffer)
326 (eq major-mode 'help-mode))))
327
328 (push '(display-buffer-from-help-p display-buffer-same-window)
329 display-buffer-alist)
330
331
277## Startup 332## Startup
278 333
279 (cuss inhibit-startup-screen t "Don't show Emacs' startup buffer.") 334 (cuss inhibit-startup-screen t "Don't show Emacs' startup buffer.")
@@ -349,34 +404,46 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
349 (if (find-font (font-spec :name font)) 404 (if (find-font (font-spec :name font))
350 (throw :font font))))) 405 (throw :font font)))))
351 406
407 (defun set-face-from-alternatives (face fonts)
408 (dolist (font fonts)
409 (if (find-font (font-spec :family (car font)))
410 (apply #'set-face-attribute `(,face nil
411 :family ,(car font)
412 ,@(cdr font))))))
413
352 (defun acdw/setup-fonts () 414 (defun acdw/setup-fonts ()
353 "Setup fonts. This has to happen after the frame is setup for 415 "Setup fonts. This has to happen after the frame is setup for
354 the first time, so it should be added to `window-setup-hook'. It 416 the first time, so it should be added to `window-setup-hook'. It
355 removes itself from that hook." 417 removes itself from that hook."
356 (interactive) 418 (interactive)
357 (when (display-graphic-p) 419 (when (display-graphic-p)
358 (set-face-attribute 'default nil 420 (set-face-from-alternatives 'default
359 :font 421 '(("Libertinus Mono"
360 (font-candidate 422 :height 110)
361 "Libertinus Mono-11" 423 ("Linux Libertine Mono O"
362 "Linux Libertine Mono O-11" 424 :height 110)
363 "Go Mono-10" 425 ("Go Mono"
364 "Consolas-10")) 426 :height 100)
427 ("Consolas"
428 :height 100)))
365 429
366 (set-face-attribute 'fixed-pitch nil 430 (set-face-from-alternatives 'fixed-pitch
367 :font 431 '(("Libertinus Mono"
368 (font-candidate 432 :height 1.0)
369 "Libertinus Mono-11" 433 ("Linux Libertine Mono O"
370 "Linux Libertine Mono O-11" 434 :height 1.0)
371 "Go Mono-10" 435 ("Go Mono"
372 "Consolas-10")) 436 :height 1.0)
437 ("Consolas"
438 :height 1.0)))
373 439
374 (set-face-attribute 'variable-pitch nil 440 (set-face-from-alternatives 'variable-pitch
375 :font 441 '(("Libertinus Serif"
376 (font-candidate 442 :height 1.0)
377 "Libertinus Serif-13" 443 ("Linux Libertine O"
378 "Linux Libertine O-12" 444 :height 1.0)
379 "Georgia-11")) 445 ("Georgia"
446 :height 1.0)))
380 447
381 (remove-function after-focus-change-function #'acdw/setup-fonts))) 448 (remove-function after-focus-change-function #'acdw/setup-fonts)))
382 449
@@ -400,6 +467,16 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
400# Interactivity 467# Interactivity
401 468
402 469
470## Async
471
472 (use-package async)
473
474 (autoload 'dired-async-mode "dired-async.el" nil t)
475 (dired-async-mode +1)
476
477 (async-bytecomp-package-mode +1)
478
479
403## Completing-read 480## Completing-read
404 481
405 482
@@ -463,8 +540,12 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
463 :branch "main") 540 :branch "main")
464 :init 541 :init
465 (marginalia-mode +1) 542 (marginalia-mode +1)
466 (cuss marginalia-annotators '(marginalia-annotators-heavy 543 (cuss marginalia-annotators
467 marginalia-annotators-light))) 544 (if (eq system-type 'windows-nt)
545 '(marginalia-annotators-light
546 marginalia-annotators-heavy)
547 '(marginalia-annotators-heavy
548 marginalia-annotators-light))))
468 549
469 550
470## Ignore case 551## Ignore case
@@ -490,6 +571,11 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
490 571
491## Mouse 572## Mouse
492 573
574
575### Fix scrolling in margins
576
577This is not *quite* correct yet. For example, scrolling in the margins with a trackpad isn’t picked up (a trackpad sends different mouse events).
578
493 (dolist (vec '([left-margin wheel-down] 579 (dolist (vec '([left-margin wheel-down]
494 [right-margin wheel-down] 580 [right-margin wheel-down]
495 [left-margin wheel-up] 581 [left-margin wheel-up]
@@ -497,6 +583,46 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
497 (bind-key vec #'mwheel-scroll)) 583 (bind-key vec #'mwheel-scroll))
498 584
499 585
586## Keyboard
587
588
589### Use `ESC` as a cancel key
590
591From [link0ff](https://github.com/link0ff/emacs-init). I thought they made a great point that `ESC` isn’t necessary to copy the `META` key on window-systems, which is where I use Emacs, anyway.
592
593 (when window-system
594 (define-key global-map [escape] 'keyboard-escape-quit)
595 (define-key isearch-mode-map [escape] 'isearch-cancel))
596
597
598### Make `C-z` more useful as a prefix key
599
600Also from link0ff. See the above for a link.
601
602 (defvar my-map
603 (let ((map (make-sparse-keymap))
604 (c-z (global-key-binding "\C-z")))
605 (global-unset-key "\C-z")
606 (define-key global-map "\C-z" map)
607 (define-key map "\C-z" c-z)
608 map))
609 (run-hooks 'my-map-defined-hook)
610
611
612### Which-key
613
614 (use-package which-key
615 :config
616 (which-key-mode +1))
617
618
619### Bindings
620
6211. Switch to another window
622
623 (bind-key "M-o" #'other-window)
624
625
500# Persistence 626# Persistence
501 627
502 628
@@ -596,6 +722,11 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
596 (cuss save-interprogram-paste-before-kill t) 722 (cuss save-interprogram-paste-before-kill t)
597 723
598 724
725### Sync the system clipboard and the kill ring
726
727 (cuss yank-pop-change-selection t)
728
729
599## So long mode 730## So long mode
600 731
601 (when (fboundp 'global-so-long-mode) 732 (when (fboundp 'global-so-long-mode)
@@ -619,6 +750,15 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
619 ("C-+" . er/contract-region))) 750 ("C-+" . er/contract-region)))
620 751
621 752
753## Highlight modified regions
754
755 (use-package goggles
756 :custom
757 (goggles-pulse nil)
758 :config
759 (goggles-mode +1))
760
761
622# Files 762# Files
623 763
624 764
@@ -627,7 +767,7 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
627 767
628### UTF-8 768### UTF-8
629 769
630 (set-language-environment 'utf-8) 770 (set-language-environment "UTF-8")
631 (set-terminal-coding-system 'utf-8) 771 (set-terminal-coding-system 'utf-8)
632 (cuss locale-coding-system 'utf-8) 772 (cuss locale-coding-system 'utf-8)
633 (set-default-coding-systems 'utf-8) 773 (set-default-coding-systems 'utf-8)
@@ -785,6 +925,14 @@ I add it to the `find-file-hook` *and* `before-save-hook` because I don't want t
785 :mode "\\.fnl\\'") 925 :mode "\\.fnl\\'")
786 926
787 927
928### Emacs lisp
929
930 (cuss eval-expression-print-length nil
931 "Don't truncate printed expressions by length.")
932 (cuss eval-expression-print-level nil
933 "Don't truncate printed expressions by level.")
934
935
788# Writing 936# Writing
789 937
790 938
@@ -846,6 +994,8 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m
846 (org-pretty-entities t) 994 (org-pretty-entities t)
847 (org-num-mode +1) 995 (org-num-mode +1)
848 996
997 (cuss org-directory "~/Org")
998
849 (org-src-tab-acts-natively t) 999 (org-src-tab-acts-natively t)
850 (org-src-fontify-natively t) 1000 (org-src-fontify-natively t)
851 (org-src-window-setup 'current-window) 1001 (org-src-window-setup 'current-window)
@@ -856,6 +1006,15 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m
856 (require 'ox-md)) 1006 (require 'ox-md))
857 1007
858 1008
1009### Org Agenda
1010
1011 (cuss org-agenda-files (no-littering-expand-etc-file-name "agenda-files"))
1012
1013 (if (and (stringp org-agenda-files)
1014 (not (file-exists-p org-agenda-files)))
1015 (with-temp-buffer (write-file org-agenda-files)))
1016
1017
859### Make bullets look like bullets 1018### Make bullets look like bullets
860 1019
861 (font-lock-add-keywords 1020 (font-lock-add-keywords
@@ -1163,7 +1322,13 @@ from [karthinks](https://karthinks.com/software/more-batteries-included-with-ema
1163 1322
1164 ;; init.el -*- lexical-binding: t -*- 1323 ;; init.el -*- lexical-binding: t -*-
1165 1324
11661. Load config 13251. Speed up init
1326
1327 (setq gc-cons-threshold most-positive-fixnum)
1328 (defvar old-file-name-handler file-name-handler-alist)
1329 (setq file-name-handler-alist nil)
1330
13312. Load config
1167 1332
1168 inspired by [Protesilaos Stavrou](https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028). 1333 inspired by [Protesilaos Stavrou](https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028).
1169 1334
@@ -1176,6 +1341,12 @@ from [karthinks](https://karthinks.com/software/more-batteries-included-with-ema
1176 (require 'org) 1341 (require 'org)
1177 (org-babel-load-file conf-org))) 1342 (org-babel-load-file conf-org)))
1178 1343
13443. Reset for normal operation
1345
1346 (setq gc-cons-threshold 16777216 ; 16mb
1347 gc-cons-percentage 0.1
1348 file-name-handler-alist old-file-name-handler)
1349
1179 1350
1180### early-init.el 1351### early-init.el
1181 1352
diff --git a/config.org b/config.org index b1c138b..c0ecb10 100644 --- a/config.org +++ b/config.org
@@ -4,7 +4,7 @@
4#+EXPORT_FILE_NAME: README.md 4#+EXPORT_FILE_NAME: README.md
5#+OPTIONS: toc:nil 5#+OPTIONS: toc:nil
6#+BANKRUPTCY_COUNT: 3 6#+BANKRUPTCY_COUNT: 3
7#+Time-stamp: <2020-12-16 20:14:19 acdw> 7#+Time-stamp: <2020-12-21 17:20:22 aduckworth>
8 8
9Let’s configure Emacs using Org mode, they said. It’ll be fun, they said. 9Let’s configure Emacs using Org mode, they said. It’ll be fun, they said.
10 10
diff --git a/init.el b/init.el index 71d8816..fadf705 100644 --- a/init.el +++ b/init.el
@@ -1,5 +1,9 @@
1;; init.el -*- lexical-binding: t -*- 1;; init.el -*- lexical-binding: t -*-
2 2
3(setq gc-cons-threshold most-positive-fixnum)
4(defvar old-file-name-handler file-name-handler-alist)
5(setq file-name-handler-alist nil)
6
3(let* ((conf (expand-file-name "config" 7(let* ((conf (expand-file-name "config"
4 user-emacs-directory)) 8 user-emacs-directory))
5 (conf-el (concat conf ".el")) 9 (conf-el (concat conf ".el"))
@@ -8,3 +12,7 @@
8 (load conf 'no-error)) 12 (load conf 'no-error))
9 (require 'org) 13 (require 'org)
10 (org-babel-load-file conf-org))) 14 (org-babel-load-file conf-org)))
15
16(setq gc-cons-threshold 16777216 ; 16mb
17 gc-cons-percentage 0.1
18 file-name-handler-alist old-file-name-handler)