Update README
This commit is contained in:
parent
869905fcea
commit
3f1cd96a63
219
README.md
219
README.md
|
@ -167,6 +167,18 @@ when it errors.
|
|||
### Remove the bell
|
||||
|
||||
(cuss visible-bell (not (string= (system-name) "larry")))
|
||||
|
||||
(defun acdw/ring-bell-function ()
|
||||
"Custom bell-ringing function."
|
||||
(let ((orig-face (face-foreground 'mode-line)))
|
||||
(set-face-foreground 'modeline "#F2804F")
|
||||
(run-with-idle-timer
|
||||
0.1 nil
|
||||
(lambda (fg)
|
||||
(set-face-foreground 'mode-line fg))
|
||||
orig-face)))
|
||||
|
||||
(cuss ring-bell-function #'acdw/ring-bell-function)
|
||||
|
||||
|
||||
### Tell Ediff to setup windows better
|
||||
|
@ -274,6 +286,49 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
(winner-mode +1))
|
||||
|
||||
|
||||
### Windmove
|
||||
|
||||
(cuss windmove-create-window t
|
||||
"Create windows in a direction if they don't exist.")
|
||||
(cuss windomove-wrap-around t
|
||||
"Wrap window movements around frame edges.")
|
||||
|
||||
(windmove-default-keybindings)
|
||||
|
||||
|
||||
### Pop some buffers up in the same window
|
||||
|
||||
from [link0ff](https://github.com/link0ff/emacs-init).
|
||||
|
||||
(push `(,(rx bos
|
||||
"*"
|
||||
(or "Help" "Apropos" "Colors" "Buffer List" "Command History"
|
||||
"Dictionary" "Locate" "Messages" "Proced" "eww" "snd"
|
||||
(and "gud-" (+ (any "a-z0-9")))
|
||||
"compilation" "grep" "erlang" "haskell"
|
||||
;; Handle both "*shell*" and e.g. "*emacs-shell*"
|
||||
;; generated by `project-shell':
|
||||
(and (? (* nonl) "-") "shell")
|
||||
"Shell Command Output"
|
||||
(and "SQL: " (+ (any "A-za-z")))
|
||||
"Diff" "vc-dir" "vc-log" "vc-search-log")
|
||||
"*"
|
||||
;; Uniquifed buffer name with optional suffix in angle brackets
|
||||
(? (and "<" (+ (not (any ">"))) ">"))
|
||||
eos)
|
||||
display-buffer-same-window
|
||||
(inhibit-same-window . nil))
|
||||
display-buffer-alist)
|
||||
|
||||
(defun display-buffer-from-help-p (_buffer-name _action)
|
||||
(unless current-prefix-arg
|
||||
(with-current-buffer (window-buffer)
|
||||
(eq major-mode 'help-mode))))
|
||||
|
||||
(push '(display-buffer-from-help-p display-buffer-same-window)
|
||||
display-buffer-alist)
|
||||
|
||||
|
||||
## Startup
|
||||
|
||||
(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
|
|||
(if (find-font (font-spec :name font))
|
||||
(throw :font font)))))
|
||||
|
||||
(defun set-face-from-alternatives (face fonts)
|
||||
(dolist (font fonts)
|
||||
(if (find-font (font-spec :family (car font)))
|
||||
(apply #'set-face-attribute `(,face nil
|
||||
:family ,(car font)
|
||||
,@(cdr font))))))
|
||||
|
||||
(defun acdw/setup-fonts ()
|
||||
"Setup fonts. This has to happen after the frame is setup for
|
||||
the first time, so it should be added to `window-setup-hook'. It
|
||||
removes itself from that hook."
|
||||
(interactive)
|
||||
(when (display-graphic-p)
|
||||
(set-face-attribute 'default nil
|
||||
:font
|
||||
(font-candidate
|
||||
"Libertinus Mono-11"
|
||||
"Linux Libertine Mono O-11"
|
||||
"Go Mono-10"
|
||||
"Consolas-10"))
|
||||
(set-face-from-alternatives 'default
|
||||
'(("Libertinus Mono"
|
||||
:height 110)
|
||||
("Linux Libertine Mono O"
|
||||
:height 110)
|
||||
("Go Mono"
|
||||
:height 100)
|
||||
("Consolas"
|
||||
:height 100)))
|
||||
|
||||
(set-face-attribute 'fixed-pitch nil
|
||||
:font
|
||||
(font-candidate
|
||||
"Libertinus Mono-11"
|
||||
"Linux Libertine Mono O-11"
|
||||
"Go Mono-10"
|
||||
"Consolas-10"))
|
||||
(set-face-from-alternatives 'fixed-pitch
|
||||
'(("Libertinus Mono"
|
||||
:height 1.0)
|
||||
("Linux Libertine Mono O"
|
||||
:height 1.0)
|
||||
("Go Mono"
|
||||
:height 1.0)
|
||||
("Consolas"
|
||||
:height 1.0)))
|
||||
|
||||
(set-face-attribute 'variable-pitch nil
|
||||
:font
|
||||
(font-candidate
|
||||
"Libertinus Serif-13"
|
||||
"Linux Libertine O-12"
|
||||
"Georgia-11"))
|
||||
(set-face-from-alternatives 'variable-pitch
|
||||
'(("Libertinus Serif"
|
||||
:height 1.0)
|
||||
("Linux Libertine O"
|
||||
:height 1.0)
|
||||
("Georgia"
|
||||
:height 1.0)))
|
||||
|
||||
(remove-function after-focus-change-function #'acdw/setup-fonts)))
|
||||
|
||||
|
@ -400,6 +467,16 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
# Interactivity
|
||||
|
||||
|
||||
## Async
|
||||
|
||||
(use-package async)
|
||||
|
||||
(autoload 'dired-async-mode "dired-async.el" nil t)
|
||||
(dired-async-mode +1)
|
||||
|
||||
(async-bytecomp-package-mode +1)
|
||||
|
||||
|
||||
## Completing-read
|
||||
|
||||
|
||||
|
@ -463,8 +540,12 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
:branch "main")
|
||||
:init
|
||||
(marginalia-mode +1)
|
||||
(cuss marginalia-annotators '(marginalia-annotators-heavy
|
||||
marginalia-annotators-light)))
|
||||
(cuss marginalia-annotators
|
||||
(if (eq system-type 'windows-nt)
|
||||
'(marginalia-annotators-light
|
||||
marginalia-annotators-heavy)
|
||||
'(marginalia-annotators-heavy
|
||||
marginalia-annotators-light))))
|
||||
|
||||
|
||||
## Ignore case
|
||||
|
@ -490,6 +571,11 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
|
||||
## Mouse
|
||||
|
||||
|
||||
### Fix scrolling in margins
|
||||
|
||||
This is not *quite* correct yet. For example, scrolling in the margins with a trackpad isn’t picked up (a trackpad sends different mouse events).
|
||||
|
||||
(dolist (vec '([left-margin wheel-down]
|
||||
[right-margin wheel-down]
|
||||
[left-margin wheel-up]
|
||||
|
@ -497,6 +583,46 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
(bind-key vec #'mwheel-scroll))
|
||||
|
||||
|
||||
## Keyboard
|
||||
|
||||
|
||||
### Use `ESC` as a cancel key
|
||||
|
||||
From [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.
|
||||
|
||||
(when window-system
|
||||
(define-key global-map [escape] 'keyboard-escape-quit)
|
||||
(define-key isearch-mode-map [escape] 'isearch-cancel))
|
||||
|
||||
|
||||
### Make `C-z` more useful as a prefix key
|
||||
|
||||
Also from link0ff. See the above for a link.
|
||||
|
||||
(defvar my-map
|
||||
(let ((map (make-sparse-keymap))
|
||||
(c-z (global-key-binding "\C-z")))
|
||||
(global-unset-key "\C-z")
|
||||
(define-key global-map "\C-z" map)
|
||||
(define-key map "\C-z" c-z)
|
||||
map))
|
||||
(run-hooks 'my-map-defined-hook)
|
||||
|
||||
|
||||
### Which-key
|
||||
|
||||
(use-package which-key
|
||||
:config
|
||||
(which-key-mode +1))
|
||||
|
||||
|
||||
### Bindings
|
||||
|
||||
1. Switch to another window
|
||||
|
||||
(bind-key "M-o" #'other-window)
|
||||
|
||||
|
||||
# Persistence
|
||||
|
||||
|
||||
|
@ -596,6 +722,11 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
(cuss save-interprogram-paste-before-kill t)
|
||||
|
||||
|
||||
### Sync the system clipboard and the kill ring
|
||||
|
||||
(cuss yank-pop-change-selection t)
|
||||
|
||||
|
||||
## So long mode
|
||||
|
||||
(when (fboundp 'global-so-long-mode)
|
||||
|
@ -619,6 +750,15 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
("C-+" . er/contract-region)))
|
||||
|
||||
|
||||
## Highlight modified regions
|
||||
|
||||
(use-package goggles
|
||||
:custom
|
||||
(goggles-pulse nil)
|
||||
:config
|
||||
(goggles-mode +1))
|
||||
|
||||
|
||||
# Files
|
||||
|
||||
|
||||
|
@ -627,7 +767,7 @@ from [Stack Overflow](https://stackoverflow.com/questions/23659909/reverse-evalu
|
|||
|
||||
### UTF-8
|
||||
|
||||
(set-language-environment 'utf-8)
|
||||
(set-language-environment "UTF-8")
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
(cuss locale-coding-system 'utf-8)
|
||||
(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
|
|||
:mode "\\.fnl\\'")
|
||||
|
||||
|
||||
### Emacs lisp
|
||||
|
||||
(cuss eval-expression-print-length nil
|
||||
"Don't truncate printed expressions by length.")
|
||||
(cuss eval-expression-print-level nil
|
||||
"Don't truncate printed expressions by level.")
|
||||
|
||||
|
||||
# Writing
|
||||
|
||||
|
||||
|
@ -846,6 +994,8 @@ I’ve put org mode under Applications, as opposed to Writing, because it’s m
|
|||
(org-pretty-entities t)
|
||||
(org-num-mode +1)
|
||||
|
||||
(cuss org-directory "~/Org")
|
||||
|
||||
(org-src-tab-acts-natively t)
|
||||
(org-src-fontify-natively t)
|
||||
(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
|
|||
(require 'ox-md))
|
||||
|
||||
|
||||
### Org Agenda
|
||||
|
||||
(cuss org-agenda-files (no-littering-expand-etc-file-name "agenda-files"))
|
||||
|
||||
(if (and (stringp org-agenda-files)
|
||||
(not (file-exists-p org-agenda-files)))
|
||||
(with-temp-buffer (write-file org-agenda-files)))
|
||||
|
||||
|
||||
### Make bullets look like bullets
|
||||
|
||||
(font-lock-add-keywords
|
||||
|
@ -1163,7 +1322,13 @@ from [karthinks](https://karthinks.com/software/more-batteries-included-with-ema
|
|||
|
||||
;; init.el -*- lexical-binding: t -*-
|
||||
|
||||
1. Load config
|
||||
1. Speed up init
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(defvar old-file-name-handler file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
|
||||
2. Load config
|
||||
|
||||
inspired by [Protesilaos Stavrou](https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028).
|
||||
|
||||
|
@ -1176,6 +1341,12 @@ from [karthinks](https://karthinks.com/software/more-batteries-included-with-ema
|
|||
(require 'org)
|
||||
(org-babel-load-file conf-org)))
|
||||
|
||||
3. Reset for normal operation
|
||||
|
||||
(setq gc-cons-threshold 16777216 ; 16mb
|
||||
gc-cons-percentage 0.1
|
||||
file-name-handler-alist old-file-name-handler)
|
||||
|
||||
|
||||
### early-init.el
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#+EXPORT_FILE_NAME: README.md
|
||||
#+OPTIONS: toc:nil
|
||||
#+BANKRUPTCY_COUNT: 3
|
||||
#+Time-stamp: <2020-12-16 20:14:19 acdw>
|
||||
#+Time-stamp: <2020-12-21 17:20:22 aduckworth>
|
||||
|
||||
Let’s configure Emacs using Org mode, they said. It’ll be fun, they said.
|
||||
|
||||
|
|
8
init.el
8
init.el
|
@ -1,5 +1,9 @@
|
|||
;; init.el -*- lexical-binding: t -*-
|
||||
|
||||
(setq gc-cons-threshold most-positive-fixnum)
|
||||
(defvar old-file-name-handler file-name-handler-alist)
|
||||
(setq file-name-handler-alist nil)
|
||||
|
||||
(let* ((conf (expand-file-name "config"
|
||||
user-emacs-directory))
|
||||
(conf-el (concat conf ".el"))
|
||||
|
@ -8,3 +12,7 @@
|
|||
(load conf 'no-error))
|
||||
(require 'org)
|
||||
(org-babel-load-file conf-org)))
|
||||
|
||||
(setq gc-cons-threshold 16777216 ; 16mb
|
||||
gc-cons-percentage 0.1
|
||||
file-name-handler-alist old-file-name-handler)
|
||||
|
|
Loading…
Reference in New Issue