emacs-devel
[Top][All Lists]
Advanced

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

RE: [PATCH] frame.c: focus hooks


From: Drew Adams
Subject: RE: [PATCH] frame.c: focus hooks
Date: Mon, 18 Nov 2013 06:53:44 -0800 (PST)

Hi Brian,

 

Hm. That's too bad. I was hoping for Emacs vs outside focus changes, especially since the use case examples given suggested that. I wouldn't want a buffer to get saved just because I switched Emacs frames, for instance (but I recognize that someone else might).

 

Let's please make this crystal clear in the doc and names of functions etc. And in the use-case examples we provide in the doc, if any.

 

Anyway, I'm in favor of adding such hooks.

 

Thx - Drew

 

Hi, Drew.

 

Thanks for the feedback.

 

Unfortunately, no.  The "focus in" and "focus out" events in Emacs fire

per frame.  So alt-tabbing between Emacs frames will trigger a focus loss

event for the origin frame and focus gain for the destination frame

 

Initially I tried hacking in at the terminal level (nsterm.c, xterm.c,

and w32term.c) but I had difficulty figuring out how application

(opposed to frame) focus works under X.  It's not clear to me that X

itself even *has* a concept of "active application" distinct from "frame

that has input focus".  (Perhaps this concept exists at the window

manager level, but there are a lot of window managers...) I'm not even a

beginner at X programming, though, so maybe someone could point me in

the right direction?

 

The convenient thing about patching into the "focus in" and "focus out"

events is that they live up in frame.c, which appears to be

cross-platform.

 

Best,

Brian

 

On Sun, Nov 17, 2013 at 5:33 PM, Drew Adams <address@hidden> wrote:

> I'd like to contribute the attached patch, which adds hooks into
> gain and loss of focus events.
>
> This allows saving all buffers on loss of focus.  (Alt-tabbing
> between an editor and browser is a popular workflow for web
> programmers.)
>
> It also allows reversion of buffers on regain of focus, convenient
> if one is switching between Emacs and another editor.
>
> People will probably find other handy uses for these hooks.

Sounds useful.

Is this only for a focus switch between Emacs (any frame) and some
other application?  Or is it also for a focus switch from one Emacs
frame to another.

(I hope it is the former, which is what you describe in your example
use cases.)

 


reply via email to

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