refactor(dired): dirvish-hide-cursor

Give the same treatment I give dirvish-hide-details to
dirvish-hide-cursor (see ddfb0cc).

Ref: ddfb0cc3cc
Ref: #6760
This commit is contained in:
Henrik Lissner 2024-08-22 11:59:45 -04:00
parent 1b336d0549
commit 1e73754dad
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -105,27 +105,29 @@ Fixes #3939: unsortable dired entries on Windows."
(setq dirvish-subtree-always-show-state t) (setq dirvish-subtree-always-show-state t)
(appendq! dirvish-attributes '(nerd-icons subtree-state))) (appendq! dirvish-attributes '(nerd-icons subtree-state)))
;; HACK: Makes `dirvish-hide-details' accept a list of symbols to instruct ;; HACK: Makes `dirvish-hide-details' and `dirvish-hide-cursor' accept a list
;; Dirvish in what contexts `dirvish-hide-details' should be enabled. The ;; of symbols to instruct Dirvish in what contexts they should be enabled.
;; accepted values are: ;; The accepted values are:
;; - `dired': when opening a directory directly or w/o Dirvish's full UI. ;; - `dired': when opening a directory directly or w/o Dirvish's full UI.
;; - `dirvish': when opening full-frame Dirvish. ;; - `dirvish': when opening full-frame Dirvish.
;; - `dirvish-side': when opening Dirvish in the sidebar. ;; - `dirvish-side': when opening Dirvish in the sidebar.
;; REVIEW: Upstream this behavior later. (Maybe with similar treatment for ;; REVIEW: Upstream this behavior later.
;; `dirvish-hide-cursor'?) (setq dirvish-hide-details '(dirvish dirvish-side)
(setq dirvish-hide-details '(dirvish dirvish-side)) dirvish-hide-cursor '(dirvish dirvish-side))
(defadvice! +dired--hide-details-maybe-a (fn &rest args) (defadvice! +dired--hide-details-maybe-a (fn &rest args)
:around #'dirvish-init-dired-buffer :around #'dirvish-init-dired-buffer
(let ((dirvish-hide-details (letf! (defun enabled? (val)
(if (listp dirvish-hide-details) (if (listp val)
(cond ((if dirvish--this (memq 'side (dv-type dirvish--this))) (cond ((if dirvish--this (memq 'side (dv-type dirvish--this)))
(memq 'dirvish-side dirvish-hide-details)) (memq 'dirvish-side val))
((or (null dirvish--this) ((or (null dirvish--this)
(null (car (dv-layout dirvish--this)))) (null (car (dv-layout dirvish--this))))
(memq 'dired dirvish-hide-details)) (memq 'dired val))
((memq 'dirvish dirvish-hide-details))) ((memq 'dirvish val)))
dirvish-hide-details))) val))
(apply fn args))) (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) (when (modulep! :ui tabs)
(after! centaur-tabs (after! centaur-tabs