summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-01-26 02:00:22 -0500
committerKyle Meyer <kyle@kyleam.com>2014-01-26 02:00:22 -0500
commit4bcfb672357b5840249c72b28cb860001c4e3967 (patch)
tree13e236eaccfdf6985e576f3b07bdec937f2f7955
parent7869360008d87ca4b459c703f4894625dd8181cc (diff)
downloademacs.d-4bcfb672357b5840249c72b28cb860001c4e3967.tar.gz
Reorganize and use require-package
`require-package' is from https://github.com/purcell/emacs.d/blob/master/lisp/init-elpa.el.
-rw-r--r--init.el48
-rw-r--r--lisp/init-appearance.el15
-rw-r--r--lisp/init-babel.el10
-rw-r--r--lisp/init-bib.el16
-rw-r--r--lisp/init-buffile.el (renamed from lisp/init-ibuffer.el)65
-rw-r--r--lisp/init-dired.el5
-rw-r--r--lisp/init-editing.el161
-rw-r--r--lisp/init-elisp.el4
-rw-r--r--lisp/init-elpa.el22
-rw-r--r--lisp/init-external.el21
-rw-r--r--lisp/init-framewin.el37
-rw-r--r--lisp/init-func.el236
-rw-r--r--lisp/init-general.el72
-rw-r--r--lisp/init-git.el20
-rw-r--r--lisp/init-gnus.el62
-rw-r--r--lisp/init-grep.el2
-rw-r--r--lisp/init-haskell.el2
-rw-r--r--lisp/init-ido.el12
-rw-r--r--lisp/init-keybindings.el30
-rw-r--r--lisp/init-keychord.el36
-rw-r--r--lisp/init-keymaps.el18
-rw-r--r--lisp/init-modes.el15
-rw-r--r--lisp/init-org.el81
-rw-r--r--lisp/init-orgcontacts.el2
-rw-r--r--lisp/init-pkg.el53
-rw-r--r--lisp/init-projectile.el12
-rw-r--r--lisp/init-python.el21
-rw-r--r--lisp/init-shell.el9
-rw-r--r--lisp/init-smex.el5
-rw-r--r--lisp/init-tex.el6
-rw-r--r--lisp/init-text.el32
-rw-r--r--lisp/init-yas.el5
32 files changed, 542 insertions, 593 deletions
diff --git a/init.el b/init.el
index 48139cf..9b75434 100644
--- a/init.el
+++ b/init.el
@@ -1,31 +1,49 @@
(defvar init-lisp-dir (expand-file-name "lisp" user-emacs-directory))
(add-to-list 'load-path init-lisp-dir)
+(add-to-list 'load-path (expand-file-name "vendor" user-emacs-directory))
+(require 'init-appearance)
+(require 'init-elpa)
(require 'init-general)
-(require 'init-pkg)
-(require 'init-keymaps)
+(require-package 'dash)
+(require-package 'mocker)
+
+(require 'init-org)
+(require 'init-orgcontacts)
(require 'init-babel)
+
+(require 'init-buffile)
+(require 'init-framewin)
+
+(require 'init-editing)
+
+(require 'init-text)
+(require 'init-elisp)
+(require 'init-shell)
+(require 'init-haskell)
+(require 'init-python)
+(require-package 'ess)
+(require-package 'lua-mode)
+
+(require 'init-tex)
(require 'init-bib)
+
+(require-package 'htmlize)
+(require-package 'less-css-mode)
+
(require 'init-dired)
-(require 'init-elisp)
-(require 'init-func)
(require 'init-git)
-(require 'init-gnus)
+(require 'init-projectile)
(require 'init-grep)
-(require 'init-haskell)
-(require 'init-ibuffer)
+
(require 'init-ido)
-(require 'init-keybindings)
-(require 'init-keychord)
-(require 'init-modes)
-(require 'init-orgcontacts)
-(require 'init-org)
-(require 'init-projectile)
-(require 'init-python)
(require 'init-smex)
-(require 'init-tex)
+
(require 'init-yas)
+
+(require 'init-gnus)
+
(require 'init-untracked)
(server-start)
diff --git a/lisp/init-appearance.el b/lisp/init-appearance.el
new file mode 100644
index 0000000..8882194
--- /dev/null
+++ b/lisp/init-appearance.el
@@ -0,0 +1,15 @@
+(setq default-frame-alist '((font . "Droid Sans Mono-9"))
+ inhibit-splash-screen t
+ initial-scratch-message nil)
+
+(scroll-bar-mode -1)
+(tool-bar-mode -1)
+(menu-bar-mode -1)
+(blink-cursor-mode -1)
+
+;; Line info
+(line-number-mode t)
+(column-number-mode t)
+(size-indication-mode t)
+
+(provide 'init-appearance)
diff --git a/lisp/init-babel.el b/lisp/init-babel.el
index 561419d..2df25d3 100644
--- a/lisp/init-babel.el
+++ b/lisp/init-babel.el
@@ -13,12 +13,10 @@
;; Babel minted latex export
;; Modified from
;; http://orgmode.org/worg/org-tutorials/org-latex-export.html.
-(setq org-export-latex-listings 'minted)
-(setq org-export-latex-custom-lang-environments
- '((R "rcode")
- (sh "shcode")
- (python "pythoncode")))
-
+(setq org-export-latex-listings 'minted
+ org-export-latex-custom-lang-environments '((R "rcode")
+ (sh "shcode")
+ (python "pythoncode")))
(setq org-latex-to-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
diff --git a/lisp/init-bib.el b/lisp/init-bib.el
index 7d91e93..23efcc5 100644
--- a/lisp/init-bib.el
+++ b/lisp/init-bib.el
@@ -1,14 +1,12 @@
;; Make cite key have form <last author last name><year><first word>.
-(setq bibtex-autokey-year-length 4)
-(setq bibtex-autokey-titleword-length nil)
-(setq bibtex-autokey-titlewords-stretch 0)
-(setq bibtex-autokey-titlewords 1)
-(setq bibtex-autokey-year-title-separator "")
-
-(setq bibtex-autokey-titleword-ignore
+(setq bibtex-autokey-year-length 4
+ bibtex-autokey-titleword-length nil
+ bibtex-autokey-titlewords-stretch 0
+ bibtex-autokey-titlewords 1
+ bibtex-autokey-year-title-separator ""
+ bibtex-autokey-titleword-ignore
'("A" "An" "On" "The" "Why" "How" "Where" "[0-9].*"))
-;; Used by `bibtex-fill-entry'.
-(setq bibtex-align-at-equal-sign t)
+(setq bibtex-align-at-equal-sign t) ; Used by `bibtex-fill-entry'.
(provide 'init-bib)
diff --git a/lisp/init-ibuffer.el b/lisp/init-buffile.el
index 9131279..865e629 100644
--- a/lisp/init-ibuffer.el
+++ b/lisp/init-buffile.el
@@ -1,3 +1,56 @@
+;;; Files and buffers
+
+(defun km/rename-current-buffer-file ()
+ "Rename current buffer and file it is visiting."
+ (interactive)
+ (let ((name (buffer-name))
+ (filename (buffer-file-name)))
+ (if (not (and filename (file-exists-p filename)))
+ (error "Buffer '%s' is not visiting a file!" name)
+ (let ((new-name (read-file-name "New name: " filename)))
+ (if (get-buffer new-name)
+ (error "A buffer named '%s' already exists!" new-name)
+ (rename-file filename new-name 1)
+ (rename-buffer new-name)
+ (set-visited-file-name new-name)
+ (set-buffer-modified-p nil)
+ (message "File '%s' successfully renamed to '%s'"
+ name (file-name-nondirectory new-name)))))))
+
+(global-set-key (kbd "C-x C-r") 'km/rename-current-buffer-file)
+
+;; http://emacs-fu.blogspot.com/2013/03/editing-with-root-privileges-once-more.html
+(defun km/find-file-as-root ()
+ "`ido-find-file` that automatically edits the file with
+root-privileges (using tramp/sudo) if the file is not writable by
+user."
+ (interactive)
+ (let ((file (ido-read-file-name "Edit as root: ")))
+ (unless (file-writable-p file)
+ (setq file (concat "/sudo:root@localhost:" file)))
+ (find-file file)))
+
+(global-set-key (kbd "C-x F") 'km/find-file-as-root)
+
+(defun km/save-and-kill-buffer ()
+ "Save current buffer and then kill it"
+ (interactive)
+ (save-buffer)
+ (kill-this-buffer))
+
+(global-set-key (kbd "C-x K") 'kill-buffer-and-window)
+(key-chord-define-global ",f" 'find-file)
+
+(key-chord-define-global ",s" 'save-buffer)
+(key-chord-define-global ",q" 'kill-this-buffer)
+(key-chord-define-global ",d" 'km/save-and-kill-buffer)
+(key-chord-define-global ",e" '(lambda ()
+ (interactive)
+ (save-buffer)
+ (server-edit)))
+
+;;; Ibuffer
+
;; Replace buffer-menu with ibuffer.
(global-set-key (kbd "C-x C-b") 'ibuffer)
@@ -60,10 +113,10 @@
(ibuffer-auto-mode 1) ; Keep buffer list up-to-date.
(ibuffer-switch-to-saved-filter-groups "home")))
-;; Don't prompt to delete unmodified buffers.
-(setq ibuffer-expert t)
-
-;; Don't show empty filter groups.
-(setq ibuffer-show-empty-filter-groups nil)
+(setq
+ ;; Don't prompt to delete unmodified buffers.
+ ibuffer-expert t
+ ;; Don't show empty filter groups.
+ ibuffer-show-empty-filter-groups nil)
-(provide 'init-ibuffer)
+(provide 'init-buffile)
diff --git a/lisp/init-dired.el b/lisp/init-dired.el
index a81f5c3..d6b88a6 100644
--- a/lisp/init-dired.el
+++ b/lisp/init-dired.el
@@ -20,8 +20,7 @@
(setq dired-omit-extensions
(append dired-omit-extensions km/latex-omit-extensions))
-(setq-default dired-omit-files-p t)
-
-(setq dired-listing-switches "-alh")
+(setq dired-omit-files-p t
+ dired-listing-switches "-alh")
(provide 'init-dired)
diff --git a/lisp/init-editing.el b/lisp/init-editing.el
new file mode 100644
index 0000000..61bd9b9
--- /dev/null
+++ b/lisp/init-editing.el
@@ -0,0 +1,161 @@
+(require-package 'multiple-cursors)
+(require-package 'expand-region)
+(require-package 'wrap-region)
+(require-package 'ace-jump-mode)
+
+(global-set-key (kbd "C-x \\") 'align-regexp)
+(key-chord-define-global ";a" 'ace-jump-mode)
+(key-chord-define-global ",v" 'view-mode)
+
+;; Overrides `suspend-emacs' (which is also bound to C-x C-z).
+(global-set-key (kbd "C-z") 'zap-to-char)
+(global-unset-key (kbd "M-z"))
+
+(global-set-key (kbd "C-'") 'backward-kill-word)
+
+;; http://www.emacswiki.org/emacs/UnfillParagraph
+(defun unfill-paragraph ()
+ "Takes a multi-line paragraph and makes it into a single line of text."
+ (interactive)
+ (let ((fill-column (point-max)))
+ (fill-paragraph nil)))
+
+;; Buffer-specific prevention modified from
+;; http://stackoverflow.com/questions/14913398/
+;; in-emacs-how-do-i-save-without-running-save-hooks.
+(defvar km/prevent-cleanup nil
+ "If set, `km/cleanup-buffer' does not perform clean up on save.")
+
+(defun km/toggle-prevent-cleanup ()
+ "Toggle state of `km/prevent-cleanup'"
+ (interactive)
+ (let ((state t))
+ (when km/prevent-cleanup
+ (setq state nil))
+ (set (make-local-variable 'km/prevent-cleanup) state)))
+
+(defun km/cleanup-buffer ()
+ (interactive)
+ (unless km/prevent-cleanup
+ (unless (equal major-mode 'makefile-gmake-mode)
+ (untabify (point-min) (point-max)))
+ (delete-trailing-whitespace)
+ (set-buffer-file-coding-system 'utf-8)))
+(add-hook 'before-save-hook 'km/cleanup-buffer)
+
+;; Replace map
+(define-prefix-command 'replace-map)
+(global-set-key (kbd "C-c r") 'replace-map)
+
+(define-key replace-map "s" 'query-replace)
+(define-key replace-map "S" 'replace-string)
+(define-key replace-map "r" 'query-replace-regexp)
+(define-key replace-map "R" 'replace-regexp)
+
+;; Insert map
+(define-prefix-command 'insert-map)
+(global-set-key (kbd "C-c i") 'insert-map)
+
+(defun km/shebang (&optional lang)
+ (interactive "s\language (default python):")
+ (if (= (length lang) 0)
+ (setq lang "python"))
+ (insert "#!/usr/bin/env " lang "\n"))
+(define-key insert-map "s" 'km/shebang)
+
+(defun km/insert-date ()
+ (interactive)
+ (insert (format-time-string "%Y-%m-%d")))
+
+(defun km/toggle-line-or-region-comment ()
+ "Comment/uncomment the current line or region"
+ (interactive)
+ (let (beg end)
+ (if (region-active-p)
+ (setq beg (region-beginning) end (region-end))
+ (setq beg (line-beginning-position) end (line-end-position)))
+ (comment-or-uncomment-region beg end))
+ (forward-line))
+
+(key-chord-define-global ",c" 'km/toggle-line-or-region-comment)
+
+(defun km/todo-comment ()
+ "Add commented TODO"
+ (interactive)
+ (let (beg end)
+ (if (region-active-p)
+ (setq beg (region-beginning) end (region-end))
+ (setq beg (line-beginning-position) end (line-end-position)))
+ (unless (comment-only-p beg end)
+ (beginning-of-line)
+ (insert "TODO ")
+ (comment-region beg (+ end 5))
+ (forward-line))))
+
+(define-key insert-map "d" 'km/insert-date)
+(define-key insert-map "t" 'km/todo-comment)
+(define-key insert-map "i" 'indent-relative)
+
+;; Put multiple cursors map under insert prefix.
+(define-prefix-command 'multiple-cursors-map)
+(define-key insert-map "m" 'multiple-cursors-map)
+
+(define-key multiple-cursors-map "l" 'mc/edit-lines)
+(define-key multiple-cursors-map "n" 'mc/mark-next-like-this)
+(define-key multiple-cursors-map "p" 'mc/mark-previous-like-this)
+(define-key multiple-cursors-map "a" 'mc/mark-all-like-this)
+
+(global-set-key (kbd "C-;") 'er/expand-region)
+
+;; Kill map
+(define-prefix-command 'kill-map)
+(global-set-key (kbd "C-c k") 'kill-map)
+
+(defun km/kill-string-at-point ()
+ (interactive)
+ (let ((string-start (nth 8 (syntax-ppss))))
+ (goto-char string-start)
+ (kill-sexp)))
+
+(defun km/kill-thing-at-point (thing killthing killarg)
+ "Go to the beginning of THING and call KILLTHING with
+KILLARG."
+ (goto-char (beginning-of-thing thing))
+ (funcall killthing killarg))
+
+(defun km/kill-sentence-at-point (arg)
+ (interactive "P")
+ (km/kill-thing-at-point 'sentence 'kill-sentence arg))
+
+(defun km/kill-word-at-point (arg)
+ (interactive "P")
+ (km/kill-thing-at-point 'word 'kill-word arg))
+
+(defun km/kill-paragraph-at-point (arg)
+ (interactive "P")
+ (km/kill-thing-at-point 'paragraph 'kill-paragraph arg))
+
+(defun km/kill-line-at-point (arg)
+ (interactive "P")
+ (km/kill-thing-at-point 'line 'kill-line arg))
+
+(defun km/kill-sexp-at-point (arg)
+ (interactive "P")
+ (km/kill-thing-at-point 'sexp 'kill-sexp arg))
+
+(define-key kill-map "s" 'km/kill-string-at-point)
+(define-key kill-map "." 'km/kill-sentence-at-point)
+(define-key kill-map "w" 'km/kill-word-at-point)
+(define-key kill-map "p" 'km/kill-paragraph-at-point)
+(define-key kill-map "l" 'km/kill-line-at-point)
+
+(defun km/join-next-line-with-space ()
+ "Join current line to the next line with a space in between."
+ (interactive)
+ (move-end-of-line 1)
+ (kill-line)
+ (just-one-space))
+
+(define-key kill-map "j" 'km/join-next-line-with-space)
+
+(provide 'init-editing)
diff --git a/lisp/init-elisp.el b/lisp/init-elisp.el
index 511ee4a..9437134 100644
--- a/lisp/init-elisp.el
+++ b/lisp/init-elisp.el
@@ -1,10 +1,12 @@
+(require-package 'paredit)
+
(autoload 'enable-paredit-mode "paredit"
"Turn on pseudo-structural editing of Lisp code."
t)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
-(eval-after-load "paredit"
+(eval-after-load 'paredit
'(progn
(define-key paredit-mode-map (kbd "C-,") 'paredit-forward-slurp-sexp)
(define-key paredit-mode-map (kbd "C-.") 'paredit-forward-barf-sexp)
diff --git a/lisp/init-elpa.el b/lisp/init-elpa.el
new file mode 100644
index 0000000..61fae9e
--- /dev/null
+++ b/lisp/init-elpa.el
@@ -0,0 +1,22 @@
+;; Modified from
+;; https://github.com/purcell/emacs.d/blob/master/lisp/init-elpa.el.
+
+(require 'package)
+
+(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/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)))))
+
+(package-initialize)
+
+(provide 'init-elpa)
diff --git a/lisp/init-external.el b/lisp/init-external.el
new file mode 100644
index 0000000..bd5d988
--- /dev/null
+++ b/lisp/init-external.el
@@ -0,0 +1,21 @@
+(define-prefix-command 'external-map)
+(global-set-key (kbd "C-c x") 'external-map)
+
+(defvar km/terminal "urxvt")
+
+(defun km/open-external-terminal ()
+ (interactive)
+ (start-process "ext-term" nil km/terminal))
+
+(define-key external-map "t" 'km/open-external-terminal)
+(define-key external-map "s" 'shell-command)
+
+(defadvice recompile (around restore-windows)
+ "Prevent recompiling from spawning new windows."
+ (save-window-excursion
+ ad-do-it))
+(ad-activate 'recompile)
+
+(global-set-key (kbd "C-c g") 'recompile)
+
+(provide 'init-external)
diff --git a/lisp/init-framewin.el b/lisp/init-framewin.el
new file mode 100644
index 0000000..cbcce94
--- /dev/null
+++ b/lisp/init-framewin.el
@@ -0,0 +1,37 @@
+;;; Frames and windows
+
+;; From prelude
+(defun km/swap-windows ()
+ "If you have 2 windows, it swaps them."
+ (interactive)
+ (if (/= (count-windows) 2)
+ (message "You need exactly 2 windows to do this.")
+ (let* ((w1 (car (window-list)))
+ (w2 (cadr (window-list)))
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+ (s1 (window-start w1))
+ (s2 (window-start w2)))
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)))
+ (other-window 1))
+
+;; http://www.emacswiki.org/emacs/ToggleWindowSplit
+(defun km/switch-frame-split ()
+ "If the frame is split vertically, split it horizontally or vice versa.
+Assumes that the frame is only split into two."
+ (interactive)
+ (unless (= (length (window-list)) 2)
+ (error "Can only toggle a frame split in two"))
+ (let ((split-vertically-p (window-combined-p)))
+ (delete-window)
+ (if split-vertically-p
+ (split-window-horizontally)
+ (split-window-vertically))
+ (switch-to-buffer nil)))
+
+(global-set-key (kbd "C-c s") 'km/swap-windows)
+
+(provide 'init-framewin)
diff --git a/lisp/init-func.el b/lisp/init-func.el
deleted file mode 100644
index 9c87ed1..0000000
--- a/lisp/init-func.el
+++ /dev/null
@@ -1,236 +0,0 @@
-;; http://whattheemacsd.com/
-;; whitespace cleanup
-
-;; Buffer-specific prevention modified from
-;; http://stackoverflow.com/questions/14913398/
-;; in-emacs-how-do-i-save-without-running-save-hooks.
-(defvar km/prevent-cleanup nil
- "If set, `km/cleanup-buffer' does not perform clean up on save.")
-
-(defun km/toggle-prevent-cleanup ()
- "Toggle state of `km/prevent-cleanup'"
- (interactive)
- (let ((state t))
- (when km/prevent-cleanup
- (setq state nil))
- (set (make-local-variable 'km/prevent-cleanup) state)))
-
-(defun km/cleanup-buffer ()
- (interactive)
- (unless km/prevent-cleanup
- (unless (equal major-mode 'makefile-gmake-mode)
- (untabify (point-min) (point-max)))
- (delete-trailing-whitespace)
- (set-buffer-file-coding-system 'utf-8)))
-(add-hook 'before-save-hook 'km/cleanup-buffer)
-
-(defun km/rename-current-buffer-file ()
- "Renames current buffer and file it is visiting."
- (interactive)
- (let ((name (buffer-name))
- (filename (buffer-file-name)))
- (if (not (and filename (file-exists-p filename)))
- (error "Buffer '%s' is not visiting a file!" name)
- (let ((new-name (read-file-name "New name: " filename)))
- (if (get-buffer new-name)
- (error "A buffer named '%s' already exists!" new-name)
- (rename-file filename new-name 1)
- (rename-buffer new-name)
- (set-visited-file-name new-name)
- (set-buffer-modified-p nil)
- (message "File '%s' successfully renamed to '%s'"
- name (file-name-nondirectory new-name)))))))
-
-(global-set-key (kbd "C-x C-r") 'km/rename-current-buffer-file)
-
-(defun km/shebang (&optional lang)
- (interactive "s\language (default python):")
- (if (= (length lang) 0)
- (setq lang "python"))
- (insert "#!/usr/bin/env " lang "\n"))
-(define-key insert-map "s" 'km/shebang)
-
-(defun km/insert-date ()
- (interactive)
- (insert (format-time-string "%Y-%m-%d")))
-
-(define-key insert-map "d" 'km/insert-date)
-
-(defun km/start-ess ()
- (interactive)
- (require 'ess-site))
-
-;; http://emacs-fu.blogspot.com/2013/03/editing-with-root-privileges-once-more.html
-(defun km/find-file-as-root ()
- "`ido-find-file` that automatically edits the file with
-root-privileges (using tramp/sudo) if the file is not writable by
-user."
- (interactive)
- (let ((file (ido-read-file-name "Edit as root: ")))
- (unless (file-writable-p file)
- (setq file (concat "/sudo:root@localhost:" file)))
- (find-file file)))
-
-(global-set-key (kbd "C-x F") 'km/find-file-as-root)
-
-(defun km/save-and-kill-buffer ()
- "Save current buffer and then kill it"
- (interactive)
- (save-buffer)
- (kill-this-buffer))
-
-(defun km/toggle-line-or-region-comment ()
- "Comment/uncomment the current line or region"
- (interactive)
- (let (beg end)
- (if (region-active-p)
- (setq beg (region-beginning) end (region-end))
- (setq beg (line-beginning-position) end (line-end-position)))
- (comment-or-uncomment-region beg end))
- (forward-line))
-
-(defun km/todo-comment ()
- "Add commented TODO"
- (interactive)
- (let (beg end)
- (if (region-active-p)
- (setq beg (region-beginning) end (region-end))
- (setq beg (line-beginning-position) end (line-end-position)))
- (unless (comment-only-p beg end)
- (beginning-of-line)
- (insert "TODO ")
- (comment-region beg (+ end 5))
- (forward-line))))
-
-;; Kill functions
-
-(defun km/kill-string-at-point ()
- (interactive)
- (let ((string-start (nth 8 (syntax-ppss))))
- (goto-char string-start)
- (kill-sexp)))
-
-(defun km/kill-thing-at-point (thing killthing killarg)
- "Go to the beginning of THING and call KILLTHING with
-KILLARG."
- (goto-char (beginning-of-thing thing))
- (funcall killthing killarg))
-
-(defun km/kill-sentence-at-point (arg)
- (interactive "P")
- (km/kill-thing-at-point 'sentence 'kill-sentence arg))
-
-(defun km/kill-word-at-point (arg)
- (interactive "P")
- (km/kill-thing-at-point 'word 'kill-word arg))
-
-(defun km/kill-paragraph-at-point (arg)
- (interactive "P")
- (km/kill-thing-at-point 'paragraph 'kill-paragraph arg))
-
-(defun km/kill-line-at-point (arg)
- (interactive "P")
- (km/kill-thing-at-point 'line 'kill-line arg))
-
-(defun km/kill-sexp-at-point (arg)
- (interactive "P")
- (km/kill-thing-at-point 'sexp 'kill-sexp arg))
-
-(define-key kill-map "s" 'km/kill-string-at-point)
-(define-key kill-map "." 'km/kill-sentence-at-point)
-(define-key kill-map "w" 'km/kill-word-at-point)
-(define-key kill-map "p" 'km/kill-paragraph-at-point)
-(define-key kill-map "l" 'km/kill-line-at-point)
-
-(defun km/join-next-line-with-space ()
- "Join current line to the next line with a space in between."
- (interactive)
- (move-end-of-line 1)
- (kill-line)
- (just-one-space))
-
-(define-key kill-map "j" 'km/join-next-line-with-space)
-
-(defadvice recompile (around restore-windows)
- "Prevent recompiling from spawning new windows."
- (save-window-excursion
- ad-do-it))
-(ad-activate 'recompile)
-
-(global-set-key (kbd "C-c g") 'recompile)
-
-;; From prelude
-(defun km/swap-windows ()
- "If you have 2 windows, it swaps them."
- (interactive)
- (if (/= (count-windows) 2)
- (message "You need exactly 2 windows to do this.")
- (let* ((w1 (car (window-list)))
- (w2 (cadr (window-list)))
- (b1 (window-buffer w1))
- (b2 (window-buffer w2))
- (s1 (window-start w1))
- (s2 (window-start w2)))
- (set-window-buffer w1 b2)
- (set-window-buffer w2 b1)
- (set-window-start w1 s2)
- (set-window-start w2 s1)))
- (other-window 1))
-
-(global-set-key (kbd "C-c s") 'km/swap-windows)
-
-(defvar km/terminal "urxvt")
-
-(defun km/open-external-terminal ()
- (interactive)
- (start-process "ext-term" nil km/terminal))
-
-(define-key external-map "t" 'km/open-external-terminal)
-
-(defun km/export-wrapped-text (arg)
- "Export the text in current buffer as wrapped text.
-This is useful for preparing text in emacs and then exporting to
-a wrapped buffer for pasting text (e.g., into a web form).
-
-If region is active, export is restricted to the region. If ARG
-is non-nil, the region is copied with `x-select-text'."
- (interactive "P")
- (let ((wrapped-buffer (get-buffer-create "*Wrapped export*"))
- beg end)
- (if (region-active-p)
- (progn (setq beg (region-beginning))
- (setq end (region-end)))
- (setq beg (point-min))
- (setq end (point-max)))
- (copy-to-buffer wrapped-buffer beg end)
- (switch-to-buffer-other-window wrapped-buffer)
- (while (not (eobp))
- (forward-paragraph)
- (forward-line -1)
- (unfill-paragraph)
- (forward-line 1))
- (when arg
- (x-select-text (buffer-substring-no-properties (point-min) (point-max))))))
-
-;; http://www.emacswiki.org/emacs/UnfillParagraph
-(defun unfill-paragraph ()
- "Takes a multi-line paragraph and makes it into a single line of text."
- (interactive)
- (let ((fill-column (point-max)))
- (fill-paragraph nil)))
-
-;; http://www.emacswiki.org/emacs/ToggleWindowSplit
-(defun km/switch-frame-split ()
- "If the frame is split vertically, split it horizontally or vice versa.
-Assumes that the frame is only split into two."
- (interactive)
- (unless (= (length (window-list)) 2)
- (error "Can only toggle a frame split in two"))
- (let ((split-vertically-p (window-combined-p)))
- (delete-window)
- (if split-vertically-p
- (split-window-horizontally)
- (split-window-vertically))
- (switch-to-buffer nil)))
-
-(provide 'init-func)
diff --git a/lisp/init-general.el b/lisp/init-general.el
index 04541b1..8fedfd8 100644
--- a/lisp/init-general.el
+++ b/lisp/init-general.el
@@ -1,75 +1,40 @@
-(setq default-frame-alist '((font . "Droid Sans Mono-9")))
-
-(setq inhibit-splash-screen t
- initial-scratch-message nil)
-
-(scroll-bar-mode -1)
-(tool-bar-mode -1)
-(menu-bar-mode -1)
+(setq echo-keystrokes 0.1
+ use-dialog-box nil
+ visible-bell t
+ shell-command-switch "-ic"
+ x-select-enable-clipboard t ; Share clipboard with system.
+ x-select-enable-primary t
+ ispell-program-name "aspell"
+ whitespace-style '(spaces tabs newline space-mark tab-mark newline-mark)
+ tramp-default-method "ssh"
+ sentence-end-double-space nil
+ browse-url-browser-function 'browse-url-generic
+ browse-url-generic-program "chromium")
(setq-default indicate-empty-lines t)
-(when (not indicate-empty-lines)
- (toggle-indicate-empty-lines))
-(setq echo-keystrokes 0.1
- use-dialog-box nil
- visible-bell t)
(show-paren-mode t)
(defalias 'yes-or-no-p 'y-or-n-p)
-;; Line info
-(line-number-mode t)
-(column-number-mode t)
-(size-indication-mode t)
-
;; Set location of custom.el.
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
;; Store all backup and autosave files in tmp dir.
-(setq backup-directory-alist
- `((".*" . ,temporary-file-directory)))
-(setq auto-save-file-name-transforms
- `((".*" ,temporary-file-directory t)))
+(setq backup-directory-alist `((".*" . ,temporary-file-directory))
+ auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
-;; Revert buffers automatically when underlying files are changed
-;; externally.
(global-auto-revert-mode t)
-;; Tramp
-(require 'tramp)
-(setq tramp-default-method "ssh")
-
-(setq browse-url-browser-function 'browse-url-generic
- browse-url-generic-program "chromium")
-
-(setq x-select-enable-primary t)
-
;; Make scripts executable at save.
(add-hook 'after-save-hook
'executable-make-buffer-file-executable-if-script-p)
-(setq-default fill-column 72)
-(add-hook 'text-mode-hook 'turn-on-auto-fill)
-
-;; Make whitespace-mode use just basic coloring.
-;; http://ergoemacs.org/emacs/whitespace-mode.html
-(setq whitespace-style (quote
- (spaces tabs newline space-mark
- tab-mark newline-mark)))
-
(transient-mark-mode -1)
-;; Share clipboard with system.
-(setq x-select-enable-clipboard t)
-
-(blink-cursor-mode -1)
-
(put 'narrow-to-region 'disabled nil)
-(setq ispell-program-name "aspell")
-
(global-set-key (kbd "M-/") 'hippie-expand)
;; http://www.emacswiki.org/emacs/HippieExpand#toc9
(defadvice he-substitute-string (after he-paredit-fix activate)
@@ -77,18 +42,17 @@
(if (and paredit-mode (equal (substring str -1) ")"))
(progn (backward-delete-char 1) (forward-char))))
-(setq sentence-end-double-space nil)
-
-(eval-after-load "view"
+(eval-after-load 'view
'(progn
(define-key view-mode-map "l" 'recenter-top-bottom)
(define-key view-mode-map "a" 'ace-jump-mode)))
-(setq shell-command-switch "-ic")
-
;; http://irreal.org/blog/?p=1536
(autoload 'zap-up-to-char "misc"
"Kill up to, but not including ARGth occurrence of CHAR.")
(global-set-key (kbd "M-z") 'zap-up-to-char)
+(require-package 'key-chord)
+(key-chord-mode 1)
+
(provide 'init-general)
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 2f9316d..0b5d420 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -1,8 +1,10 @@
-(require 'git-annex)
+(require-package 'magit)
+(require-package 'git-commit-mode)
+(require-package 'git-annex)
(setq git-annex-commit nil)
-(require 'magit)
+(key-chord-define-global ",g" 'magit-status)
(defun km/magit-auto-commit ()
"Commit all changes with \"auto\" commit message.
@@ -10,18 +12,18 @@ Useful for non-source code repos (e.g., Org mode note files)."
(interactive)
(magit-run-git "commit" "--all" "--message=auto"))
-(magit-key-mode-insert-action 'committing
- "u" "Auto commit" 'km/magit-auto-commit)
+
+(eval-after-load 'magit
+ '(magit-key-mode-insert-action 'committing
+ "u" "Auto commit" 'km/magit-auto-commit))
;; http://whattheemacsd.com/setup-magit.el-01.html
(defadvice magit-status (around magit-fullscreen activate)
ad-do-it
(delete-other-windows))
-(setq magit-restore-window-configuration t)
-
-(setq magit-default-tracking-name-function 'magit-default-tracking-name-branch-only)
-
-(setq magit-log-show-margin nil)
+(setq magit-restore-window-configuration t
+ magit-default-tracking-name-function 'magit-default-tracking-name-branch-only
+ magit-log-show-margin nil)
(provide 'init-git)
diff --git a/lisp/init-gnus.el b/lisp/init-gnus.el
index 4021d43..a9d03dd 100644
--- a/lisp/init-gnus.el
+++ b/lisp/init-gnus.el
@@ -1,6 +1,5 @@
(require 'gnus)
-;; Set up gnus directories before gnus is initialized.
(setq gnus-directory "~/.gnus.d"
gnus-home-directory "~/.gnus.d"
message-directory "~/.gnus.d/mail"
@@ -10,12 +9,10 @@
nnfolder-active-file "~/.gnus.d/mail/archive/active"
gnus-article-save-directory "~/.gnus.d/saved"
gnus-kill-files-directory "~/.gnus.d/scores"
- gnus-cache-directory "~/.gnus.d/cache")
-
-(setq gnus-startup-file (nnheader-concat gnus-home-directory "newsrc"))
-(setq gnus-init-file (nnheader-concat gnus-home-directory "gnus"))
-
-(setq gnus-save-newsrc-file nil
+ gnus-cache-directory "~/.gnus.d/cache"
+ gnus-startup-file (nnheader-concat gnus-home-directory "newsrc")
+ gnus-init-file (nnheader-concat gnus-home-directory "gnus")
+ gnus-save-newsrc-file nil
gnus-read-newsrc-file nil)
(defun km/sync-mail ()
@@ -41,43 +38,33 @@
(setq imap-shell-program "/usr/lib/dovecot/imap -c ~/.dovecotrc"
gnus-select-method '(nnimap "dov" (nnimap-stream shell))
- gnus-secondary-select-methods '((nntp "news.gmane.org")))
-
-(setq message-send-mail-function 'message-send-mail-with-sendmail
- sendmail-program "/usr/bin/msmtp")
-
-(setq message-sendmail-envelope-from 'header)
-
-(setq gnus-gcc-mark-as-read t)
-
-(setq message-citation-line-function 'message-insert-formatted-citation-line)
-(setq message-citation-line-format "On %D %R, %N wrote:")
-
-(setq message-kill-buffer-on-exit t)
+ gnus-secondary-select-methods '((nntp "news.gmane.org"))
+ message-send-mail-function 'message-send-mail-with-sendmail
+ sendmail-program "/usr/bin/msmtp"
+ message-sendmail-envelope-from 'header
+ gnus-gcc-mark-as-read t
+ message-citation-line-function 'message-insert-formatted-citation-line
+ message-citation-line-format "On %D %R, %N wrote:"
+ message-kill-buffer-on-exit t
+ gnus-group-list-inactive-groups nil
+ gnus-topic-display-empty-topics nil
+ gnus-visible-headers '("^From" "^Subject" "^Date" "^To" "^Cc" "^User-Agent")
+ gnus-confirm-mail-reply-to-news t
+ mm-discouraged-alternatives '("text/html" "text/richtext")
+ footnote-section-tag "")
;; Use for rss too specific to add to gwene.
(require 'nnrss)
-(setq gnus-group-list-inactive-groups nil)
-
;; Start in topic mode.
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
-(setq gnus-topic-display-empty-topics nil)
-
-(setq gnus-visible-headers
- '("^From" "^Subject" "^Date" "^To" "^Cc" "^User-Agent"))
(add-hook 'message-mode-hook
'(lambda ()
(flyspell-mode 1)))
-(setq gnus-confirm-mail-reply-to-news t)
-
-(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
-
-(setq gnus-summary-line-format
- "%U%R %&user-date;%-20= %-15,15f %B %S \n")
-(setq gnus-sum-thread-tree-indent " "
+(setq gnus-summary-line-format "%U%R %&user-date;%-20= %-15,15f %B %S \n"
+ gnus-sum-thread-tree-indent " "
gnus-sum-thread-tree-root "."
gnus-sum-thread-tree-false-root "o "
gnus-sum-thread-tree-single-indent ""
@@ -86,8 +73,7 @@
gnus-sum-thread-tree-single-leaf "`-> ")
(setq gnus-thread-sort-functions
- '(gnus-thread-sort-by-number
- gnus-thread-sort-by-most-recent-date))
+ '(gnus-thread-sort-by-number gnus-thread-sort-by-most-recent-date))
(defun km/follow-gwene-link ()
"Follow link at bottom of gwene message"
@@ -159,10 +145,8 @@ A new buffer with the patch contents is opened in another window."
(setq notmuch-fcc-dirs nil)
-(setq footnote-section-tag "")
-
-;; modified from
-;; http://emacs-fu.blogspot.com/2008/12/some-simple-tricks-boxquote-footnote.html
+;; Modified from
+;; http://emacs-fu.blogspot.com/2008/12/some-simple-tricks-boxquote-footnote.html.
(defun km/snip-mail-quote (beg end &optional quote-char no-number)
"Replace region lines with \"[n lines ...]\".
diff --git a/lisp/init-grep.el b/lisp/init-grep.el
index 5a5051e..a1d6dbf 100644
--- a/lisp/init-grep.el
+++ b/lisp/init-grep.el
@@ -12,4 +12,6 @@
(defadvice grep-find (after hide-grep-header activate) (hide-grep-header))
(defadvice vc-git-grep (after hide-grep-header activate) (hide-grep-header))
+(key-chord-define-global ",z" 'rgrep)
+
(provide 'init-grep)
diff --git a/lisp/init-haskell.el b/lisp/init-haskell.el
index 3be2fe8..f8f7e33 100644
--- a/lisp/init-haskell.el
+++ b/lisp/init-haskell.el
@@ -1,3 +1,5 @@
+(require-package 'haskell-mode)
+
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(provide 'init-haskell)
diff --git a/lisp/init-ido.el b/lisp/init-ido.el
index 078107f..186a8e4 100644
--- a/lisp/init-ido.el
+++ b/lisp/init-ido.el
@@ -1,4 +1,6 @@
-(require 'flx-ido)
+(require-package 'flx)
+(require-package 'flx-ido)
+
(ido-mode t)
(setq ido-enable-prefix nil
@@ -7,14 +9,13 @@
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-max-prospects 10
- ido-save-directory-list-file "~/.emacs.d/cache/ido.hist")
+ ido-save-directory-list-file "~/.emacs.d/cache/ido.hist"
+ ido-max-directory-size 100000)
(flx-ido-mode 1)
;; Disable ido faces to see flx highlights.
(setq ido-use-faces nil)
-(setq ido-max-directory-size 100000)
-
;; Recent files
(setq recentf-save-file "~/.emacs.d/cache/recentf"
recentf-max-saved-items 200
@@ -29,4 +30,7 @@
(when file
(find-file file))))
+(key-chord-define-global ",r" 'km/recentf-ido-find-file)
+(key-chord-define-global ",b" 'ido-switch-buffer)
+
(provide 'init-ido)
diff --git a/lisp/init-keybindings.el b/lisp/init-keybindings.el
deleted file mode 100644
index 70ad6b3..0000000
--- a/lisp/init-keybindings.el
+++ /dev/null
@@ -1,30 +0,0 @@
-;; Keybindings that don't go with other topics
-
-(global-set-key (kbd "C-x \\") 'align-regexp)
-(global-set-key (kbd "C-x K") 'kill-buffer-and-window)
-
-;; Overrides `suspend-emacs' (which is also bound to C-x C-z).
-(global-set-key (kbd "C-z") 'zap-to-char)
-(global-unset-key (kbd "M-z"))
-
-(global-set-key (kbd "C-'") 'backward-kill-word)
-
-(define-key replace-map "s" 'query-replace)
-(define-key replace-map "S" 'replace-string)
-(define-key replace-map "r" 'query-replace-regexp)
-(define-key replace-map "R" 'replace-regexp)
-
-(define-key insert-map "t" 'km/todo-comment)
-
-(define-key insert-map "i" 'indent-relative)
-
-(define-key multiple-cursors-map "l" 'mc/edit-lines)
-(define-key multiple-cursors-map "n" 'mc/mark-next-like-this)
-(define-key multiple-cursors-map "p" 'mc/mark-previous-like-this)
-(define-key multiple-cursors-map "a" 'mc/mark-all-like-this)
-
-(global-set-key (kbd "C-;") 'er/expand-region)
-
-(define-key external-map "s" 'shell-command)
-
-(provide 'init-keybindings)
diff --git a/lisp/init-keychord.el b/lisp/init-keychord.el
deleted file mode 100644
index 8b1603a..0000000
--- a/lisp/init-keychord.el
+++ /dev/null
@@ -1,36 +0,0 @@
-(require 'key-chord)
-(key-chord-mode 1)
-
-(key-chord-define-global ",r" 'km/recentf-ido-find-file)
-(key-chord-define-global ",t" 'org-capture)
-;; Instead of alt-x
-(key-chord-define-global ",x" 'smex)
-(key-chord-define-global ",f" 'find-file)
-(key-chord-define-global ",g" 'magit-status)
-(key-chord-define-global ",b" 'ido-switch-buffer)
-
-(key-chord-define-global ",s" 'save-buffer)
-(key-chord-define-global ",q" 'kill-this-buffer)
-(key-chord-define-global ",d" 'km/save-and-kill-buffer)
-(key-chord-define-global ",e" '(lambda ()
- (interactive)
- (save-buffer)
- (server-edit)))
-
-(key-chord-define-global ",c" 'km/toggle-line-or-region-comment)
-
-(key-chord-define-global ";a" 'ace-jump-mode)
-(key-chord-define-global ",z" 'rgrep)
-(key-chord-define-global ",v" 'view-mode)
-
-(key-chord-define-global ",a" 'org-agenda)
-
-;; Projectile key chords
-(key-chord-define-global ";s" 'projectile-switch-project)
-(key-chord-define-global ";f" 'projectile-find-file)
-(key-chord-define-global ";d" 'projectile-find-dir)
-(key-chord-define-global ";g" 'projectile-grep)
-(key-chord-define-global ";r" 'projectile-replace)
-(key-chord-define-global ";c" 'projectile-commander)
-
-(provide 'init-keychord)
diff --git a/lisp/init-keymaps.el b/lisp/init-keymaps.el
deleted file mode 100644
index eb1db41..0000000
--- a/lisp/init-keymaps.el
+++ /dev/null
@@ -1,18 +0,0 @@
-(define-prefix-command 'replace-map)
-(global-set-key (kbd "C-c r") 'replace-map)
-
-(define-prefix-command 'kill-map)
-(global-set-key (kbd "C-c k") 'kill-map)
-
-(define-prefix-command 'insert-map)
-(global-set-key (kbd "C-c i") 'insert-map)
-
-;; multiple cursors
-;; Put under insert prefix.
-(define-prefix-command 'multiple-cursors-map)
-(define-key insert-map "m" 'multiple-cursors-map)
-
-(define-prefix-command 'external-map)
-(global-set-key (kbd "C-c x") 'external-map)
-
-(provide 'init-keymaps)
diff --git a/lisp/init-modes.el b/lisp/init-modes.el
deleted file mode 100644
index 5db7a41..0000000
--- a/lisp/init-modes.el
+++ /dev/null
@@ -1,15 +0,0 @@
-;; These could be kept alongside related topics, but for whatever reason
-;; I prefer having them together.
-
-(defvar km/modes '(("\\.zsh$" . shell-script-mode)
- ("\\.*rc$" . conf-unix-mode)
- ("\\.org.txt$" . org-mode)
- ("PKGBUILD" . pkgbuild-mode))
- "Auto mode mappings")
-
-(mapc
- (lambda (mode) (setq auto-mode-alist
- (cons mode auto-mode-alist)))
- km/modes)
-
-(provide 'init-modes)
diff --git a/lisp/init-org.el b/lisp/init-org.el
index 274e673..450ac66 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -1,16 +1,15 @@
-(setq org-modules '(org-bibtex org-gnus org-info))
-
-(setq org-log-done t)
-(setq org-todo-keywords
- '((sequence "TODO" "STARTED" "|" "DONE" "NA")))
-(setq org-use-speed-commands t)
-(setq org-fast-tag-selection-single-key 'expert)
-(setq org-catch-invisible-edits 'error)
-(setq org-goto-interface 'outline-path-completion)
-(setq org-src-fontify-natively t)
-(setq org-special-ctrl-k t)
-(setq org-blank-before-new-entry '((heading . t)
- (plain-list-item . auto)))
+(add-to-list 'load-path "~/src/emacs/org-mode/lisp")
+
+(setq org-modules '(org-bibtex org-gnus org-info)
+ org-log-done t
+ org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE" "NA"))
+ org-use-speed-commands t
+ org-fast-tag-selection-single-key 'expert
+ org-catch-invisible-edits 'error
+ org-goto-interface 'outline-path-completionp
+ org-src-fontify-natively t
+ org-special-ctrl-k t
+ org-blank-before-new-entry '((heading . t) (plain-list-item . auto)))
(setq org-capture-templates
'(("t" "task" entry (file+headline "~/notes/tasks.org" "Inbox")
@@ -35,6 +34,7 @@
"* TODO %?\n%x")
("X" "misc clipboard" entry (file+headline "~/notes/misc.org" "Inbox")
"* %?\n%x")))
+(key-chord-define-global ",t" 'org-capture)
(defun km/open-main-orgfile ()
(interactive)
@@ -44,6 +44,7 @@
(global-set-key (kbd "C-c o a") 'org-agenda)
(global-set-key (kbd "C-c o b") 'org-iswitchb)
(global-set-key (kbd "C-c o m") 'km/open-main-orgfile)
+(key-chord-define-global ",a" 'org-agenda)
(setq org-structure-template-alist
'(("p" "#+property: " "")
@@ -73,10 +74,18 @@
("i" "#+index: ?" "#+index: ?")
("I" "#+include: %file ?" "<include file=%file markup=\"?\">")))
-;; Don't let `org-cycle-agenda-files' binding override custom
-;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound
-;; to C-,).
-(define-key org-mode-map (kbd "C-'") nil)
+(eval-after-load 'org
+ '(progn
+ ;; Don't let `org-cycle-agenda-files' binding override custom
+ ;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound
+ ;; to C-,).
+ (define-key org-mode-map (kbd "C-'") nil)
+ ;; Avoid conflict when amsmath is loaded.
+ (setcar (rassoc '("wasysym" t) org-latex-default-packages-alist)
+ "nointegrals")
+ (add-to-list 'org-latex-packages-alist '("" "amsmath" t))))
+
+(add-to-list 'auto-mode-alist '("\\.org.txt$" . org-mode))
;;; Org in other modes
(defun km/load-orgstruct ()
@@ -86,10 +95,6 @@
(add-hook 'message-mode-hook 'km/load-orgstruct)
(add-hook 'git-commit-mode-hook 'km/load-orgstruct)
-;; Avoid conflict when amsmath is loaded.
-(setcar (rassoc '("wasysym" t) org-latex-default-packages-alist)
- "nointegrals")
-(add-to-list 'org-latex-packages-alist '("" "amsmath" t))
(defadvice org-agenda-list (around org-agenda-fullscreen activate)
"Start agenda in fullscreen.
@@ -102,19 +107,18 @@ be restored properly."
ad-do-it
(delete-other-windows))
-(setq org-agenda-restore-windows-after-quit t)
-(setq org-agenda-sticky nil)
+(setq org-agenda-restore-windows-after-quit t
+ org-agenda-sticky nil)
;;; Agenda
-(setq org-agenda-files '("~/notes/calendar.org" "~/notes/tasks.org"))
-(setq org-default-notes-file "~/notes/tasks.org")
-
-(setq org-agenda-show-all-dates t)
-(setq org-agenda-skip-deadline-if-done t)
-(setq org-agenda-skip-scheduled-if-done t)
-(setq org-agenda-start-on-weekday nil)
-(setq org-reverse-note-order t)
+(setq org-agenda-files '("~/notes/calendar.org" "~/notes/tasks.org")
+ org-default-notes-file "~/notes/tasks.org"
+ org-agenda-show-all-dates t
+ org-agenda-skip-deadline-if-done t
+ org-agenda-skip-scheduled-if-done t
+ org-agenda-start-on-weekday nil
+ org-reverse-note-order t)
(setq org-agenda-custom-commands
'(("d" todo "DONE" nil)
@@ -134,16 +138,15 @@ be restored properly."
"List of refiling targets for agenda, including non-agenda
files.")
-(setq org-refile-targets (quote ((nil :maxlevel . 3)
- (km/org-refiling-targets :maxlevel . 2))))
-
-;; Use ido for refiling.
-(setq org-outline-path-complete-in-steps nil)
-(setq org-completion-use-ido t)
-
(defun km/verify-refile-target ()
"Exclude DONE state from refile targets."
(not (member (nth 2 (org-heading-components)) org-done-keywords)))
-(setq org-refile-target-verify-function 'km/verify-refile-target)
+
+(setq org-refile-targets '((nil :maxlevel . 3)
+ (km/org-refiling-targets :maxlevel . 2)))
+(setq org-refile-target-verify-function 'km/verify-refile-target
+ ;; Use ido for refiling.
+ org-outline-path-complete-in-steps nil
+ org-completion-use-ido t)
(provide 'init-org)
diff --git a/lisp/init-orgcontacts.el b/lisp/init-orgcontacts.el
index 548c146..300542b 100644
--- a/lisp/init-orgcontacts.el
+++ b/lisp/init-orgcontacts.el
@@ -1,4 +1,4 @@
-(require 'org-contacts)
+(add-to-list 'load-path "~/src/emacs/org-mode/contrib/lisp" t)
(setq org-contacts-files '("~/notes/contacts.org"))
diff --git a/lisp/init-pkg.el b/lisp/init-pkg.el
deleted file mode 100644
index 0b248ef..0000000
--- a/lisp/init-pkg.el
+++ /dev/null
@@ -1,53 +0,0 @@
-;; http://www.aaronbedra.com/emacs.d/
-
-(require 'package)
-(add-to-list 'package-archives
- '("melpa" . "http://melpa.milkbox.net/packages/") t)
-(setq package-enable-at-startup nil)
-(package-initialize)
-
-(require 'cl)
-(defvar km/packages '(ace-jump-mode
- auctex
- dash
- ess
- expand-region
- flx
- flx-ido
- git-annex
- git-commit-mode
- haskell-mode
- htmlize
- key-chord
- less-css-mode
- lua-mode
- magit
- markdown-mode
- mocker
- multiple-cursors
- paredit
- pkgbuild-mode
- projectile
- smex
- wrap-region
- yasnippet)
- "Default packages")
-
-(defun km/packages-installed-p ()
- (loop for pkg in km/packages
- when (not (package-installed-p pkg)) do (return nil)
- finally (return t)))
-
-(unless (km/packages-installed-p)
- (message "%s" "Refreshing package database...")
- (package-refresh-contents)
- (dolist (pkg km/packages)
- (when (not (package-installed-p pkg))
- (message "installing %s" pkg)
- (package-install pkg))))
-
-(add-to-list 'load-path "~/.emacs.d/vendor/")
-(add-to-list 'load-path "~/src/emacs/org-mode/lisp")
-(add-to-list 'load-path "~/src/emacs/org-mode/contrib/lisp" t)
-
-(provide 'init-pkg)
diff --git a/lisp/init-projectile.el b/lisp/init-projectile.el
index 66da4c6..52f610d 100644
--- a/lisp/init-projectile.el
+++ b/lisp/init-projectile.el
@@ -1,6 +1,9 @@
+(require-package 'projectile)
+
(projectile-global-mode)
-(setq projectile-switch-project-action 'projectile-commander)
+(setq projectile-switch-project-action 'projectile-commander
+ projectile-use-git-grep t)
;; Default binding is D.
(def-projectile-commander-method ?r
@@ -24,6 +27,11 @@ I have set `projectile-switch-project-action' to
(define-key projectile-mode-map (kbd "C-c p j")
'km/projectile-switch-project-to-file)
-(setq projectile-use-git-grep t)
+(key-chord-define-global ";s" 'projectile-switch-project)
+(key-chord-define-global ";f" 'projectile-find-file)
+(key-chord-define-global ";d" 'projectile-find-dir)
+(key-chord-define-global ";g" 'projectile-grep)
+(key-chord-define-global ";r" 'projectile-replace)
+(key-chord-define-global ";c" 'projectile-commander)
(provide 'init-projectile)
diff --git a/lisp/init-python.el b/lisp/init-python.el
index ae4871b..bbd477b 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -1,17 +1,16 @@
;; http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc5
(defun km/setup-ipython-shell ()
(interactive)
- (setq
- python-shell-interpreter "ipython"
- python-shell-interpreter-args ""
- python-shell-prompt-regexp "In \\[[0-9]+\\]: "
- python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
- python-shell-completion-setup-code
- "from IPython.core.completerlib import module_completion"
- python-shell-completion-module-string-code
- "';'.join(module_completion('''%s'''))\n"
- python-shell-completion-string-code
- "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
+ (setq python-shell-interpreter "ipython"
+ python-shell-interpreter-args ""
+ python-shell-prompt-regexp "In \\[[0-9]+\\]: "
+ python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
+ python-shell-completion-setup-code
+ "from IPython.core.completerlib import module_completion"
+ python-shell-completion-module-string-code
+ "';'.join(module_completion('''%s'''))\n"
+ python-shell-completion-string-code
+ "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
(defun km/create-python-test-file (arg)
"Create a python test file from the name of the current file.
diff --git a/lisp/init-shell.el b/lisp/init-shell.el
new file mode 100644
index 0000000..db3c6ad
--- /dev/null
+++ b/lisp/init-shell.el
@@ -0,0 +1,9 @@
+;;; Shell and configuration files
+
+(require-package 'pkgbuild-mode)
+
+(add-to-list 'auto-mode-alist '("\\.zsh$" . shell-script-mode))
+(add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode))
+(add-to-list 'auto-mode-alist '("PKGBUILD" . pkgbuild-mode))
+
+(provide 'init-shell)
diff --git a/lisp/init-smex.el b/lisp/init-smex.el
index 94e48b5..bd0c5eb 100644
--- a/lisp/init-smex.el
+++ b/lisp/init-smex.el
@@ -1,9 +1,12 @@
+(require-package 'smex)
+
;; http://www.juanrubio.me/2011/11/emacs-smex-m-x-do-not-like-typing/
-(require 'smex)
(smex-initialize)
;; smex bound in km-evil.ex (,x).
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; Old M-x
(global-set-key (kbd "M-x") 'execute-extended-command)
+(key-chord-define-global ",x" 'smex)
+
(provide 'init-smex)
diff --git a/lisp/init-tex.el b/lisp/init-tex.el
index 3654a87..0f5a43b 100644
--- a/lisp/init-tex.el
+++ b/lisp/init-tex.el
@@ -1,3 +1,5 @@
+(require-package 'auctex)
+
(require 'tex)
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
@@ -13,8 +15,6 @@
(add-hook 'org-mode-hook 'km/org-mode-reftex-setup)
-(setq reftex-default-bibliography
- (quote
- ("~/refs/refs.bib")))
+(setq reftex-default-bibliography '("~/refs/refs.bib"))
(provide 'init-tex)
diff --git a/lisp/init-text.el b/lisp/init-text.el
new file mode 100644
index 0000000..275934e
--- /dev/null
+++ b/lisp/init-text.el
@@ -0,0 +1,32 @@
+(require-package 'markdown-mode)
+
+(setq-default fill-column 72)
+
+(add-hook 'text-mode-hook 'turn-on-auto-fill)
+
+(defun km/export-wrapped-text (arg)
+ "Export the text in current buffer as wrapped text.
+This is useful for preparing text in emacs and then exporting to
+a wrapped buffer for pasting text (e.g., into a web form).
+
+If region is active, export is restricted to the region. If ARG
+is non-nil, the region is copied with `x-select-text'."
+ (interactive "P")
+ (let ((wrapped-buffer (get-buffer-create "*Wrapped export*"))
+ beg end)
+ (if (region-active-p)
+ (progn (setq beg (region-beginning))
+ (setq end (region-end)))
+ (setq beg (point-min))
+ (setq end (point-max)))
+ (copy-to-buffer wrapped-buffer beg end)
+ (switch-to-buffer-other-window wrapped-buffer)
+ (while (not (eobp))
+ (forward-paragraph)
+ (forward-line -1)
+ (unfill-paragraph)
+ (forward-line 1))
+ (when arg
+ (x-select-text (buffer-substring-no-properties (point-min) (point-max))))))
+
+(provide 'init-text)
diff --git a/lisp/init-yas.el b/lisp/init-yas.el
index 1c0c74a..aa3e7f7 100644
--- a/lisp/init-yas.el
+++ b/lisp/init-yas.el
@@ -1,6 +1,7 @@
-(require 'yasnippet)
+(require-package 'yasnippet)
-(yas-reload-all)
+(eval-after-load 'yas
+ '(yas-reload-all))
(add-hook 'prog-mode-hook
'(lambda ()