emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 18d4bdf: Don't reload packages at startup


From: Dmitry Gutov
Subject: [Emacs-diffs] master 18d4bdf: Don't reload packages at startup
Date: Thu, 18 Dec 2014 10:18:47 +0000

branch: master
commit 18d4bdf135524f33173caa2ef2164345bd09017d
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Don't reload packages at startup
    
    Fixes: debbugs:19390
    
    * lisp/emacs-lisp/package.el (package-activate-1): Add RELOAD argument
    and a docstring.
    (package-activate): Call itself on dependencies on PACKAGE with
    the same FORCE argument.  Pass FORCE as RELOAD into
    `package-activate-1' .
---
 lisp/ChangeLog             |    8 ++++++++
 lisp/emacs-lisp/package.el |   12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 87c3944..0d5cdd1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-18  Dmitry Gutov  <address@hidden>
+
+       * emacs-lisp/package.el (package-activate-1): Add RELOAD argument
+       and a docstring.
+       (package-activate): Call itself on dependencies on PACKAGE with
+       the same FORCE argument.  Pass FORCE as RELOAD into
+       `package-activate-1'  (bug#19390).
+
 2014-12-17  Sam Steingold  <address@hidden>
 
        * emacs-lisp/package.el (package--list-loaded-files): Handle
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 199eac5..1949d0d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -516,7 +516,11 @@ Return the max version (as a string) if the package is 
held at a lower version."
              force))
           (t (error "Invalid element in `package-load-list'")))))
 
-(defun package-activate-1 (pkg-desc)
+(defun package-activate-1 (pkg-desc &optional reload)
+  "Activate package given by PKG-DESC, even if it was already active.
+If RELOAD is non-nil, also `load' any files inside the package which
+correspond to previously loaded files (those returned by
+`package--list-loaded-files')."
   (let* ((name (package-desc-name pkg-desc))
         (pkg-dir (package-desc-dir pkg-desc))
          (pkg-dir-dir (file-name-as-directory pkg-dir)))
@@ -527,7 +531,7 @@ Return the max version (as a string) if the package is held 
at a lower version."
     (let* ((old-lp load-path)
            (autoloads-file (expand-file-name
                             (format "%s-autoloads" name) pkg-dir))
-           (loaded-files-list (package--list-loaded-files pkg-dir)))
+           (loaded-files-list (and reload (package--list-loaded-files 
pkg-dir))))
       (with-demoted-errors (format "Error loading %s: %%s" name)
         (load autoloads-file nil t))
       (when (and (eq old-lp load-path)
@@ -638,14 +642,14 @@ If FORCE is true, (re-)activate it if it's already 
activated."
              (fail (catch 'dep-failure
                      ;; Activate its dependencies recursively.
                      (dolist (req (package-desc-reqs pkg-vec))
-                       (unless (package-activate (car req) (cadr req))
+                       (unless (package-activate (car req) force)
                          (throw 'dep-failure req))))))
        (if fail
            (warn "Unable to activate package `%s'.
 Required package `%s-%s' is unavailable"
                  package (car fail) (package-version-join (cadr fail)))
          ;; If all goes well, activate the package itself.
-         (package-activate-1 pkg-vec)))))))
+         (package-activate-1 pkg-vec force)))))))
 
 (defun define-package (_name-string _version-string
                                     &optional _docstring _requirements



reply via email to

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