From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83wmz09vsh.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5194"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64606@debbugs.gnu.org To: Aditya Yadav Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 16 09:10:26 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qKvth-0001B9-Kj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 16 Jul 2023 09:10:26 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKvtN-0008C1-3R; Sun, 16 Jul 2023 03:10:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKvtL-0008Bc-7z for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 03:10:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKvtK-0003Gw-V7 for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 03:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKvtK-0006MV-EF for bug-gnu-emacs@gnu.org; Sun, 16 Jul 2023 03:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jul 2023 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64606 X-GNU-PR-Package: emacs Original-Received: via spool by 64606-submit@debbugs.gnu.org id=B64606.168949139624439 (code B ref 64606); Sun, 16 Jul 2023 07:10:02 +0000 Original-Received: (at 64606) by debbugs.gnu.org; 16 Jul 2023 07:09:56 +0000 Original-Received: from localhost ([127.0.0.1]:46517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKvtD-0006M6-L7 for submit@debbugs.gnu.org; Sun, 16 Jul 2023 03:09:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKvt8-0006Lp-1n for 64606@debbugs.gnu.org; Sun, 16 Jul 2023 03:09:53 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKvt2-0003EQ-O1; Sun, 16 Jul 2023 03:09:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vO53J9YDWs/JQJS2F2NTa0zlxtADH+qvrCqwQpXhCrI=; b=lwVGSuzO9qhtTXEnFO21 ZBqLAju1KUS25IMB7eeK2f+hYpGDkOwXvUQPNZoAZ1bqrUGgHQv8jkDxUojTomnc+yF3PFHCbB7Cs r+yYDg7BfyfYw5/en/1n9blGkuSgHVy1kFksKjMUzN4kgD9ky3Wtbvcjy1hkKYGDLaURom6FOgBrE FBh/Ej4lRF5fD0tfW0uK7v+EvBCO3lAOkf6eIUYXZZgCYuC34I7wViHUDoo9CI7LUUr7CGQ5MTA4s uHuWsQ1cmkH3hdxsYfKORyTXFbV+umTJLXZy7VTOQ8NtKy+9YsYqhD/SHXvGONfZh/9qnEDUZ4rF6 4JihdTns1hrCkQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKvt2-0004nN-6O; Sun, 16 Jul 2023 03:09:44 -0400 In-Reply-To: (message from Aditya Yadav on Fri, 14 Jul 2023 02:49:23 +0530) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265276 Archived-At: > From: Aditya Yadav > 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") > #("star1/letter1" "--dired -AGFhlv --group-directories-first --time-s..." nil nil) > ls-lisp--insert-directory(# "star1/letter1" "--dired -AGFhlv - > -group-directories-first --time-s..." nil nil) > apply(ls-lisp--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() > #() > combine-change-calls-1(1 227 # 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))