GNU bug report logs -
#30938
27.0; `dired-do-create-files' etc.: do NOT always raise error if no files
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Sun, 25 Mar 2018 16:37:01 UTC
Severity: minor
Found in version 27.0
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> I might agree that it's a bug if I understand it. But since you
> refuse to explain it, I guess I never will.
Maybe this will help (but I doubt it) -
1. Existing Dired+ command (updated to accommodate this bug by
adding INTERACTIVEP and passing that to `dired-get-marked-files'):
(defun diredp-insert-subdirs (&optional switches interactivep)
"Insert the marked subdirectories.
Like using \\<dired-mode-map>`\\[dired-maybe-insert-subdir]' at \
each marked directory line."
(interactive
(list (and current-prefix-arg
(read-string
"Switches for listing: "
(or dired-subdir-switches dired-actual-switches)))
t))
(dolist (subdir
(dired-get-marked-files
nil nil
(lambda (fl)
(and (file-directory-p fl)
(not (diredp-string-match-p "/[.][.]?\\'" fl))))
nil
interactivep))
(dired-maybe-insert-subdir subdir switches)))
Imaginary function that uses that command as a utility:
(defun insert-marked-subdirs-and-do-stuff ()
(DO-STUFF)
(diredp-insert-subdirs)
(DO-OTHER-STUFF))
If you assume that the insertion of marked subdirs is
not a requirement for the main behavior of this function,
e.g., that it acts on any that get inserted but it doesn't
_require_ any such insertions to do its job in general,
then without some change as proposed this function can
end in error without ever trying to DO-OTHER-STUFF.
I'm arguing that similar considerations can apply to
other existing commands.
Whether each such case is actually problematic is not
so important (IMO). The point is for individual such
commands to, a priori, treat the non-interactive case
separately.
A non-interactive use case for an arbitrary command that
calls ` dired-get-marked-files' does not necessarily
have `user-error' as the right behavior for an empty set
of marked files. That's all I'm saying.
This bug report was last modified 3 years and 30 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.