From: Masatake YAMATO <jet@gyve.org>
Cc: teirllm@dms.auburn.edu, emacs-devel@gnu.org
Subject: Re: info inconsistency about "Shell Commands in Dired"
Date: Sun, 22 Aug 2004 23:00:16 +0900 (JST) [thread overview]
Message-ID: <20040822.230016.104028620.jet@gyve.org> (raw)
In-Reply-To: <x58yc7nxbb.fsf@lola.goethe.zz>
> > > > How do you think using `format' function directly instead of `?' ?
> > > >
> > > > e.g.
> > > >
> > > > uuencode %s %s > %s.uu
> > > >
> > > > Advantage:
> > > > - If the user want to `%' itself in the command line, format function
> > > > can handle it:
> > > >
> > > > echo %%s
> > > >
> > > > - Implementation is not so difficult(for us).
> > >
> > > Not? How do you call the format function? Depends on the number of
> > > %s...
> >
> > Good point.
> > I found next code works.
> >
> > (apply 'format "echo %s" '("a" "a" "a"))
> > => "echo a"
> >
> > So we can pass arguments as much as possible:-P.
>
> As much as possible?
> (apply 'format "echo %s %s %s %s" '#1=("a" . #1#))
>
> Just turns out that apply is not too happy about passing infinitely
> long argument lists on.
Sorry. "as much as possible" is wrong expression.
What I'd like to say is:
(defun count-%s (string)
(let ((count 0)
(pos 0))
(while (string-match "%s" string pos)
(setq pos (match-end 0))
(setq count (1+ count)))
count))
(let ((cmdline "echo %s %s %s %s")
(filenanme "a"))
(apply 'format cmdline (make-list (count-%s cmdline) filenanme)))
=> "echo a a a a"
However, we don't have to take care about "%%s".
Even if %%s is appeared on the `cmdline', we can count it as one.
Giving the `filename' as arguments for `format' more than necessary is
ok.
(let ((cmdline "echo %%s %%s %%s %s")
(filenanme "a"))
(apply 'format cmdline (make-list (count-%s cmdline) filenanme)))
=> "echo %s %s %s a"
Anyway, I think using an environment varaible method I wrote in
another mail is better than this method.
next prev parent reply other threads:[~2004-08-22 14:00 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 19:08 info inconsistency about "Shell Commands in Dired" Masatake YAMATO
2004-08-21 0:40 ` Luc Teirlinck
2004-08-21 6:38 ` Masatake YAMATO
2004-08-21 20:18 ` Luc Teirlinck
2004-08-22 16:52 ` Richard Stallman
2004-08-21 20:35 ` Luc Teirlinck
2004-08-22 3:55 ` Eli Zaretskii
2004-08-22 4:05 ` Luc Teirlinck
2004-08-21 20:40 ` Luc Teirlinck
2004-08-21 21:24 ` Luc Teirlinck
2004-08-21 10:02 ` Eli Zaretskii
2004-08-21 16:50 ` Richard Stallman
2004-08-21 17:12 ` David Kastrup
2004-08-21 22:49 ` Luc Teirlinck
2004-08-21 23:08 ` Luc Teirlinck
2004-08-21 23:12 ` Luc Teirlinck
2004-08-22 4:17 ` Masatake YAMATO
2004-08-22 7:11 ` David Kastrup
2004-08-22 12:33 ` Masatake YAMATO
2004-08-22 12:59 ` David Kastrup
2004-08-22 14:00 ` Masatake YAMATO [this message]
2004-08-22 12:43 ` Masatake YAMATO
2004-08-22 15:31 ` Luc Teirlinck
2004-08-22 16:03 ` Masatake YAMATO
2004-08-22 19:46 ` Luc Teirlinck
2004-08-25 4:41 ` Masatake YAMATO
2004-08-22 15:00 ` Luc Teirlinck
2004-08-22 15:39 ` Masatake YAMATO
2004-08-23 23:26 ` Richard Stallman
2004-08-25 22:36 ` Luc Teirlinck
2004-08-26 4:52 ` Richard Stallman
2004-08-26 21:16 ` Luc Teirlinck
2004-08-27 16:59 ` Richard Stallman
2004-08-27 17:25 ` David Kastrup
2004-08-27 17:49 ` Luc Teirlinck
2004-08-28 16:48 ` Richard Stallman
2004-08-29 20:33 ` Juri Linkov
2004-08-30 16:05 ` Richard Stallman
2004-08-25 23:10 ` Luc Teirlinck
2004-08-26 7:28 ` Kim F. Storm
2004-08-26 14:53 ` Luc Teirlinck
2004-08-26 20:53 ` Richard Stallman
2004-08-27 7:21 ` Kim F. Storm
2004-08-28 1:35 ` Richard Stallman
2004-08-22 16:52 ` Richard Stallman
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=20040822.230016.104028620.jet@gyve.org \
--to=jet@gyve.org \
--cc=emacs-devel@gnu.org \
--cc=teirllm@dms.auburn.edu \
/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.