[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dired cons bug?
From: |
Eli Zaretskii |
Subject: |
Re: dired cons bug? |
Date: |
Thu, 11 Aug 2022 16:30:56 +0300 |
> Date: Wed, 10 Aug 2022 13:26:25 +0200
> From: Harald Judt <h.judt@gmx.at>
>
> I have a question regarding using dired programmatically in Emacs 28.1. Say I
> do the following call to open a dired buffer and insert the files:
>
> (dired (cons "/home/user" '("/home/user/tmp/test/a/a"
> "/home/user/tmp/test/b/b" "/home/user/tmp/test/c/c")))
>
> It works fine, I get a nice listing and can move around like expected, mark
> files and try to delete them. Now it gets interesting: Usually after hitting
> "x" to execute, then confirming the deletion, the buffer will refresh. But not
> in this case, not when I open dired using the cons above. I can revert the
> buffer using "g".
>
> Note that when I simply do (dired "/home/user/tmp/test"), then insert the
> subdir to show the files and delete them, this is not reproducible. The buffer
> will be refreshed immediately after the delete operation completes.
>
> Why? Am I missing something? Is this a (known) bug or expected behaviour? I've
> tried with emacs -Q, so it seems to be no configuration problem.
I think it's a bug. Please see if the patch below gives good results.
diff --git a/lisp/dired.el b/lisp/dired.el
index f261f9f..f7651c6 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3674,7 +3674,10 @@ dired-internal-do-deletions
(progress-reporter-update progress-reporter succ)
(dired-fun-in-all-buffers
(file-name-directory fn) (file-name-nondirectory fn)
- #'dired-delete-entry fn))
+ #'dired-delete-entry fn)
+ ;; For when FN's directory name is different
+ ;; from the current buffer's dired-directory.
+ (dired-delete-entry fn))
(quit (throw '--delete-cancel (message "OK, canceled")))
(error ;; catch errors from failed deletions
(dired-log "%s: %s\n" (car err) (error-message-string err))