From: Eli Zaretskii <eliz@gnu.org>
To: Aditya Yadav <aadi58002@gmail.com>
Cc: 64606@debbugs.gnu.org
Subject: bug#64606: 29.0.91; Error when editing partial matched files with dired editable mode
Date: Sun, 16 Jul 2023 10:10:06 +0300 [thread overview]
Message-ID: <83wmz09vsh.fsf@gnu.org> (raw)
In-Reply-To: <CALu=s2bx6Uo6g6mTD=r+=t_-uKE-RymcWt-Ujud=MDKHivYSgg@mail.gmail.com> (message from Aditya Yadav on Fri, 14 Jul 2023 02:49:23 +0530)
> From: Aditya Yadav <aadi58002@gmail.com>
> Date: Fri, 14 Jul 2023 02:49:23 +0530
>
> Let say in the current dir it is the following structure
> .
> ├── star1
> │ └── letter1
> ├── star2
> │ └── letter2
> └── star3
> └── letter3
>
> When i open dired with the command partial match `./s/l`
>
> -rw-rw-r-- 1 aditya-yadav 6 2023-07-13 22:32 star1/letter1
> -rw-rw-r-- 1 aditya-yadav 6 2023-07-13 22:32 star2/letter2
> -rw-rw-r-- 1 aditya-yadav 6 2023-07-13 22:32 star3/letter3
>
> When i try to rename a file with dired editable mode and when i write the changes
> Dired errors out and closes the buffer although the rename of the file is successful
>
> Aside from the partial match you can go to that directory with the above structure and run
> (dired '("." "star1/letter1" "star2/letter2" "star3/letter3"))
> from eshell to get the same result
>
> Debug on error output:-
>
> Debugger entered--Lisp error: (file-missing "Reading directory" "No such file or directory"
> "star1/letter1")
> #<subr insert-directory>("star1/letter1" "--dired -AGFhlv --group-directories-first --time-s..." nil nil)
> ls-lisp--insert-directory(#<subr insert-directory> "star1/letter1" "--dired -AGFhlv -
> -group-directories-first --time-s..." nil nil)
> apply(ls-lisp--insert-directory #<subr insert-directory> ("star1/letter1" "--dired -AGFhlv -
> -group-directories-first --time-s..." nil nil))
> insert-directory("star1/letter1" "--dired -AGFhlv --group-directories-first --time-s..." nil nil)
> dired-insert-directory("/home/aditya-yadav/Personal/Demo/" "-AGFhlv --group-directories-first -
> -time-style=lon..." ("star1/letter1" "star2/letter2" "star3/letter3") nil t)
> dired-readin-insert()
> #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_47>()
> combine-change-calls-1(1 227 #<subr
> F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_47>)
> dired-readin()
> dired-revert(nil nil)
> revert-buffer()
> wdired-finish-edit()
> funcall-interactively(wdired-finish-edit)
> evil-ex-call-command(nil #("w" 0 1 (ex-index 1)) nil)
> evil-ex-execute(#("w" 0 1 (ex-index 1)))
> evil-ex(nil)
> funcall-interactively(evil-ex nil)
> command-execute(evil-ex)
Thanks. Does the patch below give good results?
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 5c745cc..7b9c75d 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -556,8 +556,24 @@ wdired-finish-edit
;; been modified with their new name keeping
;; the ones that are unmodified at the same place.
(cl-loop for f in (cdr dired-directory)
- collect (or (assoc-default f files-renamed)
- f))))))
+ collect
+ (or (assoc-default f files-renamed)
+ ;; F could be relative or
+ ;; abbreviated, whereas
+ ;; files-renamed always consists
+ ;; of absolute file names.
+ (let ((relative
+ (not (file-name-absolute-p f)))
+ (match
+ (assoc-default (expand-file-name f)
+ files-renamed)))
+ (cond
+ ;; If it was relative, convert
+ ;; the new name back to relative.
+ ((and match relative)
+ (file-relative-name match))
+ (t match)))
+ f))))))
;; Re-sort the buffer.
(revert-buffer)
(let ((inhibit-read-only t))
next prev parent reply other threads:[~2023-07-16 7:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 21:19 bug#64606: 29.0.91; Error when editing partial matched files with dired editable mode Aditya Yadav
2023-07-16 7:10 ` Eli Zaretskii [this message]
[not found] ` <CALu=s2bEp52LB2Uv8u5QBU9UC8+8op6Dr+UN3Cumm+=8TV1UCA@mail.gmail.com>
2023-07-16 9:17 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wmz09vsh.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=64606@debbugs.gnu.org \
--cc=aadi58002@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.