jtbm37 / all-the-icons-dired

Adds dired support to all-the-icons
GNU General Public License v3.0
197 stars 26 forks source link

Icons don't show after `dired-insert-subdir` #11

Closed ryanprior closed 4 years ago

ryanprior commented 7 years ago

When inserting a subdirectory into a dired buffer, the new items don't show any icons.

Steps to reproduce

1) open a dired buffer in a directory with a subdirectory that has files in it 2) activate all-the-icons-dired-mode 3) put the cursor over the subdirectory and hit i

Expected result: icons show for files in the subdirectory Actual result: no icons show

Workaround

If you deactivate all-the-icons-dired-mode and re-activate it, all the items get icons including the ones in the subdirectory.

rgemulla commented 7 years ago

This quick fix works for me (not really tested thoroughly):

  (defun rg/all-the-icons-dired-hook ()
    (setq-local all-the-icons-dired-displayed nil)
    (all-the-icons-dired--display))
  ;;;###autoload
  (define-minor-mode rg/all-the-icons-dired-mode
    "Display all-the-icons icon for each files in a dired buffer."
    :lighter " rg/all-the-icons-dired-mode"
    (if (and (display-graphic-p) rg/all-the-icons-dired-mode)
        (progn
          (add-hook 'dired-after-readin-hook 'rg/all-the-icons-dired-hook t t)
          (when (derived-mode-p 'dired-mode)
            (all-the-icons-dired--display)))
    (remove-hook 'dired-after-readin-hook 'rg/all-the-icons-dired-hook t)
    (dired-revert)))
  (add-hook 'dired-mode-hook 'rg/all-the-icons-dired-mode)
seagle0128 commented 5 years ago

I think the simple workaround is:

(advice-add #'all-the-icons-dired--display :before #'all-the-icons-dired--reset)
conao3 commented 4 years ago

33 might solve this issue?

ryanprior commented 4 years ago

I refreshed my packages and find that the issue is resolved for me. I also tried it with a fresh Spacemacs install which has none of my custom init, in order to make sure I wasn't patching the behavior somewhere; it still worked fine.

So I'd consider this issue resolved. Thank you!