Avoid using condition-case during pkg load

This commit is contained in:
Eivind Fonn 2016-03-03 21:30:54 +01:00
parent 52bb7b7c7f
commit 067ac63f15

View file

@ -27,27 +27,26 @@ directory is returned.
If LOG is non-nil a message is displayed in spacemacs-buffer-mode buffer.
FILE-TO-LOAD is an explicit file to load after the installation."
(let ((warning-minimum-level :error))
(condition-case-unless-debug nil
(if (locate-file (symbol-name pkg) load-path (get-load-suffixes))
(require pkg)
(error
;; not installed, we try to initialize package.el only if required to
;; precious seconds during boot time
(require 'cl)
(let ((pkg-elpa-dir (spacemacs//get-package-directory pkg)))
(if pkg-elpa-dir
(add-to-list 'load-path pkg-elpa-dir)
;; install the package
(when log
(spacemacs-buffer/append
(format "(Bootstrap) Installing %s...\n" pkg))
(spacemacs//redisplay))
(configuration-layer/retrieve-package-archives 'quiet)
(package-install pkg)
(setq pkg-elpa-dir (spacemacs//get-package-directory pkg)))
(require pkg nil 'noerror)
(when file-to-load
(load-file (concat pkg-elpa-dir file-to-load)))
pkg-elpa-dir)))))
;; not installed, we try to initialize package.el only if required to
;; precious seconds during boot time
(require 'cl)
(let ((pkg-elpa-dir (spacemacs//get-package-directory pkg)))
(if pkg-elpa-dir
(add-to-list 'load-path pkg-elpa-dir)
;; install the package
(when log
(spacemacs-buffer/append
(format "(Bootstrap) Installing %s...\n" pkg))
(spacemacs//redisplay))
(configuration-layer/retrieve-package-archives 'quiet)
(package-install pkg)
(setq pkg-elpa-dir (spacemacs//get-package-directory pkg)))
(require pkg nil 'noerror)
(when file-to-load
(load-file (concat pkg-elpa-dir file-to-load)))
pkg-elpa-dir))))
(defun spacemacs//get-package-directory (pkg)
"Return the directory of PKG. Return nil if not found."