emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102159: Check more carefully for pac


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102159: Check more carefully for packages before loading package.el.
Date: Sat, 30 Oct 2010 20:06:18 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102159
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2010-10-30 20:06:18 -0400
message:
  Check more carefully for packages before loading package.el.
  
  * startup.el (command-line): Search for package directories, and
  don't load package.el if none are found.
  
  * emacs-lisp/package.el (describe-package, list-packages): Call
  package-initialize if it has not been called yet.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/package.el
  lisp/startup.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-10-30 12:24:06 +0000
+++ b/lisp/ChangeLog    2010-10-31 00:06:18 +0000
@@ -1,3 +1,11 @@
+2010-10-30  Chong Yidong  <address@hidden>
+
+       * startup.el (command-line): Search for package directories, and
+       don't load package.el if none are found.
+
+       * emacs-lisp/package.el (describe-package, list-packages): Call
+       package-initialize if it has not been called yet.
+
 2010-10-30  Alan Mackenzie  <address@hidden>
 
        * progmodes/cc-fonts.el (c-font-lock-enum-tail): New function

=== modified file 'lisp/emacs-lisp/package.el'
--- a/lisp/emacs-lisp/package.el        2010-10-24 15:46:21 +0000
+++ b/lisp/emacs-lisp/package.el        2010-10-31 00:06:18 +0000
@@ -1037,10 +1037,13 @@
 (defun describe-package (package)
   "Display the full documentation of PACKAGE (a symbol)."
   (interactive
-   (let* ((packages (append (mapcar 'car package-alist)
+   (let* ((guess (function-called-at-point))
+         packages val)
+     ;; Initialize the package system if it's not.
+     (unless package-alist
+       (package-initialize))
+     (setq packages (append (mapcar 'car package-alist)
                            (mapcar 'car package-archive-contents)))
-         (guess (function-called-at-point))
-         val)
      (unless (memq guess packages)
        (setq guess nil))
      (setq packages (mapcar 'symbol-name packages))
@@ -1617,6 +1620,9 @@
 Fetches the updated list of packages before displaying.
 The list is displayed in a buffer named `*Packages*'."
   (interactive)
+  ;; Initialize the package system if necessary.
+  (unless package-alist
+    (package-initialize))
   (package-refresh-contents)
   (package--list-packages))
 

=== modified file 'lisp/startup.el'
--- a/lisp/startup.el   2010-10-26 03:58:19 +0000
+++ b/lisp/startup.el   2010-10-31 00:06:18 +0000
@@ -1172,8 +1172,30 @@
                 (eq face-ignored-fonts old-face-ignored-fonts))
       (clear-face-cache)))
 
-  ;; Load ELPA packages.
-  (and user-init-file package-enable-at-startup (package-initialize))
+  ;; If any package directory exists, initialize the package system.
+  (and user-init-file
+       package-enable-at-startup
+       (catch 'package-dir-found
+        (let (dirs)
+          (if (boundp 'package-directory-list)
+              (setq dirs package-directory-list)
+            (dolist (f load-path)
+              (and (stringp f)
+                   (equal (file-name-nondirectory f) "site-lisp")
+                   (push (expand-file-name "elpa" f) dirs))))
+          (push (if (boundp 'package-user-dir)
+                    package-user-dir
+                  (locate-user-emacs-file "elpa"))
+                dirs)
+          (dolist (dir dirs)
+            (when (file-directory-p dir)
+              (dolist (subdir (directory-files dir))
+                (when (and (file-directory-p (expand-file-name subdir dir))
+                           ;; package-subdirectory-regexp from package.el
+                           (string-match 
"^\\([^.].*\\)-\\([0-9]+\\(?:[.][0-9]+\\)*\\)$"
+                                         subdir))
+                  (throw 'package-dir-found t)))))))
+       (package-initialize))
 
   (setq after-init-time (current-time))
   (run-hooks 'after-init-hook)


reply via email to

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