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))
|
(setq want-native-compile nil))
|
||||||
(and (or want-byte-compile want-native-compile)
|
(and (or want-byte-compile want-native-compile)
|
||||||
(or (file-newer-than-file-p repo-dir build-dir)
|
(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
|
(cl-loop with outdated = nil
|
||||||
for file in (doom-files-in build-dir :match "\\.el$" :full t)
|
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))
|
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))
|
(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))
|
||||||
|
|
|
@ -246,29 +246,29 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
||||||
(fset
|
(fset
|
||||||
fn (lambda (&rest _)
|
fn (lambda (&rest _)
|
||||||
;; Only trigger this after Emacs has initialized.
|
;; Only trigger this after Emacs has initialized.
|
||||||
(when (and after-init-time
|
(when (and (not running?)
|
||||||
(not running?)
|
(not (doom-context-p 'init))
|
||||||
(or (daemonp)
|
(or (daemonp)
|
||||||
;; In some cases, hooks may be lexically unset to
|
;; In some cases, hooks may be lexically unset to
|
||||||
;; inhibit them during expensive batch operations on
|
;; inhibit them during expensive batch operations on
|
||||||
;; buffers (such as when processing buffers
|
;; buffers (such as when processing buffers
|
||||||
;; internally). In these cases we should assume this
|
;; internally). In that case assume this hook was
|
||||||
;; hook wasn't invoked interactively.
|
;; invoked non-interactively.
|
||||||
(and (boundp hook)
|
(and (boundp hook)
|
||||||
(symbol-value hook))))
|
(symbol-value hook))))
|
||||||
(setq running? t) ; prevent infinite recursion
|
(setq running? t) ; prevent infinite recursion
|
||||||
(doom-run-hooks hook-var)
|
(doom-run-hooks hook-var)
|
||||||
(set hook-var nil))))
|
(set hook-var nil))))
|
||||||
(cond ((daemonp)
|
(when (daemonp)
|
||||||
;; In a daemon session we don't need all these lazy loading
|
;; In a daemon session we don't need all these lazy loading shenanigans.
|
||||||
;; shenanigans. Just load everything immediately.
|
;; Just load everything immediately.
|
||||||
(add-hook 'after-init-hook fn 'append))
|
(add-hook 'server-after-make-frame-hook fn 'append))
|
||||||
((eq hook 'find-file-hook)
|
(if (eq hook 'find-file-hook)
|
||||||
;; Advise `after-find-file' instead of using `find-file-hook'
|
;; Advise `after-find-file' instead of using `find-file-hook' because
|
||||||
;; because the latter is triggered too late (after the file has
|
;; the latter is triggered too late (after the file has opened and
|
||||||
;; opened and modes are all set up).
|
;; modes are all set up).
|
||||||
(advice-add 'after-find-file :before fn '((depth . -101))))
|
(advice-add 'after-find-file :before fn '((depth . -101)))
|
||||||
((add-hook hook fn -101)))
|
(add-hook hook fn -101))
|
||||||
fn)))
|
fn)))
|
||||||
|
|
||||||
(defun doom-compile-functions (&rest fns)
|
(defun doom-compile-functions (&rest fns)
|
||||||
|
|
|
@ -256,7 +256,7 @@ uses a straight or package.el command directly).")
|
||||||
(alist-get 'straight packages)
|
(alist-get 'straight packages)
|
||||||
(doom--ensure-straight recipe pin))
|
(doom--ensure-straight recipe pin))
|
||||||
(doom--ensure-core-packages
|
(doom--ensure-core-packages
|
||||||
(seq-filter (fn! (eq (plist-get % :type) 'core))
|
(seq-filter (fn! (eq (plist-get (cdr %) :type) 'core))
|
||||||
packages)))))
|
packages)))))
|
||||||
|
|
||||||
(defun doom-initialize-packages (&optional force-p)
|
(defun doom-initialize-packages (&optional force-p)
|
||||||
|
|
|
@ -101,34 +101,40 @@
|
||||||
;;; Disable UI elements early
|
;;; Disable UI elements early
|
||||||
;; PERF,UI: Doom strives to be keyboard-centric, so I consider these UI elements
|
;; 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
|
;; clutter. Initializing them also costs a morsel of startup time. What's
|
||||||
;; more, the menu bar exposes functionality that Doom doesn't endorse. Perhaps
|
;; more, the menu bar exposes functionality that Doom doesn't endorse or
|
||||||
;; one day Doom will support these, but today is not that day. By disabling
|
;; police. Perhaps one day Doom will support these, but today is not that day.
|
||||||
;; them early, we save Emacs some time.
|
;; By disabling them early, we save Emacs some time.
|
||||||
|
|
||||||
;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
|
;; HACK: I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
|
||||||
;; `scroll-bar-mode' because their manipulation of frame parameters can
|
;; `scroll-bar-mode' because their manipulation of frame parameters can
|
||||||
;; trigger/queue a superfluous (and expensive, depending on the window system)
|
;; 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 '(menu-bar-lines . 0) default-frame-alist)
|
||||||
(push '(tool-bar-lines . 0) default-frame-alist)
|
(push '(tool-bar-lines . 0) default-frame-alist)
|
||||||
(push '(vertical-scroll-bars) 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
|
(setq menu-bar-mode nil
|
||||||
tool-bar-mode nil
|
tool-bar-mode nil
|
||||||
scroll-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
|
;;; Encodings
|
||||||
;; Contrary to what many Emacs users have in their configs, you don't need more
|
;; Contrary to what many Emacs users have in their configs, you don't need more
|
||||||
|
|
|
@ -135,28 +135,6 @@
|
||||||
prog-mode-hook)
|
prog-mode-hook)
|
||||||
#'spell-fu-mode))
|
#'spell-fu-mode))
|
||||||
:config
|
: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
|
(add-hook! 'spell-fu-mode-hook
|
||||||
(defun +spell-init-excluded-faces-h ()
|
(defun +spell-init-excluded-faces-h ()
|
||||||
"Set `spell-fu-faces-exclude' according to `+spell-excluded-faces-alist'."
|
"Set `spell-fu-faces-exclude' according to `+spell-excluded-faces-alist'."
|
||||||
|
|
|
@ -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))
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,11 @@ TAB/S-TAB.")
|
||||||
(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
|
||||||
|
@ -79,8 +78,8 @@ TAB/S-TAB.")
|
||||||
(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)
|
||||||
|
|
|
@ -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")))
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
|
(format "(defun org-git-version (&rest _) \"%s-??-%s\")\n"
|
||||||
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
|
version (cdr (doom-call-process "git" "rev-parse" "--short" "HEAD")))
|
||||||
"(provide 'org-version)\n")))))
|
"(provide 'org-version)\n")))))
|
||||||
:pin "e9c288dfaccc2960e5b6889e6aabea700ad4e05a")
|
:pin "5bdfc02c6fa1b9ad4f075ac1ad1e4086ead310db")
|
||||||
(package! org-contrib
|
(package! org-contrib
|
||||||
:recipe (:host github
|
:recipe (:host github
|
||||||
:repo "emacsmirror/org-contrib")
|
:repo "emacsmirror/org-contrib")
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
;; hooks, but not the body.
|
;; hooks, but not the body.
|
||||||
(add-hook! 'envrc-global-mode-hook
|
(add-hook! 'envrc-global-mode-hook
|
||||||
(defun +direnv-init-global-mode-earlier-h ()
|
(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)
|
(if (not envrc-global-mode)
|
||||||
(remove-hook 'change-major-mode-after-body-hook fn)
|
(remove-hook 'change-major-mode-after-body-hook fn)
|
||||||
(remove-hook 'after-change-major-mode-hook fn)
|
(remove-hook 'after-change-major-mode-hook fn)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue