about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--early-init.el18
-rw-r--r--init.el24
-rw-r--r--lisp/system.el8
-rw-r--r--lisp/titlecase.el197
-rw-r--r--machines/bob.el (renamed from systems/bob.el)4
-rw-r--r--machines/gnu-linux.el (renamed from systems/gnu-linux.el)2
-rw-r--r--machines/windows-nt.el (renamed from systems/windows-nt.el)8
7 files changed, 37 insertions, 224 deletions
diff --git a/early-init.el b/early-init.el index c379934..2569602 100644 --- a/early-init.el +++ b/early-init.el
@@ -54,10 +54,10 @@ See `no-littering' for examples.")
54 "My Syncthing directory.") 54 "My Syncthing directory.")
55 55
56;; Load system-specific changes. 56;; Load system-specific changes.
57(progn (require 'system) 57;; (progn (require 'system)
58 (setq system-default-font "DejaVu Sans Mono" 58;; (setq system-default-font "DejaVu Sans Mono"
59 system-variable-pitch-font "DejaVu Sans") 59;; system-variable-pitch-font "DejaVu Sans")
60 (system-settings-load)) 60;; (system-settings-load))
61 61
62;;; Default frame settings 62;;; Default frame settings
63 63
@@ -77,11 +77,11 @@ See `no-littering' for examples.")
77(+with-ensure-after-init 77(+with-ensure-after-init
78 ;; Set default faces 78 ;; Set default faces
79 (+with-message "Setting default faces" 79 (+with-message "Setting default faces"
80 (let ((font-name system-default-font) 80 (let ((font-name machine-default-font)
81 (font-size system-default-height) 81 (font-size machine-default-height)
82 (variable-font-name system-variable-pitch-font) 82 (variable-font-name machine-variable-pitch-font)
83 (variable-font-size system-variable-pitch-height)) 83 (variable-font-size machine-variable-pitch-height))
84 (set-face-attribute 'default nil :family system-default-font 84 (set-face-attribute 'default nil :family font-name
85 :height font-size :weight 'book) 85 :height font-size :weight 'book)
86 (set-face-attribute 'italic nil :family font-name 86 (set-face-attribute 'italic nil :family font-name
87 :height font-size :slant 'italic) 87 :height font-size :slant 'italic)
diff --git a/init.el b/init.el index 151bc69..4eb05bd 100644 --- a/init.el +++ b/init.el
@@ -258,10 +258,10 @@
258 #'hl-line-mode) 258 #'hl-line-mode)
259 (:+key "C-x C-j" #'dired-jump) 259 (:+key "C-x C-j" #'dired-jump)
260 (with-eval-after-load 'dired 260 (with-eval-after-load 'dired
261 (pcase system-system 261 (cl-case system-type
262 ('windows 262 ((windows-nt ms-dos)
263 (:straight w32-browser)) 263 (:straight w32-browser))
264 ('linux 264 (gnu/linux
265 (:straight dired-open) 265 (:straight dired-open)
266 (:option dired-listing-switches 266 (:option dired-listing-switches
267 (concat dired-listing-switches " -F"))))) 267 (concat dired-listing-switches " -F")))))
@@ -398,12 +398,6 @@
398 (+kmacro-recording-indicator-mode +1) 398 (+kmacro-recording-indicator-mode +1)
399 (+kmacro-block-undo-mode +1))) 399 (+kmacro-block-undo-mode +1)))
400 400
401(setup magit
402 ;; This setup is weird because of dependency issues
403 (:straight (transient :host github :repo "magit/transient" :branch "master")
404 (magit :host github :repo "magit/magit")
405 (git-modes :host github :repo "magit/git-modes")))
406
407(setup minibuffer 401(setup minibuffer
408 (:require +minibuffer) 402 (:require +minibuffer)
409 (:with-map minibuffer-local-map 403 (:with-map minibuffer-local-map
@@ -1232,6 +1226,10 @@ See also `crux-reopen-as-root-mode'."
1232 (:file-match (rx ".rkt" eos) 1226 (:file-match (rx ".rkt" eos)
1233 (rx ".scm" eos))) 1227 (rx ".scm" eos)))
1234 1228
1229(setup (:straight (git-modes
1230 :host github :repo "magit/git-modes"))
1231 (:require git-modes))
1232
1235;; (setup (:straight god-mode) 1233;; (setup (:straight god-mode)
1236;; (setq god-mode-enable-function-key-translation nil) 1234;; (setq god-mode-enable-function-key-translation nil)
1237;; (:require god-mode 1235;; (:require god-mode
@@ -1330,6 +1328,8 @@ See also `crux-reopen-as-root-mode'."
1330 (:with-mode emacs-lisp-mode 1328 (:with-mode emacs-lisp-mode
1331 (:bind "C-c e" #'macrostep-expand))) 1329 (:bind "C-c e" #'macrostep-expand)))
1332 1330
1331(setup (:straight (magit :host github :repo "magit/magit")))
1332
1333(setup (:straight marginalia) 1333(setup (:straight marginalia)
1334 (marginalia-mode +1)) 1334 (marginalia-mode +1))
1335 1335
@@ -1723,3 +1723,9 @@ See also `crux-reopen-as-root-mode'."
1723 (:require +zzz-to-char) 1723 (:require +zzz-to-char)
1724 (:option zzz-to-char-reach (+bytes 1 :kib)) 1724 (:option zzz-to-char-reach (+bytes 1 :kib))
1725 (:global "M-z" #'+zzz-to-char)) 1725 (:global "M-z" #'+zzz-to-char))
1726
1727(setup (:straight (machine
1728 :host github :repo "duckwork/machine.el"))
1729 (:option machine-default-font "DejaVu Sans Mono"
1730 machine-variable-pitch-font "DejaVu Sans")
1731 (machine-settings-load))
diff --git a/lisp/system.el b/lisp/system.el index 0c1e457..73cd80b 100644 --- a/lisp/system.el +++ b/lisp/system.el
@@ -6,6 +6,12 @@
6;; different definitions. This library is built to assist in working with 6;; different definitions. This library is built to assist in working with
7;; different system configurations for Emacs. 7;; different system configurations for Emacs.
8 8
9;;; TODO:
10
11;; machine.el
12;; machine-case to switch on machine
13;;
14
9;;; Code: 15;;; Code:
10 16
11(require 'cl-lib) 17(require 'cl-lib)
@@ -171,5 +177,3 @@ NOMESSAGE is passed directly to `load'."
171 177
172(provide 'system) 178(provide 'system)
173;;; system.el ends here 179;;; system.el ends here
174
175
diff --git a/lisp/titlecase.el b/lisp/titlecase.el deleted file mode 100644 index c79f558..0000000 --- a/lisp/titlecase.el +++ /dev/null
@@ -1,197 +0,0 @@
1;;; titlecase.el --- title-case phrases -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;; adapted from https://hungyi.net/posts/programmers-way-to-title-case/
6
7;;; Code:
8
9(require 'seq)
10
11(defgroup titlecase nil
12 "Customizations for titlecasing phrases."
13 :prefix "titlecase-"
14 :group 'text)
15
16;;; Lists of words /never/ to capitalize
17
18(defvar titlecase-prepositions
19 '("'thout" "'tween" "aboard" "about" "above"
20 "abreast" "absent" "abt." "across" "after" "against" "ago" "aloft" "along"
21 "alongside" "amid" "amidst" "among" "amongst" "anti" "apart" "apropos"
22 "around" "as" "aside" "aslant" "astride" "at" "atop" "away" "before"
23 "behind" "below" "beneath" "beside" "besides" "between" "beyond" "but" "by"
24 "c." "ca." "circa" "come" "concerning" "contra" "counting" "cum" "despite"
25 "down" "during" "effective" "ere" "except" "excepting" "excluding" "failing"
26 "following" "for" "from" "hence" "in" "including" "inside" "into" "less"
27 "like" "mid" "midst" "minus" "mod" "modulo" "near" "nearer" "nearest"
28 "neath" "next" "notwithstanding" "o'" "o'er" "of" "off" "offshore" "on"
29 "onto" "ontop" "opposite" "out" "outside" "over" "pace" "past" "pending"
30 "per" "plus" "post" "pre" "pro" "qua" "re" "regarding" "respecting" "round"
31 "sans" "save" "saving" "short" "since" "sub" "t'" "than" "through"
32 "throughout" "thru" "thruout" "till" "times" "to" "toward" "towards" "under"
33 "underneath" "unlike" "until" "unto" "up" "upon" "v." "versus" "via"
34 "vis-à-vis" "vs." "w." "w/" "w/i" "w/o" "wanting" "with" "within"
35 "without")
36 "List of prepositions in English.
37This list is, by necessity, incomplete, even though prepositions
38are a closed lexical group in the English language. This list
39was pulled and culled from
40https://en.wikipedia.org/wiki/List_of_English_prepositions.")
41
42(defvar titlecase-articles '("a" "an" "the")
43 "List of articles in English.")
44
45(defvar titlecase-coordinating-conjunctions '("for" "and" "nor" "but" "or"
46 "yet" "so")
47 "List of coordinating conjunctions in English.")
48
49(defvar titlecase-lowercase-chicago (append titlecase-articles
50 titlecase-prepositions
51 titlecase-coordinating-conjunctions)
52 "Words to lowercase in Chicago Style.
53Include: articles, coordinating conjunctions, prepositions, and
54\"to\" in an infinitive (though that's caught as a preposition).")
55
56(defvar titlecase-lowercase-apa (append titlecase-articles
57 (seq-filter (lambda (p)
58 (< (length p) 4))
59 titlecase-prepositions))
60 "Words to lowercase in APA Style.")
61
62(defvar titlecase-lowercase-mla (append titlecase-articles
63 titlecase-prepositions
64 titlecase-coordinating-conjunctions)
65 "Words to lowercase in MLA Style.")
66
67(defvar titlecase-lowercase-ap (append titlecase-articles
68 (seq-filter (lambda (p)
69 (< (length p) 4))
70 titlecase-prepositions)
71 (seq-filter
72 (lambda (p)
73 (< (length p) 4))
74 titlecase-coordinating-conjunctions))
75 "Words to lowercase in AP Style.")
76
77(defvar titlecase-lowercase-bluebook (append titlecase-articles
78 titlecase-coordinating-conjunctions
79 (seq-filter
80 (lambda (p)
81 (< (length p) 4))
82 titlecase-prepositions))
83 "Words to lowercase in Bluebook Style.")
84
85(defvar titlecase-lowercase-ama (append titlecase-articles
86 titlecase-coordinating-conjunctions
87 (seq-filter (lambda (p)
88 (< (length p) 4))
89 titlecase-prepositions))
90 "Words to lowercase in AMA Style.")
91
92(defvar titlecase-lowercase-nyt (append titlecase-articles
93 titlecase-prepositions
94 titlecase-coordinating-conjunctions)
95 "Words to lowercase in New York Times Style.")
96
97(defvar titlecase-lowercase-wikipedia
98 (append titlecase-articles
99 (seq-filter (lambda (p) (< (length p) 5)) titlecase-prepositions)
100 titlecase-coordinating-conjunctions)
101 "Words to lowercase in Wikipedia Style.")
102
103(defcustom titlecase-style 'chicago
104 "Which style to use when titlecasing."
105 :type '(choice (const :tag "Chicago Style" chicago)
106 (const :tag "APA Style" apa)
107 (const :tag "MLA Style" mla)
108 (const :tag "AP Style" ap)
109 (const :tag "Bluebook Style" bluebook)
110 (const :tag "AMA Style" ama)
111 (const :tag "New York Times Style" nyt)
112 (const :tag "Wikipedia Style" wikipedia)))
113
114(defun titlecase--normalize (begin end)
115 "Normalize region from BEGIN to END."
116 (goto-char begin)
117 (unless (re-search-forward "[a-z]" end :noerror)
118 (downcase-region begin end)))
119
120(defun titlecase--capitalize-first-word (begin end)
121 "Capitalize the first word of region from BEGIN to END."
122 (goto-char begin)
123 (capitalize-word 1))
124
125(defun titlecase--capitalize-last-word (begin end)
126 "Capitalize the last word of region from BEGIN to END."
127 (goto-char end)
128 (backward-word 1)
129 (when (and (>= (point) begin))
130 (capitalize-word 1)))
131
132
133
134
135(defun titlecase-region-with-style (begin end style)
136 "Titlecase the region of English text from BEGIN to END, using STYLE."
137 (interactive "*r")
138 (save-excursion
139 (goto-char begin)
140 ;; If the region is in ALL-CAPS, normalize it first
141 (unless (re-search-forward "[a-z]" end :noerror)
142 (downcase-region begin end))
143 (goto-char begin) ; gotta go back to the beginning
144 (let (;; Constants during this function's runtime
145 (case-fold-search nil)
146 (downcase-word-list (symbol-value
147 (intern (format "titlecase-lowercase-%s"
148 style))))
149 ;; State variables
150 (this-word (current-word))
151 (force-capitalize t))
152 ;; And loop over the rest
153 (while (< (point) end)
154 (setq this-word (current-word))
155 (cond
156 ;; Skip ALL-CAPS words
157 ((string-match "^[A-Z]+$" this-word) (forward-word 1))
158 ;; Force capitalization if `force-capitalize' is t
159 (force-capitalize (progn (capitalize-word 1)
160 (setq force-capitalize nil)))
161 ;; Special rules for different styles
162 ((and (memq style '(ap))
163 (> (length this-word) 3))
164 (capitalize-word 1))
165 ;; Downcase words that should be
166 ((member (downcase this-word) downcase-word-list)
167 (downcase-word 1))
168 ;; Otherwise, capitalize the word
169 (t (capitalize-word 1)))
170 ;; If the word ends with a :, ., ?, newline, or carriage-return, force
171 ;; the next word to be capitalized.
172 (when (looking-at "[:.?;\n\r]")
173 (setq force-capitalize t))
174 (skip-syntax-forward "^w" end))
175 ;; Capitalize the last word, only in some styles
176 (when (memq style '(chicago ap bluebook ama nyt wikipedia))
177 (backward-word 1)
178 (when (and (>= (point) begin))
179 (capitalize-word 1))))))
180
181;;;###autoload
182(defun titlecase-region (begin end)
183 "Titlecase the region of English text from BEGIN to END.
184Uses the style provided in `titlecase-style'."
185 (interactive "*r")
186 (titlecase-region-with-style begin end titlecase-style))
187
188;;;###autoload
189(defun titlecase-dwim ()
190 "Titlecase either the region, if active, or the current line."
191 (interactive)
192 (if (region-active-p)
193 (titlecase-region (region-beginning) (region-end))
194 (titlecase-region (point-at-bol) (point-at-eol))))
195
196(provide 'titlecase)
197;;; titlecase.el ends here
diff --git a/systems/bob.el b/machines/bob.el index 427f38a..e9b444c 100644 --- a/systems/bob.el +++ b/machines/bob.el
@@ -4,7 +4,7 @@
4 4
5;;; Code: 5;;; Code:
6 6
7(setq system-default-font "DejaVu Sans Mono" 7(setq machine-default-font "DejaVu Sans Mono"
8 system-default-height 105) 8 machine-default-height 105)
9 9
10;;; bob.el ends here 10;;; bob.el ends here
diff --git a/systems/gnu-linux.el b/machines/gnu-linux.el index 333f15a..309ca34 100644 --- a/systems/gnu-linux.el +++ b/machines/gnu-linux.el
@@ -1,5 +1,5 @@
1;;; linux.el -*- lexical-binding: t; -*- 1;;; linux.el -*- lexical-binding: t; -*-
2 2
3(setq system-default-height 105) 3(setq machine-default-height 105)
4 4
5;;; linux.el ends here 5;;; linux.el ends here
diff --git a/systems/windows-nt.el b/machines/windows-nt.el index 3a0deee..a95754e 100644 --- a/systems/windows-nt.el +++ b/machines/windows-nt.el
@@ -7,10 +7,10 @@
7 7
8;; Fonts 8;; Fonts
9 9
10(setq system-default-font "Cascadia Mono" 10(setq machine-default-font "Cascadia Mono"
11 system-default-height 90 11 machine-default-height 90
12 system-variable-pitch-font "Carlito" 12 machine-variable-pitch-font "Carlito"
13 system-variable-pitch-height 1.2) 13 machine-variable-pitch-height 1.2)
14 14
15;; Add C:\Program Files\* and C:\Program Files (x86)\* to exec-path 15;; Add C:\Program Files\* and C:\Program Files (x86)\* to exec-path
16(dolist (path (append (file-expand-wildcards "C:/Program Files/*") 16(dolist (path (append (file-expand-wildcards "C:/Program Files/*")