emacs-devel
[Top][All Lists]
Advanced

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

Re: Occur stack


From: Daniel Colascione
Subject: Re: Occur stack
Date: Sat, 18 Jan 2014 23:12:32 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/18/2014 10:40 PM, Tom wrote:
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:


      (eval `(let ((dir default-directory)
                   (args command-args))
               (lambda ()
                 (let ((default-directory dir))
                   (grep-find args))))
            t))))

Yuck!


This is the first time I used closures, so it may be crude.

Is there a simpler way to write this? First I tried to
set default-directory in the outer let, but then it had
apparently no effect on grep-find.

That's because default-directory is marked special and so we don't close over its value.

Hmm, I tried it again and it worked, so I must have had
some other error when I wrote this.

Is this the simplest way then? Or can it be simplified more?

      (eval `(let ((default-directory default-directory)
                   (args command-args))
               (lambda ()
                 (grep-find args)))
            t))))

What about this? (Untested.)

(let ((dd-value default-directory))
  (lamda () (let ((default-directory dd-value))
              (grep-find args))))



reply via email to

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