This post is asking this question more clearly and concisely.
My code contains the following function to install dependencies:
(defun literef-install-packages() "Install any missing packages. The code is taken from `https://stackoverflow.com/a/10093312/2725810'." (setq package-list '(org org-ref pdf-tools smooth-scrolling company)) ; list the repositories containing them (setq package-archives '(("elpa" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("marmalade" . "http://marmalade-repo.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))) (package-initialize) (unless package-archive-contents (package-refresh-contents)) (dolist (package package-list) (unless (eq (package-installed-p package) t) (when (yes-or-no-p (concat "The package " (symbol-name package) " is not installed. Install it? ")) (package-install package) (when (eq package 'pdf-tools) (pdf-tools-install))))))
This code installs all the required packages besides
org, whose earlier (compared to the version in MELPA) version is built-in. In particular, when I try to evaluate
(package-install 'org), I get the message saying that the package is already installed. How do I get around this problem?