wyuenho / all-the-icons-dired Goto Github PK
View Code? Open in Web Editor NEWThis project forked from jtbm37/all-the-icons-dired
Adds dired support to all-the-icons
License: GNU General Public License v3.0
This project forked from jtbm37/all-the-icons-dired
Adds dired support to all-the-icons
License: GNU General Public License v3.0
Hi, I have been using this package through doom for a while now and been pretty happy with it but recently on opening a directory with some 15000 files caused dired to choke and using profiling suggested that a lot of the time was being spent here. On investigation it seems a large part of the slowdown is due to the use of overlays. I think the reason is twofold:
dired-filter-mode
and dired-filter-group-mode
from dired-hacks
and I needed to advise them too to refresh the icons and that was making the problem worse. But even with those modes off, it was really slow and I had to use C-g
to abort the operation.I tried adding icons using a display
text-property instead and it seems to work much better. It still takes a few second to open that directory but not too bad (the best thing here would be lazy propertizing like font-lock
does but I don't know how that works). There seem to be several other advantages beside performance, since now lines can also be added, removed and reordered freely without needing a refresh,
Very few functions need to advised. I have only advised dired-insert-set-properties
and added a hook to dired-after-readin-hook
and everything seems to be working smoothly.
When using dired-insert-subtree
only the new entries need to be propertized so it is fast even in very large directories. find-dired
also seems to behave better for the same reason.
In my very limited experience with it everything seems to be fine and I seemno obvious downsides. So I wanted to ask if there are pitfalls to this approach?
Linux Mint 20
Emacs 27.2
packages:
all-the-icons-dired
all-the-icons-icons
In my init.el
(require 'all-the-icons-dired)
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
But when I try to open folder in dired mode I get error:
setq: Wrong type argument: number-or-marker-p, nil
all-the-icons-dired Version | melpa 20210614.1350 (newest) |
Emacs Version | GNU Emacs 28.0.50.148618 |
OS | Arch Linux (5.12.15-arch1-1) |
emacs -q ? |
yes |
Emacs Configuration:
(require 'package)
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(use-package dired-narrow
:after (dired)
:bind (:map dired-mode-map
("/" . dired-narrow)))
(use-package all-the-icons-dired
:hook
(dired-mode . all-the-icons-dired-mode))
all-the-icons-dired
does not update the icons when using dired-narrow
with the dired-narrow-enter-directory
function.
emacs -q
with the given configuration and up-to-date melpa packages/
or M-x dired-narrow
The all-the-icons-dired--refresh-advice
should be executed when entering a directory (dired-narrow-enter-directory
) with dired-narrow.
The dired buffer should not display mangled icons.
The all-the-icons-dired--refresh-advice
function is not executed when entering a directory (dired-narrow-enter-directory
) with dired-narrow.
This results in mangled icons.
It seems like the advice using the dired-narrow--internal
function should use dired-narrow--remove-text-with-property
since after executing this function the icons appear mangled (by stepping through it with the debugger).
(push '(dired-narrow dired-narrow--remove-text-with-property all-the-icons-dired--refresh-advice) all-the-icons-dired-advice-alist)
Either replace or add this line. Replacing it has worked for me (1 day of testing).
diff --git a/all-the-icons-dired.el b/all-the-icons-dired.el
index 625b027..9b7cf71 100644
--- a/all-the-icons-dired.el
+++ b/all-the-icons-dired.el
@@ -118,7 +118,7 @@
(dired-aux dired-insert-subdir all-the-icons-dired--refresh-advice)
(dired wdired-abort-changes all-the-icons-dired--refresh-advice)
(dired dired-internal-do-deletions all-the-icons-dired--refresh-advice)
- (dired-narrow dired-narrow--internal all-the-icons-dired--refresh-advice)
+ (dired-narrow dired-narrow--remove-text-with-property all-the-icons-dired--refresh-advice)
(dired dired-readin all-the-icons-dired--refresh-advice)
(dired dired-revert all-the-icons-dired--refresh-advice)
(find-dired find-dired-sentinel all-the-icons-dired--refresh-advice))
Thank you for maintaining this package!
I think the root cause is the advice of dired-do-redisplay
is missing. Please take a look at this issue. Thanks!
all-the-icons-dired/all-the-icons-dired.el
Lines 113 to 136 in 5e9b097
It seems filename matching is case sensitive when using all-the-icons-dired.
a.pdf shows a PDF icon whereas a.PDF shows the default icon.
If I just call all-the-icons-icon-for-file manually it returns the PDF icon for both a.pdf and a.PDF.
This began happening today, not too sure why yet:
all-the-icons-dired--refresh-advice: Symbol’s value as variable is void: file
Unfortunately, file-directory-p
tends to be very slow (and can hang in some cases) when invoked on remote machines.The simple fix is to just avoid calling this entirely on remote machines. A better fix is to use the output of POSIX mode string.
Specifically, if you look at dired-move-to-end-of-filename
, you'll see the following code:
(if (re-search-backward
dired-permission-flags-regexp nil t)
(setq file-type (char-after (match-beginning 1))
If called when point
is at the beginning of a filename (after calling (dired-move-to-filename t)
), this code will set file-type
to one of:
-
- regular filed
- directoryl
- symlinks
- socketp
- pipec
- character deviceb
- block deviceUnfortunately, the l
case (symlink) is a bit difficult to handle as it might be a link to a directory, or it might be a link to a file. Personally, I'd resolve the underlying file type when local, and just display some generic "link" icon when remote. But there's no "right" way to handle that case.
Executing dired-do-redisplay
on shifts the selected file(s) icons to the left edge
Steps to reproduce the behavior:
dired
all-the-icons-dired
is enableddired-do-redisplay
The icon should be left in the correct position.
See here: doomemacs/doomemacs#5579
Doom Emacs on Arch Linux (using the emacs-pgtk-native-comp-git
AUR package), though it can also be reproduced in Vanilla: doomemacs/doomemacs#5579 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.