unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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).