Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs , use-package and package-refresh-contents

In my init.el I want use "use-package" to lazily load my mode and speed up my emacs start.

I want use-package automatically download my mode from elpa/melpa/... thanks to package lib.

But it seems I need to do a (package-refresh-contents) before each time otherwise use-package raise an error.

(error "Package `deft' is not available for installation")

my conf is

(require 'use-package)
(package-refresh-contents) ; take forever at each emacs start
(use-package deft 
  :ensure t)

but (package-refresh-contents) take forever. can't we delegate the (package-refresh-contents) to use-package so it is done once ?

like image 608
taharqa Avatar asked Jun 18 '14 08:06

taharqa


1 Answers

use-package does not provide this functionality. You could use the following instead:

(unless package-archive-contents
  (package-refresh-contents))

This will only update the package list, if it is empty, which should be sufficient to avoid your problem. You still need to manually update packages, though, with M-x list-packages and U.

like image 81
lunaryorn Avatar answered Sep 20 '22 23:09

lunaryorn