emms-patches
[Top][All Lists]
Advanced

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

[Emms-patches] [PATCH] lisp/emms-cache.el: Initialize cache immediately


From: David Engster
Subject: [Emms-patches] [PATCH] lisp/emms-cache.el: Initialize cache immediately instead of using after-init-hook.
Date: Wed, 10 Mar 2010 18:37:30 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.92 (darwin)

* emms-cache.el (emms-cache): Call emms-cache-restore directly instead
  of using after-init-hook.
---
Further comments on this patch: I think using the after-init-hook to
restore the cache is problematic.  If you happen to call up EMMS later,
be it manually or through some means like idle-require, the cache won't
be restored from the cache file.  Therefore, I'd like to suggest to
restore the cache immediately when EMMS is initialized.  I currently
don't see any advantage to do this in the after-init-hook, but if I'm
missing something here, please let me know.

 lisp/emms-cache.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emms-cache.el b/lisp/emms-cache.el
index 35221b3..2262c7c 100644
--- a/lisp/emms-cache.el
+++ b/lisp/emms-cache.el
@@ -71,12 +71,12 @@ This is used to cache over emacs sessions.")
   (interactive "p")
   (if (and arg (> arg 0))
       (progn
-        (add-hook 'after-init-hook 'emms-cache-restore)
+       (unless emms-cache-dirty
+         (emms-cache-restore))
         (add-hook 'kill-emacs-hook 'emms-cache-save)
         (setq emms-cache-get-function 'emms-cache-get)
         (setq emms-cache-set-function 'emms-cache-set)
         (setq emms-cache-modified-function 'emms-cache-dirty))
-    (remove-hook 'after-init-hook 'emms-cache-restore)
     (remove-hook 'kill-emacs-hook 'emms-cache-save)
     (setq emms-cache-get-function nil)
     (setq emms-cache-set-function nil)
-- 
1.7.0.2




reply via email to

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