[Top][All Lists]

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

elisp question: format

From: Aaron Maxwell
Subject: elisp question: format
Date: Sat, 23 Jun 2007 23:56:06 -0700
User-agent: KMail/1.9.5


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/ --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/ --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/ --heap 6000 
--library %s/lib" 
       (make-list 3 "/home/amax/opt/scmutils/mit-scheme")))

Is there a clearer way to do this? 

Thanks in advance.

Aaron Maxwell

Business Owners and Self-Employed:  You're NOT Alone!
The Business Butler -

reply via email to

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