From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bob Babcock Newsgroups: gmane.emacs.help Subject: Re: eval-last-sexp in other window Date: Wed, 01 Apr 2009 02:10:31 +0000 Organization: FlashNewsgroups.com Message-ID: References: <87d4bzbfky.fsf@galatea.local> <87bpri9lhd.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1238561187 27673 80.91.229.12 (1 Apr 2009 04:46:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Apr 2009 04:46:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 01 06:47:45 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LosMb-0005fo-6D for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Apr 2009 06:47:45 +0200 Original-Received: from localhost ([127.0.0.1]:35460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LosLD-0000pJ-Kv for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Apr 2009 00:46:19 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7yQUZ7CaYQxA!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Xnews/2006.08.24 Original-X-Complaints-To: abuse@flashnewsgroups.com Original-Lines: 23 Original-X-Trace: d504f49d2cd17c740dc9127530 Original-Xref: news.stanford.edu gnu.emacs.help:168142 X-Mailman-Approved-At: Wed, 01 Apr 2009 00:44:08 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63429 Archived-At: 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?