From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Trying to return focus to a window Date: Sun, 23 Nov 2008 22:10:00 +0100 Organization: A noiseless patient Spider Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1227476466 11296 80.91.229.12 (23 Nov 2008 21:41:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Nov 2008 21:41:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 23 22:42:09 2008 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 1L4MiS-0003VZ-AT for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Nov 2008 22:42:04 +0100 Original-Received: from localhost ([127.0.0.1]:35799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4MhJ-000766-0L for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Nov 2008 16:40:53 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin2!goblin.stu.neva.ru!feeder1.news.weretis.net!newsfeeder.dynfx.net!weretis.net!news.motzarella.org!motzarella.org!news.motzarella.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-X-Trace: news.motzarella.org U2FsdGVkX1+1uxbo8jlFUDYeYC5KXsoS7Y0lCsxhh5CbEDFQFKB4a3SZm2QnFGC0Xi+LLFcww4A01BAaWaLWhg1gXdZ7frTGi5oXtzf96l7jNfAPDSKLosJvxc1B/DrMy4ZOP+4n/7C4MId/GDy86w== Original-X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers Original-NNTP-Posting-Date: Sun, 23 Nov 2008 21:10:40 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/+f7YBeC0vvAp8o0krAYQnhP/tVXK5HBy6mr2/A4MfiQ== Cancel-Lock: sha1:LQK8Cb8oWGgPXF7XgFF41xbwM7A= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:164709 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:60038 Archived-At: I have tried two ways to have the focus return to the source buffer/window when "execute buffer" is done using python integration as outlined here : http://www.emacswiki.org/emacs/PythonMode#toc10 The two ways I have tried (both using defadvice) are: ,---- | ;; (defadvice py-execute-buffer (around stay-current-buffer activate) | ;; "This advice make cursor stay current position after execute `py-execute-buffer'." | ;; (save-excursion | ;; ad-do-it) | ;; (message "py-execute-function done")) | | (defadvice py-execute-buffer (around stay-current-buffer activate) | "This advice make cursor stay current position after execute `py-execute-buffer'." | (let ((remember-point (point)) | (remember-window (selected-window))) | ad-do-it | (message "focus stuff done") | (select-window remember-window) | (goto-char remember-point))) `---- But in both cases the cursor stays in the iPython window (same frame). Can someone suggest how best to get the cursor back into the python buffer when I execute py-execute-buffer? is there something fundamentally wrong with the approach I have taken above or a naive code error? thanks, r.