From debbugs-submit-bounces@debbugs.gnu.org Sat May 15 17:48:41 2021 Received: (at submit) by debbugs.gnu.org; 15 May 2021 21:48:41 +0000 Received: from localhost ([127.0.0.1]:49368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1li29J-0000c2-HI for submit@debbugs.gnu.org; Sat, 15 May 2021 17:48:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:49526) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1li29I-0000bv-2h for submit@debbugs.gnu.org; Sat, 15 May 2021 17:48:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1li29H-0000p2-Qi for bug-gnu-emacs@gnu.org; Sat, 15 May 2021 17:48:39 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:46233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1li29F-0002hs-Rs for bug-gnu-emacs@gnu.org; Sat, 15 May 2021 17:48:39 -0400 Received: (Authenticated sender: juri@linkov.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 2E0251C0004 for ; Sat, 15 May 2021 21:48:31 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: Revert Dired after copy/rename Organization: LINKOV.NET Date: Sun, 16 May 2021 00:45:58 +0300 Message-ID: <87v97j1xih.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.183.197; envelope-from=juri@linkov.net; helo=relay5-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-do-create-files-revert-buffer.patch 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. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 19 12:32:04 2021 Received: (at 48456) by debbugs.gnu.org; 19 May 2021 16:32:04 +0000 Received: from localhost ([127.0.0.1]:60571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljP76-0000DE-7i for submit@debbugs.gnu.org; Wed, 19 May 2021 12:32:04 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:30909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljP73-0000C4-Gf for 48456@debbugs.gnu.org; Wed, 19 May 2021 12:32:02 -0400 Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 8DBEF240008 for <48456@debbugs.gnu.org>; Wed, 19 May 2021 16:31:53 +0000 (UTC) From: Juri Linkov To: 48456@debbugs.gnu.org Subject: Re: bug#48456: Revert Dired after copy/rename Organization: LINKOV.NET References: <87v97j1xih.fsf@mail.linkov.net> Date: Wed, 19 May 2021 19:18:37 +0300 In-Reply-To: <87v97j1xih.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 16 May 2021 00:45:58 +0300") Message-ID: <87v97en1tm.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 48456 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain > 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. It seems better to create a new option: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-do-revert-buffer.patch diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index eb43ab187d..5df4d6b206 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2065,6 +2065,24 @@ dired-create-files operation success-count)))) (dired-move-to-filename)) +(defcustom dired-do-revert-buffer nil + "Automatically revert Dired buffers after some operations. +This option controls whether to refresh the directory listing in a +Dired buffer that is the destination of copy/rename/symlink/hardlink operations. +If the value is t, always revert the Dired buffer updated in the result +of Dired operations. +If the value is a function, it is called with the destination directory name +as a single argument, and the buffer is reverted after Dired operations +if the function returns non-nil." + :type '(choice + (const :tag "Don't revert" nil) + (const :tag "Always revert destination directory" t) + (const :tag "Revert only local Dired buffers" + (lambda (dir) (not (file-remote-p dir)))) + (function :tag "Predicate function")) + :group 'dired + :version "28.1") + (defun dired-do-create-files (op-symbol file-creator operation arg &optional marker-char op1 how-to) @@ -2168,7 +2186,12 @@ dired-do-create-files (lambda (from) (expand-file-name (file-name-nondirectory from) target)) (lambda (_from) target)) - marker-char)))) + marker-char) + (when (or (eq dired-do-revert-buffer t) + (and (functionp dired-do-revert-buffer) + (funcall dired-do-revert-buffer target))) + (dired-fun-in-all-buffers (file-name-directory target) nil + #'revert-buffer))))) ;; Read arguments for a marked-files command that wants a file name, ;; perhaps popping up the list of marked files. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 21 14:33:01 2021 Received: (at 48456) by debbugs.gnu.org; 21 May 2021 18:33:01 +0000 Received: from localhost ([127.0.0.1]:37559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lk9xE-0003ZL-W7 for submit@debbugs.gnu.org; Fri, 21 May 2021 14:33:01 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:48105) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lk9xC-0003Z4-JT; Fri, 21 May 2021 14:32:59 -0400 Received: (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 36A00100007; Fri, 21 May 2021 18:32:50 +0000 (UTC) From: Juri Linkov To: 48456@debbugs.gnu.org Subject: Re: bug#48456: Revert Dired after copy/rename Organization: LINKOV.NET References: <87v97j1xih.fsf@mail.linkov.net> <87v97en1tm.fsf@mail.linkov.net> Date: Fri, 21 May 2021 21:32:29 +0300 In-Reply-To: <87v97en1tm.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 19 May 2021 19:18:37 +0300") Message-ID: <87cztkuede.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 48456 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) tags 48456 fixed close 48456 28.0.50 quit > It seems better to create a new option: > > diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el > index eb43ab187d..5df4d6b206 100644 > --- a/lisp/dired-aux.el > +++ b/lisp/dired-aux.el > @@ -2065,6 +2065,24 @@ dired-create-files > +(defcustom dired-do-revert-buffer nil Now pushed to master and closed. From debbugs-submit-bounces@debbugs.gnu.org Fri May 21 16:08:43 2021 Received: (at 48456) by debbugs.gnu.org; 21 May 2021 20:08:43 +0000 Received: from localhost ([127.0.0.1]:37624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkBRr-00088a-Cr for submit@debbugs.gnu.org; Fri, 21 May 2021 16:08:43 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:36760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkBRo-00088K-Sw for 48456@debbugs.gnu.org; Fri, 21 May 2021 16:08:42 -0400 Received: by mail-wr1-f47.google.com with SMTP id c14so20393130wrx.3 for <48456@debbugs.gnu.org>; Fri, 21 May 2021 13:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=VP+4V2upSAPhX54h1oMlkT/tUBlSIg9yPLfyR4XrRPo=; b=c+6x7b4iCW3gg/nl/brLqSFaWJQsMdk2F7qNzLP9FiVen2RPmOcjXrnd7yFy9zsZfu Ssfbz+Vrc2ad/jFnERtn18aDvl/5U0BURXWWDDZEdC4/OCmA8koBZnaKdHcqlXNvT7b0 s72mWo4xWgwwjc62e8Ag8rmLG5nedmtNr/K+lWEC1rJyTMfH/ERCBhmpsEG/Mm0lzZhk n0JIKuoCGBXmKtX539T9q8yfxMNmHLde3eSPPJ0apxLKCswPNjlAACaiQiz0b53vEGb0 83TVjPSEVbmqvB2A6R4aRP6JZgLdMMmBzs4zcH+T+xpCj9zMhJ6gHTFhzb1CK2h+Rjk+ JmEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=VP+4V2upSAPhX54h1oMlkT/tUBlSIg9yPLfyR4XrRPo=; b=LZKY/s7yyP6ASOVlVMfDm2zNURYwwWwlQ+vIo+b5c+VmsQgotIzgi/XPMvA22+EpH4 +wGow3wmzZ0XroNKzTbb711KeTkTx7Sm5Si9YqDQdnkdnUJnSqxq4SpVS5YWFgQX3hLT YZBZ83lUJX4fbgUlo6ERAGdBDTRNGYR1fbMPk4y3WLCgw46UvX3Q2AFh+KYJg2RZyMTq r1n3kB/EZCViEp1IyASQ1YhthW3voI9sDny2fCOZ58uozYJllT5asKM3prsMkcC0dOSz g5GdatS+R5b4eGDSEIU/19TBmCXw1ipmwoSkWbo3hiqrgT6vgLMgoEDM2fss10S3M6aN V9Cg== X-Gm-Message-State: AOAM531DCDGWVAxeaD9tSmINin9aAukUG+n3FnKxuhFcIp0DKMh2r1Ip WVtYKRx0YX6RZqMHYlYf2TaMVWxiXdYefw== X-Google-Smtp-Source: ABdhPJyKq4xE34+nVpTCRfURL+rk/xgCA2QDDkJN0PnY5W2znn6ffmwwbNTD4y7nalL0RVn2F/QLrw== X-Received: by 2002:adf:f211:: with SMTP id p17mr11125988wro.169.1621627714770; Fri, 21 May 2021 13:08:34 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:d15:339e:aa10:60f1]) by smtp.gmail.com with ESMTPSA id y2sm3180585wrl.92.2021.05.21.13.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 13:08:34 -0700 (PDT) From: "Basil L. Contovounesios" To: Juri Linkov Subject: Re: bug#48456: Revert Dired after copy/rename References: <87v97j1xih.fsf@mail.linkov.net> <87v97en1tm.fsf@mail.linkov.net> <87cztkuede.fsf@mail.linkov.net> Date: Fri, 21 May 2021 21:08:33 +0100 In-Reply-To: <87cztkuede.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 21 May 2021 21:32:29 +0300") Message-ID: <87r1hz3l4u.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48456 Cc: 48456@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> It seems better to create a new option: >> >> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el >> index eb43ab187d..5df4d6b206 100644 >> --- a/lisp/dired-aux.el >> +++ b/lisp/dired-aux.el >> @@ -2065,6 +2065,24 @@ dired-create-files >> +(defcustom dired-do-revert-buffer nil > > Now pushed to master and closed. Thanks, but I now see: Test dired-test-bug30624 condition: (ert-test-failed ((should (dired-do-create-files 'copy 'dired-copy-file "Copy" nil)) :form (dired-do-create-files copy dired-copy-file "Copy" nil) :value nil)) Should the 'should' be removed? AFAICT the return value of dired-do-create-files is unspecified (and unused). -- Basil From debbugs-submit-bounces@debbugs.gnu.org Sat May 22 17:14:05 2021 Received: (at 48456) by debbugs.gnu.org; 22 May 2021 21:14:05 +0000 Received: from localhost ([127.0.0.1]:40167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkYwf-0003ZJ-6C for submit@debbugs.gnu.org; Sat, 22 May 2021 17:14:05 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:60713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkYwd-0003Yh-6T for 48456@debbugs.gnu.org; Sat, 22 May 2021 17:14:03 -0400 Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id C7046240002; Sat, 22 May 2021 21:13:55 +0000 (UTC) From: Juri Linkov To: "Basil L. Contovounesios" Subject: Re: bug#48456: Revert Dired after copy/rename Organization: LINKOV.NET References: <87v97j1xih.fsf@mail.linkov.net> <87v97en1tm.fsf@mail.linkov.net> <87cztkuede.fsf@mail.linkov.net> <87r1hz3l4u.fsf@tcd.ie> Date: Sun, 23 May 2021 00:06:23 +0300 In-Reply-To: <87r1hz3l4u.fsf@tcd.ie> (Basil L. Contovounesios's message of "Fri, 21 May 2021 21:08:33 +0100") Message-ID: <87v97amq2s.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 48456 Cc: 48456@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > Test dired-test-bug30624 condition: > (ert-test-failed > ((should > (dired-do-create-files 'copy 'dired-copy-file "Copy" nil)) > :form > (dired-do-create-files copy dired-copy-file "Copy" nil) > :value nil)) > > Should the 'should' be removed? AFAICT the return value of > dired-do-create-files is unspecified (and unused). It's hard to guess how important the return value was. It seems the return value of dired-do-create-files via dired-create-files and via dired-move-to-filename was the position of the beginning of the filename, or nil if none found. If it should be preserved, then dired-do-create-files could be changed to something like this: (prog1 (dired-create-files ... (when (or (eq dired-do-revert-buffer t) ... Otherwise, the 'should' should be replaced with diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el index 7f1743f88d..1fd14e72aa 100644 --- a/test/lisp/dired-aux-tests.el +++ b/test/lisp/dired-aux-tests.el @@ -109,7 +109,8 @@ dired-test-bug30624 (progn (dired-revert) (dired-mark-files-regexp "bug30624_file") - (should (dired-do-create-files 'copy 'dired-copy-file "Copy" nil))) + (dired-do-create-files 'copy 'dired-copy-file "Copy" nil) + (should (dired-move-to-filename))) (delete-directory target-dir 'recursive) (mapc #'delete-file `(,file1 ,file2)) (kill-buffer buf))))) From debbugs-submit-bounces@debbugs.gnu.org Mon May 24 07:04:26 2021 Received: (at 48456) by debbugs.gnu.org; 24 May 2021 11:04:26 +0000 Received: from localhost ([127.0.0.1]:42489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ll8Nm-0005Wn-Hq for submit@debbugs.gnu.org; Mon, 24 May 2021 07:04:26 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:44789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ll8Nj-0005WY-Sw for 48456@debbugs.gnu.org; Mon, 24 May 2021 07:04:25 -0400 Received: by mail-wr1-f43.google.com with SMTP id i17so28082315wrq.11 for <48456@debbugs.gnu.org>; Mon, 24 May 2021 04:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=LTc+tJejADmThG5w/OQpE6Ykhgz9PLHJE6ESNN5POdk=; b=g2gCVjh2f4uR35fTTfdNs0mEfPTN3bBfrwkxP6fnSp5VCCW4XN0MEbA5u5eK4e8WOs BgpI+mNGVjcKsG7aZaUmkcNDoIYVMz2OOf2nhnLEzQa0xEOlPTb57JRYzffN3cMn4GzF cIeG5Ko2m6hqgHooax2A36kGA2xowpl5z++Z2geW7NOoDSuRsc589YZbUu9RFBiAJHRF uovYJazf5HSkie0E0Bh9IGLEM3q7tWiAvqCv6vqijz2ucGJtg4ITkiFnaDi8Nj+MOWVh S+fWrEg5GPRAQ/Ej48eA2W8L9MZjqWRocQjoQDDKn5o6sguEmI+bnXKYe1vnpaOKjECO nceg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=LTc+tJejADmThG5w/OQpE6Ykhgz9PLHJE6ESNN5POdk=; b=uOX5INAhrEKJ4X7WFVeoiSmBhWAGVZLz/RHi+yr0h0wlS/FL0PeO77RfgTDuPl63YW wxRmel/5ZxgjrAsYKG9exZoWMbJtD61JRrifPQgxvRkYVvWvET2ibHdEwOoC0xzn1WrJ DyOBhp4Va4JJ2yha7zg8lfs27MG7veASo/e++WA+6zgSVhDd+ugR2bb13Yg+SA6oBW4T kXbwe6pV3mQ944hgH5laVNJeklfDhQp7WWU/WkB2w9Iy1ZiZbW3cDg3Imn+FpvuFDzUI JpdLkKaBs31Vaqz4MtAKMY7ZnssdOBrJoaT5+5TL99Mj3zDsx97JjI2HyC7KrjK98Yev wrJQ== X-Gm-Message-State: AOAM532a5f42+hspgG4ueUMebGrvfVtF2A9dunCq76R7IRTc1aZqJvxw Bbq4bknOZd5q0BZpmdOVpoe/XA== X-Google-Smtp-Source: ABdhPJyGSLqXDBiyZoLH3PzBhWOB/rpJF94DEAOm4enIm5YoGgzd7pOOHPFjpZ4Z2zB27RBbNuERKg== X-Received: by 2002:a05:6000:154c:: with SMTP id 12mr22252596wry.14.1621854257993; Mon, 24 May 2021 04:04:17 -0700 (PDT) Received: from localhost ([2a02:8084:20e2:c380:f410:82e8:3a21:eedf]) by smtp.gmail.com with ESMTPSA id z12sm9252786wmc.5.2021.05.24.04.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 04:04:17 -0700 (PDT) From: "Basil L. Contovounesios" To: Juri Linkov Subject: Re: bug#48456: Revert Dired after copy/rename References: <87v97j1xih.fsf@mail.linkov.net> <87v97en1tm.fsf@mail.linkov.net> <87cztkuede.fsf@mail.linkov.net> <87r1hz3l4u.fsf@tcd.ie> <87v97amq2s.fsf@mail.linkov.net> Date: Mon, 24 May 2021 12:04:14 +0100 In-Reply-To: <87v97amq2s.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 23 May 2021 00:06:23 +0300") Message-ID: <87fsycmlzl.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 48456 Cc: 48456@debbugs.gnu.org, Tino Calancha X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> Test dired-test-bug30624 condition: >> (ert-test-failed >> ((should >> (dired-do-create-files 'copy 'dired-copy-file "Copy" nil)) >> :form >> (dired-do-create-files copy dired-copy-file "Copy" nil) >> :value nil)) >> >> Should the 'should' be removed? AFAICT the return value of >> dired-do-create-files is unspecified (and unused). > > It's hard to guess how important the return value was. > It seems the return value of dired-do-create-files > via dired-create-files and via dired-move-to-filename > was the position of the beginning of the filename, > or nil if none found. > > If it should be preserved, then dired-do-create-files > could be changed to something like this: > > (prog1 (dired-create-files > ... > (when (or (eq dired-do-revert-buffer t) > ... > > Otherwise, the 'should' should be replaced with > > diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el > index 7f1743f88d..1fd14e72aa 100644 > --- a/test/lisp/dired-aux-tests.el > +++ b/test/lisp/dired-aux-tests.el > @@ -109,7 +109,8 @@ dired-test-bug30624 > (progn > (dired-revert) > (dired-mark-files-regexp "bug30624_file") > - (should (dired-do-create-files 'copy 'dired-copy-file "Copy" nil))) > + (dired-do-create-files 'copy 'dired-copy-file "Copy" nil) > + (should (dired-move-to-filename))) > (delete-directory target-dir 'recursive) > (mapc #'delete-file `(,file1 ,file2)) > (kill-buffer buf))))) Either (as well as ignoring the unspecified return value) sounds fine to me. CCing Tino for comment. Thanks, -- Basil From unknown Sat Jun 14 00:08:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 21 Jun 2021 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator