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

[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: Tue, 31 Mar 2009 04:42:01 +0000
User-agent: Xnews/2006.08.24

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) )

This doesn't call the debugger on error, but that's ok.


reply via email to

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