mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
bump: dirvish
hlissner/dirvish@5f046190e8 -> alexluigit/dirvish@f449754dd5 As of alexluigit/dirvish@f449754dd5, all of these hacks are obsolete and can be safely removed (see Refs below). The hack around `:commands dirvish-find-entry-a dirvish-dired-noselect-a` is kept as it is because I don't understand why that is necessary. The latest upstream also includes fixes for #8170 and #8081 (respect `dired-kill-when-opening-new-dired-buffer` option). Ref: alexluigit/dirvish@3145513cb5 Ref: alexluigit/dirvish@24e612c39d Ref: alexluigit/dirvish@15e2cd1925 Ref: alexluigit/dirvish@3bdb7f23b9 Ref: alexluigit/dirvish@1b905092f6 Ref: alexluigit/dirvish@d775e38b53 Ref: alexluigit/dirvish@f986123a4d Ref: alexluigit/dirvish@0cd07f5f09 Fix: #8170 Fix: #8081
This commit is contained in:
@ -31,20 +31,21 @@ sidebars)."
|
||||
(setq win nil))
|
||||
(unless win
|
||||
(call-interactively #'dirvish-side))
|
||||
(when-let* (((not dirvish--this))
|
||||
(dir (or (dirvish--get-project-root) default-directory))
|
||||
(when-let* (((not (dirvish-curr)))
|
||||
((not (active-minibuffer-window)))
|
||||
(win (dirvish-side--session-visible-p))
|
||||
(dv (with-selected-window win (dirvish-curr)))
|
||||
((not (active-minibuffer-window)))
|
||||
(file buffer-file-name))
|
||||
(dir (or (dirvish--get-project-root) default-directory))
|
||||
(prev (with-selected-window win (dirvish-prop :index)))
|
||||
(curr buffer-file-name)
|
||||
((not (string-suffix-p "COMMIT_EDITMSG" curr)))
|
||||
((not (equal prev curr))))
|
||||
(with-selected-window win
|
||||
(when dir
|
||||
(setq dirvish--this dv)
|
||||
(let (buffer-list-update-hook) (dirvish-find-entry-a dir))
|
||||
(if dirvish-side-auto-expand (dirvish-subtree-expand-to file)
|
||||
(dired-goto-file file))
|
||||
(dired-goto-file curr))
|
||||
(dirvish-prop :cus-header 'dirvish-side-header)
|
||||
(dirvish--setup-mode-line (car (dv-layout dv)))
|
||||
(dirvish-update-body-h))
|
||||
(setq dirvish--this nil)))))
|
||||
(dirvish-update-body-h))))))
|
||||
(select-window (dirvish-side--session-visible-p)))
|
||||
|
@ -81,12 +81,13 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||
(dirvish-override-dired-mode)
|
||||
(set-popup-rule! "^ ?\\*Dirvish.*" :ignore t)
|
||||
|
||||
;; Don't recycle sessions. We don't want leftover buffers lying around,
|
||||
;; especially if users are reconfiguring Dirvish or trying to recover from an
|
||||
;; error. It's too easy to accidentally break Dirvish (e.g. by focusing the
|
||||
;; header window) at the moment, or get stuck in a focus loop with the buried
|
||||
;; buffers. Starting from scratch isn't even that expensive, anyway.
|
||||
(setq dirvish-reuse-session nil)
|
||||
;; Fixes #8038. This setting is for folks who expect to be able to switch back
|
||||
;; to dired buffers where the file is opened from. In other cases, don't
|
||||
;; recycle sessions. We don't want leftover buffers lying around, especially
|
||||
;; if users are reconfiguring Dirvish or trying to recover from an error. It's
|
||||
;; too easy to accidentally break Dirvish (e.g. by focusing the header window)
|
||||
;; at the moment. Starting from scratch isn't even that expensive, anyway.
|
||||
(setq dirvish-reuse-session 'open)
|
||||
|
||||
(if (modulep! +dirvish)
|
||||
(setq dirvish-attributes '(file-size)
|
||||
@ -106,14 +107,6 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||
dirvish-header-line-height height)))))
|
||||
|
||||
(when (modulep! :ui vc-gutter)
|
||||
;; HACK: Dirvish sets up the fringes for vc-state late in the startup
|
||||
;; process, causing this jarring pop-in effect. This advice sets them up
|
||||
;; sooner to avoid this.
|
||||
;; REVIEW: Upstream this later.
|
||||
(defadvice! +dired--init-fringes-a (_dir _buffer setup)
|
||||
:before #'dirvish-data-for-dir
|
||||
(when (and setup (memq 'vc-state dirvish-attributes))
|
||||
(set-window-fringes nil 5 1)))
|
||||
;; The vc-gutter module uses `diff-hl-dired-mode' + `diff-hl-margin-mode'
|
||||
;; for diffs in dirvish buffers. `vc-state' uses overlays, so they won't be
|
||||
;; visible in the terminal.
|
||||
@ -124,39 +117,8 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||
(setq dirvish-subtree-always-show-state t)
|
||||
(appendq! dirvish-attributes '(nerd-icons subtree-state)))
|
||||
|
||||
;; HACK: Fixes #8038. Because `dirvish-reuse-session' is unset above, when
|
||||
;; walking a directory tree, previous dired buffers are killed along the
|
||||
;; way, which is jarring for folks who expect to be able to switch back to
|
||||
;; those buffers before their dired session ends. As long as we retain
|
||||
;; those, Dirvish will still clean them up on `dirvish-quit'.
|
||||
(defadvice! +dired--retain-buffers-on-dirvish-find-entry-a (fn &rest args)
|
||||
:around #'dirvish-find-entry-a
|
||||
(let ((dirvish-reuse-session t))
|
||||
(apply fn args)))
|
||||
|
||||
;; HACK: Makes `dirvish-hide-details' and `dirvish-hide-cursor' accept a list
|
||||
;; of symbols to instruct Dirvish in what contexts they should be enabled.
|
||||
;; The accepted values are:
|
||||
;; - `dired': when opening a directory directly or w/o Dirvish's full UI.
|
||||
;; - `dirvish': when opening full-frame Dirvish.
|
||||
;; - `dirvish-side': when opening Dirvish in the sidebar.
|
||||
;; REVIEW: Upstream this behavior later.
|
||||
(setq dirvish-hide-details '(dirvish dirvish-side)
|
||||
dirvish-hide-cursor '(dirvish dirvish-side))
|
||||
(defadvice! +dired--hide-details-maybe-a (fn &rest args)
|
||||
:around #'dirvish-init-dired-buffer
|
||||
(letf! (defun enabled? (val)
|
||||
(if (listp val)
|
||||
(cond ((if dirvish--this (memq 'side (dv-type dirvish--this)))
|
||||
(memq 'dirvish-side val))
|
||||
((or (null dirvish--this)
|
||||
(null (car (dv-layout dirvish--this))))
|
||||
(memq 'dired val))
|
||||
((memq 'dirvish val)))
|
||||
val))
|
||||
(let ((dirvish-hide-details (enabled? dirvish-hide-details)))
|
||||
(setq-local dirvish-hide-cursor (and (enabled? dirvish-hide-cursor) t))
|
||||
(apply fn args))))
|
||||
|
||||
(when (modulep! :ui tabs)
|
||||
(after! centaur-tabs
|
||||
@ -201,20 +163,6 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||
:n "S" #'dirvish-relative-symlink
|
||||
:n "h" #'dirvish-hardlink))
|
||||
|
||||
;; HACK: Modifies Dirvish to fall back to default `mode-line-format' if
|
||||
;; `dirvish-use-mode-line' is nil, instead of when
|
||||
;; `dirvish-mode-line-format' is nil (since the latter *still* prepends to
|
||||
;; the default `mode-line-format'), and is overall less intuitive.
|
||||
;; REVIEW: Upstream this behavior later.
|
||||
(defadvice! +dired--dirvish-use-modeline-a (fn &rest args)
|
||||
"Change how `dirvish-use-mode-line' and `dirvish-mode-line-format' operate."
|
||||
:around #'dirvish--setup-mode-line
|
||||
(when dirvish-use-mode-line
|
||||
(let ((dirvish--mode-line-fmt
|
||||
(if dirvish-mode-line-format
|
||||
dirvish--mode-line-fmt)))
|
||||
(apply fn args))))
|
||||
|
||||
;; HACK: Kill Dirvish session before switching projects/workspaces, otherwise
|
||||
;; it errors out on trying to delete/change dedicated windows.
|
||||
(add-hook! '(persp-before-kill-functions
|
||||
@ -222,41 +170,12 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||
projectile-before-switch-project-hook)
|
||||
(defun +dired--cleanup-dirvish-h (&rest _)
|
||||
(when-let ((dv (cl-loop for w in (window-list)
|
||||
if (or (window-parameter w 'window-side)
|
||||
(window-dedicated-p w))
|
||||
if (window-dedicated-p w)
|
||||
if (with-current-buffer (window-buffer w) (dirvish-curr))
|
||||
return it)))
|
||||
(let (dirvish-reuse-session)
|
||||
(with-selected-window (dv-root-window dv)
|
||||
(dirvish-quit))))))
|
||||
|
||||
;; HACK: If a directory has a .dir-locals.el, its settings could
|
||||
;; interfere/crash Dirvish trying to preview it.
|
||||
;; REVIEW: Upstream this later.
|
||||
(defadvice! +dired--ignore-local-vars-for-dir-previews-a (fn &rest args)
|
||||
:around #'dirvish-default-dp
|
||||
(let ((result (apply fn args)))
|
||||
(if (and (file-directory-p (car args))
|
||||
(eq (car-safe result) 'dired))
|
||||
`(dired . (,@(butlast (cdr result))
|
||||
,(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))))))
|
||||
result)))
|
||||
|
||||
;; 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
|
||||
;; before complaining, otherwise complain if epdfinfo hasn't been built yet.
|
||||
;; REVIEW: Upstream this later.
|
||||
(defadvice! +dired--autoload-pdf-tools-a (fn &rest args)
|
||||
:around #'dirvish-pdf-dp
|
||||
(when (equal (nth 1 args) "pdf")
|
||||
(if (and (require 'pdf-tools nil t)
|
||||
(file-exists-p pdf-info-epdfinfo-program))
|
||||
(apply fn args)
|
||||
'(info . "`epdfinfo' program required to preview pdfs; run `M-x pdf-tools-install'")))))
|
||||
(dirvish-quit)))))))
|
||||
|
||||
|
||||
(use-package! diredfl
|
||||
|
@ -2,6 +2,6 @@
|
||||
;;; emacs/dired/packages.el
|
||||
|
||||
(package! dirvish
|
||||
:recipe (:host github :repo "hlissner/dirvish")
|
||||
:pin "5f046190e886fb0a2dae7e884cc7cd9bcf48ac26")
|
||||
:recipe (:host github :repo "alexluigit/dirvish")
|
||||
:pin "f449754dd591524f2be8fe58f8ab7f0298dbe11b")
|
||||
(package! diredfl :pin "fe72d2e42ee18bf6228bba9d7086de4098f18a70")
|
||||
|
Reference in New Issue
Block a user