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.
This commit is contained in:
Case Duckworth 2022-01-05 17:12:32 -06:00
parent 084618a930
commit 9e46efac61
6 changed files with 127 additions and 106 deletions

View File

@ -21,13 +21,16 @@
;;; Code:
(define-advice load (:before (feature &rest _))
"Message the user when loading a library."
(with-temp-message (format "Now loading: '%s'" feature)))
;;(setq debug-on-error t)
(message "Loading early-init.el...")
;; (define-advice load (:before (feature &rest _))
;; "Message the user when loading a library."
;; (with-temp-message (format "Now loading: '%s'" feature)))
;;; Speed up init
(setq gc-cons-threshold most-positive-fixnum)
;; (setq gc-cons-threshold most-positive-fixnum)
(add-hook 'emacs-startup-hook
(defun emacs-startup@restore-values ()
@ -41,8 +44,6 @@
;;; Set up extra load paths and functionality
(push (locate-user-emacs-file "lisp") load-path)
(add-to-list 'load-path (locate-user-emacs-file "lisp/compat") :append)
(require 'acdw)
(+define-dir .etc (locate-user-emacs-file ".etc")
@ -159,5 +160,7 @@ See `no-littering' for examples.")
;; is `straight-package-neutering-mode'.
(defalias 'straight-ಠ_ಠ-mode nil)
(message "Loading early-init.el...Done.")
(provide 'early-init)
;;; early-init.el ends here

78
init.el
View File

@ -15,17 +15,13 @@
;; - Make good choices.
;;; Code:
(dolist (feature `((early-init . ,(locate-user-emacs-file "early-init"))
acdw
private))
(require (or (car-safe feature) feature) (cdr-safe feature) :noerror))
(let ((early-features `((early-init . ,(locate-user-emacs-file "early-init"))
acdw private +key)))
(dolist (feature early-features)
(require (or (car-safe feature) feature) (cdr-safe feature) :noerror)))
(setup (:require +casing)
(:+key "M-c" +casing-map)
;; Unbind default casing bindings
(:global "M-u" nil "M-c" nil "M-l" nil
"C-x C-u" nil "C-x C-l" nil))
(+casing-mode +1))
(setup (:require +emacs)
;; +emacs.el contains super-basic defaults that are basically necessary for
@ -37,11 +33,8 @@
(:global "C-x C-k" #'kill-current-buffer
"C-x 4 n" #'clone-buffer
"C-c v" #'visible-mode
"C-M-;" #'+lisp-comment-or-uncomment-sexp)
;; Unbind stuff, too.
(dolist (key '("C-M-j"
"M-j"))
(global-set-key (kbd key) nil))
"C-M-;" #'+lisp-comment-or-uncomment-sexp
"M-j" nil)
;; C-h deletes backward - see https://idiomdrottning.org/bad-emacs-defaults
(global-set-key (kbd "C-h") 'delete-backward-char)
(keyboard-translate ?\C-h ?\C-?)
@ -55,15 +48,28 @@
(:bind "C-c s" #'+init-sort-then-save)
(:hook #'+init-add-setup-to-imenu))
(setup (:require +key)
(+ensure-after-init #'+key-global-mode))
(setup (:require +lookup)
(:+key "C-c l" +lookup-map))
(+lookup-mode +1))
(setup (:require auth-source)
(:option auth-sources (list (private/ "authinfo"))))
(setup (:require auto-insert)
(setf (alist-get '("lisp/.*\\.el\\'" . "+Emacs lisp")
auto-insert-alist nil nil #'equal)
`(nil ";;; " (file-name-nondirectory (buffer-file-name))
(make-string (max 2 (- fill-column (current-column) 27)) 32)
"-*- lexical-binding: t; -*-" '(setq lexical-binding t)
,(concat "\n\n;;; Commentary:"
"\n\n;; ") _
,(concat "\n\n;;; Code:"
"\n\n"
"\n\n(provide '")
(file-name-base (buffer-file-name))
,(concat ")" "\n;;; ")
(file-name-nondirectory (buffer-file-name)) " ends here\n"))
(auto-insert-mode +1))
(setup (:require cus-edit)
;; I don't use Custom to actually /make/ any customizations, but it's handy to
;; (A) see what options are available and (B) persist some changes across
@ -98,28 +104,15 @@
(setup (:require reading)
(:global "C-c C-r" #'reading-mode))
(setup +key
(+ensure-after-init #'+key-global-mode))
(setup abbrev
(:option abbrev-file-name (sync/ "abbrev.el")
save-abbrevs 'silent)
(:hook-into text-mode
circe-chat-mode))
(setup auto-insert
(setf (alist-get '("lisp/.*\\.el\\'" . "+Emacs lisp")
auto-insert-alist nil nil #'equal)
`(nil ";;; " (file-name-nondirectory (buffer-file-name))
(make-string (max 2 (- fill-column (current-column) 27)) 32)
"-*- lexical-binding: t; -*-" '(setq lexical-binding t)
,(concat "\n\n;;; Commentary:"
"\n\n;; ") _
,(concat "\n\n;;; Code:"
"\n\n"
"\n\n(provide '")
(file-name-base (buffer-file-name))
,(concat ")" "\n;;; ")
(file-name-nondirectory (buffer-file-name)) " ends here\n"))
(auto-insert-mode +1))
(setup autorevert
(:option global-auto-revert-non-file-buffers t
auto-revert-verbose nil)
@ -303,6 +296,9 @@
"M-n" nil
"M-p" nil))
(setup flyspell
(:hook-into org-mode))
(setup hideshow
(:also-load +hideshow)
(:with-mode hs-minor-mode
@ -558,7 +554,7 @@
[remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp))
(setup (:straight avy)
(:also-load +avy)
(:require avy +avy)
(:+key "M-j" #'avy-goto-char-timer)
(:bind-into isearch
"M-j" #'avy-isearch)
@ -780,7 +776,7 @@
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)))
(define-key +key-mode-map (kbd (car binding)) (cdr binding)))
(global-set-key (kbd (car binding)) (cdr binding)))
(with-eval-after-load 'isearch-mode
(dolist (binding '(("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history)
@ -813,7 +809,8 @@
(setup (:straight crux)
;; yes it's silly I have an addon to this addon.
(:also-load +crux)
(:option crux-shell-func #'crux-eshell)
(:option crux-shell-func #'crux-eshell
+crux-default-date-format "%F")
(:global "C-o" #'crux-smart-open-line
"C-x 4 t" #'crux-transpose-windows
"M-w" #'+crux-kill-ring-save
@ -844,7 +841,7 @@ See also `crux-reopen-as-root-mode'."
(autoload 'dictionary-search "dictionary"
"Ask for a word and search it in all dictionaries" t)
(:hook #'reading-mode)
(define-key +lookup-map "d" #'dictionary-search))
(define-key +lookup-mode-map "d" #'dictionary-search))
(setup (:straight (discord
:host github
@ -949,6 +946,11 @@ See also `crux-reopen-as-root-mode'."
:repo "duckwork/filldent.el"))
(:+key "M-q" #'filldent-dwim))
(setup (:straight flyspell-correct)
(:option flyspell-correct--cr-key ";")
(:bind-into flyspell
"C-;" #'flyspell-correct-wrapper))
(setup (:straight-when (forge
:host github :repo "magit/forge")
(eq system-system 'linux))

View File

@ -3,17 +3,7 @@
;;; Code:
(require 'thingatpt)
(defvar +casing-map (make-sparse-keymap)
"Keymap for word-casing.")
(let ((map +casing-map))
(define-key map "u" #'+upcase-dwim)
(define-key map (kbd "M-u") #'+upcase-dwim)
(define-key map "l" #'+downcase-dwim)
(define-key map (kbd "M-l") #'+downcase-dwim)
(define-key map "c" #'+capitalize-dwim)
(define-key map (kbd "M-c") #'+capitalize-dwim))
(require '+key)
;;;###autoload
(defun +upcase-dwim (arg)
@ -28,9 +18,10 @@ Otherwise, it calls `upcase-word' on the word at point (using
(word-bound (save-excursion
(skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word))))
(when (and (car word-bound) (cdr word-bound))
(upcase-region (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound))
(upcase-word following))))
(upcase-word following)))))
;;;###autoload
(defun +downcase-dwim (arg)
@ -45,9 +36,10 @@ Otherwise, it calls `downcase-word' on the word at point (using
(word-bound (save-excursion
(skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word))))
(when (and (car word-bound) (cdr word-bound))
(downcase-region (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound))
(downcase-word following))))
(downcase-word following)))))
;;;###autoload
(defun +capitalize-dwim (arg)
@ -62,11 +54,26 @@ Otherwise, it calls `capitalize-word' on the word at point (using
(word-bound (save-excursion
(skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word))))
(when (and (car word-bound) (cdr word-bound))
(capitalize-region (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound))
(capitalize-word following))))
(capitalize-word following)))))
;; Later on, I'll add repeat maps and stuff in here...
(define-minor-mode +casing-mode
"Enable easy case-twiddling commands."
:lighter " cC"
:keymap (let ((map (make-sparse-keymap)))
(define-key map "u" #'+upcase-dwim)
(define-key map (kbd "M-u") #'+upcase-dwim)
(define-key map "l" #'+downcase-dwim)
(define-key map (kbd "M-l") #'+downcase-dwim)
(define-key map "c" #'+capitalize-dwim)
(define-key map (kbd "M-c") #'+capitalize-dwim)
map)
(define-key +key-mode-map (kbd "M-c") (when +casing-mode
+casing-mode-map)))
(provide '+casing)
;;; +casing.el ends here

View File

@ -243,10 +243,7 @@ kill without asking."
("C-s" . isearch-forward-regexp)
("C-r" . isearch-backward-regexp)
("C-M-s" . isearch-forward)
("C-M-r" . isearch-backward)
("M-u" . upcase-dwim)
("M-l" . downcase-dwim)
("M-c" . capitalize-dwim)))
("C-M-r" . isearch-backward)))
(define-key +key-mode-map (kbd (car binding)) (cdr binding)))
;;; Required libraries

View File

@ -7,11 +7,17 @@
;;; Code:
(defvar +lookup-map (let ((map (make-sparse-keymap)))
(require '+key)
(define-minor-mode +lookup-mode
"A mode for easily looking things up."
:lighter " l^"
:keymap (let ((map (make-sparse-keymap)))
(define-key map "f" #'find-function)
(define-key map "l" #'find-library)
map)
"Keymap for looking up things.")
(define-key +key-mode-map (kbd "C-c l") (when +lookup-mode
+lookup-mode-map)))
(provide '+lookup)
;;; +lookup.el ends here

View File

@ -19,6 +19,8 @@
;;; Code:
(require 'diary-lib)
;;; Define a directory and an expanding function
(defmacro +define-dir (name directory &optional docstring inhibit-mkdir)
@ -94,7 +96,11 @@ itself."
;; sunset-command.
(funcall sunset-command)
(run-at-time sunrise nil sunrise-command))
((time-less-p nil sunset-time) (run-at-time sunset nil sunset-command))
((time-less-p nil sunset-time)
;; If it isn't sunset yet, it's still light---so we need to run the
;; sunrise-command.
(funcall sunrise-command)
(run-at-time sunset nil sunset-command))
(t (run-at-time "12:00am" nil sunset-command)))
;; Reset everything at midnight
(unless reset