* bug#58256: Possible mistake in recent `dired-do-flagged-delete' change
@ 2022-10-02 18:42 Stefan Kangas
2022-10-02 19:17 ` Stefan Kangas
2022-10-02 20:46 ` Stephen Berman
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Kangas @ 2022-10-02 18:42 UTC (permalink / raw)
To: 58256; +Cc: Stephen Berman
It seems like there might be a mistake in the `dired-do-flagged-delete'
of this commit:
commit 194d54a929a83fede75d618b104acd1b544feb10
Author: Stephen Berman <stephen.berman@gmx.net>
Date: Fri Jun 4 12:01:41 2021 +0200
Fix placement of point in Dired deletion operations
It seems like there is a `dolist' that will always run on the empty
list. Was perhaps the below the intended change?
If so, I wonder how this code would have worked without that `dolist' so
far, and if that line could just be removed instead?
diff --git a/lisp/dired.el b/lisp/dired.el
index b9e89292e2..358e815c88 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3664,16 +3664,17 @@ dired-do-flagged-delete
case-fold-search markers)
(if (save-excursion (goto-char (point-min))
(re-search-forward regexp nil t))
- (dired-internal-do-deletions
- (nreverse
- ;; this can't move point since ARG is nil
- (dired-map-over-marks (cons (dired-get-filename)
- (let ((m (point-marker)))
- (push m markers)
- m))
- nil))
- nil t)
- (dolist (m markers) (set-marker m nil))
+ (progn
+ (dired-internal-do-deletions
+ (nreverse
+ ;; this can't move point since ARG is nil
+ (dired-map-over-marks (cons (dired-get-filename)
+ (let ((m (point-marker)))
+ (push m markers)
+ m))
+ nil))
+ nil t)
+ (dolist (m markers) (set-marker m nil)))
(or nomessage
(message "(No deletions requested)")))))
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#58256: Possible mistake in recent `dired-do-flagged-delete' change
2022-10-02 18:42 bug#58256: Possible mistake in recent `dired-do-flagged-delete' change Stefan Kangas
@ 2022-10-02 19:17 ` Stefan Kangas
2022-10-02 20:46 ` Stephen Berman
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2022-10-02 19:17 UTC (permalink / raw)
To: 58256; +Cc: Stephen Berman
[-- Attachment #1: Type: text/plain, Size: 276 bytes --]
Stefan Kangas <stefankangas@gmail.com> writes:
> If so, I wonder how this code would have worked without that `dolist' so
> far, and if that line could just be removed instead?
The command seems to be working correctly with the attached patch.
Am I missing something here?
[-- Attachment #2: 0001-lisp-dired.el-dired-do-flagged-delete-Simplify.patch --]
[-- Type: text/x-diff, Size: 1313 bytes --]
From 6500b271658a7a71ff8856b2f423d87557307bbf Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sun, 2 Oct 2022 21:08:40 +0200
Subject: [PATCH] * lisp/dired.el (dired-do-flagged-delete): Simplify.
---
lisp/dired.el | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/lisp/dired.el b/lisp/dired.el
index b9e89292e2..7d3940832a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3661,19 +3661,13 @@ dired-do-flagged-delete
(interactive)
(let* ((dired-marker-char dired-del-marker)
(regexp (dired-marker-regexp))
- case-fold-search markers)
+ case-fold-search)
(if (save-excursion (goto-char (point-min))
(re-search-forward regexp nil t))
- (dired-internal-do-deletions
+ (dired-internal-do-deletions
(nreverse
- ;; this can't move point since ARG is nil
- (dired-map-over-marks (cons (dired-get-filename)
- (let ((m (point-marker)))
- (push m markers)
- m))
- nil))
+ (dired-map-over-marks (cons (dired-get-filename) (point-marker)) nil))
nil t)
- (dolist (m markers) (set-marker m nil))
(or nomessage
(message "(No deletions requested)")))))
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#58256: Possible mistake in recent `dired-do-flagged-delete' change
2022-10-02 18:42 bug#58256: Possible mistake in recent `dired-do-flagged-delete' change Stefan Kangas
2022-10-02 19:17 ` Stefan Kangas
@ 2022-10-02 20:46 ` Stephen Berman
2022-10-02 22:30 ` Stefan Kangas
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Berman @ 2022-10-02 20:46 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 58256
On Sun, 2 Oct 2022 20:42:17 +0200 Stefan Kangas <stefankangas@gmail.com> wrote:
> It seems like there might be a mistake in the `dired-do-flagged-delete'
> of this commit:
>
> commit 194d54a929a83fede75d618b104acd1b544feb10
> Author: Stephen Berman <stephen.berman@gmx.net>
> Date: Fri Jun 4 12:01:41 2021 +0200
>
> Fix placement of point in Dired deletion operations
>
> It seems like there is a `dolist' that will always run on the empty
> list. Was perhaps the below the intended change?
Yeah, it looks like I mistakenly put the dolist in the 'else' clause
instead of the 'then' clause. Thanks for catching that.
On Sun, 2 Oct 2022 19:17:27 +0000 Stefan Kangas <stefankangas@gmail.com> wrote:
> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> If so, I wonder how this code would have worked without that `dolist' so
>> far, and if that line could just be removed instead?
>
> The command seems to be working correctly with the attached patch.
>
> Am I missing something here?
I think doing it that way leaves the markers in the buffer, though
probably for typical use cases that's not a problem, and it is simpler
that way (as I noted when I posted my patch). I guess the same
simplification can be applied to `dired-do-delete' as well.
Steve Berman
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#58256: Possible mistake in recent `dired-do-flagged-delete' change
2022-10-02 20:46 ` Stephen Berman
@ 2022-10-02 22:30 ` Stefan Kangas
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2022-10-02 22:30 UTC (permalink / raw)
To: Stephen Berman; +Cc: 58256
close 58256 29.1
thanks
Stephen Berman <stephen.berman@gmx.net> writes:
> Yeah, it looks like I mistakenly put the dolist in the 'else' clause
> instead of the 'then' clause. Thanks for catching that.
[...]
> I think doing it that way leaves the markers in the buffer, though
> probably for typical use cases that's not a problem, and it is simpler
> that way (as I noted when I posted my patch). I guess the same
> simplification can be applied to `dired-do-delete' as well.
OK. Let's stick with the more correct way and actually delete the
markers.
I've done this in commit 0d0d59b32c, and I'm closing this bug report.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-02 22:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-02 18:42 bug#58256: Possible mistake in recent `dired-do-flagged-delete' change Stefan Kangas
2022-10-02 19:17 ` Stefan Kangas
2022-10-02 20:46 ` Stephen Berman
2022-10-02 22:30 ` Stefan Kangas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).