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

78
init.el
View File

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

View File

@ -3,17 +3,7 @@
;;; Code: ;;; Code:
(require 'thingatpt) (require 'thingatpt)
(require '+key)
(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))
;;;###autoload ;;;###autoload
(defun +upcase-dwim (arg) (defun +upcase-dwim (arg)
@ -28,9 +18,10 @@ Otherwise, it calls `upcase-word' on the word at point (using
(word-bound (save-excursion (word-bound (save-excursion
(skip-chars-forward "^[:word:]") (skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word)))) (bounds-of-thing-at-point 'word))))
(upcase-region (car word-bound) (cdr word-bound)) (when (and (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound)) (upcase-region (car word-bound) (cdr word-bound))
(upcase-word following)))) (goto-char (cdr word-bound))
(upcase-word following)))))
;;;###autoload ;;;###autoload
(defun +downcase-dwim (arg) (defun +downcase-dwim (arg)
@ -45,9 +36,10 @@ Otherwise, it calls `downcase-word' on the word at point (using
(word-bound (save-excursion (word-bound (save-excursion
(skip-chars-forward "^[:word:]") (skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word)))) (bounds-of-thing-at-point 'word))))
(downcase-region (car word-bound) (cdr word-bound)) (when (and (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound)) (downcase-region (car word-bound) (cdr word-bound))
(downcase-word following)))) (goto-char (cdr word-bound))
(downcase-word following)))))
;;;###autoload ;;;###autoload
(defun +capitalize-dwim (arg) (defun +capitalize-dwim (arg)
@ -62,11 +54,26 @@ Otherwise, it calls `capitalize-word' on the word at point (using
(word-bound (save-excursion (word-bound (save-excursion
(skip-chars-forward "^[:word:]") (skip-chars-forward "^[:word:]")
(bounds-of-thing-at-point 'word)))) (bounds-of-thing-at-point 'word))))
(capitalize-region (car word-bound) (cdr word-bound)) (when (and (car word-bound) (cdr word-bound))
(goto-char (cdr word-bound)) (capitalize-region (car word-bound) (cdr word-bound))
(capitalize-word following)))) (goto-char (cdr word-bound))
(capitalize-word following)))))
;; Later on, I'll add repeat maps and stuff in here... ;; 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) (provide '+casing)
;;; +casing.el ends here ;;; +casing.el ends here

View File

@ -80,8 +80,8 @@ Do this only if the buffer is not visiting a file."
mark-ring-max 50 mark-ring-max 50
minibuffer-eldef-shorten-default t minibuffer-eldef-shorten-default t
minibuffer-prompt-properties (list 'read-only t minibuffer-prompt-properties (list 'read-only t
'cursor-intangible t 'cursor-intangible t
'face 'minibuffer-prompt) 'face 'minibuffer-prompt)
mode-require-final-newline 'visit-save mode-require-final-newline 'visit-save
mouse-drag-copy-region t mouse-drag-copy-region t
mouse-wheel-progressive-speed nil mouse-wheel-progressive-speed nil
@ -90,8 +90,8 @@ Do this only if the buffer is not visiting a file."
read-answer-short t read-answer-short t
read-buffer-completion-ignore-case t read-buffer-completion-ignore-case t
read-extended-command-predicate (when (fboundp read-extended-command-predicate (when (fboundp
'command-completion-default-include-p) 'command-completion-default-include-p)
'command-completion-default-include-p) 'command-completion-default-include-p)
recenter-positions '(top middle bottom) recenter-positions '(top middle bottom)
regexp-search-ring-max 100 regexp-search-ring-max 100
regexp-search-ring-max 200 regexp-search-ring-max 200
@ -169,23 +169,23 @@ Do this only if the buffer is not visiting a file."
;;; Modes ;;; Modes
(dolist (enable-mode '(global-auto-revert-mode (dolist (enable-mode '(global-auto-revert-mode
blink-cursor-mode blink-cursor-mode
electric-pair-mode electric-pair-mode
show-paren-mode show-paren-mode
global-so-long-mode global-so-long-mode
minibuffer-depth-indicate-mode minibuffer-depth-indicate-mode
file-name-shadow-mode file-name-shadow-mode
minibuffer-electric-default-mode minibuffer-electric-default-mode
delete-selection-mode delete-selection-mode
column-number-mode)) column-number-mode))
(when (fboundp enable-mode) (when (fboundp enable-mode)
(funcall enable-mode +1))) (funcall enable-mode +1)))
(dolist (disable-mode '(tooltip-mode (dolist (disable-mode '(tooltip-mode
tool-bar-mode tool-bar-mode
menu-bar-mode menu-bar-mode
scroll-bar-mode scroll-bar-mode
horizontal-scroll-bar-mode)) horizontal-scroll-bar-mode))
(when (fboundp disable-mode) (when (fboundp disable-mode)
(funcall disable-mode -1))) (funcall disable-mode -1)))
@ -243,19 +243,16 @@ kill without asking."
("C-s" . isearch-forward-regexp) ("C-s" . isearch-forward-regexp)
("C-r" . isearch-backward-regexp) ("C-r" . isearch-backward-regexp)
("C-M-s" . isearch-forward) ("C-M-s" . isearch-forward)
("C-M-r" . isearch-backward) ("C-M-r" . isearch-backward)))
("M-u" . upcase-dwim)
("M-l" . downcase-dwim)
("M-c" . capitalize-dwim)))
(define-key +key-mode-map (kbd (car binding)) (cdr binding))) (define-key +key-mode-map (kbd (car binding)) (cdr binding)))
;;; Required libraries ;;; Required libraries
(when (require 'uniquify nil :noerror) (when (require 'uniquify nil :noerror)
(setq-default uniquify-buffer-name-style 'forward (setq-default uniquify-buffer-name-style 'forward
uniquify-separator path-separator uniquify-separator path-separator
uniquify-after-kill-buffer-p t uniquify-after-kill-buffer-p t
uniquify-ignore-buffers-re "^\\*")) uniquify-ignore-buffers-re "^\\*"))
(when (require 'goto-addr) (when (require 'goto-addr)
(if (fboundp 'global-goto-address-mode) (if (fboundp 'global-goto-address-mode)
@ -264,36 +261,36 @@ kill without asking."
(when (require 'recentf nil :noerror) (when (require 'recentf nil :noerror)
(setq-default recentf-save-file (.etc "recentf.el") (setq-default recentf-save-file (.etc "recentf.el")
recentf-max-menu-items 100 recentf-max-menu-items 100
recentf-max-saved-items nil recentf-max-saved-items nil
recentf-auto-cleanup 'mode) recentf-auto-cleanup 'mode)
(add-to-list 'recentf-exclude .etc) (add-to-list 'recentf-exclude .etc)
(recentf-mode +1)) (recentf-mode +1))
(when (require 'repeat nil :noerror) (when (require 'repeat nil :noerror)
(setq-default repeat-exit-key "g" (setq-default repeat-exit-key "g"
repeat-exit-timeout 5) repeat-exit-timeout 5)
(when (fboundp 'repeat-mode) (when (fboundp 'repeat-mode)
;; `repeat-mode' is defined in repeat.el, which is an older library. ;; `repeat-mode' is defined in repeat.el, which is an older library.
(repeat-mode +1))) (repeat-mode +1)))
(when (require 'savehist nil :noerror) (when (require 'savehist nil :noerror)
(setq-default history-length t (setq-default history-length t
history-delete-duplicates t history-delete-duplicates t
history-autosave-interval 60 history-autosave-interval 60
savehist-file (.etc "savehist.el")) savehist-file (.etc "savehist.el"))
(dolist (var '(extended-command-history (dolist (var '(extended-command-history
global-mark-ring global-mark-ring
kill-ring kill-ring
regexp-search-ring regexp-search-ring
search-ring search-ring
mark-ring)) mark-ring))
(add-to-list 'savehist-additional-variables var)) (add-to-list 'savehist-additional-variables var))
(savehist-mode +1)) (savehist-mode +1))
(when (require 'saveplace nil :noerror) (when (require 'saveplace nil :noerror)
(setq-default save-place-file (.etc "places.el") (setq-default save-place-file (.etc "places.el")
save-place-forget-unreadable-files (eq system-type 'gnu/linux)) save-place-forget-unreadable-files (eq system-type 'gnu/linux))
(save-place-mode +1)) (save-place-mode +1))
;; (when (require 'tramp) ;; (when (require 'tramp)

View File

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

View File

@ -19,6 +19,8 @@
;;; Code: ;;; Code:
(require 'diary-lib)
;;; Define a directory and an expanding function ;;; Define a directory and an expanding function
(defmacro +define-dir (name directory &optional docstring inhibit-mkdir) (defmacro +define-dir (name directory &optional docstring inhibit-mkdir)
@ -94,7 +96,11 @@ itself."
;; sunset-command. ;; sunset-command.
(funcall sunset-command) (funcall sunset-command)
(run-at-time sunrise nil sunrise-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))) (t (run-at-time "12:00am" nil sunset-command)))
;; Reset everything at midnight ;; Reset everything at midnight
(unless reset (unless reset