unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48456: Revert Dired after copy/rename
@ 2021-05-15 21:45 Juri Linkov
  2021-05-19 16:18 ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2021-05-15 21:45 UTC (permalink / raw)
  To: 48456

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

This has been a problem for a long time.
Every time after copying a file to another directory,
there is a need to switch to the Dired buffer with the copied file,
and revert it manually by typing 'g' to restore the correct sorting order,
because the copied file is inserted where point was located, but not
where it should be according to the Dired sorting order.

This patch reverts the target buffer only when dired-auto-revert-buffer
is customized to t:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-do-create-files-revert-buffer.patch --]
[-- Type: text/x-diff, Size: 569 bytes --]

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 8fce402c7a..12064d27d9 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -2117,7 +2117,9 @@ dired-do-create-files
 	   (lambda (from)
 	     (expand-file-name (file-name-nondirectory from) target))
 	 (lambda (_from) target))
-       marker-char))))
+       marker-char)
+      (when (eq dired-auto-revert-buffer t)
+        (dired-fun-in-all-buffers target nil #'revert-buffer)))))
 
 ;; Read arguments for a marked-files command that wants a file name,
 ;; perhaps popping up the list of marked files.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-24 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 21:45 bug#48456: Revert Dired after copy/rename Juri Linkov
2021-05-19 16:18 ` Juri Linkov
2021-05-21 18:32   ` Juri Linkov
2021-05-21 20:08     ` Basil L. Contovounesios
2021-05-22 21:06       ` Juri Linkov
2021-05-24 11:04         ` Basil L. Contovounesios

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).