help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisp question: format


From: Kevin Rodgers
Subject: Re: elisp question: format
Date: Wed, 27 Jun 2007 22:39:46 -0600
User-agent: Thunderbird 1.5.0.12 (Macintosh/20070509)

Aaron Maxwell wrote:
Hi,

Is there a way to direct the format function to use a single value
repeatedly for several positional parameters?

Here's the specific example of what I mean.  In my .emacs, the
following string is used:
"/home/amax/opt/scmutils/mit-scheme/bin/scheme --band 
/home/amax/opt/scmutils/mit-scheme/lib/edwin-mechanics.com --heap 6000 --library 
/home/amax/opt/scmutils/mit-scheme/lib"

(See [1] if you're curious what it's for.)  The substring 
"/home/amax/opt/scmutils/mit-scheme" repeats 3 times. The idea I had is to use 
a format string like:

(format "%s/bin/scheme --band %s/lib/edwin-mechanics.com --heap 6000 --library 
%s/lib" ...(something)...)

... and to do this in a way that I only had to type that substring
once.  However, I did not find a way to do this directly.  The closest
thing I came up with is this:

(apply 'format (cons "%s/bin/scheme --band %s/lib/edwin-mechanics.com --heap 6000 --library %s/lib" (make-list 3 "/home/amax/opt/scmutils/mit-scheme")))

Is there a clearer way to do this?

(let ((scheme-home "/home/amax/opt/scmutils/mit-scheme"))
(format "%s/bin/scheme --band %s/lib/edwin-mechanics.com --heap 6000 --library %s/lib"
          scheme-home scheme-home scheme-home))

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]