[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval-last-sexp in other window
From: |
Bob Babcock |
Subject: |
Re: eval-last-sexp in other window |
Date: |
Wed, 01 Apr 2009 02:10:31 +0000 |
User-agent: |
Xnews/2006.08.24 |
pjb@informatimago.com (Pascal J. Bourguignon) wrote in
news:87bpri9lhd.fsf@galatea.local:
>> (defun last-sexp-other-window()
>> "Get last sexp and run it in other window.
>> If there isn't another window, use current window."
>> (interactive)
>> (setq ow-sexp (preceding-sexp))
>> (other-window 1) (eval ow-sexp) (other-window -1) )
>
> At the very least, use let, not setq!
>
> (defun last-sexp-other-window()
> "Get last sexp and run it in other window.
> If there isn't another window, use current window."
> (interactive)
> (let ((ow-sexp (preceding-sexp)))
> (other-window 1)
> (eval ow-sexp)
> (other-window -1)))
I will admit that I was surprised when setq worked in this context.
Perhaps there are cases where setq would fail?
- Re: eval-last-sexp in other window,
Bob Babcock <=