[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval-last-sexp in other window
From: |
Xavier Maillard |
Subject: |
Re: eval-last-sexp in other window |
Date: |
Tue, 31 Mar 2009 22:25:06 +0200 |
User-agent: |
Rmail GNU emacs 23.0 on Slackware 12.2.0 |
pjb@informatimago.com (Pascal J. Bourguignon) wrote in
news:87d4bzbfky.fsf@galatea.local:
>> Is there a way to have eval-last-sexp (typically bound to C-xC-e) run
>> in a different window? This would be convenient when developing a
>> macro that reformats text - I want the part of the macro I'm testing
>> to be applied to the file being reformatted, not to my macro.
>
> You may use M-: to apply a form to the current buffer.
>
>
> Otherwise:
>
> (with-current-buffer (get-buffer "The Other Buffer Name")
> (do-what-you-want)) C-x C-e
Thanks. After several false starts, I have a simple macro that seems to do
what I want:
(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) )
Why not use let instead of setq ?
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org