* Suggested patch for desktop.el, and 'slothful' lazy file loading
@ 2011-04-11 4:31 Paul Sexton
2011-04-12 23:37 ` Davis Herring
0 siblings, 1 reply; 2+ messages in thread
From: Paul Sexton @ 2011-04-11 4:31 UTC (permalink / raw)
To: emacs-devel
Apologies if this is the wrong place to send a message like this. I
originally sent it the email address of the maintainer of desktop.el,
terra@diku.dk, but that address is dead.
I have been using desktop.el in "lazy" mode i.e. with the settings
(setq desktop-restore-eager 10)
(setq desktop-lazy-verbose nil)
This is supposed to make it load the first 10 files normally, then load the
rest "in the background" when Emacs is idle.
I have found that although the extra buffers are loaded in the
background, after each buffer is loaded the display still switches to
that buffer. This is very disconcerting - you are trying to work in
buffer A but you are constantly switched against your will to
viewing buffer B, C, D, etc, as they are loaded.
The following trivial patch seems to fix this, and I have not encountered any
problems so far with it.
--- D:/paul/desktop.el Fri Apr 08 08:21:40 2011
+++ D:/paul/desktop-new.el Fri Apr 08 08:22:27 2011
@@ -1082,9 +1082,7 @@
(cdr (assq 'buffer-file-coding-system
desktop-buffer-locals))))
(buf (find-file-noselect desktop-buffer-file-name)))
- (condition-case nil
- (switch-to-buffer buf)
- (error (pop-to-buffer buf)))
+ (set-buffer buf)
(and (not (eq major-mode desktop-buffer-major-mode))
(functionp desktop-buffer-major-mode)
(funcall desktop-buffer-major-mode))
Also, I have written an emacs extension called 'slothful' which allows
true lazy loading of files - instead of actually loading the file, an
empty buffer is created pointing the file, and it automatically loads
only when the buffer is first displayed. I think this might be an
interesting addition to desktop. I have tested it myself, just loading
individual files.
If anyone wants to have a look at it the repository is at:
https://bitbucket.org/eeeickythump/slothful
Cheers
Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Suggested patch for desktop.el, and 'slothful' lazy file loading
2011-04-11 4:31 Suggested patch for desktop.el, and 'slothful' lazy file loading Paul Sexton
@ 2011-04-12 23:37 ` Davis Herring
0 siblings, 0 replies; 2+ messages in thread
From: Davis Herring @ 2011-04-12 23:37 UTC (permalink / raw)
To: Paul Sexton; +Cc: emacs-devel
> I have been using desktop.el in "lazy" mode i.e. with the settings
>
> (setq desktop-restore-eager 10)
> (setq desktop-lazy-verbose nil)
>
> This is supposed to make it load the first 10 files normally, then load the
> rest "in the background" when Emacs is idle.
>
> I have found that although the extra buffers are loaded in the
> background, after each buffer is loaded the display still switches to
> that buffer. This is very disconcerting - you are trying to work in
> buffer A but you are constantly switched against your will to
> viewing buffer B, C, D, etc, as they are loaded.
I can't reproduce this (but I only have an old Emacs 22 to hand to test).
> The following trivial patch seems to fix this, and I have not encountered any
> problems so far with it.
I suppose that we use switch-to-buffer because it affects the buffer
list order, but I'm not sure; the reordering code is complicated and its
true goal is unclear. If we can use `set-buffer', we can just use
`with-current-buffer'.
> Also, I have written an emacs extension called 'slothful' which allows
> true lazy loading of files - instead of actually loading the file, an
> empty buffer is created pointing the file, and it automatically loads
> only when the buffer is first displayed. I think this might be an
> interesting addition to desktop. I have tested it myself, just loading
> individual files.
A minor point: you can't restore point and mark in such a buffer, so
they would be lost at the next desktop-save.
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-12 23:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-11 4:31 Suggested patch for desktop.el, and 'slothful' lazy file loading Paul Sexton
2011-04-12 23:37 ` Davis Herring
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).