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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to return focus to a window


From: Kevin Rodgers
Subject: Re: Trying to return focus to a window
Date: Sun, 23 Nov 2008 21:46:34 -0700
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

Richard Riley wrote:
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?

You could try save-selected-window instead of save-excursion.

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

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