unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: Save on losing focus in Emacs
@ 2007-07-02  9:41 Tassilo Horn
  2007-07-02 15:01 ` Why doesn't Emacs have a horizontal scroll bar? brianjiang
  0 siblings, 1 reply; 19+ messages in thread
From: Tassilo Horn @ 2007-07-02  9:41 UTC (permalink / raw)
  To: help-gnu-emacs

Tim X <timx@nospam.dev.null> writes:

Hi Tim,

> However, two functions which may be useful are visible-frame-list and
> filtered-frame-list. To make use of these, I think you would dneed to
> use run-with -idle-timer. Yo could possibly define a function that
> looks to see if visible-frame-list returns anything. If it doesn't,
> then save any buffers with unsaved changes.

One problem might be that the timer has to run very often to save
immediately after losing focus.

> The problem with this is that if you have a big enough display, you
> may have both your emacs frame and some other application both
> 'visible', but focus is in the other application. In which case, this
> wouldn't work.

Hm, I use a tiling window manager, so most of the time all frames are
visible unless they're on another workspace.

> Alternatively, you might be able to use mouse-position to determine
> when the mouse is not in an emacs frame - the docs don't seem very
> clear on this and you may need to experiment to see what this function
> actually returns if it is called when the mouse focus is on another
> app. Its likely emacs will report the last frame the mouse was focused
> on.

I don't use a mouse frequently. Most of the time the pointer is in a
corner of the screen.

> P.S. I do find the OPs example a bit odd. I've used Emacs to develop with for
> years and often need to switch to a browser or some other app and I've never
> ever lost any work.

You got him wrong. Let's assume you edit a html-page in emacs and switch
to the browser to view you changes. But, damn, you forgot to save the
buffer, so you have to switch back to emacs, `C-x C-s' and switch back
to the browser and refresh again. If it had saved your changes
automatically when losing focus, that would not be needed.

Bye,
Tassilo
-- 
Chuck Norris sleeps with a pillow under his gun. 

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

end of thread, other threads:[~2007-07-07 17:03 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2963.1183391480.32220.help-gnu-emacs@gnu.org>
2007-07-02 19:36 ` Why doesn't Emacs have a horizontal scroll bar? Johan Bockgård
2007-07-03  7:36 ` Mathias Dahl
2007-07-03 12:52   ` brianjiang
2007-07-03 16:01     ` Amy Templeton
2007-07-04  1:56       ` brianjiang
2007-07-07 17:03 ` thorne
2007-07-02  9:41 Save on losing focus in Emacs Tassilo Horn
2007-07-02 15:01 ` Why doesn't Emacs have a horizontal scroll bar? brianjiang
2007-07-02 15:58   ` Peter Dyballa
2007-07-02 16:25     ` Lennart Borgman (gmail)
2007-07-02 17:53       ` Peter Dyballa
     [not found]     ` <mailman.2967.1183393563.32220.help-gnu-emacs@gnu.org>
2007-07-02 16:49       ` Pascal Bourguignon
2007-07-03 20:51         ` Dieter Wilhelm
     [not found]         ` <mailman.3029.1183495887.32220.help-gnu-emacs@gnu.org>
2007-07-03 22:16           ` David Kastrup
2007-07-03 22:45             ` David Kastrup
2007-07-04  5:58             ` Dieter Wilhelm
     [not found]             ` <mailman.3044.1183528715.32220.help-gnu-emacs@gnu.org>
2007-07-04 17:16               ` David Kastrup
2007-07-05  6:37         ` Andreas Röhler
2007-07-05  7:11         ` Gordon Beaton
2007-07-05  7:56           ` Peter Dyballa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).