dev: merge branch 'master' of

This commit is contained in:
Matt Nish-Lapidus 2024-08-21 09:37:15 -04:00
commit ba6a99df4d
11 changed files with 91 additions and 25 deletions

View file

@ -56,7 +56,7 @@ TAB/S-TAB.")
(corfu-mode +1)))) (corfu-mode +1))))
:config :config
(setq corfu-auto t (setq corfu-auto t
corfu-auto-delay 0.18 corfu-auto-delay 0.24
corfu-auto-prefix 2 corfu-auto-prefix 2
global-corfu-modes '((not erc-mode global-corfu-modes '((not erc-mode
circe-mode circe-mode

View file

@ -116,6 +116,7 @@ variable for an explanation of the defaults (in comments). See
(csv "csv-mode") (csv "csv-mode")
(custom cus-edit) (custom cus-edit)
cus-theme cus-theme
dape
dashboard dashboard
daemons daemons
deadgrep deadgrep
@ -175,6 +176,7 @@ variable for an explanation of the defaults (in comments). See
helpful helpful
hg-histedit hg-histedit
hungry-delete hungry-delete
hyrolo
ibuffer ibuffer
(image image-mode) (image image-mode)
image-dired image-dired

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; editor/evil/packages.el ;;; editor/evil/packages.el
(package! evil :pin "30ebe6df27c36fdf2ea3c82a916edec31acc2647") (package! evil :pin "5db0bdc7dcd9300b983526d37cbe480f35e36211")
(package! evil-args :pin "a8151556f63c9d45d0c44c8a7ef9e5a542f3cdc7") (package! evil-args :pin "a8151556f63c9d45d0c44c8a7ef9e5a542f3cdc7")
(package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9") (package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9")
(package! evil-embrace :pin "3081d37811b6a3dfaaf01d578c7ab7a746c6064d") (package! evil-embrace :pin "3081d37811b6a3dfaaf01d578c7ab7a746c6064d")
@ -35,4 +35,4 @@
(package! neotree) (package! neotree)
(autoload 'neotree-make-executor "neotree" nil nil 'macro)) (autoload 'neotree-make-executor "neotree" nil nil 'macro))
(package! evil-collection :pin "e49d8e96ccc83d2bf7583c124582fc1ef076b15c")) (package! evil-collection :pin "772571fc6762b6cd1d35cc869e266de9a5c6022b"))

View file

