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.devel Subject: Re: Dired delete(d) the wrong file! Date: Fri, 05 Jul 2024 10:33:34 +0300 Message-ID: <86h6d470oh.fsf@gnu.org> References: <86r0c875s4.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5778"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org To: Dave Goel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 05 09:34:49 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sPdSy-0001An-SH for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Jul 2024 09:34:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPdRy-0008Oi-6I; Fri, 05 Jul 2024 03:33:46 -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 1sPdRv-0008MV-Rz for emacs-devel@gnu.org; Fri, 05 Jul 2024 03:33:43 -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 1sPdRv-0003yw-IK; Fri, 05 Jul 2024 03:33:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3lsiwE1GLNEqTYvMTqG/o2bDTLobG8riUNHQvDNOOx4=; b=gZejaji828r1 8HZ62j/Fb7wO7zeEU+CQjKV6u/2KtCfS95WHNjs8wdROxI+qLLOGtX3BLanOQeo6RPPUkw2smxGrO xeo5iZjoC9RR3kPHCUHrbJVnJpl0ANp4fEV8e1nT0I/th6nHpduLqdyK8nrsXkvKTxJr6D2Wq5bHT IJaO9EdTlU01XFgRqMCfZ4oJ0o5CIsPhMRYNaNtN0Kt8nutBILGKqdTJEEulZYuwlzbjF14M0qpfl rqjOsLtz2B8pJ0uhHKOLE5OI509AitWPPotCvJU1Zhuk7trvAWLwlXkN7Vwkv+l618vpegia2WcHH sxV5Bi43npJwuvkQzwtm3w==; In-Reply-To: (message from Dave Goel on Fri, 5 Jul 2024 01:50:16 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321380 Archived-At: > From: Dave Goel > Date: Fri, 5 Jul 2024 01:50:16 -0400 > Cc: Po Lu , emacs-devel@gnu.org > > I just tested, and the MRE I provided continues to hold if I modify the instructions to - > (setq dired-listing-switches "-alFD") Adding 'D' is pointless, since Emacs adds --dired anyway. The problem is with 'F': it triggers a (very old) bug whereby we mistakenly don't trust the --dired information. Then the problem is that the offending file name "07 nov 2395 zz.kk" looks like a date followed by a file "zz.kk". Please try the patch below (you will need to rebuild Emacs for it to take effect, or extract insert-directory-clean from files.el, make the change as below, and then evaluate the changed function): diff --git a/lisp/files.el b/lisp/files.el index 042b8e2..c518273 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -8087,8 +8087,8 @@ insert-directory-clean (end (insert-directory-adj-pos (+ beg (read (current-buffer))) error-lines))) - (if (memq (char-after end) '(?\n ?\s)) - ;; End is followed by \n or by " -> ". + (if (memq (char-after end) '(?\n ?\s ?/ ?* ?@ ?% ?= ?|)) + ;; End is followed by \n or by output of -F. (put-text-property start end 'dired-filename t) ;; It seems that we can't trust ls's output as to ;; byte positions of filenames.