all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Transferring focus to Emacs
@ 2011-06-14 16:45 Joe Riel
  2011-06-14 17:10 ` Thierry Volpiatto
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Riel @ 2011-06-14 16:45 UTC (permalink / raw)
  To: help-gnu-emacs

I want a separate program to give the focus to Emacs, and put the
cursor in a particular (existing) buffer.
   
Using emacsclient doesn't work, for example

$ emacsclient --eval '(pop-to-buffer "my-buffer")'

That does pop-up and select the buffer, however, after the command
executes, the window manager returns the focus to the xterm that
evaluated the command.  I want focus to remain in Emacs.

The "normal" call to emacsclient, with a filename, does not help
because that opens a file.  I want it to open an existing buffer.

Alternatively, emacs itself can issue whatever command is needed (I'm
communicating with emacs via another link).  Hmm.  Probably I need to
be sending the command to the window manager rather than Emacs (this
is on X). Is there an Emacs command that tells the window manager to
give the focus to Emacs (which might be on a different desktop)?
Alas, I'll want similar capability in a Windows 7 environment.

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Transferring focus to Emacs
  2011-06-14 16:45 Transferring focus to Emacs Joe Riel
@ 2011-06-14 17:10 ` Thierry Volpiatto
  2011-06-14 19:25   ` Joe Riel
  2011-06-15  6:14   ` Joe Riel
  0 siblings, 2 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2011-06-14 17:10 UTC (permalink / raw)
  To: help-gnu-emacs

Joe Riel <joer@san.rr.com> writes:

> I want a separate program to give the focus to Emacs, and put the
> cursor in a particular (existing) buffer.

Try wmctrl:

wmctrl -xa emacs
emacsclient do_what_you_have _to_do
wmctrl -xa go_back_to_initial_window (optional e.g firefox)
    

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Transferring focus to Emacs
  2011-06-14 17:10 ` Thierry Volpiatto
@ 2011-06-14 19:25   ` Joe Riel
  2011-06-15  6:14   ` Joe Riel
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Riel @ 2011-06-14 19:25 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 14 Jun 2011 19:10:29 +0200
Thierry Volpiatto <thierry.volpiatto@gmail.com> wrote:

> Joe Riel <joer@san.rr.com> writes:
> 
> > I want a separate program to give the focus to Emacs, and put the
> > cursor in a particular (existing) buffer.
> 
> Try wmctrl:
> 
> wmctrl -xa emacs
> emacsclient do_what_you_have _to_do
> wmctrl -xa go_back_to_initial_window (optional e.g firefox)

Thanks, nice suggestion. That works.

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Transferring focus to Emacs
  2011-06-14 17:10 ` Thierry Volpiatto
  2011-06-14 19:25   ` Joe Riel
@ 2011-06-15  6:14   ` Joe Riel
  2011-06-15  8:34     ` Peter Dyballa
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Riel @ 2011-06-15  6:14 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 14 Jun 2011 19:10:29 +0200
Thierry Volpiatto <thierry.volpiatto@gmail.com> wrote:

> Joe Riel <joer@san.rr.com> writes:
> 
> > I want a separate program to give the focus to Emacs, and put the
> > cursor in a particular (existing) buffer.
> 
> Try wmctrl:
> 
> wmctrl -xa emacs
> emacsclient do_what_you_have _to_do
> wmctrl -xa go_back_to_initial_window (optional e.g firefox)
  
Here's a variation on the theme.  Now I want to switch
focus back to the original window.  I know the process
number of a subprocess running in that window.  Is there
a way I can use it to find the process of the window 
(and finally the window itself)?

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Transferring focus to Emacs
  2011-06-15  6:14   ` Joe Riel
@ 2011-06-15  8:34     ` Peter Dyballa
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2011-06-15  8:34 UTC (permalink / raw)
  To: Joe Riel; +Cc: help-gnu-emacs


Am 15.06.2011 um 08:14 schrieb Joe Riel:

> I know the process
> number of a subprocess running in that window.  Is there
> a way I can use it to find the process of the window
> (and finally the window itself)?

With ps you can determine the PID of its parent process. The pstree  
utility outputs the whole list of processes that lead to this process...

--
Greetings

   Pete                           <]
              o        __o         |__    o       HPV, the real
     ___o    /I       -\<,         |o \  -\),-%     high speed!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-15  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 16:45 Transferring focus to Emacs Joe Riel
2011-06-14 17:10 ` Thierry Volpiatto
2011-06-14 19:25   ` Joe Riel
2011-06-15  6:14   ` Joe Riel
2011-06-15  8:34     ` Peter Dyballa

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.