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

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

Re: problem with elisp


From: Barry Margolin
Subject: Re: problem with elisp
Date: Wed, 08 Oct 2008 15:25:02 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.606.1223492748.25473.help-gnu-emacs@gnu.org>,
 Nikolaj Schumacher <me@nschum.de> wrote:

> Seweryn Kokot <sewkokot@gmail.com> wrote:
> 
> > Could you explain to me why the following function doesn't work in the first
> > version and when swapping line
> >     (let ((string-temp (make-temp-name "")))
> > with
> >     (let ((string-temp "@temp@"))
> > it works correctly?
> 
> Could you specify what's not working?  It seems to work for me.
> 
> `make-temp-name' is not a good idea for what you're doing, though.
> While the same string will never be returned twice, there is no
> guarantee that the string doesn't exist in your buffer.  So make sure
> you use a very unique prefix.  On the other hand, there's no added
> benefit from using `make-temp-name' instead of just the prefix.

Unless you try to use the function in the buffer containing the 
function's source code, since the prefix is guaranteed to exist in that 
buffer.  If you use make-temp-name with a suitably random prefix, the 
chance of an unintended match should be negligible.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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