Fork me on GitHub
#emacs
<
2016-07-08
>
crocket08:07:57

How can I make ~/.emacs automate package installation on the first startup without executing package-refresh-contents every time?

crocket08:07:45

;;; ~/.emacs
(package-initialize)
(package-refresh-contents)

;;; magit
(package-install 'magit)

crocket08:07:33

When I execute emacs for the first time, (package-install 'magit) fails without (package-refresh-contents).

crocket08:07:50

After executing (package-refresh-contents) once, I don't have to execute it again in ~/.emacs.

crocket08:07:23

How can I make ~/.emacs execute (package-refresh-contents) only once?

crocket08:07:28

How can I check the presence of ~/.emacs.d/elpa/archives?

crocket08:07:07

I guess this does the job.

(if (not (file-exists-p "~/.emacs.d/elpa/archives"))
    (package-refresh-contents))

m1dnight09:07:01

That is what I have for automatic installation of packages

munen10:07:47

@dhruv1: I am not aware of the use-package :bind option. The way, I'd bind a key when in cider-mode is this: (define-key cider-mode-map (kbd "RET") 'tab-to-tab-stop) Of course this is a ridiculous keybinding that I would not recommend(; However the syntax works!

dhruv113:07:50

@munen awesome! thank you. ill give this a shot if nothing else works

munen14:07:06

@dhruv1: You're welcome!^^