[Top][All Lists]

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

Suggested patch for desktop.el, and 'slothful' lazy file loading

From: Paul Sexton
Subject: Suggested patch for desktop.el, and 'slothful' lazy file loading
Date: Mon, 11 Apr 2011 04:31:02 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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,
address@hidden, 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
            (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:



reply via email to

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