GNU bug report logs -
#48072
28.0.50: dired-read-shell-command: handle empty input properly [PATCH]
Previous Next
Full log
View this message in rfc822 format
On 2021-04-28 13:03, Michael Albinus wrote:
> Boruch Baum <boruch_baum <at> gmx.com> writes:
> >
> > + (unless (executable-find command)
> > + (user-error "Not a valid command!"))
>
> This doesn't check the remote case.
Good point. It's an area of dired I'm weak in because I don't use it.
How about the following (with the update diredc regex):
(unless (executable-find
(if (string-match "^ *\\([^ ]+\\) " command)
(substring command (match-beginning 1) (match-end 1))
command)
(file-remote-p file))
(user-error "Not a valid command!"))
The snippet is currently in three separate points in diredc with slight
differences (defsubst called-for). For preparing the completion
candidates, the snippet is there at function
diredc--advice--shell-guess-fallback.
For the post-input check (`diredc--advice--dired-read-shell-command',
and with a tweak, also `diredc-do-async-shell-command'), how about this
for checking that the command is valid for all selected file:
(unless (executable-find
(if (string-match "^ *\\([^ ]+\\) " command)
(substring command (match-beginning 1) (match-end 1))
command)
(let ((f files)
remote-found)
(while (and f (not (setq remote-found (file-remote-p (pop f))))))
remote-found))
(user-error "Not a valid command!"))
ref: https://github.com/Boruch-Baum/emacs-diredc
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
This bug report was last modified 3 years and 331 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.