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

[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

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? 

Thanks in advance.

[1] http://redsymbol.blogspot.com/2007/06/using-gnu-emacs-with-scmutils.html
-- 
Aaron Maxwell
http://redsymbol.net

Business Owners and Self-Employed:  You're NOT Alone!
The Business Butler - http://businessbutler.us




reply via email to

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