From 2c0c1f970899389025281e8968e3517fa32668d8 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 25 Jan 2014 00:48:21 -0500 Subject: Clean up init files --- init/00-km-general.el | 17 +++---- init/20-keymaps.el | 2 +- init/km-babel.el | 14 +++--- init/km-dired.el | 4 +- init/km-func.el | 16 +++---- init/km-gnus.el | 10 ++--- init/km-ibuffer.el | 12 ++--- init/km-ido.el | 6 +-- init/km-keybindings.el | 4 +- init/km-keychord.el | 2 +- init/km-modes.el | 12 ++--- init/km-org.el | 117 ++++++++++++++++++++++--------------------------- init/km-projectile.el | 4 +- init/km-smex.el | 4 +- init/km-tex.el | 2 +- 15 files changed, 105 insertions(+), 121 deletions(-) (limited to 'init') diff --git a/init/00-km-general.el b/init/00-km-general.el index bf4ce0e..872eec9 100644 --- a/init/00-km-general.el +++ b/init/00-km-general.el @@ -18,25 +18,26 @@ (defalias 'yes-or-no-p 'y-or-n-p) -;; line info +;; Line info (line-number-mode t) (column-number-mode t) (size-indication-mode t) -;; set location of custom.el +;; Set location of custom.el. (setq custom-file "~/.emacs.d/custom.el") (load custom-file) -;; store all backup and autosave files in the tmp dir +;; 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))) -;; revert buffers automatically when underlying files are changed externally +;; Revert buffers automatically when underlying files are changed +;; externally. (global-auto-revert-mode t) -;; tramp +;; Tramp (require 'tramp) (setq tramp-default-method "ssh") @@ -45,14 +46,14 @@ (setq x-select-enable-primary t) -;; make scripts executable at save +;; 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 +;; Make whitespace-mode use just basic coloring. ;; http://ergoemacs.org/emacs/whitespace-mode.html (setq whitespace-style (quote (spaces tabs newline space-mark @@ -60,7 +61,7 @@ (transient-mark-mode -1) -;; share clipboard with system +;; Share clipboard with system. (setq x-select-enable-clipboard t) (blink-cursor-mode -1) diff --git a/init/20-keymaps.el b/init/20-keymaps.el index 316c172..4cc8223 100644 --- a/init/20-keymaps.el +++ b/init/20-keymaps.el @@ -8,7 +8,7 @@ (global-set-key (kbd "C-c i") 'insert-map) ;; multiple cursors -;; put under insert prefix +;; Put under insert prefix. (define-prefix-command 'multiple-cursors-map) (define-key insert-map "m" 'multiple-cursors-map) diff --git a/init/km-babel.el b/init/km-babel.el index 4bd25c8..c70f3ac 100644 --- a/init/km-babel.el +++ b/init/km-babel.el @@ -1,4 +1,4 @@ -;; set up babel languages +;; Set up babel languages. (org-babel-do-load-languages 'org-babel-load-languages '((perl . t) @@ -8,22 +8,18 @@ (emacs-lisp . t) (latex . t))) -;; don't ask for confirmation before running code +;; Don't ask for confirmation before running code. (setq org-confirm-babel-evaluate nil) -;; babel minted latex export -;; modified from -;; http://orgmode.org/worg/org-tutorials/org-latex-export.html +;; 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-minted-options -;; '(("frame" "lines") -;; ("fontsize" "\\scriptsize") -;; ("linenos" ""))) (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/init/km-dired.el b/init/km-dired.el index 25853cd..f22454f 100644 --- a/init/km-dired.el +++ b/init/km-dired.el @@ -4,11 +4,11 @@ ;; .git is present as part of `dired-omit-extensions', but this ;; seems to only be taken into account if the a non-exension part -;; exists +;; exists. (setq dired-omit-files (concat dired-omit-files "\\|\\.git$\\|\\.gitignore$\\|__pycache__")) -(defvar km/latex-omit-extensions '(".aux" +(defcustom km/latex-omit-extensions '(".aux" ".fdb_latexmk" ".fls" ".log" diff --git a/init/km-func.el b/init/km-func.el index b4f670d..c772c30 100644 --- a/init/km-func.el +++ b/init/km-func.el @@ -1,11 +1,11 @@ ;; http://whattheemacsd.com/ ;; whitespace cleanup -;; buffer-specific prevention modified from +;; 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") +;; in-emacs-how-do-i-save-without-running-save-hooks. +(defcustom 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'" @@ -102,7 +102,7 @@ user." (comment-region beg (+ end 5)) (forward-line)))) -;; kill functions +;; Kill functions (defun km/kill-string-at-point () (interactive) @@ -143,7 +143,7 @@ KILLARG." (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" + "Join current line to the next line with a space in between." (interactive) (move-end-of-line 1) (kill-line) @@ -152,14 +152,14 @@ KILLARG." (define-key kill-map "j" 'km/join-next-line-with-space) (defadvice recompile (around restore-windows) - "Prevent recompiling from spawning new 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 +;; From prelude (defun km/swap-windows () "If you have 2 windows, it swaps them." (interactive) diff --git a/init/km-gnus.el b/init/km-gnus.el index c226a12..a9d8a0e 100644 --- a/init/km-gnus.el +++ b/init/km-gnus.el @@ -1,6 +1,6 @@ (require 'gnus) -;; set up gnus directories before gnus is initialized +;; Set up gnus directories before gnus is initialized. (setq gnus-directory "~/.gnus.d" gnus-home-directory "~/.gnus.d" message-directory "~/.gnus.d/mail" @@ -29,7 +29,7 @@ (start-process "mail sync" bufname km/sync-mail-cmd))) (defvar km/sync-mail-cmd "~/bin/sync-mail.sh" - "Run sync mail script") + "Run sync mail script.") ;; http://www.emacswiki.org/emacs/GnusSync (defun gnus-grace-exit-before-kill-emacs () @@ -55,12 +55,12 @@ (setq message-kill-buffer-on-exit t) -;; for rss too specific to add to gwene +;; Use for rss too specific to add to gwene. (require 'nnrss) (setq gnus-group-list-inactive-groups nil) -;; start in topic mode +;; Start in topic mode. (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) (setq gnus-topic-display-empty-topics nil) @@ -189,7 +189,7 @@ NO-NUMBER is non-nil, the number of lines is not added." (define-key message-mode-map (kbd "C-c m s") 'km/snip-mail-quote) -;; without reporting the number of lines +;; Without reporting the number of lines (define-key message-mode-map (kbd "C-c m S") '(lambda (beg end) (interactive "r") diff --git a/init/km-ibuffer.el b/init/km-ibuffer.el index db6e8df..ac565ef 100644 --- a/init/km-ibuffer.el +++ b/init/km-ibuffer.el @@ -1,8 +1,8 @@ -;; replace buffer-menu with ibuffer +;; Replace buffer-menu with ibuffer. (global-set-key (kbd "C-x C-b") 'ibuffer) -;; modified from http://martinowen.net/blog/2010/02/tips-for-emacs-ibuffer.html -;; and here http://www.elliotglaysher.org/emacs/ +;; Modified from http://martinowen.net/blog/2010/02/tips-for-emacs-ibuffer.html +;; and here http://www.elliotglaysher.org/emacs/. (setq ibuffer-saved-filter-groups '(("home" @@ -57,11 +57,11 @@ (add-hook 'ibuffer-mode-hook '(lambda () - (ibuffer-auto-mode 1) ; keep buffer list up-to-date + (ibuffer-auto-mode 1) ; Keep buffer list up-to-date. (ibuffer-switch-to-saved-filter-groups "home"))) -;; do not prompt to delete unmodified buffers +;; Don't prompt to delete unmodified buffers. (setq ibuffer-expert t) -;; don't show empty filter groups +;; Don't show empty filter groups. (setq ibuffer-show-empty-filter-groups nil) diff --git a/init/km-ido.el b/init/km-ido.el index 9603cec..11edacc 100644 --- a/init/km-ido.el +++ b/init/km-ido.el @@ -10,18 +10,18 @@ ido-save-directory-list-file "~/.emacs.d/cache/ido.hist") (flx-ido-mode 1) -;; disable ido faces to see flx highlights. +;; Disable ido faces to see flx highlights. (setq ido-use-faces nil) (setq ido-max-directory-size 100000) -;; recent files +;; Recent files (setq recentf-save-file "~/.emacs.d/cache/recentf" recentf-max-saved-items 200 recentf-max-menu-items 15) (recentf-mode t) -;; from prelude +;; From prelude (defun km/recentf-ido-find-file () "Find a recent file using ido." (interactive) diff --git a/init/km-keybindings.el b/init/km-keybindings.el index 97ad273..4343150 100644 --- a/init/km-keybindings.el +++ b/init/km-keybindings.el @@ -1,9 +1,9 @@ -;; keybindings that don't go with other topics +;; 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) +;; 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")) diff --git a/init/km-keychord.el b/init/km-keychord.el index a61a78f..3312897 100644 --- a/init/km-keychord.el +++ b/init/km-keychord.el @@ -3,7 +3,7 @@ (key-chord-define-global ",r" 'km/recentf-ido-find-file) (key-chord-define-global ",t" 'org-capture) -;; instead of alt-x +;; Instead of alt-x (key-chord-define-global ",x" 'smex) (key-chord-define-global ",f" 'find-file) (key-chord-define-global ",g" 'magit-status) diff --git a/init/km-modes.el b/init/km-modes.el index 9d3dc19..a4b88f3 100644 --- a/init/km-modes.el +++ b/init/km-modes.el @@ -1,10 +1,10 @@ -;; these could be kept alongside related topics, but for whatever reason -;; I prefer having them together +;; 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)) +(defcustom km/modes '(("\\.zsh$" . shell-script-mode) + ("\\.*rc$" . conf-unix-mode) + ("\\.org.txt$" . org-mode) + ("PKGBUILD" . pkgbuild-mode)) "Auto mode mappings") (mapc diff --git a/init/km-org.el b/init/km-org.el index 5341f7f..b88dc19 100644 --- a/init/km-org.el +++ b/init/km-org.el @@ -1,9 +1,12 @@ -;;;; org-mode (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) -;; set up capture (setq org-capture-templates '(("t" "task" entry (file+headline "~/notes/tasks.org" "Inbox") "* TODO %?\n%i") @@ -13,7 +16,7 @@ "* %?\n%i") ("b" "backburner" entry (file+headline "~/notes/backburner.org" "Inbox") "* TODO %?\n%i") - ;; link counterparts + ;; Link counterparts ("T" "task link" entry (file+headline "~/notes/tasks.org" "Inbox") "* TODO %?\n%i\nLink: %a") ("D" "date link" entry (file+headline "~/notes/calendar.org" "Inbox") @@ -22,63 +25,12 @@ "* %?\n%i\nLink: %a") ("B" "backburner link" entry (file+headline "~/notes/backburner.org" "Inbox") "* TODO %?\n%i\nLink: %a") - ;; clipboard + ;; Clipboard ("x" "task clipboard" entry (file+headline "~/notes/tasks.org" "Inbox") "* TODO %?\n%x") ("X" "misc clipboard" entry (file+headline "~/notes/misc.org" "Inbox") "* %?\n%x"))) -(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-fast-tag-selection-single-key 'expert) - -(setq org-agenda-custom-commands - '(("d" todo "DONE" nil) - ("s" todo "STARTED" nil) - ("u" "Unschedule TODO entries" alltodo "" - ((org-agenda-skip-function - (lambda nil - (org-agenda-skip-entry-if 'scheduled 'deadline - 'regexp "\n]+>"))) - (org-agenda-overriding-header "Unscheduled TODO entries: "))) - ("p" "Past timestamps" tags "TIMESTAMP<=\"\""))) - - -(defvar km/org-additional-notes-files '("~/notes/backburner.org" - "~/notes/misc.org") - "non-agenda files that should be available for refiling") - -(defvar km/org-refiling-targets - (append km/org-additional-notes-files org-agenda-files)) - -;; other customization in prelude's org module - -;; have font colors in code blocks -(setq org-src-fontify-natively t) - -;;;; Refile settings - -;; from http://doc.norang.ca/org-mode.html -(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) - -;; Exclude DONE state tasks from refile targets -(defun km/verify-refile-target () - "Exclude todo keywords with a 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) - (defun km/open-main-orgfile () (interactive) (find-file org-default-notes-file)) @@ -100,7 +52,7 @@ ("b" "#+label: " "") ("r" "#+attr_latex: " "") ("R" "#+attr_html: " "") - ;; lower case versions of defaults + ;; Lower case versions of defaults ("s" "#+begin_src ?\n \n#+end_src" "\n\n") ("e" "#+begin_example\n ?\n#+end_example" "\n?\n") ("q" "#+begin_quote\n ?\n#+end_quote" "\n?\n") @@ -116,16 +68,12 @@ ("i" "#+index: ?" "#+index: ?") ("I" "#+include: %file ?" ""))) - -;; don't let `org-cycle-agenda-files' binding override custom +;; Don't let `org-cycle-agenda-files' binding override custom ;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound -;; to C-,) +;; to C-,). (define-key org-mode-map (kbd "C-'") nil) -(setq org-use-speed-commands t) - -(setq org-catch-invisible-edits 'error) - +;;; Org in other modes (defun km/load-orgstruct () (turn-on-orgstruct++) (turn-on-orgtbl)) @@ -133,7 +81,7 @@ (add-hook 'message-mode-hook 'km/load-orgstruct) (add-hook 'git-commit-mode-hook 'km/load-orgstruct) -;; avoid conflict when amsmath is loaded +;; 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)) @@ -152,4 +100,43 @@ be restored properly." (setq org-agenda-restore-windows-after-quit t) (setq org-agenda-sticky nil) -(setq org-goto-interface 'outline-path-completion) +;;; 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-custom-commands + '(("d" todo "DONE" nil) + ("s" todo "STARTED" nil) + ("u" "Unschedule TODO entries" alltodo "" + ((org-agenda-skip-function + (lambda nil + (org-agenda-skip-entry-if 'scheduled 'deadline + 'regexp "\n]+>"))) + (org-agenda-overriding-header "Unscheduled TODO entries: "))) + ("p" "Past timestamps" tags "TIMESTAMP<=\"\""))) + +;;; Refiling + +(defcustom km/org-refiling-targets + (append org-agenda-files '("~/notes/backburner.org" "~/notes/misc.org")) + "List of all refiling targets for agend, 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) diff --git a/init/km-projectile.el b/init/km-projectile.el index 40d4352..585f399 100644 --- a/init/km-projectile.el +++ b/init/km-projectile.el @@ -2,7 +2,7 @@ (setq projectile-switch-project-action 'projectile-commander) -;; default binding is D +;; Default binding is D. (def-projectile-commander-method ?r "Open project root in dired." (projectile-dired)) @@ -16,7 +16,7 @@ I have set `projectile-switch-project-action' to `projectile-commander' but would still like quick access to -`projectile-find-file'" +`projectile-find-file'." (interactive) (let ((projectile-switch-project-action 'projectile-find-file)) (projectile-switch-project))) diff --git a/init/km-smex.el b/init/km-smex.el index b8b8429..e5fc6ec 100644 --- a/init/km-smex.el +++ b/init/km-smex.el @@ -1,7 +1,7 @@ ;; 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) +;; smex bound in km-evil.ex (,x). (global-set-key (kbd "M-X") 'smex-major-mode-commands) -;; old M-x +;; Old M-x (global-set-key (kbd "M-x") 'execute-extended-command) diff --git a/init/km-tex.el b/init/km-tex.el index 7302e22..761a854 100644 --- a/init/km-tex.el +++ b/init/km-tex.el @@ -2,7 +2,7 @@ (require 'reftex) (add-hook 'LaTeX-mode-hook 'turn-on-reftex) -;;; add path for pdflatex +;;; Add path for pdflatex. (setenv "PATH" (concat "/usr/texbin" ":" -- cgit v1.2.3