This is part of the Emacs Starter Kit.
Since emacs version 24, elisp code can be downloaded, installed and loaded
almost automatically with package.el
. There are still some discussions on how
to use it properly (see B. Batsov article for example). In this file, we use
the “usual” way through ELPA for most of the packages to be
installed. Nevertheless, we also define some el-get
command to install some
packages a bit oldy and not supported by any ELPA repository.
If there is no internet connection then no way to use any of the package
managers. This should not work under Windows system since it does not have the
network-interface-list
function
(defun sk-elpa-online ()
"Check internet connectivity."
(if (and (functionp 'network-interface-list)
(network-interface-list))
(some (lambda (iface) (unless (equal "lo" (car iface))
(member 'up (first (last (network-interface-info
(car iface)))))))
(network-interface-list)) t))
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/")))
(package-initialize)
(unless (file-exists-p "~/.emacs.d/elpa/archives/melpa")
(package-refresh-contents))
(defun starter-packages-install (packages)
(dolist (it packages)
(when (not (package-installed-p it))
(package-install it)))
(delete-other-windows))
(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
re-downloaded in order to locate PACKAGE."
(if (package-installed-p package min-version)
t
(if (or (assoc package package-archive-contents) no-refresh)
(package-install package)
(progn
(package-refresh-contents)
(require-package package min-version t)))))
(defun starter-install-packages ()
(starter-packages-install
'(
solarized-theme
powerline
delight ; De-clutter mode line
smex ; Improved M-x
flx-ido ; Powerful flex matching for IDO
ido-completing-read+ ; Use IDO for all `completing-read's…
ido-at-point ; …and even for completion-at-point
idle-highlight-mode ; Highlights all occurences
highlight-parentheses ; Highlight parentheses
rainbow-mode ; Interpret HTML color code
swiper ; Better i-search
fill-column-indicator ; Indicate fill column
smartparens ; Parenthesis reloaded
undo-tree ; Undo reloaded
wrap-region ; Wrap region
browse-kill-ring ; Interactive selection of kill-ring
expand-region ; Expand selection with semantic unit
lorem-ipsum ; Insert lorem-ipsum
fold-this ; (Un)Fold active region
flex-isearch ; Fuzzy matching for isearch
golden-ratio ; Rescale buffer given golden ratio
ag ; Ag frontend
wgrep ; Writable grep buffer
wgrep-ag ; Writable grep-ag buffer
openwith ; Set default viewer given file extension
auto-complete
hydra
key-chord ; Map pairs of simultaneously pressed keys
markdown-mode ; Markdown major mode
multi-web-mode ; Multi-web major mode
yasnippet ; Yasnippet tool
cmake-mode ; Cmake major mode
go-mode ; Go major mode
gnuplot ; Gnuplot mode
dockerfile-mode ; Dockerfile mode
yaml-mode ; Yaml mode
pyvenv ; Python virtual env management
;; yapfify ; Python code formatter from yapf
;; isortify ; Python sort import with isort
blacken ; Python formater
pylint ; Python linter
magit ; Git frontend
magit-svn ; Git-svn frontend
git-gutter ; Show Diff state in buffer…
gist ; Integration for gist.github.com
;;forge ; See PR, Issue within magit
org-bullets ; Changing bullets to ASCII char
htmlize ; HTMLize org code
jupyter ; org-babel jupyter support
dired-subtree
popwin ; popup window
direx
dired-k
multi-term
xml-rpc
firestarter ; Execute (shell) commands on save
paradox ; Better emacs's package menu
projectile ; Project manager
)))
(condition-case nil
(starter-install-packages)
(error
(package-refresh-contents)
(starter-install-packages)))
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil t)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(end-of-buffer)
(eval-print-last-sexp)))
(setq el-get-sources
'((:name trac-wiki
:description "Simple but efficient interface to Trac."
:type github
:pkgname "tiborsimko/trac-wiki-el")
(:name emacs-deferred
:description "Facilities to manage asynchronous tasks."
:type github
:pkgname "kiwanami/emacs-deferred")
(:name inertial-scroll
:description "Soft mouse scrolling."
:type github
:pkgname "kiwanami/emacs-inertial-scroll")
(:name ox-ioslide
:description "Export your Org document to Google I/O HTML5 slide."
:type github
:pkgname "coldnew/org-ioslide")
)
)
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)
;; (mapc (lambda (f)
;; (let ((name (plist-get f :name)))
;; (when (not (require name nil t)) (el-get-install name)))) el-get-sources)