From: Boruch Baum <boruch_baum@gmx.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 48072@debbugs.gnu.org
Subject: bug#48072: 28.0.50: dired-read-shell-command: handle empty input properly [PATCH]
Date: Wed, 28 Apr 2021 08:00:11 -0400 [thread overview]
Message-ID: <20210428120011.5g73ctmekbff42gf@E15-2016.optimum.net> (raw)
In-Reply-To: <87y2d2brhy.fsf@gmx.de>
On 2021-04-28 13:03, Michael Albinus wrote:
> Boruch Baum <boruch_baum@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
next prev parent reply other threads:[~2021-04-28 12:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 19:02 bug#48072: 28.0.50: dired-read-shell-command: handle empty input properly [PATCH] Boruch Baum
2021-04-27 19:19 ` Eli Zaretskii
2021-04-27 19:32 ` Boruch Baum
2021-04-28 2:22 ` Eli Zaretskii
2021-04-28 3:00 ` Boruch Baum
2021-04-28 6:19 ` Kévin Le Gouguec
2021-04-28 9:33 ` Boruch Baum
2021-04-28 9:50 ` Boruch Baum
2021-04-28 11:58 ` Eli Zaretskii
2021-04-28 12:49 ` Boruch Baum
2021-04-28 13:03 ` Eli Zaretskii
2021-04-28 15:01 ` Boruch Baum
2021-04-28 15:13 ` Eli Zaretskii
2021-04-28 15:21 ` Boruch Baum
2021-04-28 15:52 ` Eli Zaretskii
2021-04-28 17:10 ` Michael Albinus
2021-04-28 15:16 ` Boruch Baum
2021-04-28 11:47 ` Eli Zaretskii
2021-04-28 11:03 ` Michael Albinus
2021-04-28 12:00 ` Boruch Baum [this message]
2021-04-28 12:13 ` Michael Albinus
2021-04-28 12:46 ` Boruch Baum
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210428120011.5g73ctmekbff42gf@E15-2016.optimum.net \
--to=boruch_baum@gmx.com \
--cc=48072@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
/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 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).