unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: elisp question: format
Date: Wed, 27 Jun 2007 22:39:46 -0600	[thread overview]
Message-ID: <f5ve2h$1u5$1@sea.gmane.org> (raw)
In-Reply-To: <200706232356.06328.amax@redsymbol.net>

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	other threads:[~2007-06-28  4:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-24  6:56 elisp question: format Aaron Maxwell
2007-06-28  4:39 ` Kevin Rodgers [this message]
     [not found] ` <mailman.2722.1183005606.32220.help-gnu-emacs@gnu.org>
2007-06-29 13:26   ` Joel J. Adamson
     [not found] <mailman.2558.1182668174.32220.help-gnu-emacs@gnu.org>
2007-06-24  9:00 ` Pascal Bourguignon
2007-06-24 11:22 ` Daniel Jensen
2007-06-25  8:59   ` Aaron Maxwell

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='f5ve2h$1u5$1@sea.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).