From d0aa346425627ce21f5abd95da6851bc325d6dca Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 1 Oct 2022 14:12:50 +0800 Subject: [PATCH] feat!(dired): use dirvish by default BREAKING CHANGE: Deprecate `+ranger` flag, use package dirvish by default and rewrite the module based on it. Doing so we can remove these packages and their associated hacks: `all-the-icons-dired`, `dired-rsync`, `fd-dired`, `dired-git-info`, `ranger`. See file log below for details. purcell/diredfl@f9140b2c4215 -> purcell/diredfl@62b559e1d6b6 alexluigit/dirvish@73dcaa404da9 -> alexluigit/dirvish@11a3bec247b9 * modules/ui/vc-gutter/config.el(dired-mode-hook, diff-hl-dired-mode): when dired module is enabled, use `vc-state` from dirvish to render the vc gutter instead of diff-hl-dired-mode, doing so we get better performance and integration with the dired module. * modules/emacs/dired/autoload.el: delete this file since the commands in it are no longer used. * modules/emacs/dired/doctor.el: add deprecate warning for `+ranger` flag * modules/emacs/dired/README.org: rewrite based on the new features * modules/emacs/dired/config.el: - (dirvish-mode-line-format, dired-hide-details-hide-symlink-targets): set `dired-hide-details-hide-symlink-targets` to t, show symlink target on mode-line instead - (dired-listing-switches, +dired-disable-gnu-ls-flags-maybe-h): dirvish has inbuilt gnuls check, so the setup for `dired-listing-switches` can be simplified as such and the `+dired-disable-gnu-ls-flags-maybe-h` can be safely removed. - (+dired/quit-all): dirvish has a fine-tuned machinery for closing dired buffers, so replace this command with `dirvish-quit`. One can set `dirvish-reuse-session` to nil to get similar behavior to `+dired/quit-all`. - (dired-rsync): replace `dired-rsync` with `dirvish-rsync` - (+ranger): deprecate this flag. - (dirvish-attributes, all-the-icons-dired): remove package `all-the-icons-dired`, use `all-the-icons` attribute in dirvish to implement the `+icons` flag. - (fd-dired): use the better alternative dirvish-fd to replace this command/package. - (dirvish-attributes, dired-git-info-mode): use `git-msg` attribute from dirvish to replace dired-git-info-mode. - (dirvish-attributes): add `collapse` attribute for `+dirvish` flag - (dirvish-attributes): add `subtree-state` attribute for `+icons` flag - (dirvish-mode-map): introduce a few new keybindings such as `dirvish-subtree-toggle` - (dirvish-attributes, dirvish-use-header-line, dirvish-mode-line-format, dirvish-hide-cursor, dirvish-hide-details): support classic dired UI when +dirvish is not enabled. Fix: #6562 Replace: #6568 Ref: https://github.com/alexluigit/dirvish/blob/a877ba816f907daea2d86bd10754bec6484e753a/dirvish-extras.el#L172-L190 Ref: alexluigit/dirvish#34 Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#find-dired--fd-dired Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#all-the-icons-dired Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#dired-git-info--diff-hl--dired-k Ref: https://github.com/alexluigit/dirvish/blob/main/docs/COMPARISON.org#dired-rsync --- modules/emacs/dired/README.org | 181 +++++++++++++++++++++--- modules/emacs/dired/autoload.el | 15 -- modules/emacs/dired/config.el | 240 +++++++++----------------------- modules/emacs/dired/doctor.el | 3 + modules/emacs/dired/packages.el | 13 +- modules/ui/vc-gutter/config.el | 3 +- 6 files changed, 240 insertions(+), 215 deletions(-) delete mode 100644 modules/emacs/dired/autoload.el diff --git a/modules/emacs/dired/README.org b/modules/emacs/dired/README.org index 7a324d97939..6cfde042133 100644 --- a/modules/emacs/dired/README.org +++ b/modules/emacs/dired/README.org @@ -4,24 +4,45 @@ #+since: 2.0.0 * Description :unfold: -This module provides reasonable defaults and augmentations for dired. +This module provides reasonable defaults and augmentations for [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired]], the +inbuilt file manager for Emacs. The extra features are mostly introduced by the +Dired enhancement package [[https://github.com/alexluigit/dirvish][Dirvish]]. ** Maintainers -/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]] +- [[doom-user:][@alexluigit]] + +[[doom-contrib-maintainer:][Become a maintainer?]] ** Module flags - +icons :: Enables the display of fancy icons depending on file types in dired buffers. -- +ranger :: - Enables dired to be more like [[https://github.com/ranger/ranger][ranger]]. +- +dirvish :: + Apply some stylistic defaults to the Dired buffer. + + Show file size at right fringe + + Collapse directories with only one entry in it automatically. + + Use prettified header line and mode line + + Hide file details information by default + + Enable line highlighting, hide the cursor ** Packages +<<<<<<< HEAD - [[doom-package:all-the-icons-dired]] if [[doom-module:+icons]] - [[doom-package:diff-hl]] - [[doom-package:diredfl]] - [[doom-package:dired-rsync]] - [[doom-package:fd-dired]] - [[doom-package:ranger]] if [[doom-module:+ranger]] +||||||| parent of 720ddadec (feat!(dired): use dirvish by default) +- [[doom-package:][all-the-icons-dired]] if [[doom-module:][+icons]] +- [[doom-package:][diff-hl]] +- [[doom-package:][diredfl]] +- [[doom-package:][dired-rsync]] +- [[doom-package:][fd-dired]] +- [[doom-package:][ranger]] if [[doom-module:][+ranger]] +======= +- [[doom-package:][dirvish]] +- [[doom-package:][diredfl]] +>>>>>>> 720ddadec (feat!(dired): use dirvish by default) ** TODO Hacks #+begin_quote @@ -38,35 +59,161 @@ This module provides reasonable defaults and augmentations for dired. This module has no requirements *except on BSDs* like MacOS or FreeBSD, where =GNU ls= (aka ~gls~) is required. -* TODO Usage -#+begin_quote - 🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]] -#+end_quote +Optionally, install these dependencies to improve the preview experience: +<<<<<<< HEAD | Keybind | Description | |---------+----------------------------| | [[kbd:][SPC f d]] | Find directory with dired | | [[kbd:][q]] | Exit dired buffer | | [[kbd:][C-c C-r]] | Run [[doom-package:dired-rsync]] | | [[kbd:][C-c C-e]] | Rename entries with [[doom-package:wdired]] | - -Other keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired reference card]]. - +||||||| parent of 720ddadec (feat!(dired): use dirvish by default) +| Keybind | Description | +|---------+----------------------------| +| [[kbd:][SPC f d]] | Find directory with dired | +| [[kbd:][q]] | Exit dired buffer | +| [[kbd:][C-c C-r]] | Run [[doom-package:][dired-rsync]] | +| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] | +======= ++ =imagemagick= for image preview ++ =poppler= | =pdf-tools= for pdf preview ++ =ffmpegthumbnailer= for video preview ++ =mediainfo= for audio/video metadata generation ++ =tar= and =unzip= for archive files preview +>>>>>>> 720ddadec (feat!(dired): use dirvish by default) + +** macOS +#+begin_src bash + brew install coreutils fd poppler ffmpegthumbnailer mediainfo imagemagick +#+end_src + +<<<<<<< HEAD ** Ranger If [[doom-module:+ranger]] is enabled often a buffer will be opened in minimal ranger mode (~deer-mode~). In this case [[kbd:][z P]] can be used to toggle between full ranger and ~deer-mode~. - -* TODO Configuration -#+begin_quote - 🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]] -#+end_quote +||||||| parent of 720ddadec (feat!(dired): use dirvish by default) +** Ranger +If [[doom-module:][+ranger]] is enabled often a buffer will be opened in minimal ranger mode +(~deer-mode~). In this case [[kbd:][z P]] can be used to toggle between full ranger and +~deer-mode~. +======= +** Debian-based +#+begin_src bash + apt install fd-find poppler-utils ffmpegthumbnailer mediainfo imagemagick tar unzip +#+end_src +>>>>>>> 720ddadec (feat!(dired): use dirvish by default) + +** Arch-based +#+begin_src bash + pacman -S fd poppler ffmpegthumbnailer mediainfo imagemagick tar unzip +#+end_src + +** FreeBSD +#+begin_src bash + pkg install gnuls fd-find poppler ffmpegthumbnailer ImageMagick7 gtar +#+end_src + +** Windows (not tested, may not work) +#+begin_src bash + # install via Scoop: https://scoop.sh/ + scoop install coreutils fd poppler imagemagick unzip +#+end_src + +* Usage +** Global bindings +You can access Dired/Dirvish by opening a directory entry in commands like +~find-file (SPC f f)~. Or you can create a Dired buffer directly with these +keybindings. + +| Keybind | Description | +|------------------------------+------------------------------------| +| [[kbd:][SPC f d]] | Find directory with dired | +| [[kbd:][SPC o -]] | Jump to current directory in dired | + +These commands are available but not bound to any keys. + +| Command | Description | +|------------------+--------------------------------| +| [[kbd:][M-x dirvish]] | Open dired with preview | +| [[kbd:][M-x dirvish-dwim]] | Dirvish with smart layout | +| [[kbd:][M-x dirvish-fd]] | Search files in dired using fd | +| [[kbd:][M-x dirvish-side]] | Open project sidebar | + +** Dired bindings +*** Basics +| Keybind | Description | +|----------+-------------------------------------------| +| [[kbd:][n]] | Move down a line | +| [[kbd:][p]] | Move up a line | +| [[kbd:][e]] or [[kbd][RET]] | Visit the file or directory on this line | +| [[kbd:][(]] | Toggle visibility of detailed information | +| [[kbd:][q]] | Exit dired buffer | +| [[kbd:][^]] | Go Up a directory | +| [[kbd:][m]] | Mark a file | +| [[kbd:][u]] | Unmark a file | +| [[kbd:][D]] | Delete a file | +| [[kbd:][+]] | Create a directory | +| ... | ... | + +This is only a very small sample of dired keybindings, just for you to get a +sense of Dired. Other basic keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired +reference card]]. If you have enabled ~(evil +everywhere)~, you would get a +different set of bindings ([[kbd][j/k]] for move down/up a line), consult =evil-collection= +for the actual bindings. + +*** Extras +You don't have to memorize all of Dired bindings because this module provided a +lot of easy-to-read menus such as ~dirvish-mark-menu~ (powered by =transient.el=) +for you to find the suitable command in a specific context. All of these +(sub-)menus are included in ~dirvish-dispatch (?)~, the main help menu. Some +extremely useful ones are bound to a separate keys as well. + +| Keybind | Description | +|---------+-----------------------------------------------| +| [[kbd:][?]] | Ask for help | +| [[kbd:][a]] | Quick access frequently used directories | +| [[kbd:][f]] | Get file information under the cursor | +| [[kbd:][y]] | Paste/link/move marked files here | +| [[kbd:][s]] | Sort buffer with different criteria | +| [[kbd:][M-m]] | Commands relate to marking and actions | +| [[kbd:][M-s]] | Setup user interface for dirvish | +| [[kbd:][M-e]] | "Emerge" important files at the top | + +Other bindings in this module: + +| [[kbd:][TAB]] | Expand or contract directory under the cursor | +| [[kbd:][M-f]] | Jump to next dired history entry | +| [[kbd:][M-b]] | Jump to previous dired history entry | +| [[kbd:][M-n]] | Narrow the buffer with user input | +| [[kbd:][M-t]] | Toggle fullscreen (preview) | +| [[kbd:][C-c C-e]] | Rename entries with [[doom-package:][wdired]] | + +* Configuration +** Quick access entries + +Use the following syntax to configure the entries displayed in +~dirvish-quick-access~ command. + +#+begin_src emacs-lisp + ;; in $DOOMDIR/config.el + (setq! dirvish-quick-access-entries + `(("h" "~/" "Home") + ("e" ,user-emacs-directory "Emacs user directory") + ("c" "~/Code/" "Code") + ("d" "~/Downloads/" "Downloads") + ("m" "/mnt/" "Mounted drives") + ("t" "~/.local/share/Trash/files/" "Trash"))) +#+end_src * Troubleshooting /There are no known problems with this module./ [[doom-report:][Report one?]] * Frequently asked questions -/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]] +** How to kill all session buffers on quit? + +Set ~dirvish-reuse-session~ to nil. * TODO Appendix #+begin_quote diff --git a/modules/emacs/dired/autoload.el b/modules/emacs/dired/autoload.el deleted file mode 100644 index e44d3dda0dd..00000000000 --- a/modules/emacs/dired/autoload.el +++ /dev/null @@ -1,15 +0,0 @@ -;;; emacs/dired/autoload.el -*- lexical-binding: t; -*- - -;;;###autoload -(defun +dired/quit-all () - "Kill all `dired-mode' buffers." - (interactive) - (mapc #'kill-buffer (doom-buffers-in-mode 'dired-mode)) - (message "Killed all dired buffers")) - -;;;###autoload -(defun +dired-enable-git-info-h () - "Enable `dired-git-info-mode' in git repos." - (and (not (file-remote-p default-directory)) - (locate-dominating-file "." ".git") - (dired-git-info-mode 1))) diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index 26e5e74e20b..d4cb615606e 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -1,10 +1,9 @@ -;;; tools/dired/config.el -*- lexical-binding: t; -*- +;;; emacs/dired/config.el -*- lexical-binding: t; -*- (use-package! dired :commands dired-jump :init (setq dired-dwim-target t ; suggest a target for moving/copying intelligently - dired-hide-details-hide-symlink-targets nil ;; don't prompt to revert, just do it dired-auto-revert-buffer #'dired-buffer-stale-p ;; Always copy/delete recursively @@ -25,31 +24,28 @@ :slot 20 :size 0.8 :select t :quit nil :ttl 0) (set-evil-initial-state! 'image-dired-display-image-mode 'emacs) - (let ((args (list "-ahl" "-v" "--group-directories-first"))) - (when IS-BSD - ;; Use GNU ls as `gls' from `coreutils' if available. Add `(setq - ;; dired-use-ls-dired nil)' to your config to suppress the Dired warning - ;; when not using GNU ls. - (if-let (gls (executable-find "gls")) - (setq insert-directory-program gls) - ;; BSD ls doesn't support -v or --group-directories-first - (setq args (list (car args))))) - (setq dired-listing-switches (string-join args " ")) - - (add-hook! 'dired-mode-hook - (defun +dired-disable-gnu-ls-flags-maybe-h () - "Remove extraneous switches from `dired-actual-switches' when it's -uncertain that they are supported (e.g. over TRAMP or on Windows). - -Fixes #1703: dired over TRAMP displays a blank screen. -Fixes #3939: unsortable dired entries on Windows." - (when (or (file-remote-p default-directory) - (and (boundp 'ls-lisp-use-insert-directory-program) - (not ls-lisp-use-insert-directory-program))) - (setq-local dired-actual-switches (car args)))))) - - ;; Don't complain about this command being disabled when we use it - (put 'dired-find-alternate-file 'disabled nil) + (let* ((ls (executable-find "ls")) + (gls (executable-find "gls")) + (idp (executable-find insert-directory-program)) + (ls-is-gnu? (and ls (= 0 (process-file ls nil nil nil "--version")))) + (idp-is-gnu-ls? + (and idp (= 0 (process-file idp nil nil nil "--version"))))) + (setq dired-listing-switches + "-l --almost-all --human-readable --group-directories-first") + (setq insert-directory-program + (cond + ;; just use GNU ls if found + (ls-is-gnu? ls) + ;; use insert-directory-program if it points to GNU ls + (idp-is-gnu-ls? insert-directory-program) + ;; heuristic: GNU ls is often installed as gls by Homebrew on Mac + ((and (eq system-type 'darwin) gls) gls) + (t + ;; Emacs 28+ sanitizes unknown switches silently + (when (< emacs-major-version 28) + (setq dired-listing-switches "-alh")) + ;; fallback to insert-directory-program + insert-directory-program)))) (defadvice! +dired--no-revert-in-virtual-buffers-a (&rest args) "Don't auto-revert in dired-virtual buffers (see `dired-virtual-revert')." @@ -57,127 +53,11 @@ Fixes #3939: unsortable dired entries on Windows." (not (eq revert-buffer-function #'dired-virtual-revert))) (map! :map dired-mode-map - ;; Kill all dired buffers on q - :ng "q" #'+dired/quit-all ;; To be consistent with ivy/helm+wgrep integration "C-c C-e" #'wdired-change-to-wdired-mode)) -(use-package! dired-rsync - :general (dired-mode-map "C-c C-r" #'dired-rsync)) - - -(use-package! diredfl - :hook (dired-mode . diredfl-mode)) - - -(use-package! ranger - :when (modulep! +ranger) - :after dired - :init (setq ranger-override-dired t) - :config - (unless (file-directory-p image-dired-dir) - (make-directory image-dired-dir)) - - (set-popup-rule! "^\\*ranger" :ignore t) - - (defadvice! +dired--cleanup-header-line-a () - "Ranger fails to clean up `header-line-format' when it is closed, so..." - :before #'ranger-revert - (dolist (buffer (buffer-list)) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (when (equal header-line-format '(:eval (ranger-header-line))) - (setq header-line-format nil)))))) - - (defadvice! +dired--cleanup-mouse1-bind-a () - "Ranger binds an anonymous function to mouse-1 after previewing a buffer -that prevents the user from escaping the window with the mouse. This command is -never cleaned up if the buffer already existed before ranger was initialized, so -we have to clean it up ourselves." - :after #'ranger-setup-preview - (when (window-live-p ranger-preview-window) - (with-current-buffer (window-buffer ranger-preview-window) - (local-unset-key [mouse-1])))) - - (defadvice! +dired--ranger-travel-a () - "Temporary fix for this function until ralesi/ranger.el#236 gets merged." - :override #'ranger-travel - (interactive) - (let ((prompt "Travel: ")) - (cond - ((bound-and-true-p helm-mode) - (ranger-find-file (helm-read-file-name prompt))) - ((bound-and-true-p ivy-mode) - (ivy-read prompt 'read-file-name-internal - :matcher #'counsel--find-file-matcher - :action - (lambda (x) - (with-ivy-window - (ranger-find-file (expand-file-name x default-directory)))))) - ((bound-and-true-p ido-mode) - (ranger-find-file (ido-read-file-name prompt))) - (t - (ranger-find-file (read-file-name prompt)))))) - - (setq ranger-cleanup-on-disable t - ranger-excluded-extensions '("mkv" "iso" "mp4") - ranger-deer-show-details t - ranger-max-preview-size 10 - ranger-show-literal nil - ranger-hide-cursor nil)) - - -(use-package! dirvish - :when (modulep! +dirvish) - :defer t - :init (after! dired (dirvish-override-dired-mode)) - :hook (dired-mode . dired-omit-mode) - :config - (setq dirvish-cache-dir (concat doom-cache-dir "dirvish/") - dirvish-hide-details nil - dirvish-attributes '(git-msg) - dired-omit-files (concat dired-omit-files "\\|^\\..*$")) - (when (modulep! +icons) - (push 'all-the-icons dirvish-attributes)) - (map! :map dirvish-mode-map - :n "b" #'dirvish-goto-bookmark - :n "z" #'dirvish-show-history - :n "f" #'dirvish-file-info-menu - :n "F" #'dirvish-toggle-fullscreen - :n "l" #'dired-find-file - :n "h" #'dired-up-directory - :localleader - "h" #'dired-omit-mode)) - - -(use-package! all-the-icons-dired - :when (modulep! +icons) - :unless (modulep! +dirvish) - :hook (dired-mode . all-the-icons-dired-mode) - :config - ;; HACK Fixes #1929: icons break file renaming in Emacs 27+, because the icon - ;; is considered part of the filename, so we disable icons while we're in - ;; wdired-mode. - (defvar +wdired-icons-enabled -1) - - ;; display icons with colors - (setq all-the-icons-dired-monochrome nil) - - (defadvice! +dired-disable-icons-in-wdired-mode-a (&rest _) - :before #'wdired-change-to-wdired-mode - (setq-local +wdired-icons-enabled (if all-the-icons-dired-mode 1 -1)) - (when all-the-icons-dired-mode - (all-the-icons-dired-mode -1))) - - (defadvice! +dired-restore-icons-after-wdired-mode-a (&rest _) - :after #'wdired-change-to-dired-mode - (all-the-icons-dired-mode +wdired-icons-enabled))) - - (use-package! dired-x - :unless (modulep! +dirvish) - :unless (modulep! +ranger) :hook (dired-mode . dired-omit-mode) :config (setq dired-omit-verbose nil @@ -211,37 +91,55 @@ we have to clean it up ourselves." "h" #'dired-omit-mode)) -(use-package! fd-dired - :when doom-projectile-fd-binary - :defer t - :init - (global-set-key [remap find-dired] #'fd-dired) - (set-popup-rule! "^\\*F\\(?:d\\|ind\\)\\*$" :ignore t)) - (use-package! dired-aux :defer t :config (setq dired-create-destination-dirs 'ask dired-vc-rename-file t)) -;;;###package dired-git-info -(map! :after dired - :map (dired-mode-map ranger-mode-map) - :ng ")" #'dired-git-info-mode) -(setq dgi-commit-message-format "%h %cs %s" - dgi-auto-hide-details-p nil) -(after! wdired - ;; Temporarily disable `dired-git-info-mode' when entering wdired, due to - ;; reported incompatibilities. - (defvar +dired--git-info-p nil) - (defadvice! +dired--disable-git-info-a (&rest _) - :before #'wdired-change-to-wdired-mode - (setq +dired--git-info-p (bound-and-true-p dired-git-info-mode)) - (when +dired--git-info-p - (dired-git-info-mode -1))) - (defadvice! +dired--reactivate-git-info-a (&rest _) - :after '(wdired-exit - wdired-abort-changes - wdired-finish-edit) - (when +dired--git-info-p - (dired-git-info-mode +1)))) + +(use-package! diredfl + :hook (dired-mode . diredfl-mode) + :hook (dirvish-directory-view-mode . diredfl-mode)) + + +(use-package! dirvish + :defer t + :general (dired-mode-map "C-c C-r" #'dirvish-rsync) + :after-call dired-noselect dired dired-jump + :config + (dirvish-override-dired-mode) + (setq dirvish-cache-dir (concat doom-cache-dir "dirvish/")) + (set-popup-rule! "^ ?\\*Dirvish.*" :ignore t) + (map! :map dirvish-mode-map + :n "?" #'dirvish-dispatch + :n "q" #'dirvish-quit + :ng "a" #'dirvish-quick-access + :ng "f" #'dirvish-file-info-menu + :ng "y" #'dirvish-yank-menu + :ng "s" #'dirvish-quicksort + :ng "TAB" #'dirvish-subtree-toggle + :ng "M-t" #'dirvish-layout-toggle + :ng "M-b" #'dirvish-history-go-backward + :ng "M-f" #'dirvish-history-go-forward + :ng "M-n" #'dirvish-narrow + :ng "M-m" #'dirvish-mark-menu + :ng "M-s" #'dirvish-setup-menu + :ng "M-e" #'dirvish-emerge-menu) + (if (modulep! +dirvish) + (setq dirvish-attributes '(file-size collapse) + dirvish-mode-line-format + '(:left (sort file-time symlink) :right (omit yank index))) + (setq dirvish-attributes nil + dirvish-use-header-line nil + dirvish-mode-line-format nil + dirvish-hide-details nil + dirvish-hide-cursor nil)) + (when (modulep! :ui tabs) + (after! centaur-tabs + (add-hook! 'dired-mode-hook 'centaur-tabs-local-mode) + (add-hook! 'dirvish-directory-view-mode-hook 'centaur-tabs-local-mode))) + (when (modulep! :ui vc-gutter) + (push 'vc-state dirvish-attributes)) + (when (modulep! +icons) + (appendq! dirvish-attributes '(all-the-icons subtree-state)))) diff --git a/modules/emacs/dired/doctor.el b/modules/emacs/dired/doctor.el index 2c2e77b29ab..3c0c77a8cfd 100644 --- a/modules/emacs/dired/doctor.el +++ b/modules/emacs/dired/doctor.el @@ -2,3 +2,6 @@ (when (and IS-BSD (not (executable-find "gls"))) (warn! "Cannot find gls (GNU ls). This may cause issues with dired")) + +(when (modulep! +ranger) + (warn! "The +ranger flag has been removed from this module")) diff --git a/modules/emacs/dired/packages.el b/modules/emacs/dired/packages.el index 802ec83c3b8..57e3726e39f 100644 --- a/modules/emacs/dired/packages.el +++ b/modules/emacs/dired/packages.el @@ -1,14 +1,5 @@ ;; -*- no-byte-compile: t; -*- ;;; emacs/dired/packages.el -(package! diredfl :pin "f9140b2c42151dca669003d685c9f079b2e3dc37") -(package! dired-git-info :pin "9461476a28a5fec0784260f6e318237c662c3430") -(package! dired-rsync :pin "7940d9154d0a908693999b0e1ea351a6d365c93d") -(when (modulep! +ranger) - (package! ranger :pin "2498519cb21dcd5791d240607a72a204d1761668")) -(when (modulep! +dirvish) - (package! dirvish :pin "4fe9c00894304e99aca22ae4b6b656fe94b8f927")) -(when (and (modulep! +icons) - (not (modulep! +dirvish))) - (package! all-the-icons-dired :pin "5e9b097f9950cc9f86de922b07903a4e5fefc733")) -(package! fd-dired :pin "458464771bb220b6eb87ccfd4c985c436e57dc7e") +(package! diredfl :pin "62b559e1d6b69834a56a57eb1832ac6ad4d2e5d0") +(package! dirvish :pin "11a3bec247b9e4742f171434e948895b3dc730ed") diff --git a/modules/ui/vc-gutter/config.el b/modules/ui/vc-gutter/config.el index 0f3b2bea121..9e20d7b9fd7 100644 --- a/modules/ui/vc-gutter/config.el +++ b/modules/ui/vc-gutter/config.el @@ -148,10 +148,11 @@ is deferred until the file is saved. Respects `git-gutter:disabled-modes'." :when (modulep! +diff-hl) :hook (find-file . diff-hl-mode) :hook (vc-dir-mode . diff-hl-dir-mode) - :hook (dired-mode . diff-hl-dired-mode) :hook (diff-hl-mode . diff-hl-flydiff-mode) :commands diff-hl-stage-current-hunk diff-hl-revert-hunk diff-hl-next-hunk diff-hl-previous-hunk :config + (unless (modulep! :emacs dired) + (add-hook! 'dired-mode-hook #'diff-hl-dired-mode)) (set-popup-rule! "^\\*diff-hl" :select nil :size '+popup-shrink-to-fit) ;; PERF: reduce load on remote