nit: reformat+revise comments

Includes minor refactors to appease the byte-compiler or use more
succinct (but equivalent) syntax.
This commit is contained in:
Henrik Lissner 2024-04-09 12:39:51 -04:00
parent d317fa4667
commit 96e3255c33
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
4 changed files with 32 additions and 34 deletions

View file

@ -143,11 +143,11 @@ tell you about it. Very annoying. This prevents that."
(letf! ((#'sit-for #'ignore)) (letf! ((#'sit-for #'ignore))
(apply fn args))) (apply fn args)))
;; HACK Emacs generates long file paths for its auto-save files; long = ;; HACK: Emacs generates long file paths for its auto-save files; long =
;; `auto-save-list-file-prefix' + `buffer-file-name'. If too long, the ;; `auto-save-list-file-prefix' + `buffer-file-name'. If too long, the
;; filesystem will murder your family. To appease it, I compress ;; filesystem will murder your family. To appease it, I compress
;; `buffer-file-name' to a stable 40 characters. ;; `buffer-file-name' to a stable 40 characters.
;; TODO PR this upstream; should be a universal issue! ;; TODO: PR this upstream; should be a universal issue!
(defadvice! doom-make-hashed-auto-save-file-name-a (fn) (defadvice! doom-make-hashed-auto-save-file-name-a (fn)
"Compress the auto-save file name so paths don't get too long." "Compress the auto-save file name so paths don't get too long."
:around #'make-auto-save-file-name :around #'make-auto-save-file-name
@ -156,7 +156,7 @@ tell you about it. Very annoying. This prevents that."
;; Don't do anything for non-file-visiting buffers. Names ;; Don't do anything for non-file-visiting buffers. Names
;; generated for those are short enough already. ;; generated for those are short enough already.
(null buffer-file-name) (null buffer-file-name)
;; If an alternate handler exists for this path, bow out. Most of ;; If an alternate handler exists for this path, bow out. Most of
;; them end up calling `make-auto-save-file-name' again anyway, so ;; them end up calling `make-auto-save-file-name' again anyway, so
;; we still achieve this advice's ultimate goal. ;; we still achieve this advice's ultimate goal.
(find-file-name-handler buffer-file-name (find-file-name-handler buffer-file-name
@ -165,8 +165,8 @@ tell you about it. Very annoying. This prevents that."
(sha1 buffer-file-name)))) (sha1 buffer-file-name))))
(funcall fn))) (funcall fn)))
;; HACK ...does the same for Emacs backup files, but also packages that use ;; HACK: ...does the same for Emacs backup files, but also packages that use
;; `make-backup-file-name-1' directly (like undo-tree). ;; `make-backup-file-name-1' directly (like undo-tree).
(defadvice! doom-make-hashed-backup-file-name-a (fn file) (defadvice! doom-make-hashed-backup-file-name-a (fn file)
"A few places use the backup file name so paths don't get too long." "A few places use the backup file name so paths don't get too long."
:around #'make-backup-file-name-1 :around #'make-backup-file-name-1
@ -191,7 +191,7 @@ tell you about it. Very annoying. This prevents that."
;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a ;; Favor spaces over tabs. Pls dun h8, but I think spaces (and 4 of them) is a
;; more consistent default than 8-space tabs. It can be changed on a per-mode ;; more consistent default than 8-space tabs. It can be changed on a per-mode
;; basis anyway (and is, where tabs are the canonical style, like go-mode). ;; basis anyway (and is, where tabs are the canonical style, like `go-mode').
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 4) tab-width 4)
@ -269,19 +269,20 @@ tell you about it. Very annoying. This prevents that."
;; Only prompts for confirmation when buffer is unsaved. ;; Only prompts for confirmation when buffer is unsaved.
revert-without-query (list ".")) revert-without-query (list "."))
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the ;; PERF: `auto-revert-mode' and `global-auto-revert-mode' would, normally,
;; heck out of file watchers _or_ aggressively poll your buffer list every X ;; abuse the heck out of file watchers _or_ aggressively poll your buffer
;; seconds. Too many watchers can grind Emacs to a halt if you preform ;; list every X seconds. Too many watchers can grind Emacs to a halt if you
;; expensive or batch processes on files outside of Emacs (e.g. their mtime ;; preform expensive or batch processes on files outside of Emacs (e.g.
;; changes), and polling your buffer list is terribly inefficient as your ;; their mtime changes), and polling your buffer list is terribly
;; buffer list grows into the hundreds. ;; inefficient as your buffer list grows into the hundreds.
;; ;;
;; Doom does this lazily instead. i.e. All visible buffers are reverted ;; Doom does this lazily instead. i.e. All visible buffers are reverted
;; immediately when a) a file is saved or b) Emacs is refocused (after using ;; immediately when a) a file is saved or b) Emacs is refocused (after using
;; another app). Meanwhile, buried buffers are reverted only when they are ;; another app). Meanwhile, buried buffers are reverted only when they are
;; switched to. This way, Emacs only ever has to operate on, at minimum, a ;; switched to. This way, Emacs only ever has to operate on, at minimum, a
;; single buffer and, at maximum, ~10 buffers (after all, when do you ever ;; single buffer and, at maximum, ~10 x F buffers, where F = number of open
;; have more than 10 windows in any single frame?). ;; frames (after all, when do you ever have more than 10 windows in any
;; single frame?).
(defun doom-auto-revert-buffer-h () (defun doom-auto-revert-buffer-h ()
"Auto revert current buffer, if necessary." "Auto revert current buffer, if necessary."
(unless (or auto-revert-mode (active-minibuffer-window)) (unless (or auto-revert-mode (active-minibuffer-window))

View file

@ -87,12 +87,10 @@
;; ;;
;;; Flymake ;;; Flymake
(use-package! flymake (use-package! flymake
:when (modulep! +flymake) :when (modulep! +flymake)
:defer t :hook ((prog-mode text-mode) . flymake-mode)
:init
;; as flymakes fail silently there is no need to activate it on a per major mode basis
(add-hook! (prog-mode text-mode) #'flymake-mode)
:config :config
(setq flymake-fringe-indicator-position 'right-fringe)) (setq flymake-fringe-indicator-position 'right-fringe))

View file

@ -44,12 +44,11 @@ use the minibuffer such as `query-replace'.")
(setq corfu-auto t (setq corfu-auto t
corfu-auto-delay 0.18 corfu-auto-delay 0.18
corfu-auto-prefix 2 corfu-auto-prefix 2
global-corfu-modes '((not global-corfu-modes '((not erc-mode
erc-mode circe-mode
circe-mode help-mode
help-mode gud-mode
gud-mode vterm-mode)
vterm-mode)
t) t)
corfu-cycle t corfu-cycle t
corfu-preselect 'prompt corfu-preselect 'prompt
@ -67,8 +66,8 @@ use the minibuffer such as `query-replace'.")
(add-to-list 'corfu-continue-commands #'+corfu-smart-sep-toggle-escape) (add-to-list 'corfu-continue-commands #'+corfu-smart-sep-toggle-escape)
(add-hook 'evil-insert-state-exit-hook #'corfu-quit) (add-hook 'evil-insert-state-exit-hook #'corfu-quit)
;; If you want to update the visual hints after completing minibuffer commands ;; HACK: If you want to update the visual hints after completing minibuffer
;; with Corfu and exiting, you have to do it manually. ;; commands with Corfu and exiting, you have to do it manually.
(defadvice! +corfu--insert-before-exit-minibuffer-a () (defadvice! +corfu--insert-before-exit-minibuffer-a ()
:before #'exit-minibuffer :before #'exit-minibuffer
(when (or (and (frame-live-p corfu--frame) (when (or (and (frame-live-p corfu--frame)

View file

@ -40,7 +40,7 @@
((user-error "Definition lookup in SRC blocks isn't supported yet")))))) ((user-error "Definition lookup in SRC blocks isn't supported yet"))))))
;;;###autoload ;;;###autoload
(defun +org-lookup-references-handler (identifier) (defun +org-lookup-references-handler (_identifier)
"TODO" "TODO"
(when (org-in-src-block-p t) (when (org-in-src-block-p t)
(user-error "References lookup in SRC blocks isn't supported yet"))) (user-error "References lookup in SRC blocks isn't supported yet")))