From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: Re: info inconsistency about "Shell Commands in Dired" Date: Sun, 22 Aug 2004 23:00:16 +0900 (JST) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <20040822.230016.104028620.jet@gyve.org> References: <20040822.213334.41627640.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1093183375 30126 80.91.224.253 (22 Aug 2004 14:02:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Aug 2004 14:02:55 +0000 (UTC) Cc: teirllm@dms.auburn.edu, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 22 16:02:49 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bysvp-0000v8-00 for ; Sun, 22 Aug 2004 16:02:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Byt0E-0000mg-JA for ged-emacs-devel@m.gmane.org; Sun, 22 Aug 2004 10:07:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Byt08-0000mb-EC for emacs-devel@gnu.org; Sun, 22 Aug 2004 10:07:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Byt05-0000mP-Tt for emacs-devel@gnu.org; Sun, 22 Aug 2004 10:07:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Byt05-0000mM-Qh for emacs-devel@gnu.org; Sun, 22 Aug 2004 10:07:13 -0400 Original-Received: from [210.130.136.40] (helo=r-maa.spacetown.ne.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BysvJ-0006dJ-Ov; Sun, 22 Aug 2004 10:02:18 -0400 Original-Received: from localhost (h219-110-074-165.catv01.itscom.jp [219.110.74.165]) by r-maa.spacetown.ne.jp (8.11.6) with ESMTP id i7ME2GE01121; Sun, 22 Aug 2004 23:02:16 +0900 (JST) Original-To: dak@gnu.org In-Reply-To: X-Mailer: Mew version 4.0.62 on Emacs 21.3.50 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:26400 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26400 > > > > 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.