dev: merging from main
This commit is contained in:
commit
08d20c7e62
11 changed files with 75 additions and 91 deletions
|
@ -301,7 +301,7 @@ list remains lean."
|
|||
(setq want-native-compile nil))
|
||||
(and (or want-byte-compile want-native-compile)
|
||||
(or (file-newer-than-file-p repo-dir build-dir)
|
||||
(file-exists-p (straight--modified-dir (or local-repo package)))
|
||||
(file-exists-p (straight--modified-dir package))
|
||||
(cl-loop with outdated = nil
|
||||
for file in (doom-files-in build-dir :match "\\.el$" :full t)
|
||||
if (or (if want-byte-compile (doom-packages--elc-file-outdated-p file))
|
||||
|
|
|
@ -143,11 +143,11 @@ tell you about it. Very annoying. This prevents that."
|
|||
(letf! ((#'sit-for #'ignore))
|
||||
(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
|
||||
;; filesystem will murder your family. To appease it, I compress
|
||||
;; `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)
|
||||
"Compress the auto-save file name so paths don't get too long."
|
||||
:around #'make-auto-save-file-name
|
||||
|
@ -165,7 +165,7 @@ tell you about it. Very annoying. This prevents that."
|
|||
(sha1 buffer-file-name))))
|
||||
(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).
|
||||
(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."
|
||||
|
@ -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
|
||||
;; 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
|
||||
tab-width 4)
|
||||
|
||||
|
@ -269,19 +269,20 @@ tell you about it. Very annoying. This prevents that."
|
|||
;; Only prompts for confirmation when buffer is unsaved.
|
||||
revert-without-query (list "."))
|
||||
|
||||
;; `auto-revert-mode' and `global-auto-revert-mode' would, normally, abuse the
|
||||
;; heck out of file watchers _or_ aggressively poll your buffer list every X
|
||||
;; seconds. Too many watchers can grind Emacs to a halt if you preform
|
||||
;; expensive or batch processes on files outside of Emacs (e.g. their mtime
|
||||
;; changes), and polling your buffer list is terribly inefficient as your
|
||||
;; buffer list grows into the hundreds.
|
||||
;; PERF: `auto-revert-mode' and `global-auto-revert-mode' would, normally,
|
||||
;; abuse the heck out of file watchers _or_ aggressively poll your buffer
|
||||
;; list every X seconds. Too many watchers can grind Emacs to a halt if you
|
||||
;; preform expensive or batch processes on files outside of Emacs (e.g.
|
||||
;; their mtime changes), and polling your buffer list is terribly
|
||||
;; inefficient as your buffer list grows into the hundreds.
|
||||
;;
|
||||
;; 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
|
||||
;; 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
|
||||
;; single buffer and, at maximum, ~10 buffers (after all, when do you ever
|
||||
;; have more than 10 windows in any single frame?).
|
||||
;; single buffer and, at maximum, ~10 x F buffers, where F = number of open
|
||||
;; frames (after all, when do you ever have more than 10 windows in any
|
||||
;; single frame?).
|
||||
(defun doom-auto-revert-buffer-h ()
|
||||
"Auto revert current buffer, if necessary."
|
||||
(unless (or auto-revert-mode (active-minibuffer-window))
|
||||
|
|
|
@ -246,29 +246,29 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
|||
(fset
|
||||
fn (lambda (&rest _)
|
||||
;; Only trigger this after Emacs has initialized.
|
||||
(when (and after-init-time
|
||||
(not running?)
|
||||
(when (and (not running?)
|
||||
(not (doom-context-p 'init))
|
||||
(or (daemonp)
|
||||
;; In some cases, hooks may be lexically unset to
|
||||
;; inhibit them during expensive batch operations on
|
||||
;; buffers (such as when processing buffers
|
||||
;; internally). In these cases we should assume this
|
||||
;; hook wasn't invoked interactively.
|
||||
;; internally). In that case assume this hook was
|
||||
;; invoked non-interactively.
|
||||
(and (boundp hook)
|
||||
(symbol-value hook))))
|
||||
(setq running? t) ; prevent infinite recursion
|
||||
(doom-run-hooks hook-var)
|
||||
(set hook-var nil))))
|
||||
(cond ((daemonp)
|
||||
;; In a daemon session we don't need all these lazy loading
|
||||
;; shenanigans. Just load everything immediately.
|
||||
(add-hook 'after-init-hook fn 'append))
|
||||
((eq hook 'find-file-hook)
|
||||
;; Advise `after-find-file' instead of using `find-file-hook'
|
||||
;; because the latter is triggered too late (after the file has
|
||||
;; opened and modes are all set up).
|
||||
(advice-add 'after-find-file :before fn '((depth . -101))))
|
||||
((add-hook hook fn -101)))
|
||||
(when (daemonp)
|
||||
;; In a daemon session we don't need all these lazy loading shenanigans.
|
||||
;; Just load everything immediately.
|
||||
(add-hook 'server-after-make-frame-hook fn 'append))
|
||||
(if (eq hook 'find-file-hook)
|
||||
;; Advise `after-find-file' instead of using `find-file-hook' because
|
||||
;; the latter is triggered too late (after the file has opened and
|
||||
;; modes are all set up).
|
||||
(advice-add 'after-find-file :before fn '((depth . -101)))
|
||||
(add-hook hook fn -101))
|
||||
fn)))
|
||||
|
||||
(defun doom-compile-functions (&rest fns)
|
||||
|
|
|
@ -256,7 +256,7 @@ uses a straight or package.el command directly).")
|
|||
(alist-get 'straight packages)
|
||||
(doom--ensure-straight recipe pin))
|
||||
(doom--ensure-core-packages
|
||||
(seq-filter (fn! (eq (plist-get % :type) 'core))
|
||||
(seq-filter (fn! (eq (plist-get (cdr %) :type) 'core))
|
||||
packages)))))
|
||||
|
||||
(defun doom-initialize-packages (&optional force-p)
|
||||
|
|
|
@ -101,34 +101,40 @@
|
|||
;;; Disable UI elements early
|
||||
;; PERF,UI: Doom strives to be keyboard-centric, so I consider these UI elements
|
||||
;; clutter. Initializing them also costs a morsel of startup time. What's
|
||||
;; more, the menu bar exposes functionality that Doom doesn't endorse. Perhaps
|
||||
;; one day Doom will support these, but today is not that day. By disabling
|
||||
;; them early, we save Emacs some time.
|
||||
;; more, the menu bar exposes functionality that Doom doesn't endorse or
|
||||
;; police. Perhaps one day Doom will support these, but today is not that day.
|
||||
;; By disabling them early, we save Emacs some time.
|
||||
|
||||
;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
|
||||
;; `scroll-bar-mode' because their manipulation of frame parameters can
|
||||
;; trigger/queue a superfluous (and expensive, depending on the window system)
|
||||
;; frame redraw at startup.
|
||||
;; frame redraw at startup. The variables must be set to `nil' as well so
|
||||
;; users don't have to call the functions twice to re-enable them.
|
||||
(push '(menu-bar-lines . 0) default-frame-alist)
|
||||
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||
(push '(vertical-scroll-bars) default-frame-alist)
|
||||
;; And set these to nil so users don't have to toggle the modes twice to
|
||||
;; reactivate them.
|
||||
(setq menu-bar-mode nil
|
||||
tool-bar-mode nil
|
||||
scroll-bar-mode nil)
|
||||
;; FIX: On MacOS, disabling the menu bar makes MacOS treat Emacs as a
|
||||
;; non-application window -- which means it doesn't automatically capture
|
||||
;; focus when it is started, among other things, so enable the menu-bar for
|
||||
;; GUI frames, but keep it disabled in terminal frames because there it
|
||||
;; unavoidably activates an ugly, in-frame menu bar.
|
||||
(eval-when! doom--system-macos-p
|
||||
(add-hook! '(window-setup-hook after-make-frame-functions)
|
||||
(defun doom-restore-menu-bar-in-gui-frames-h (&optional frame)
|
||||
(when-let (frame (or frame (selected-frame)))
|
||||
(when (display-graphic-p frame)
|
||||
(set-frame-parameter frame 'menu-bar-lines 1))))))
|
||||
|
||||
;; HACK: The menu-bar needs special treatment on MacOS. On Linux and Windows
|
||||
;; (and TTY frames in MacOS), the menu-bar takes up valuable in-frame real
|
||||
;; estate -- so we disable it -- but on MacOS (GUI frames only) the menu bar
|
||||
;; lives outside of the frame, on the MacOS menu bar, which is acceptable, but
|
||||
;; disabling Emacs' menu-bar also makes MacOS treat Emacs GUI frames like
|
||||
;; non-application windows (e.g. it won't capture focus on activation, among
|
||||
;; other things), so the menu-bar should be preserved there.
|
||||
;;
|
||||
(when doom--system-macos-p
|
||||
;; NOTE: The correct way to disable this hack is to toggle `menu-bar-mode' (or
|
||||
;; put it on a hook). Don't try to undo the hack below, as it may change
|
||||
;; without warning, but will always respect `menu-bar-mode'.
|
||||
(setcdr (assq 'menu-bar-lines default-frame-alist) 'tty)
|
||||
(add-hook! 'after-make-frame-functions
|
||||
(defun doom--init-menu-bar-on-macos-h (&optional frame)
|
||||
(if (eq (frame-parameter frame 'menu-bar-lines) 'tty)
|
||||
(set-frame-parameter frame 'menu-bar-lines
|
||||
(if (display-graphic-p frame) 1 0))))))
|
||||
|
||||
;;; Encodings
|
||||
;; Contrary to what many Emacs users have in their configs, you don't need more
|
||||
|
|
|
@ -135,28 +135,6 @@
|
|||
prog-mode-hook)
|
||||
#'spell-fu-mode))
|
||||
:config
|
||||
;; TODO PR this fix upstream!
|
||||
(defadvice! +spell--fix-face-detection-a (fn &rest args)
|
||||
"`spell-fu--faces-at-point' uses face detection that won't penetrary
|
||||
overlays (like `hl-line'). This makes `spell-fu-faces-exclude' demonstrably less
|
||||
useful when it'll still spellcheck excluded faces on any line that `hl-line' is
|
||||
displayed on, even momentarily."
|
||||
:around #'spell-fu--faces-at-point
|
||||
(letf! (defun get-char-property (pos prop &optional obj)
|
||||
(or (plist-get (text-properties-at pos) prop)
|
||||
(funcall get-char-property pos prop obj)))
|
||||
(apply fn args)))
|
||||
|
||||
(defadvice! +spell--create-word-dict-a (_word words-file _action)
|
||||
"Prevent `spell-fu--word-add-or-remove' from throwing non-existant
|
||||
directory errors when writing a personal dictionary file (by creating the
|
||||
directory first)."
|
||||
:before #'spell-fu--word-add-or-remove
|
||||
(unless (file-exists-p words-file)
|
||||
(make-directory (file-name-directory words-file) t)
|
||||
(with-temp-file words-file
|
||||
(insert (format "personal_ws-1.1 %s 0\n" ispell-dictionary)))))
|
||||
|
||||
(add-hook! 'spell-fu-mode-hook
|
||||
(defun +spell-init-excluded-faces-h ()
|
||||
"Set `spell-fu-faces-exclude' according to `+spell-excluded-faces-alist'."
|
||||
|
|
|
@ -87,12 +87,10 @@
|
|||
|
||||
;;
|
||||
;;; Flymake
|
||||
|
||||
(use-package! flymake
|
||||
:when (modulep! +flymake)
|
||||
:defer t
|
||||
: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)
|
||||
:hook ((prog-mode text-mode) . flymake-mode)
|
||||
:config
|
||||
(setq flymake-fringe-indicator-position 'right-fringe))
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@ TAB/S-TAB.")
|
|||
(setq corfu-auto t
|
||||
corfu-auto-delay 0.18
|
||||
corfu-auto-prefix 2
|
||||
global-corfu-modes '((not
|
||||
erc-mode
|
||||
global-corfu-modes '((not erc-mode
|
||||
circe-mode
|
||||
help-mode
|
||||
gud-mode
|
||||
|
@ -79,8 +78,8 @@ TAB/S-TAB.")
|
|||
(add-to-list 'corfu-continue-commands #'+corfu-smart-sep-toggle-escape)
|
||||
(add-hook 'evil-insert-state-exit-hook #'corfu-quit)
|
||||
|
||||
;; If you want to update the visual hints after completing minibuffer commands
|
||||
;; with Corfu and exiting, you have to do it manually.
|
||||
;; HACK: If you want to update the visual hints after completing minibuffer
|
||||
;; commands with Corfu and exiting, you have to do it manually.
|
||||
(defadvice! +corfu--insert-before-exit-minibuffer-a ()
|
||||
:before #'exit-minibuffer
|
||||
(when (or (and (frame-live-p corfu--frame)
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
((user-error "Definition lookup in SRC blocks isn't supported yet"))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-lookup-references-handler (identifier)
|
||||
(defun +org-lookup-references-handler (_identifier)
|
||||
"TODO"
|
||||
(when (org-in-src-block-p t)
|
||||
(user-error "References lookup in SRC blocks isn't supported yet")))
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
|
||||
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
|
||||
"(provide 'org-version)\n")))))
|
||||
:pin "e9c288dfaccc2960e5b6889e6aabea700ad4e05a")
|
||||
:pin "5bdfc02c6fa1b9ad4f075ac1ad1e4086ead310db")
|
||||
(package! org-contrib
|
||||
:recipe (:host github
|
||||
:repo "emacsmirror/org-contrib")
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
;; hooks, but not the body.
|
||||
(add-hook! 'envrc-global-mode-hook
|
||||
(defun +direnv-init-global-mode-earlier-h ()
|
||||
(let ((fn #'envrc-global-mode-enable-in-buffers))
|
||||
(let ((fn (if (fboundp #'envrc-global-mode-enable-in-buffers)
|
||||
#'envrc-global-mode-enable-in-buffers ; Removed in Emacs 30.
|
||||
#'envrc-global-mode-enable-in-buffer)))
|
||||
(if (not envrc-global-mode)
|
||||
(remove-hook 'change-major-mode-after-body-hook fn)
|
||||
(remove-hook 'after-change-major-mode-hook fn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue