dev: merge branch 'master'
This commit is contained in:
commit
0e36272203
2 changed files with 53 additions and 22 deletions
|
@ -382,6 +382,13 @@ users).")
|
||||||
(set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist)
|
(set-default-toplevel-value 'file-name-handler-alist file-name-handler-alist)
|
||||||
;; Remember it so it can be reset where needed.
|
;; Remember it so it can be reset where needed.
|
||||||
(put 'file-name-handler-alist 'initial-value old-value)
|
(put 'file-name-handler-alist 'initial-value old-value)
|
||||||
|
;; COMPAT: Eventually, Emacs will process any files passed to it via the
|
||||||
|
;; command line, and will do so *really* early in the startup process.
|
||||||
|
;; These might contain special file paths like TRAMP paths, so restore
|
||||||
|
;; `file-name-handler-alist' just for this portion of startup.
|
||||||
|
(define-advice command-line-1 (:around (fn args-left) respect-file-handlers)
|
||||||
|
(let ((file-name-handler-alist (if args-left old-value file-name-handler-alist)))
|
||||||
|
(funcall fn args-left)))
|
||||||
;; COMPAT: ...but restore `file-name-handler-alist' later, because it is
|
;; COMPAT: ...but restore `file-name-handler-alist' later, because it is
|
||||||
;; needed for handling encrypted or compressed files, among other things.
|
;; needed for handling encrypted or compressed files, among other things.
|
||||||
(add-hook! 'emacs-startup-hook :depth 101
|
(add-hook! 'emacs-startup-hook :depth 101
|
||||||
|
|
|
@ -81,40 +81,51 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||||
;; buffers. Starting from scratch isn't even that expensive, anyway.
|
;; buffers. Starting from scratch isn't even that expensive, anyway.
|
||||||
(setq dirvish-reuse-session nil)
|
(setq dirvish-reuse-session nil)
|
||||||
|
|
||||||
;; A more reserved mode-line height that should match doom-modeline's (or the
|
|
||||||
;; vanilla mode-line's) height.
|
|
||||||
(add-hook! 'after-setting-font-hook
|
|
||||||
(defun +dired-update-mode-line-heigth-h ()
|
|
||||||
;; REVIEW: Too hardcoded.
|
|
||||||
(setq dirvish-mode-line-height (+ (frame-char-height) 4)
|
|
||||||
dirvish-header-line-height (+ (frame-char-height) 8))))
|
|
||||||
(+dired-update-mode-line-heigth-h)
|
|
||||||
|
|
||||||
(if (modulep! +dirvish)
|
(if (modulep! +dirvish)
|
||||||
(setq dirvish-attributes '(file-size)
|
(setq dirvish-attributes '(file-size)
|
||||||
dirvish-mode-line-format
|
dirvish-mode-line-format
|
||||||
'(:left (sort file-time symlink) :right (omit yank index)))
|
'(:left (sort file-time symlink) :right (omit yank index)))
|
||||||
(setq dirvish-attributes nil
|
(setq dirvish-attributes nil
|
||||||
dirvish-use-header-line nil
|
dirvish-use-header-line nil
|
||||||
dirvish-mode-line-format nil))
|
dirvish-use-mode-line nil))
|
||||||
|
|
||||||
|
;; Match the height of `doom-modeline', if it's being used.
|
||||||
|
;; TODO: Make this respect user changes to these variables.
|
||||||
|
(when (modulep! :ui modeline)
|
||||||
|
(add-hook! 'dired-mode-hook
|
||||||
|
(defun +dired-update-mode-line-height-h ()
|
||||||
|
(when-let (height (bound-and-true-p doom-modeline-height))
|
||||||
|
(setq dirvish-mode-line-height height
|
||||||
|
dirvish-header-line-height height)))))
|
||||||
|
|
||||||
(when (modulep! :ui vc-gutter)
|
(when (modulep! :ui vc-gutter)
|
||||||
(push 'vc-state dirvish-attributes))
|
(push 'vc-state dirvish-attributes))
|
||||||
|
|
||||||
(when (modulep! +icons)
|
(when (modulep! +icons)
|
||||||
(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: Doom will treat an integer value for `dirvish-hide-details' to mean
|
;; HACK: Makes `dirvish-hide-details' accept a list of symbols to instruct
|
||||||
;; hide file/dir details if window is less than N characters wide (e.g. for
|
;; Dirvish in what contexts `dirvish-hide-details' should be enabled. The
|
||||||
;; side windows or small full-window layouts).
|
;; accepted values are:
|
||||||
(setq dirvish-hide-details 50)
|
;; - `dired': when opening a directory directly or w/o Dirvish's full UI.
|
||||||
;; TODO: Proc this hook sooner. The delay on `dirvish-setup-hook' is jarring.
|
;; - `dirvish': when opening full-frame Dirvish.
|
||||||
(add-hook! 'dirvish-setup-hook
|
;; - `dirvish-side': when opening Dirvish in the sidebar.
|
||||||
(defun +dired-hide-details-in-side-mode-h ()
|
;; REVIEW: Upstream this behavior later. (Maybe with similar treatment for
|
||||||
(when (integerp dirvish-hide-details)
|
;; `dirvish-hide-cursor'?)
|
||||||
(dired-hide-details-mode
|
(setq dirvish-hide-details '(dirvish dirvish-side))
|
||||||
(if (< (window-width dirvish--selected-window) dirvish-hide-details)
|
(defadvice! +dired--hide-details-maybe-a (fn &rest args)
|
||||||
+1 -1)))))
|
:around #'dirvish-init-dired-buffer
|
||||||
|
(let ((dirvish-hide-details
|
||||||
|
(if (listp dirvish-hide-details)
|
||||||
|
(cond ((if dirvish--this (memq 'side (dv-type dirvish--this)))
|
||||||
|
(memq 'dirvish-side dirvish-hide-details))
|
||||||
|
((or (null dirvish--this)
|
||||||
|
(null (car (dv-layout dirvish--this))))
|
||||||
|
(memq 'dired dirvish-hide-details))
|
||||||
|
((memq 'dirvish dirvish-hide-details)))
|
||||||
|
dirvish-hide-details)))
|
||||||
|
(apply fn args)))
|
||||||
|
|
||||||
(when (modulep! :ui tabs)
|
(when (modulep! :ui tabs)
|
||||||
(after! centaur-tabs
|
(after! centaur-tabs
|
||||||
|
@ -155,6 +166,20 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||||
:n "S" #'dirvish-relative-symlink
|
:n "S" #'dirvish-relative-symlink
|
||||||
:n "h" #'dirvish-hardlink))
|
: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
|
;; HACK: Kill Dirvish session before switching projects/workspaces, otherwise
|
||||||
;; it errors out on trying to delete/change dedicated windows.
|
;; it errors out on trying to delete/change dedicated windows.
|
||||||
(add-hook! '(persp-before-kill-functions projectile-before-switch-project-hook)
|
(add-hook! '(persp-before-kill-functions projectile-before-switch-project-hook)
|
||||||
|
@ -165,7 +190,6 @@ Fixes #3939: unsortable dired entries on Windows."
|
||||||
(and dirvish--this (selected-window)))))
|
(and dirvish--this (selected-window)))))
|
||||||
(delete-window win))))
|
(delete-window win))))
|
||||||
|
|
||||||
|
|
||||||
;; HACK: If a directory has a .dir-locals.el, its settings could
|
;; HACK: If a directory has a .dir-locals.el, its settings could
|
||||||
;; interfere/crash Dirvish trying to preview it.
|
;; interfere/crash Dirvish trying to preview it.
|
||||||
;; REVIEW: Upstream this later.
|
;; REVIEW: Upstream this later.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue