checks dependencies in package section.

This commit is contained in:
larstvei 2014-04-02 22:08:48 +02:00
parent 6774efff6e
commit 0f18bb1fe6
3 changed files with 117 additions and 81 deletions

90
init.el
View File

@ -10,7 +10,6 @@ tangled, and the tangled file is compiled."
(add-hook 'after-save-hook 'init-hook) (add-hook 'after-save-hook 'init-hook)
(require 'package) (require 'package)
(package-initialize)
(add-to-list 'package-archives (add-to-list 'package-archives
'("MELPA" . "http://melpa.milkbox.net/packages/") t) '("MELPA" . "http://melpa.milkbox.net/packages/") t)
@ -36,6 +35,12 @@ PACKAGE is installed and the current version is deleted."
(package-desc-vers (cdr pkg-desc))))) (package-desc-vers (cdr pkg-desc)))))
(package-install package)))) (package-install package))))
(defun dependencies (package)
"Returns a list of dependencies from a given PACKAGE."
(let* ((pkg-desc (assq package package-alist))
(reqs (and pkg-desc (package-desc-reqs (cdr pkg-desc)))))
(mapcar 'car reqs)))
(defvar days-between-updates 1) (defvar days-between-updates 1)
(defvar do-package-update-on-init t) (defvar do-package-update-on-init t)
(defvar package-last-update-file (defvar package-last-update-file
@ -69,36 +74,46 @@ PACKAGE is installed and the current version is deleted."
(y-or-n-p "Update all packages?")) (y-or-n-p "Update all packages?"))
(package-refresh-contents) (package-refresh-contents)
(dolist (package (let* ((packages
'(ac-geiser ; Auto-complete backend for geiser '(ac-geiser ; Auto-complete backend for geiser
ac-slime ; An auto-complete source using slime completions ac-slime ; An auto-complete source using slime completions
ace-jump-mode ; quick cursor location minor mode ace-jump-mode ; quick cursor location minor mode
auto-compile ; automatically compile Emacs Lisp libraries auto-compile ; automatically compile Emacs Lisp libraries
auto-complete ; auto completion auto-complete ; auto completion
elscreen ; window session manager elscreen ; window session manager
expand-region ; Increase selected region by semantic units expand-region ; Increase selected region by semantic units
flx-ido ; flx integration for ido flx-ido ; flx integration for ido
ido-vertical-mode ; Makes ido-mode display vertically. ido-vertical-mode ; Makes ido-mode display vertically.
geiser ; GNU Emacs and Scheme talk to each other geiser ; GNU Emacs and Scheme talk to each other
haskell-mode ; A Haskell editing mode haskell-mode ; A Haskell editing mode
jedi ; Python auto-completion for Emacs jedi ; Python auto-completion for Emacs
magit ; control Git from Emacs magit ; control Git from Emacs
markdown-mode ; Emacs Major mode for Markdown-formatted files. markdown-mode ; Emacs Major mode for Markdown-formatted files.
matlab-mode ; MATLAB integration with Emacs. matlab-mode ; MATLAB integration with Emacs.
monokai-theme ; A fruity color theme for Emacs. monokai-theme ; A fruity color theme for Emacs.
move-text ; Move current line or region with M-up or M-down move-text ; Move current line or region with M-up or M-down
multiple-cursors ; Multiple cursors for Emacs. multiple-cursors ; Multiple cursors for Emacs.
org ; Outline-based notes management and organizer org ; Outline-based notes management and organizer
paredit ; minor mode for editing parentheses paredit ; minor mode for editing parentheses
powerline ; Rewrite of Powerline powerline ; Rewrite of Powerline
pretty-lambdada ; the word `lambda' as the Greek letter. pretty-lambdada ; the word `lambda' as the Greek letter.
smex ; M-x interface with Ido-style fuzzy matching. smex ; M-x interface with Ido-style fuzzy matching.
undo-tree)) ; Treat undo history as a tree undo-tree)) ; Treat undo history as a tree
(upgrade-or-install-package package)) ;; Fetch dependencies from all packages.
(reqs (mapcar 'dependencies packages))
;; Append these to the original list, and remove any duplicates.
(packages (delete-dups (apply 'append packages reqs))))
(dolist (package packages)
(upgrade-or-install-package package)))
;; This package is only relevant for Mac OS X. ;; This package is only relevant for Mac OS X.
(when (memq window-system '(mac ns)) (when (memq window-system '(mac ns))
(upgrade-or-install-package 'exec-path-from-shell))) (upgrade-or-install-package 'exec-path-from-shell)))
(setq package-enable-at-startup nil)
(package-initialize)
(when (memq window-system '(mac ns)) (when (memq window-system '(mac ns))
(setq mac-option-modifier nil (setq mac-option-modifier nil
mac-command-modifier 'meta mac-command-modifier 'meta
@ -115,6 +130,7 @@ PACKAGE is installed and the current version is deleted."
ox-md ; Markdown exporter (from org) ox-md ; Markdown exporter (from org)
pretty-lambdada ; show 'lambda' as the greek letter. pretty-lambdada ; show 'lambda' as the greek letter.
recentf ; recently opened files recentf ; recently opened files
smex ; M-x interface Ido-style.
tex-mode)) ; TeX, LaTeX, and SliTeX mode commands tex-mode)) ; TeX, LaTeX, and SliTeX mode commands
(require feature)) (require feature))
@ -283,17 +299,17 @@ PACKAGE is installed and the current version is deleted."
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)) (imagemagick-register-types))
(defadvice mu4e (before show-mu4e (arg) activate) ;; (defadvice mu4e (before show-mu4e (arg) activate)
"Always show mu4e in fullscreen and remember window ;; "Always show mu4e in fullscreen and remember window
configuration." ;; configuration."
(unless arg ;; (unless arg
(window-configuration-to-register :mu4e-fullscreen) ;; (window-configuration-to-register :mu4e-fullscreen)
(mu4e-update-mail-and-index t) ;; (mu4e-update-mail-and-index t)
(delete-other-windows))) ;; (delete-other-windows)))
(defadvice mu4e-quit (after restore-windows nil activate) ;; (defadvice mu4e-quit (after restore-windows nil activate)
"Restore window configuration." ;; "Restore window configuration."
(jump-to-register :mu4e-fullscreen)) ;; (jump-to-register :mu4e-fullscreen))
;; Overwrite the native 'compose-mail' binding to 'show-mu4e'. ;; Overwrite the native 'compose-mail' binding to 'show-mu4e'.
(global-set-key (kbd "C-x m") 'mu4e)) (global-set-key (kbd "C-x m") 'mu4e))

108
init.org
View File

@ -41,7 +41,6 @@
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp :tangle yes
(require 'package) (require 'package)
(package-initialize)
#+END_SRC #+END_SRC
Packages can be fetched from different mirrors, [[http://melpa.milkbox.net/#/][melpa]] is the largest Packages can be fetched from different mirrors, [[http://melpa.milkbox.net/#/][melpa]] is the largest
@ -84,6 +83,16 @@
(package-install package)))) (package-install package))))
#+END_SRC #+END_SRC
Also, we will need a function to find all dependencies from a given package.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun dependencies (package)
"Returns a list of dependencies from a given PACKAGE."
(let* ((pkg-desc (assq package package-alist))
(reqs (and pkg-desc (package-desc-reqs (cdr pkg-desc)))))
(mapcar 'car reqs)))
#+END_SRC
The =package-refresh-contents= function downloads archive descriptions, The =package-refresh-contents= function downloads archive descriptions,
this is a major bottleneck in this configuration. To avoid this we can this is a major bottleneck in this configuration. To avoid this we can
try to only check for updates once every day or so. Here are three try to only check for updates once every day or so. Here are three
@ -140,35 +149,45 @@
(y-or-n-p "Update all packages?")) (y-or-n-p "Update all packages?"))
(package-refresh-contents) (package-refresh-contents)
(dolist (package (let* ((packages
'(ac-geiser ; Auto-complete backend for geiser '(ac-geiser ; Auto-complete backend for geiser
ac-slime ; An auto-complete source using slime completions ac-slime ; An auto-complete source using slime completions
ace-jump-mode ; quick cursor location minor mode ace-jump-mode ; quick cursor location minor mode
auto-compile ; automatically compile Emacs Lisp libraries auto-compile ; automatically compile Emacs Lisp libraries
auto-complete ; auto completion auto-complete ; auto completion
elscreen ; window session manager elscreen ; window session manager
expand-region ; Increase selected region by semantic units expand-region ; Increase selected region by semantic units
flx-ido ; flx integration for ido flx-ido ; flx integration for ido
ido-vertical-mode ; Makes ido-mode display vertically. ido-vertical-mode ; Makes ido-mode display vertically.
geiser ; GNU Emacs and Scheme talk to each other geiser ; GNU Emacs and Scheme talk to each other
haskell-mode ; A Haskell editing mode haskell-mode ; A Haskell editing mode
jedi ; Python auto-completion for Emacs jedi ; Python auto-completion for Emacs
magit ; control Git from Emacs magit ; control Git from Emacs
markdown-mode ; Emacs Major mode for Markdown-formatted files. markdown-mode ; Emacs Major mode for Markdown-formatted files.
matlab-mode ; MATLAB integration with Emacs. matlab-mode ; MATLAB integration with Emacs.
monokai-theme ; A fruity color theme for Emacs. monokai-theme ; A fruity color theme for Emacs.
move-text ; Move current line or region with M-up or M-down move-text ; Move current line or region with M-up or M-down
multiple-cursors ; Multiple cursors for Emacs. multiple-cursors ; Multiple cursors for Emacs.
org ; Outline-based notes management and organizer org ; Outline-based notes management and organizer
paredit ; minor mode for editing parentheses paredit ; minor mode for editing parentheses
powerline ; Rewrite of Powerline powerline ; Rewrite of Powerline
pretty-lambdada ; the word `lambda' as the Greek letter. pretty-lambdada ; the word `lambda' as the Greek letter.
smex ; M-x interface with Ido-style fuzzy matching. smex ; M-x interface with Ido-style fuzzy matching.
undo-tree)) ; Treat undo history as a tree undo-tree)) ; Treat undo history as a tree
(upgrade-or-install-package package)) ;; Fetch dependencies from all packages.
(reqs (mapcar 'dependencies packages))
;; Append these to the original list, and remove any duplicates.
(packages (delete-dups (apply 'append packages reqs))))
(dolist (package packages)
(upgrade-or-install-package package)))
;; This package is only relevant for Mac OS X. ;; This package is only relevant for Mac OS X.
(when (memq window-system '(mac ns)) (when (memq window-system '(mac ns))
(upgrade-or-install-package 'exec-path-from-shell))) (upgrade-or-install-package 'exec-path-from-shell)))
(setq package-enable-at-startup nil)
(package-initialize)
#+END_SRC #+END_SRC
** Mac OS X ** Mac OS X
@ -204,6 +223,7 @@
ox-md ; Markdown exporter (from org) ox-md ; Markdown exporter (from org)
pretty-lambdada ; show 'lambda' as the greek letter. pretty-lambdada ; show 'lambda' as the greek letter.
recentf ; recently opened files recentf ; recently opened files
smex ; M-x interface Ido-style.
tex-mode)) ; TeX, LaTeX, and SliTeX mode commands tex-mode)) ; TeX, LaTeX, and SliTeX mode commands
(require feature)) (require feature))
#+END_SRC #+END_SRC
@ -475,11 +495,11 @@
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp :tangle yes
(defvar load-mail-setup nil) (defvar load-mail-setup nil)
(when load-mail-setup (when load-mail-setup
;; We need mu4e ;; We need mu4e
(require 'mu4e) (require 'mu4e)
;; Some basic mu4e settings. ;; Some basic mu4e settings.
(setq mu4e-maildir "~/.ifimail" ; top-level Maildir (setq mu4e-maildir "~/.ifimail" ; top-level Maildir
mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages
@ -493,7 +513,7 @@
mu4e-view-show-images t ; view images mu4e-view-show-images t ; view images
mu4e-html2text-command mu4e-html2text-command
"html2text -utf8") ; use utf-8 "html2text -utf8") ; use utf-8
;; Setup for sending mail. ;; Setup for sending mail.
(setq user-full-name (setq user-full-name
"Lars Tveito" ; Your full name "Lars Tveito" ; Your full name
@ -505,23 +525,23 @@
smtpmail-stream-type 'ssl ; Protocol used for sending smtpmail-stream-type 'ssl ; Protocol used for sending
send-mail-function 'smtpmail-send-it ; Use smpt to send send-mail-function 'smtpmail-send-it ; Use smpt to send
mail-user-agent 'mu4e-user-agent) ; Use mu4e! mail-user-agent 'mu4e-user-agent) ; Use mu4e!
;; Register file types that can be handled by ImageMagick. ;; Register file types that can be handled by ImageMagick.
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)) (imagemagick-register-types))
(defadvice mu4e (before show-mu4e (arg) activate) ;; (defadvice mu4e (before show-mu4e (arg) activate)
"Always show mu4e in fullscreen and remember window ;; "Always show mu4e in fullscreen and remember window
configuration." ;; configuration."
(unless arg ;; (unless arg
(window-configuration-to-register :mu4e-fullscreen) ;; (window-configuration-to-register :mu4e-fullscreen)
(mu4e-update-mail-and-index t) ;; (mu4e-update-mail-and-index t)
(delete-other-windows))) ;; (delete-other-windows)))
(defadvice mu4e-quit (after restore-windows nil activate) ;; (defadvice mu4e-quit (after restore-windows nil activate)
"Restore window configuration." ;; "Restore window configuration."
(jump-to-register :mu4e-fullscreen)) ;; (jump-to-register :mu4e-fullscreen))
;; Overwrite the native 'compose-mail' binding to 'show-mu4e'. ;; Overwrite the native 'compose-mail' binding to 'show-mu4e'.
(global-set-key (kbd "C-x m") 'mu4e)) (global-set-key (kbd "C-x m") 'mu4e))
#+END_SRC #+END_SRC

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 KiB

After

Width:  |  Height:  |  Size: 329 KiB