The following init file does not work if flycheck
is not installed:
(defun install-my-packs ()
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
;; Install use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; Config
;; https://jwiegley.github.io/use-package/keywords/
(require 'use-package-ensure)
(setq use-package-always-pin "melpa"
use-package-always-ensure t
use-package-compute-statistics t
use-package-verbose t
use-package-always-defer t)
(use-package flycheck)
;; More use-package calls ...
)
(install-my-packs)
The use-package-always-ensure
default is not effective and I get the error:
Error (use-package): Cannot load flycheck
However, if I don't use the function wrapper install-my-packs
, but I call straight the code in the body of this function, then use-package
downloads flycheck
from MELPA.
The init file works, too, if I use (install-my-packs)
but I individually set (use-package flycheck :ensure t)
for each package to install.
For obvious reasons, I find convenient to put all the code to initialise my packages in a dedicated function. How can I obtain this?