[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval-last-sexp in other window
From: |
Pascal J. Bourguignon |
Subject: |
Re: eval-last-sexp in other window |
Date: |
Tue, 31 Mar 2009 22:29:42 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) |
Xavier Maillard <xma@gnu.org> writes:
> 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 ?
À mon avis, c'est par pure méchanceté.
--
__Pascal Bourguignon__