unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Bob Babcock <wssddc@nospam.gis.net>
To: help-gnu-emacs@gnu.org
Subject: Re: eval-last-sexp in other window
Date: Wed, 01 Apr 2009 02:10:31 +0000	[thread overview]
Message-ID: <Xns9BDFE194A8BF0wssddcgisnet@74.209.131.18> (raw)
In-Reply-To: 87bpri9lhd.fsf@galatea.local

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?


  reply	other threads:[~2009-04-01  2:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30  4:22 eval-last-sexp in other window Bob Babcock
2009-03-30  8:05 ` Pascal J. Bourguignon
2009-03-31  4:42   ` Bob Babcock
2009-03-31  7:53     ` Pascal J. Bourguignon
2009-04-01  2:10       ` Bob Babcock [this message]
2009-04-01  9:09         ` Pascal J. Bourguignon
  -- strict thread matches above, loose matches on Subject: below --
2009-03-31 20:25 Xavier Maillard
     [not found] <mailman.4338.1238531287.31690.help-gnu-emacs@gnu.org>
2009-03-31 20:29 ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Xns9BDFE194A8BF0wssddcgisnet@74.209.131.18 \
    --to=wssddc@nospam.gis.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).