GithubHelp home page GithubHelp logo

wyuenho / all-the-icons-dired Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jtbm37/all-the-icons-dired

23.0 23.0 7.0 170 KB

Adds dired support to all-the-icons

License: GNU General Public License v3.0

Emacs Lisp 100.00%

all-the-icons-dired's People

Contributors

arouene avatar conao3 avatar eigengrau avatar gexplorer avatar jacobilsoe avatar jtbm37 avatar lordpretzel avatar mattiasb avatar mohkale avatar nagy avatar nixmaniack avatar pkulev avatar punassuming avatar wyuenho avatar yibe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

all-the-icons-dired's Issues

Why overlays and not text properties

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:

  1. Large number of overlays is problematic.
  2. Overlays need to be recreated whenever files are reordered, filtered, added to dired buffer. I was using 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,

  1. 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.

  2. 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?

Not show icons when use dired-subtree

Linux Mint 20
Emacs 27.2
packages: dired, dired-subtree, all-the-icons-dired

I use package dired-subtree to expand folders (in dired mode) by press TAB.

(global-set-key (kbd "TAB") 'dired-subtree-toggle)

Here my folder Temp
1

Nice. Icons show.

But when I press TAB ... the icons not show in subfolders
2

If I open folder by press ENTER the icons success show.
3
4

setq: Wrong type argument: number-or-marker-p, nil

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

Mangled icons when using `dired-narrow` with the `dired-narrow-enter-directory` function

Information

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))

Bug Description

all-the-icons-dired does not update the icons when using dired-narrow with the dired-narrow-enter-directory function.

How to Reproduce

  1. Use emacs -q with the given configuration and up-to-date melpa packages
  2. Open dired in a arbitrary directory
  3. Press / or M-x dired-narrow
  4. Move cursor to a directory
  5. Press C-j

Expected Behavior

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.

Actual Behavior

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.
image

Cause

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).

Workaround

(push '(dired-narrow dired-narrow--remove-text-with-property all-the-icons-dired--refresh-advice) all-the-icons-dired-advice-alist)

Suggested Change

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))

Comment

Thank you for maintaining this package!

Display incorrect icons after press "l"

I think the root cause is the advice of dired-do-redisplay is missing. Please take a look at this issue. Thanks!

(defvar all-the-icons-dired-advice-alist
'((dired-aux dired-create-directory all-the-icons-dired--refresh-advice)
(dired-aux dired-do-create-files all-the-icons-dired--refresh-advice)
(dired-aux dired-do-kill-lines all-the-icons-dired--refresh-advice)
(dired-aux dired-do-rename all-the-icons-dired--refresh-advice)
(dired-aux dired-insert-subdir all-the-icons-dired--refresh-advice)
(dired-aux dired-kill-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-subtree dired-subtree-insert all-the-icons-dired--refresh-advice)
(dired-subtree dired-subtree-remove 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))
"A list of file, adviced function, and advice function.")
(defun all-the-icons-dired--setup ()
"Setup `all-the-icons-dired'."
(setq-local tab-width 1)
(pcase-dolist (`(,file ,sym ,fn) all-the-icons-dired-advice-alist)
(with-eval-after-load file
(advice-add sym :around fn)))
(all-the-icons-dired--refresh))

Case sensitive matching

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.

Avoid calling `file-directory-p` on remote files

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 file
  • d - directory
  • l - symlink
  • s - socket
  • p - pipe
  • c - character device
  • b - block device

Unfortunately, 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.

Icons misalign on redisplay

Describe the bug

Executing dired-do-redisplay on shifts the selected file(s) icons to the left edge

To Reproduce

Steps to reproduce the behavior:

  1. Open a folder with dired
  2. Make sure all-the-icons-dired is enabled
  3. Put the cursor on a file or mark it and run dired-do-redisplay

Expected behavior

The icon should be left in the correct position.

Screenshots

See here: doomemacs/doomemacs#5579

System

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)

All icons have one color now?

After an update recently all icons became white with dark themes and black with light themes, instead of colorful icons. Is there any change?

Screenshot_20210223_190739

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.