@ -68,14 +68,21 @@
(defalias '+format/buffer #'apheleia-format-buffer) (defalias '+format/buffer #'apheleia-format-buffer)
;;;###autoload ;;;###autoload
(defun +format/region (beg end &optional _arg) (defun +format/region (beg end &optional _arg interactive)
"Format the selected region. "Format the selected region.
WARNING: if the formatter doesn't support partial formatting, this command tries WARNING: if the formatter doesn't support partial formatting, this command tries
to pretend the active selection is the contents of a standalone file, but this to pretend the active selection is the contents of a standalone file, but this
may not always work. Keep your undo keybind handy!" may not always work. Keep your undo keybind handy!"
(interactive "rP") (interactive (list (doom-region-beginning)
(+format-region beg end)) (doom-region-end)
current-prefix-arg
'interactive))
(+format-region
beg end
(lambda ()
(when interactive
(message "Region reformatted!")))))
;;;###autoload ;;;###autoload
(defun +format/region-or-buffer () (defun +format/region-or-buffer ()

View file

@ -102,5 +102,9 @@ This is controlled by `+format-on-save-disabled-modes'."
".prettierrc.toml") ".prettierrc.toml")
if (locate-dominating-file default-directory file) if (locate-dominating-file default-directory file)
return t) return t)
(assq 'prettier (+javascript-npm-conf))) (when-let ((pkg (locate-dominating-file default-directory "package.json")))
(require 'json)
(let ((json-key-type 'alist))
(assq 'prettier
(json-read-file (expand-file-name "package.json" pkg))))))
(apheleia-formatters-indent "--use-tabs" "--tab-width")))))))) (apheleia-formatters-indent "--use-tabs" "--tab-width"))))))))

View file

@ -143,7 +143,6 @@ Fixes #3939: unsortable dired entries on Windows."
:n "F" #'dirvish-layout-toggle :n "F" #'dirvish-layout-toggle
:n "z" #'dirvish-history-jump :n "z" #'dirvish-history-jump
:n "gh" #'dirvish-subtree-up :n "gh" #'dirvish-subtree-up
:n "gl" #'dirvish-subtree-down
:m "[h" #'dirvish-history-go-backward :m "[h" #'dirvish-history-go-backward
:m "]h" #'dirvish-history-go-forward :m "]h" #'dirvish-history-go-forward
:m "[e" #'dirvish-emerge-next-group :m "[e" #'dirvish-emerge-next-group
@ -199,18 +198,13 @@ Fixes #3939: unsortable dired entries on Windows."
(if (and (file-directory-p (car args)) (if (and (file-directory-p (car args))
(eq (car-safe result) 'dired)) (eq (car-safe result) 'dired))
`(dired . (,@(butlast (cdr result)) `(dired . (,@(butlast (cdr result))
,(format "(let ((enable-local-variables nil)) %s)" ,(format "(let %s %s)"
(prin1-to-string
(mapcar (lambda (env) `(,(car env) ,(cdr env)))
(remove '(inhibit-message . t) dirvish-preview-environment)))
(car (last (cdr result)))))) (car (last (cdr result))))))
result))) result)))
;; HACK: Suppress mode hooks when previewing files, as they may contain
;; expensive or disruptive functionality that isn't needed just for
;; previewing them.
;; REVIEW: Upstream this later?
(defadvice! +dired--suppress-hooks-in-previews-a (fn &rest args)
:around #'dirvish--find-file-temporarily
(delay-mode-hooks (apply fn args)))
;; HACK: Dirvish will complain that pdf-tools is required to preview PDFs, ;; HACK: Dirvish will complain that pdf-tools is required to preview PDFs,
;; even if the package is installed, so I advise it to try autoloading it ;; even if the package is installed, so I advise it to try autoloading it
;; before complaining, otherwise complain if epdfinfo hasn't been built yet. ;; before complaining, otherwise complain if epdfinfo hasn't been built yet.
@ -218,8 +212,8 @@ Fixes #3939: unsortable dired entries on Windows."
(defadvice! +dired--autoload-pdf-tools-a (fn &rest args) (defadvice! +dired--autoload-pdf-tools-a (fn &rest args)
:around #'dirvish-pdf-dp :around #'dirvish-pdf-dp
(when (equal (nth 1 args) "pdf") (when (equal (nth 1 args) "pdf")
(require 'pdf-tools nil t) (if (and (require 'pdf-tools nil t)
(if (file-exists-p pdf-info-epdfinfo-program) (file-exists-p pdf-info-epdfinfo-program))
(apply fn args) (apply fn args)
'(info . "`epdfinfo' program required to preview pdfs; run `M-x pdf-tools-install'"))))) '(info . "`epdfinfo' program required to preview pdfs; run `M-x pdf-tools-install'")))))

View file

@ -92,6 +92,10 @@ info in the `header-line-format' is a more visible indicator."
(propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face) (propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face)
date-full date-relative)))) date-full date-relative))))
;; HACK: `delay-mode-hooks' suppresses font-lock-mode in later versions of
;; Emacs, so git-timemachine buffers end up unfontified.
(add-hook 'git-timemachine-mode-hook #'font-lock-mode)
(after! evil (after! evil
;; Rehash evil keybindings so they are recognized ;; Rehash evil keybindings so they are recognized
(add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps)) (add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps))

View file

@ -6,7 +6,7 @@
(package! smerge-mode :built-in t) (package! smerge-mode :built-in t)
(package! browse-at-remote :pin "76aa27dfd469fcae75ed7031bb73830831aaccbf") (package! browse-at-remote :pin "76aa27dfd469fcae75ed7031bb73830831aaccbf")
(package! git-commit :pin "55656a31cc4fe6c8996c621f4cf14aa4a1bfe47d") (package! git-commit :pin "2da34f1317c619ec2dfb9e0d969449261ca7f31f")
(package! git-timemachine (package! git-timemachine
;; The original lives on codeberg.org; which has uptime issues. ;; The original lives on codeberg.org; which has uptime issues.
:recipe (:host github :repo "emacsmirror/git-timemachine") :recipe (:host github :repo "emacsmirror/git-timemachine")

View file

@ -10,7 +10,7 @@
(when (modulep! :completion vertico) (when (modulep! :completion vertico)
(package! citar :pin "07d2a63c99fe35cbd468f8e6a322de05f1a29469") (package! citar :pin "07d2a63c99fe35cbd468f8e6a322de05f1a29469")
(package! citar-embark :pin "07d2a63c99fe35cbd468f8e6a322de05f1a29469") (package! citar-embark :pin "07d2a63c99fe35cbd468f8e6a322de05f1a29469")
(when (modulep! :lang org +roam) (when (modulep! :lang org +roam2)
(package! citar-org-roam :pin "82d47b5df1926627f56a09055c69b49b31cbbb9f"))) (package! citar-org-roam :pin "82d47b5df1926627f56a09055c69b49b31cbbb9f")))
(package! parsebib :pin "ace9df707108b17759c004c7387655277122d4c1") (package! parsebib :pin "ace9df707108b17759c004c7387655277122d4c1")

View file

@ -1,9 +1,12 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; tools/magit/packages.el ;;; tools/magit/packages.el
(package! magit :pin "cf94190410ef163fd102cdbcb67f28599d31eabc") ;; NOTE: Always bump this to HEAD~1, not HEAD, because the latest commit on
;; magit's melpa branch is auto-generated and moved to HEAD every time there's
;; a commit to its main branch.
(package! magit :pin "2da34f1317c619ec2dfb9e0d969449261ca7f31f")
(when (modulep! +forge) (when (modulep! +forge)
(package! forge :pin "a56eb3cbb27c61387d35cbff6b036a2c1bc1559d") (package! forge :pin "1e7ee99c7f76034e40210a6fd6007015b1998f6d")
(package! code-review (package! code-review
:recipe (:host github :recipe (:host github
:repo "doomelpa/code-review" :repo "doomelpa/code-review"

View file

@ -77,13 +77,13 @@ Respects `diff-hl-disable-on-remote'."
:config :config
(set-popup-rule! "^\\*diff-hl" :select nil :size '+popup-shrink-to-fit) (set-popup-rule! "^\\*diff-hl" :select nil :size '+popup-shrink-to-fit)
(setq diff-hl-global-modes '(not image-mode pdf-view-mode))
;; PERF: A slightly faster algorithm for diffing. ;; PERF: A slightly faster algorithm for diffing.
(setq vc-git-diff-switches '("--histogram")) (setq vc-git-diff-switches '("--histogram"))
;; PERF: Slightly more conservative delay before updating the diff ;; PERF: Slightly more conservative delay before updating the diff
(setq diff-hl-flydiff-delay 0.5) ; default: 0.3 (setq diff-hl-flydiff-delay 0.5) ; default: 0.3
;; PERF: don't block Emacs when updating vc gutter ;; PERF: don't block Emacs when updating vc gutter
(setq diff-hl-update-async t) (setq diff-hl-update-async t)
;; UX: get realtime feedback in diffs after staging/unstaging hunks. ;; UX: get realtime feedback in diffs after staging/unstaging hunks.
(setq diff-hl-show-staged-changes nil) (setq diff-hl-show-staged-changes nil)
@ -140,4 +140,56 @@ Respects `diff-hl-disable-on-remote'."
:around #'diff-hl-revert-hunk :around #'diff-hl-revert-hunk
(let ((pt (point))) (let ((pt (point)))
(prog1 (apply fn args) (prog1 (apply fn args)
(goto-char pt))))) (goto-char pt))))
;; FIX: `global-diff-hl-mode' enables `diff-hl-mode' *everywhere*, which calls
;; `diff-hl-update'. If `diff-hl-update-async' is non-nil, this means a new
;; thread is spawned for *every* buffer, whether they're visible or not. Not
;; only can this slow a lot down, but `kill-buffer' will silently refuse to
;; kill buffers with a thread associated with it. Chaos ensues (see #7991
;; and #7954).
;; REVIEW: Report this upstream.
(defun +vc-gutter--kill-thread (&optional block?)
(when-let ((th +vc-gutter--diff-hl-thread))
(when (thread-live-p th)
(thread-signal th 'quit nil)
(when block?
(condition-case _
(thread-join th)
((quit error) nil))))))
(defvar-local +vc-gutter--diff-hl-thread nil)
(defadvice! +vc-gutter--debounce-threads-a (&rest _)
:override #'diff-hl-update
(unless (or inhibit-redisplay
non-essential
delay-mode-hooks
(null (buffer-file-name (buffer-base-buffer)))
(null (get-buffer-window (current-buffer))))
(if (and diff-hl-update-async
(not
(run-hook-with-args-until-success 'diff-hl-async-inhibit-functions
default-directory)))
(progn
(+vc-gutter--kill-thread)
(setq +vc-gutter--diff-hl-thread
(make-thread (lambda ()
(unwind-protect
(diff-hl--update-safe)
(setq +vc-gutter--diff-hl-thread nil)))
"diff-hl--update-safe")))
(diff-hl--update))
t))
(defadvice! +vc-gutter--only-tick-on-success-a (&rest _)
:override #'diff-hl-update-once
(unless (equal diff-hl--modified-tick (buffer-chars-modified-tick))
(when (diff-hl-update)
(setq diff-hl--modified-tick (buffer-chars-modified-tick)))))
;; HACK: This advice won't work in *all* cases (it's a C function, and any
;; calls to it from C won't trigger advice), but the thread issues above are
;; triggered from Elisp's buffer API (from what I can tell).
(defadvice! +vc-gutter--kill-diff-hl-thread-a (buf)
:before #'kill-buffer
(with-current-buffer buf (+vc-gutter--kill-thread t))))