From 2d69b99e59e81113bf27faa209fb9b060f3244d4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 28 Aug 2013 13:57:12 -0400 Subject: [PATCH] * lisp/emacs-lisp/package.el (package-activate-1): Don't add unnecessarily to load-path. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a07d90dd8f..712ec6c12b0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-08-28 Stefan Monnier + + * emacs-lisp/package.el (package-activate-1): Don't add unnecessarily + to load-path. + 2013-08-28 Juri Linkov * isearch.el (isearch-reread-key-sequence-naturally): Use non-nil diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 0085074e5be..d02bcef08c6 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -457,19 +457,26 @@ Return the max version (as a string) if the package is held at a lower version." (defun package-activate-1 (pkg-desc) (let* ((name (package-desc-name pkg-desc)) - (pkg-dir (package-desc-dir pkg-desc))) + (pkg-dir (package-desc-dir pkg-desc)) + (pkg-dir-dir (file-name-as-directory pkg-dir))) (unless pkg-dir (error "Internal error: unable to find directory for `%s'" (package-desc-full-name pkg-desc))) + ;; Add to load path, add autoloads, and activate the package. + (let ((old-lp load-path)) + (load (expand-file-name (format "%s-autoloads" name) pkg-dir) nil t) + (when (and (eq old-lp load-path) + (not (or (member pkg-dir load-path) + (member pkg-dir-dir load-path)))) + ;; Old packages don't add themselves to the `load-path', so we have to + ;; do it ourselves. + (push pkg-dir load-path))) ;; Add info node. (when (file-exists-p (expand-file-name "dir" pkg-dir)) ;; FIXME: not the friendliest, but simple. (require 'info) (info-initialize) (push pkg-dir Info-directory-list)) - ;; Add to load path, add autoloads, and activate the package. - (push pkg-dir load-path) - (load (expand-file-name (format "%s-autoloads" name) pkg-dir) nil t) (push name package-activated-list) ;; Don't return nil. t)) -- 2.39.2