* desktop mode, periodic save
@ 2008-02-01 16:07 Xah Lee
2008-02-10 20:54 ` Xah
0 siblings, 1 reply; 5+ messages in thread
From: Xah Lee @ 2008-02-01 16:07 UTC (permalink / raw)
To: help-gnu-emacs
I use desktop mode, so that in case of crashing (emacs or OS), i can
know which files i was working on or needs to work on.
However, by default, the desktop mode doesn't seems to save
periodically, so that when OS crash, i lost the info about which files
that was open or needs to work on.
I'm doing this as a solution:
(desktop-save-mode 1)
(add-hook 'find-file-hook (lambda () (desktop-save "~/")))
Is there a variable that i should use instead?
thx.
Xah
xah@xahlee.org
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: desktop mode, periodic save
2008-02-01 16:07 desktop mode, periodic save Xah Lee
@ 2008-02-10 20:54 ` Xah
2008-02-28 18:01 ` Xah
0 siblings, 1 reply; 5+ messages in thread
From: Xah @ 2008-02-10 20:54 UTC (permalink / raw)
To: help-gnu-emacs
i'm using desktop.el, with the intention so that in case of crashing
(emacs or OS), i can still have emacs open files i have left open when
crashed.
However, desktop mode by default doesn't save periodically, so that
after a crash, i lost the info of opened files. (i think this defeats
the main purpose of desktop mode)
So i added a desktop-save to find-file-hook. Like this:
(desktop-save-mode 1)
(add-hook 'find-file-hook (lambda () (desktop-save "~/")))
But the problem with this is that, when i launch emacs (no crash
involved), it will ask me to override the desktop file each time it
opens a file (due to previous desktop save)
I think the solution is to add the hook only when the initialization
is complete. How can i do that?
Xah
xah@xahlee.org
∑ http://xahlee.org/
☄
On Feb 1, 8:07 am, Xah Lee <x...@xahlee.org> wrote:
> I usedesktopmode, so that in case of crashing (emacs or OS), i can
> know which files i was working on or needs to work on.
>
> However, by default, thedesktopmode doesn't seems to save
> periodically, so that when OS crash, i lost the info about which files
> that was open or needs to work on.
>
> I'm doing this as a solution:
>
> (desktop-save-mode 1)
>
> (add-hook 'find-file-hook (lambda () (desktop-save "~/")))
>
> Is there a variable that i should use instead?
>
> thx.
>
> Xah
> x...@xahlee.org
> ∑http://xahlee.org/
>
> ☄
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: desktop mode, periodic save
2008-02-10 20:54 ` Xah
@ 2008-02-28 18:01 ` Xah
2008-02-28 21:21 ` Thorsten Bonow
2008-02-28 21:45 ` Lowell Gilbert
0 siblings, 2 replies; 5+ messages in thread
From: Xah @ 2008-02-28 18:01 UTC (permalink / raw)
To: help-gnu-emacs
how can i write a elisp code so that a function is called every 10
minutes.
I found “sleep-for” but it freezes emacs for the period.
Thanks.
Xah
xah@xahlee.org
∑ http://xahlee.org/
☄
On Feb 10, 12:54 pm, Xah <xah...@gmail.com> wrote:
> i'm usingdesktop.el, with the intention so that in case of crashing
> (emacs or OS), i can still have emacs open files i have left open when
> crashed.
>
> However,desktopmode by default doesn't save periodically, so that
> after a crash, i lost the info of opened files. (i think this defeats
> the main purpose ofdesktopmode)
>
> So i added adesktop-save to find-file-hook. Like this:
>
> (desktop-save-mode 1)
> (add-hook 'find-file-hook (lambda () (desktop-save "~/")))
>
> But the problem with this is that, when i launch emacs (no crash
> involved), it will ask me to override thedesktopfile each time it
> opens a file (due to previousdesktopsave)
>
> I think the solution is to add the hook only when the initialization
> is complete. How can i do that?
>
> Xah
> x...@xahlee.org
> ∑http://xahlee.org/
>
> ☄
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: desktop mode, periodic save
2008-02-28 18:01 ` Xah
@ 2008-02-28 21:21 ` Thorsten Bonow
2008-02-28 21:45 ` Lowell Gilbert
1 sibling, 0 replies; 5+ messages in thread
From: Thorsten Bonow @ 2008-02-28 21:21 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "Xah" == Xah <xahlee@gmail.com> writes:
Xah> how can i write a elisp code so that a function is called every 10
Xah> minutes.
Xah> I found “sleep-for” but it freezes emacs for the period.
Xah> Thanks.
Hi,
there are the
`run-with-idle-timer'/`run-with-timer' defuns...
I'm quoting from the documentation:
(run-with-timer secs repeat function &rest args)
Perform an action after a delay of secs seconds.
Repeat the action every repeat seconds, if repeat is non-nil.
secs and repeat may be integers or floating point numbers.
The action is to call function with arguments args.
This function returns a timer object which you can use in `cancel-timer'.
Toto
--
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow
...lived nine lives, gunned down ten...
Christopher Cross: Ride like the wind
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: desktop mode, periodic save
2008-02-28 18:01 ` Xah
2008-02-28 21:21 ` Thorsten Bonow
@ 2008-02-28 21:45 ` Lowell Gilbert
1 sibling, 0 replies; 5+ messages in thread
From: Lowell Gilbert @ 2008-02-28 21:45 UTC (permalink / raw)
To: help-gnu-emacs
Xah <xahlee@gmail.com> writes:
> how can i write a elisp code so that a function is called every 10
> minutes.
>
> I found “sleep-for” but it freezes emacs for the period.
timers.
There are several kinds. The elisp node "Timers for Delayed
Execution" is the starting place for the documentation.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-02-28 21:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 16:07 desktop mode, periodic save Xah Lee
2008-02-10 20:54 ` Xah
2008-02-28 18:01 ` Xah
2008-02-28 21:21 ` Thorsten Bonow
2008-02-28 21:45 ` Lowell Gilbert
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).