all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dave Goel <deego3@gmail.com>
Cc: luangruo@yahoo.com, emacs-devel@gnu.org
Subject: Re: Dired delete(d) the wrong file!
Date: Fri, 05 Jul 2024 10:33:34 +0300	[thread overview]
Message-ID: <86h6d470oh.fsf@gnu.org> (raw)
In-Reply-To: <CAOCW0Djg83m5LESyvqGo5TgVvYGx=0v64XLgfZhc=LEOdROhtA@mail.gmail.com> (message from Dave Goel on Fri, 5 Jul 2024 01:50:16 -0400)

> From: Dave Goel <deego3@gmail.com>
> Date: Fri, 5 Jul 2024 01:50:16 -0400
> Cc: Po Lu <luangruo@yahoo.com>, 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.



  reply	other threads:[~2024-07-05  7:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 22:36 Dired delete(d) the wrong file! Dave Goel
2024-07-04 23:35 ` Dave Goel
2024-07-05  1:40   ` Dave Goel
2024-07-05  8:01     ` Tassilo Horn
2024-07-05  1:24 ` Po Lu
2024-07-05  5:43   ` Eli Zaretskii
2024-07-05  5:50     ` Dave Goel
2024-07-05  7:33       ` Eli Zaretskii [this message]
2024-07-05  8:06         ` Dave Goel
2024-07-05  8:12           ` Dave Goel
2024-07-05  8:26             ` Dave Goel
2024-07-05  8:39               ` Dave Goel
2024-07-05 11:05                 ` Eli Zaretskii
2024-07-05 19:02                   ` Dave Goel
2024-07-05 11:00               ` Eli Zaretskii
2024-07-05  9:53         ` Stefan Kangas
2024-07-05 10:52           ` Eli Zaretskii
2024-07-05 23:28         ` Michael Heerdegen via Emacs development discussions.
2024-07-06  6:17           ` Eli Zaretskii
2024-07-05  5:50     ` Po Lu
2024-07-05  7:11       ` Michael Heerdegen via Emacs development discussions.

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=86h6d470oh.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=deego3@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.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.