all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Sexton <psexton@xnet.co.nz>
To: emacs-devel@gnu.org
Subject: Suggested patch for desktop.el, and 'slothful' lazy file loading
Date: Mon, 11 Apr 2011 04:31:02 +0000 (UTC)	[thread overview]
Message-ID: <loom.20110411T061946-312@post.gmane.org> (raw)

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






             reply	other threads:[~2011-04-11  4:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11  4:31 Paul Sexton [this message]
2011-04-12 23:37 ` Suggested patch for desktop.el, and 'slothful' lazy file loading Davis Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20110411T061946-312@post.gmane.org \
    --to=psexton@xnet.co.nz \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.