rainstormstudio / nerd-icons-dired

GNU General Public License v3.0
55 stars 10 forks source link

[BUG] When a file/folder is deleted, the entry does not disappear from the dired buffer #7

Closed milanglacier closed 1 year ago

milanglacier commented 1 year ago

minimal config:

(require 'package)
(setq package-user-dir "~/Downloads/emacs-package-dir")

(setq package-list '(nerd-icons-dired))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))

(require 'nerd-icons)
(require 'nerd-icons-dired)
(require 'dired-subtree)

(add-hook 'dired-mode-hook #'nerd-icons-dired-mode)

(load-theme 'tango-dark t)

step to reproduce:

open a dired buffer, delete a folder (by invoking dired-do-delete (press D), the folder entry does not disappear in the dired buffer.

See the video.

https://user-images.githubusercontent.com/45728125/236659138-0adb8e7d-c20f-4c1e-a572-798d2f382760.mov

The same "unsynchronized" issue also happens for dired-create-empty-file where after the file is created, the icons does not appear for the new created empty file until you manually refresh the dired buffer by revert-buffer.

Correct behavior

when the folder/file is deleted, this entry disappears from the dired buffer (this is the behavior without nerd-icons-dired)

milanglacier commented 1 year ago

One thing really confuses me:

After reading the source code, I found that nerd-icons-dired and all-the-icons-dired have almost exactly the same code, but why this behavior (deleting file/folder does not remove the entry from the dired buffer) doesn't appear when use all-the-icons-dired?

milanglacier commented 1 year ago

I think this is because text properties and overlays are different.

After reverting to 9fa8278a, this problem doesn't happen anymore.

rainstormstudio commented 1 year ago

ok now I'm considering reverting back to overlays as text properties introduce so many issues.

milanglacier commented 1 year ago

Thanks for the update! I will give the latest commit test soon!

milanglacier commented 1 year ago

This issue is fixed with the latest version.