[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dirvish 250768fa04: perf(core): render icons in parent win
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dirvish 250768fa04: perf(core): render icons in parent windows only once |
Date: |
Tue, 18 Mar 2025 22:00:44 -0400 (EDT) |
branch: elpa/dirvish
commit 250768fa040293b04fc74149cc253d3c243a5f7e
Author: Alex Lu <hellosimon1103@hotmail.com>
Commit: Alex Lu <hellosimon1103@hotmail.com>
perf(core): render icons in parent windows only once
---
dirvish.el | 20 +++++++++------
docs/CUSTOMIZING.org | 71 ++++++++++++++++++++++++++++------------------------
2 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/dirvish.el b/dirvish.el
index 6ba41f1a8f..4aedeb414a 100644
--- a/dirvish.el
+++ b/dirvish.el
@@ -932,10 +932,9 @@ When the attribute does not exist, set it with BODY."
(remove-overlays pm pM ov t))
finally
(with-silent-modifications
- (and (derived-mode-p '(dired-mode dirvish-directory-view-mode))
- (save-excursion
- (dirvish--render-attrs-1
- height remain (point) remote fns (if gui 0 2) hl
ww)))))))
+ (save-excursion
+ (dirvish--render-attrs-1
+ height remain (point) remote fns (if gui 0 2) hl ww))))))
(dirvish-define-attribute hl-line
"Highlight current line.
@@ -1166,6 +1165,8 @@ LEVEL is the depth of current window."
(with-temp-buffer (dired-insert-directory dir flags)
(buffer-string)))))
(attrs (mapcar #'car (dv-attributes dv)))
+ (sudo (with-current-buffer (cdr (dv-index dv))
+ (dirvish-prop :local-sudo)))
(icon (cond ((memq 'all-the-icons attrs) '(all-the-icons))
((memq 'nerd-icons attrs) '(nerd-icons))
((memq 'vscode-icon attrs) '(vscode-icon)))))
@@ -1174,6 +1175,7 @@ LEVEL is the depth of current window."
(dirvish-directory-view-mode)
(dirvish-prop :dv (dv-id dv))
(dirvish-prop :remote (file-remote-p dir))
+ (dirvish-prop :local-sudo sudo)
(puthash dir str (dv-parent-hash dv))
(let (buffer-read-only) (erase-buffer) (save-excursion (insert str)))
(setq-local dired-subdir-alist (list (cons dir (point-min-marker))))
@@ -1265,8 +1267,11 @@ Dirvish sets `revert-buffer-function' to this function."
(when-let* ((dv (dirvish-curr)) ((not (derived-mode-p 'wdired-mode)))
(r-win (dv-root-window dv)) ((window-live-p r-win)))
(when (dirvish--apply-hiding-p dirvish-hide-cursor)
(dired-move-to-filename))
- (dolist (w (window-list)) (unless (eq r-win w) (dirvish--render-attrs w))
- (dirvish--render-attrs r-win))
+ (dolist (w (window-list))
+ (when (and (not (eq r-win w))
+ (with-selected-window w (derived-mode-p 'dired-mode)))
+ (dirvish--render-attrs w)))
+ (dirvish--render-attrs r-win)
(when-let* ((filename (dired-get-filename nil t)))
(dirvish-prop :index (file-local-name filename)))))
@@ -1324,6 +1329,7 @@ Dirvish sets `revert-buffer-function' to this function."
(window-parameters . ((no-other-window . t))))
for b = (dirvish--create-parent-buffer dv parent current level)
for w = (display-buffer b `(dirvish--display-buffer . ,args)) do
+ (dirvish--render-attrs w 'never) ; only render icon
(with-selected-window w
(set-window-fringes w 1 1) (set-window-dedicated-p w t))))))
@@ -1509,7 +1515,7 @@ are killed and the Dired buffer(s) in the selected window
are buried."
(let* ((dir (or path default-directory))
(fn (if dired-kill-when-opening-new-dired-buffer 'find-alternate-file
'find-file))
- (cur? (dirvish-curr)) ; can be non-default session, reuse it directly
+ (cur? (dirvish-curr)) ; can be a non-default session, reuse it
directly
(vis? (cl-loop for w in (window-list)
for b = (window-buffer w)
for dv = (with-current-buffer b (dirvish-curr))
diff --git a/docs/CUSTOMIZING.org b/docs/CUSTOMIZING.org
index a21c5ea5b3..6edd0d915a 100644
--- a/docs/CUSTOMIZING.org
+++ b/docs/CUSTOMIZING.org
@@ -443,7 +443,8 @@ you don't have to require them explicitly if you installed
dirvish from MELPA or
'(("h" "~/" "Home")
("d" "~/Downloads/" "Downloads")
("m" "/mnt/" "Drives")
- ("s" "/ssh:my-server") "SSH server"
+ ("s" "/ssh:my-remote-server") "SSH server"
+ ("e" "/sudo:root@localhost:/etc") "Modify program settings"
("t" "~/.local/share/Trash/files/" "TrashCan")))
:config
;; (dirvish-peek-mode) ; Preview files in minibuffer
@@ -454,28 +455,28 @@ you don't have to require them explicitly if you
installed dirvish from MELPA or
'(vc-state subtree-state nerd-icons collapse git-msg file-time
file-size)
dirvish-side-attributes
'(vc-state nerd-icons collapse file-size))
- (setq delete-by-moving-to-trash t)
(setq dired-listing-switches
"-l --almost-all --human-readable --group-directories-first
--no-group")
:bind ; Bind `dirvish-fd|dirvish-side|dirvish-dwim' as you see fit
(("C-c f" . dirvish)
:map dirvish-mode-map ; Dirvish inherits `dired-mode-map'
+ ;; ("o" . dired-up-directory) ; So you can adjust dired bindings here
("?" . dirvish-dispatch) ; contains most of sub-menus in dirvish
extensions
("a" . dirvish-quick-access)
- ("f" . dirvish-file-info-menu)
+ ("f" . dirvish-history-go-forward)
+ ("b" . dirvish-history-go-backward)
("y" . dirvish-yank-menu)
("N" . dirvish-narrow)
("^" . dirvish-history-last)
+ ("s" . dirvish-setup-menu) ; `st' toggles mtime, `ss' toggles file
size, etc.
("h" . dirvish-history-jump) ; remapped `describe-mode'
- ("s" . dirvish-quicksort) ; remapped `dired-sort-toggle-or-edit'
+ ("r" . dirvish-quicksort) ; remapped `dired-sort-toggle-or-edit'
("v" . dirvish-vc-menu) ; remapped `dired-view-file'
("TAB" . dirvish-subtree-toggle)
- ("M-f" . dirvish-history-go-forward)
- ("M-b" . dirvish-history-go-backward)
+ ("M-f" . dirvish-file-info-menu)
("M-l" . dirvish-ls-switches-menu)
("M-m" . dirvish-mark-menu)
("M-t" . dirvish-layout-toggle)
- ("M-s" . dirvish-setup-menu)
("M-e" . dirvish-emerge-menu)
("M-j" . dirvish-fd-jump)))
#+end_src
@@ -498,10 +499,10 @@ Some keybindings for mouse:
- /middle click/: opening a file/directory in new window
#+begin_src emacs-lisp
- (setq mouse-1-click-follows-link nil)
- (define-key dirvish-mode-map (kbd "<mouse-1>")
'dirvish-subtree-toggle-or-open)
- (define-key dirvish-mode-map (kbd "<mouse-2>")
'dired-mouse-find-file-other-window)
- (define-key dirvish-mode-map (kbd "<mouse-3>") 'dired-mouse-find-file)
+(setq mouse-1-click-follows-link nil)
+(define-key dirvish-mode-map (kbd "<mouse-1>") 'dirvish-subtree-toggle-or-open)
+(define-key dirvish-mode-map (kbd "<mouse-2>")
'dired-mouse-find-file-other-window)
+(define-key dirvish-mode-map (kbd "<mouse-3>") 'dired-mouse-find-file)
#+end_src
** TRAMP integration
@@ -534,26 +535,30 @@ be able to answer to in the child emacs.
These packages are only listed here for discoverability.
#+begin_src emacs-lisp
- (use-package dired-x
- :config
- ;; Make dired-omit-mode hide all "dotfiles"
- (setq dired-omit-files
- (concat dired-omit-files "\\|^\\..*$")))
-
- ;; Additional syntax highlighting for dired
- (use-package diredfl
- :hook
- ((dired-mode . diredfl-mode)
- ;; highlight parent and directory preview as well
- (dirvish-directory-view-mode . diredfl-mode))
- :config
- (set-face-attribute 'diredfl-dir-name nil :bold t))
-
- ;; Use `nerd-icons' as Dirvish's icon backend
- (use-package nerd-icons)
-
- ;; Or, use `vscode-icon' instead
- ;; (use-package vscode-icon
- ;; :config
- ;; (push '("jpg" . "image") vscode-icon-file-alist))
+
+(use-package dired-x
+ :config
+ ;; Make dired-omit-mode hide all "dotfiles"
+ (setq dired-omit-files
+ (concat dired-omit-files "\\|^\\..*$")))
+
+;; Additional syntax highlighting for dired
+(use-package diredfl
+ :hook
+ ((dired-mode . diredfl-mode)
+ ;; highlight parent and directory preview as well
+ (dirvish-directory-view-mode . diredfl-mode))
+ :config
+ (set-face-attribute 'diredfl-dir-name nil :bold t))
+
+;; Use `nerd-icons' as Dirvish's icon backend
+(use-package nerd-icons)
+
+;; Or, use `vscode-icon' instead
+;; (use-package vscode-icon
+;; :config
+;; (push '("jpg" . "image") vscode-icon-file-alist))
+
+;; miscs
+(setq delete-by-moving-to-trash t)
#+end_src
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/dirvish 250768fa04: perf(core): render icons in parent windows only once,
ELPA Syncer <=