about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-01-05 17:12:32 -0600
committerCase Duckworth2022-01-05 17:12:32 -0600
commit9e46efac61fc4246b810c8b19127248ed7b3080e (patch)
tree0486104411f0edeabbb340070765b57f3be9133e /lisp
parentBreak function into library (diff)
downloademacs-9e46efac61fc4246b810c8b19127248ed7b3080e.tar.gz
emacs-9e46efac61fc4246b810c8b19127248ed7b3080e.zip
Lots of changes, maybe breaking something
I have to do a big debugging tonight.  Keybinds aren't getting picked up, idk
what's going on.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+casing.el47
-rw-r--r--lisp/+emacs.el69
-rw-r--r--lisp/+lookup.el16
-rw-r--r--lisp/acdw.el8
4 files changed, 78 insertions, 62 deletions
diff --git a/lisp/+casing.el b/lisp/+casing.el index fe97310..a21e710 100644 --- a/lisp/+casing.el +++ b/lisp/+casing.el
@@ -3,17 +3,7 @@
3;;; Code: 3;;; Code:
4 4
5(require 'thingatpt) 5(require 'thingatpt)
6 6(require '+key)
7(defvar +casing-map (make-sparse-keymap)
8 "Keymap for word-casing.")
9
10(let ((map +casing-map))
11 (define-key map "u" #'+upcase-dwim)
12 (define-key map (kbd "M-u") #'+upcase-dwim)
13 (define-key map "l" #'+downcase-dwim)
14 (define-key map (kbd "M-l") #'+downcase-dwim)
15 (define-key map "c" #'+capitalize-dwim)
16 (define-key map (kbd "M-c") #'+capitalize-dwim))
17 7
18;;;###autoload 8;;;###autoload
19(defun +upcase-dwim (arg) 9(defun +upcase-dwim (arg)
@@ -28,9 +18,10 @@ Otherwise, it calls `upcase-word' on the word at point (using
28 (word-bound (save-excursion 18 (word-bound (save-excursion
29 (skip-chars-forward "^[:word:]") 19 (skip-chars-forward "^[:word:]")
30 (bounds-of-thing-at-point 'word)))) 20 (bounds-of-thing-at-point 'word))))
31 (upcase-region (car word-bound) (cdr word-bound)) 21 (when (and (car word-bound) (cdr word-bound))
32 (goto-char (cdr word-bound)) 22 (upcase-region (car word-bound) (cdr word-bound))
33 (upcase-word following)))) 23 (goto-char (cdr word-bound))
24 (upcase-word following)))))
34 25
35;;;###autoload 26;;;###autoload
36(defun +downcase-dwim (arg) 27(defun +downcase-dwim (arg)
@@ -45,9 +36,10 @@ Otherwise, it calls `downcase-word' on the word at point (using
45 (word-bound (save-excursion 36 (word-bound (save-excursion
46 (skip-chars-forward "^[:word:]") 37 (skip-chars-forward "^[:word:]")
47 (bounds-of-thing-at-point 'word)))) 38 (bounds-of-thing-at-point 'word))))
48 (downcase-region (car word-bound) (cdr word-bound)) 39 (when (and (car word-bound) (cdr word-bound))
49 (goto-char (cdr word-bound)) 40 (downcase-region (car word-bound) (cdr word-bound))
50 (downcase-word following)))) 41 (goto-char (cdr word-bound))
42 (downcase-word following)))))
51 43
52;;;###autoload 44;;;###autoload
53(defun +capitalize-dwim (arg) 45(defun +capitalize-dwim (arg)
@@ -62,11 +54,26 @@ Otherwise, it calls `capitalize-word' on the word at point (using
62 (word-bound (save-excursion 54 (word-bound (save-excursion
63 (skip-chars-forward "^[:word:]") 55 (skip-chars-forward "^[:word:]")
64 (bounds-of-thing-at-point 'word)))) 56 (bounds-of-thing-at-point 'word))))
65 (capitalize-region (car word-bound) (cdr word-bound)) 57 (when (and (car word-bound) (cdr word-bound))
66 (goto-char (cdr word-bound)) 58 (capitalize-region (car word-bound) (cdr word-bound))
67 (capitalize-word following)))) 59 (goto-char (cdr word-bound))
60 (capitalize-word following)))))
68 61
69;; Later on, I'll add repeat maps and stuff in here... 62;; Later on, I'll add repeat maps and stuff in here...
70 63
64(define-minor-mode +casing-mode
65 "Enable easy case-twiddling commands."
66 :lighter " cC"
67 :keymap (let ((map (make-sparse-keymap)))
68 (define-key map "u" #'+upcase-dwim)
69 (define-key map (kbd "M-u") #'+upcase-dwim)
70 (define-key map "l" #'+downcase-dwim)
71 (define-key map (kbd "M-l") #'+downcase-dwim)
72 (define-key map "c" #'+capitalize-dwim)
73 (define-key map (kbd "M-c") #'+capitalize-dwim)
74 map)
75 (define-key +key-mode-map (kbd "M-c") (when +casing-mode
76 +casing-mode-map)))
77
71(provide '+casing) 78(provide '+casing)
72;;; +casing.el ends here 79;;; +casing.el ends here
diff --git a/lisp/+emacs.el b/lisp/+emacs.el index 2e3d257..7453913 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el
@@ -80,8 +80,8 @@ Do this only if the buffer is not visiting a file."
80 mark-ring-max 50 80 mark-ring-max 50
81 minibuffer-eldef-shorten-default t 81 minibuffer-eldef-shorten-default t
82 minibuffer-prompt-properties (list 'read-only t 82 minibuffer-prompt-properties (list 'read-only t
83 'cursor-intangible t 83 'cursor-intangible t
84 'face 'minibuffer-prompt) 84 'face 'minibuffer-prompt)
85 mode-require-final-newline 'visit-save 85 mode-require-final-newline 'visit-save
86 mouse-drag-copy-region t 86 mouse-drag-copy-region t
87 mouse-wheel-progressive-speed nil 87 mouse-wheel-progressive-speed nil
@@ -90,8 +90,8 @@ Do this only if the buffer is not visiting a file."
90 read-answer-short t 90 read-answer-short t
91 read-buffer-completion-ignore-case t 91 read-buffer-completion-ignore-case t
92 read-extended-command-predicate (when (fboundp 92 read-extended-command-predicate (when (fboundp
93 'command-completion-default-include-p) 93 'command-completion-default-include-p)
94 'command-completion-default-include-p) 94 'command-completion-default-include-p)
95 recenter-positions '(top middle bottom) 95 recenter-positions '(top middle bottom)
96 regexp-search-ring-max 100 96 regexp-search-ring-max 100
97 regexp-search-ring-max 200 97 regexp-search-ring-max 200
@@ -169,23 +169,23 @@ Do this only if the buffer is not visiting a file."
169;;; Modes 169;;; Modes
170 170
171(dolist (enable-mode '(global-auto-revert-mode 171(dolist (enable-mode '(global-auto-revert-mode
172 blink-cursor-mode 172 blink-cursor-mode
173 electric-pair-mode 173 electric-pair-mode
174 show-paren-mode 174 show-paren-mode
175 global-so-long-mode 175 global-so-long-mode
176 minibuffer-depth-indicate-mode 176 minibuffer-depth-indicate-mode
177 file-name-shadow-mode 177 file-name-shadow-mode
178 minibuffer-electric-default-mode 178 minibuffer-electric-default-mode
179 delete-selection-mode 179 delete-selection-mode
180 column-number-mode)) 180 column-number-mode))
181 (when (fboundp enable-mode) 181 (when (fboundp enable-mode)
182 (funcall enable-mode +1))) 182 (funcall enable-mode +1)))
183 183
184(dolist (disable-mode '(tooltip-mode 184(dolist (disable-mode '(tooltip-mode
185 tool-bar-mode 185 tool-bar-mode
186 menu-bar-mode 186 menu-bar-mode
187 scroll-bar-mode 187 scroll-bar-mode
188 horizontal-scroll-bar-mode)) 188 horizontal-scroll-bar-mode))
189 (when (fboundp disable-mode) 189 (when (fboundp disable-mode)
190 (funcall disable-mode -1))) 190 (funcall disable-mode -1)))
191 191
@@ -243,19 +243,16 @@ kill without asking."
243 ("C-s" . isearch-forward-regexp) 243 ("C-s" . isearch-forward-regexp)
244 ("C-r" . isearch-backward-regexp) 244 ("C-r" . isearch-backward-regexp)
245 ("C-M-s" . isearch-forward) 245 ("C-M-s" . isearch-forward)
246 ("C-M-r" . isearch-backward) 246 ("C-M-r" . isearch-backward)))
247 ("M-u" . upcase-dwim)
248 ("M-l" . downcase-dwim)
249 ("M-c" . capitalize-dwim)))
250 (define-key +key-mode-map (kbd (car binding)) (cdr binding))) 247 (define-key +key-mode-map (kbd (car binding)) (cdr binding)))
251 248
252;;; Required libraries 249;;; Required libraries
253 250
254(when (require 'uniquify nil :noerror) 251(when (require 'uniquify nil :noerror)
255 (setq-default uniquify-buffer-name-style 'forward 252 (setq-default uniquify-buffer-name-style 'forward
256 uniquify-separator path-separator 253 uniquify-separator path-separator
257 uniquify-after-kill-buffer-p t 254 uniquify-after-kill-buffer-p t
258 uniquify-ignore-buffers-re "^\\*")) 255 uniquify-ignore-buffers-re "^\\*"))
259 256
260(when (require 'goto-addr) 257(when (require 'goto-addr)
261 (if (fboundp 'global-goto-address-mode) 258 (if (fboundp 'global-goto-address-mode)
@@ -264,36 +261,36 @@ kill without asking."
264 261
265(when (require 'recentf nil :noerror) 262(when (require 'recentf nil :noerror)
266 (setq-default recentf-save-file (.etc "recentf.el") 263 (setq-default recentf-save-file (.etc "recentf.el")
267 recentf-max-menu-items 100 264 recentf-max-menu-items 100
268 recentf-max-saved-items nil 265 recentf-max-saved-items nil
269 recentf-auto-cleanup 'mode) 266 recentf-auto-cleanup 'mode)
270 (add-to-list 'recentf-exclude .etc) 267 (add-to-list 'recentf-exclude .etc)
271 (recentf-mode +1)) 268 (recentf-mode +1))
272 269
273(when (require 'repeat nil :noerror) 270(when (require 'repeat nil :noerror)
274 (setq-default repeat-exit-key "g" 271 (setq-default repeat-exit-key "g"
275 repeat-exit-timeout 5) 272 repeat-exit-timeout 5)
276 (when (fboundp 'repeat-mode) 273 (when (fboundp 'repeat-mode)
277 ;; `repeat-mode' is defined in repeat.el, which is an older library. 274 ;; `repeat-mode' is defined in repeat.el, which is an older library.
278 (repeat-mode +1))) 275 (repeat-mode +1)))
279 276
280(when (require 'savehist nil :noerror) 277(when (require 'savehist nil :noerror)
281 (setq-default history-length t 278 (setq-default history-length t
282 history-delete-duplicates t 279 history-delete-duplicates t
283 history-autosave-interval 60 280 history-autosave-interval 60
284 savehist-file (.etc "savehist.el")) 281 savehist-file (.etc "savehist.el"))
285 (dolist (var '(extended-command-history 282 (dolist (var '(extended-command-history
286 global-mark-ring 283 global-mark-ring
287 kill-ring 284 kill-ring
288 regexp-search-ring 285 regexp-search-ring
289 search-ring 286 search-ring
290 mark-ring)) 287 mark-ring))
291 (add-to-list 'savehist-additional-variables var)) 288 (add-to-list 'savehist-additional-variables var))
292 (savehist-mode +1)) 289 (savehist-mode +1))
293 290
294(when (require 'saveplace nil :noerror) 291(when (require 'saveplace nil :noerror)
295 (setq-default save-place-file (.etc "places.el") 292 (setq-default save-place-file (.etc "places.el")
296 save-place-forget-unreadable-files (eq system-type 'gnu/linux)) 293 save-place-forget-unreadable-files (eq system-type 'gnu/linux))
297 (save-place-mode +1)) 294 (save-place-mode +1))
298 295
299;; (when (require 'tramp) 296;; (when (require 'tramp)
diff --git a/lisp/+lookup.el b/lisp/+lookup.el index dfa0180..f13f535 100644 --- a/lisp/+lookup.el +++ b/lisp/+lookup.el
@@ -7,11 +7,17 @@
7 7
8;;; Code: 8;;; Code:
9 9
10(defvar +lookup-map (let ((map (make-sparse-keymap))) 10(require '+key)
11 (define-key map "f" #'find-function) 11
12 (define-key map "l" #'find-library) 12(define-minor-mode +lookup-mode
13 map) 13 "A mode for easily looking things up."
14 "Keymap for looking up things.") 14 :lighter " l^"
15 :keymap (let ((map (make-sparse-keymap)))
16 (define-key map "f" #'find-function)
17 (define-key map "l" #'find-library)
18 map)
19 (define-key +key-mode-map (kbd "C-c l") (when +lookup-mode
20 +lookup-mode-map)))
15 21
16(provide '+lookup) 22(provide '+lookup)
17;;; +lookup.el ends here 23;;; +lookup.el ends here
diff --git a/lisp/acdw.el b/lisp/acdw.el index a6fddfe..fcab61b 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -19,6 +19,8 @@
19 19
20;;; Code: 20;;; Code:
21 21
22(require 'diary-lib)
23
22;;; Define a directory and an expanding function 24;;; Define a directory and an expanding function
23 25
24(defmacro +define-dir (name directory &optional docstring inhibit-mkdir) 26(defmacro +define-dir (name directory &optional docstring inhibit-mkdir)
@@ -94,7 +96,11 @@ itself."
94 ;; sunset-command. 96 ;; sunset-command.
95 (funcall sunset-command) 97 (funcall sunset-command)
96 (run-at-time sunrise nil sunrise-command)) 98 (run-at-time sunrise nil sunrise-command))
97 ((time-less-p nil sunset-time) (run-at-time sunset nil sunset-command)) 99 ((time-less-p nil sunset-time)
100 ;; If it isn't sunset yet, it's still light---so we need to run the
101 ;; sunrise-command.
102 (funcall sunrise-command)
103 (run-at-time sunset nil sunset-command))
98 (t (run-at-time "12:00am" nil sunset-command))) 104 (t (run-at-time "12:00am" nil sunset-command)))
99 ;; Reset everything at midnight 105 ;; Reset everything at midnight
100 (unless reset 106 (unless reset