📜 ⬆️ ⬇️

El-get, ELPA, MELPA and automatic package installation

The article includes a part of the .emacs config that allows you to automatically check the availability at startup and, if necessary, install the missing packages using el-get and packages. It is useful if you use EMACS on different computers or share your config with other people.

Paste your .emacs at the beginning, before loading the required packages with (require)
 ;;;  el-get  ,    (add-to-list 'load-path "~/.emacs.d/el-get/el-get") ;;;       el-get (unless (require 'el-get nil 'noerror) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el") (goto-char (point-max)) (eval-print-last-sexp))) ;;; ,    "" (       el-get) (add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes") (el-get 'sync) ;;;   ,    ;;;  ,     el-get (setq required-packages (append '( anaconda-mode aggressive-indent-mode company-mode company-tern company-web el-get emacs-neotree emmet-mode flycheck flycheck-pos-tip git-gutter helm highlight-parentheses indent-guide js2-mode json-mode keyfreq less-css-mode magit markdown-mode mode-icons monokai-theme multiple-cursors paredit pip-requirements popup powerline py-autopep8 pyvenv rainbow-delimiters smart-tab smartparens tern undo-tree virtualenvwrapper web-mode yafolding yasnippet yasnippet-snippets ) (mapcar 'el-get-as-symbol (mapcar 'el-get-source-name el-get-sources)))) ;;;    el-get (el-get 'sync required-packages) ;;;     MELPA Stable  ,     el-get,   ;;;   (python-mode     MELPA Stasble,   ;;;  el-get     Bazaar -    Canonical   ) (require 'package) (require 'cl) ;;;    -  MELPA Stable (defvar elpa-packages '( py-isort python-mode web-beautify )) (defun cfg:install-packages () (let ((pkgs (remove-if #'package-installed-p elpa-packages))) (when pkgs (message "%s" "Emacs refresh packages database...") (package-refresh-contents) (message "%s" " done.") (dolist (p elpa-packages) (package-install p))))) (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t) (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/") t) ;;;   ,  ,        MELPA ;;;    ,       ,   Stable ;;; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) ;;;   ,     packages (package-initialize) ;;;    (cfg:install-packages) 


Now, when Emacs starts up, it will automatically check for the presence of the packages listed in the lists above and, if necessary, install them in one way or another.
')
Separately, I note a few important points.

Source: https://habr.com/ru/post/282542/


All Articles