Skip to content

Latest commit

 

History

History
230 lines (207 loc) · 7.65 KB

starter-kit-elpa.org

File metadata and controls

230 lines (207 loc) · 7.65 KB

Starter Kit Package Manager

This is part of the Emacs Starter Kit.

Starter Kit Package Manager

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.

Checking internet connection

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))

ELPA

Defining ELPA sources

(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))

On-demand installation of packages

(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)))))

Install packages

Header function

(defun starter-install-packages ()
  (starter-packages-install
   '(

Color themes & customization

solarized-theme
powerline

UI improvements

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

Editing utilities

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

Completion & expansion

auto-complete
hydra
key-chord                ; Map pairs of simultaneously pressed keys

Markup languages

markdown-mode            ; Markdown major mode
multi-web-mode           ; Multi-web major mode

Programming languages

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

Git integration

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 additions

org-bullets              ; Changing bullets to ASCII char
htmlize                  ; HTMLize org code
jupyter                  ; org-babel jupyter support

Utilities

dired-subtree
popwin ; popup window
direx
dired-k
multi-term
xml-rpc
firestarter ; Execute (shell) commands on save

Package & project manager

paradox    ; Better emacs's package menu
projectile ; Project manager

Footer function

)))

(condition-case nil
    (starter-install-packages)
  (error
   (package-refresh-contents)
   (starter-install-packages)))

el-get

=el-get= allows you to install and manage elisp code for Emacs. It supports lots of differents types of sources and is able to install them, update them and remove them, but more importantly it will init them for you. The next pieces of code are largely inspired by this article.

Checking el-get

(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)))

Setup packages

(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")
       )
     )

Install packages

(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)