From 58ed43ac257c8f1585a034f1e04fd1ca35884695 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 20 Apr 2013 02:22:06 -0400 Subject: cleaning up --- init/00-km-general.el | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ init/00-km-ui.el | 33 -------------------- init/km-babel.el | 31 +++++++++++++++++++ init/km-editor.el | 32 -------------------- init/km-evil.el | 2 -- init/km-func.el | 13 -------- init/km-general.el | 36 ---------------------- init/km-keybindings.el | 3 ++ init/km-mail.el | 2 -- init/km-modes.el | 18 +++++++++++ init/km-org.el | 43 --------------------------- init/km-python.el | 9 +----- init/km-tex.el | 23 +------------- 13 files changed, 135 insertions(+), 191 deletions(-) create mode 100644 init/00-km-general.el delete mode 100644 init/00-km-ui.el create mode 100644 init/km-babel.el delete mode 100644 init/km-editor.el delete mode 100644 init/km-general.el create mode 100644 init/km-keybindings.el create mode 100644 init/km-modes.el diff --git a/init/00-km-general.el b/init/00-km-general.el new file mode 100644 index 0000000..e760e51 --- /dev/null +++ b/init/00-km-general.el @@ -0,0 +1,81 @@ +(setq default-frame-alist '((font . "Droid Sans Mono-9"))) + +(require 'font-lock) +(global-font-lock-mode t) + +(setq inhibit-splash-screen t + initial-scratch-message nil) + +(scroll-bar-mode -1) +(tool-bar-mode -1) +(menu-bar-mode -1) + +(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 the 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 +(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") + +(put 'dired-find-alternate-file 'disabled nil) + +(setq x-select-enable-clipboard t) +(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) + +;; 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) + +;; (require 'ess-site) +(add-hook 'ess-mode-hook (lambda () + (setq ess-indent-level 4))) + +(add-hook 'sh-mode-hook (lambda () + (setq sh-basic-offset 4))) + +;; 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))) + +(delete-selection-mode t) ;; write over selected text +(transient-mark-mode t) +;; share clipboard with system +(setq x-select-enable-clipboard t) + +(blink-cursor-mode -1) + +(put 'narrow-to-region 'disabled nil) diff --git a/init/00-km-ui.el b/init/00-km-ui.el deleted file mode 100644 index 19c7aac..0000000 --- a/init/00-km-ui.el +++ /dev/null @@ -1,33 +0,0 @@ -;; check km-editor.el if don't find something in here - -;; to customize font -(setq default-frame-alist '((font . "Droid Sans Mono-9"))) - -(require 'font-lock) -(global-font-lock-mode t) -(add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode)) - -;; splash screen -(setq inhibit-splash-screen t - initial-scratch-message nil) - -(scroll-bar-mode -1) -(tool-bar-mode -1) -(menu-bar-mode -1) - -(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) - -;; y or n -(defalias 'yes-or-no-p 'y-or-n-p) - -;; line info -(line-number-mode t) -(column-number-mode t) -(size-indication-mode t) diff --git a/init/km-babel.el b/init/km-babel.el new file mode 100644 index 0000000..0a72278 --- /dev/null +++ b/init/km-babel.el @@ -0,0 +1,31 @@ +;; set up babel languages +(org-babel-do-load-languages + 'org-babel-load-languages + '( (perl . t) + (sh . t) + (python . t) + (R . t) + (emacs-lisp . t) + (latex . t) + )) +;; 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 +(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" + "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) diff --git a/init/km-editor.el b/init/km-editor.el deleted file mode 100644 index 596adf0..0000000 --- a/init/km-editor.el +++ /dev/null @@ -1,32 +0,0 @@ -;; check km-ui.el if don't find something in here - -(setq-default fill-column 72) -(add-hook 'text-mode-hook 'turn-on-auto-fill) - -;; ess -;; (require 'ess-site) -(add-hook 'ess-mode-hook (lambda () - (setq ess-indent-level 4))) - -;; shell scripts -(add-hook 'sh-mode-hook (lambda () - (setq sh-basic-offset 4))) - -(global-set-key (kbd "C-x \\") 'align-regexp) - -;; 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))) - -(delete-selection-mode t) ;; write over selected text -(transient-mark-mode t) -;; share clipboard with system -(setq x-select-enable-clipboard t) - -(blink-cursor-mode -1) - -(put 'narrow-to-region 'disabled nil) - -(global-set-key (kbd "C-c i") 'indent-relative) diff --git a/init/km-evil.el b/init/km-evil.el index 93e1e98..d0cce74 100644 --- a/init/km-evil.el +++ b/init/km-evil.el @@ -8,7 +8,6 @@ ;; red box in emacs mode (setq evil-emacs-state-cursor '("red" box)) - (loop for (mode . state) in '((dired-mode . emacs) (org-agenda-mode . emacs) (ibuffer-mode . emacs)) @@ -24,7 +23,6 @@ (kill-this-buffer) ) - (define-key evil-normal-state-map ",w" 'save-buffer) (define-key evil-normal-state-map ",q" 'kill-buffer) (define-key evil-normal-state-map ",d" 'km/save-and-kill-buffer) diff --git a/init/km-func.el b/init/km-func.el index 62ee561..f59d4ec 100644 --- a/init/km-func.el +++ b/init/km-func.el @@ -35,19 +35,6 @@ (insert "#!/usr/bin/env " lang "\n")) (global-set-key (kbd "C-c s") 'km/shebang) -(defun km/insert-random-string (&optional strlen) - "Insert a random string (default length: 5)" - (interactive) - (unless strlen - (setq strlen 5)) - (let (mycharset (ii 0) ) - (setq mycharset ["a" "b" "c" "d" "e" "f" "g" "h" "i" - "j" "k" "l" "m" "n" "o" "p" "q" "r" - "s" "t" "u" "v" "w" "x" "y" "z"]) - (while (< ii strlen) - (insert (elt mycharset (random (length mycharset)))) - (setq ii (1+ ii))))) - (defun km/insert-date () (interactive) (insert (format-time-string "%Y-%m-%d"))) diff --git a/init/km-general.el b/init/km-general.el deleted file mode 100644 index e16e50e..0000000 --- a/init/km-general.el +++ /dev/null @@ -1,36 +0,0 @@ -;; 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 -(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 -(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") - -(put 'dired-find-alternate-file 'disabled nil) -;;(require 'dired+) - -(setq auto-mode-alist - (cons '("\\.md$" . markdown-mode) auto-mode-alist)) -(setq auto-mode-alist - (cons '("\\.markdown$" . markdown-mode) auto-mode-alist)) -(setq auto-mode-alist - (cons '("\\.zsh$" . shell-script-mode) auto-mode-alist)) - -(setq x-select-enable-clipboard t) -(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) - -;; make scripts executable at save -(add-hook 'after-save-hook - 'executable-make-buffer-file-executable-if-script-p) diff --git a/init/km-keybindings.el b/init/km-keybindings.el new file mode 100644 index 0000000..3caaa8c --- /dev/null +++ b/init/km-keybindings.el @@ -0,0 +1,3 @@ +;; keybindings that don't go with other topics +(global-set-key (kbd "C-x \\") 'align-regexp) +(global-set-key (kbd "C-c i") 'indent-relative) diff --git a/init/km-mail.el b/init/km-mail.el index 7a48417..461af07 100644 --- a/init/km-mail.el +++ b/init/km-mail.el @@ -1,5 +1,3 @@ -(add-to-list 'auto-mode-alist '("/mutt" . mail-mode)) - (defun km/mail-position () "Move cursor to first blank line and position cursor between two blank lines" diff --git a/init/km-modes.el b/init/km-modes.el new file mode 100644 index 0000000..071ae56 --- /dev/null +++ b/init/km-modes.el @@ -0,0 +1,18 @@ +;; these could be kept alongside related topics, but for whatever reason +;; I prefer having them together + +(defvar km/modes '( + ("\\.md$" . markdown-mode) + ("\\.markdown$" . markdown-mode) + ("\\.zsh$" . shell-script-mode) + ("\\.*rc$" . conf-unix-mode) + ("\\.org.txt$" . org-mode) + ("/mutt" . mail-mode) + ) + "Auto mode mappings") + +(defun km/add-mode (mode) + (setq auto-mode-alist + (cons mode auto-mode-alist))) + +(mapcar 'km/add-mode km/modes) diff --git a/init/km-org.el b/init/km-org.el index b962950..39a1a89 100644 --- a/init/km-org.el +++ b/init/km-org.el @@ -3,19 +3,13 @@ (setq org-todo-keywords '((sequence "TODO" "STARTED" "|" "DONE" "NA"))) -;; (setq org-agenda-files (list "~/notes/tasks.org")) - ;; next 6 lines merged from prelude-org (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ca" 'org-agenda) (global-set-key "\C-cb" 'org-iswitchb) (setq org-log-done t) -;; allow for file to end in txt -(add-to-list 'auto-mode-alist '("\\.org.txt$" . org-mode)) - ;; set up capture -;; (setq org-default-notes-file (expand-file-name "~/notes/tasks.org")) (setq org-capture-templates '(("c" "cal" entry (file+headline "~/notes/calendar.org" "misc") "* %?") @@ -111,43 +105,6 @@ (setq org-refile-target-verify-function 'km/verify-refile-target) -;; set up babel languages -(org-babel-do-load-languages - 'org-babel-load-languages - '( (perl . t) - (sh . t) - (python . t) - (R . t) - (emacs-lisp . t) - (latex . t) - (ditaa . t) - )) -;; 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 -(setq org-export-latex-listings 'minted) -(setq org-export-latex-custom-lang-environments - '( - (R "rcode") - (sh "shcode") - (python "pythoncode") - )) -;; (setq org-export-latex-custom-lang-environments -;; '( -;; (emacs-lisp "common-lispcode") -;; )) -;; (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" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) - (defun km/open-main-orgfile () (interactive) (find-file org-default-notes-file)) diff --git a/init/km-python.el b/init/km-python.el index ce7aa53..9d2752e 100644 --- a/init/km-python.el +++ b/init/km-python.el @@ -2,11 +2,6 @@ (interactive) (insert "sys.exit()")) -(defun km/python-random-assignment () - (interactive) - (km/insert-random-string 10) - (insert " = None")) - (defun km/python-shebang () (interactive) (km/shebang "python")) @@ -18,8 +13,7 @@ import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator -from colors import brew, fgry, bgry" - ) +from colors import brew, fgry, bgry") (defun km/python-insert-analysis-imports () "Common imports for analysis scripts" @@ -27,7 +21,6 @@ from colors import brew, fgry, bgry" (insert km/python-analysis-imports)) (defun km/python-hook () - (local-set-key (kbd "C-c p r") 'km/python-random-assignment) (local-set-key (kbd "C-c p e") 'km/python-sysexit) (local-set-key (kbd "C-c p s") 'km/python-shebang) (local-set-key (kbd "C-c p a") 'km/python-insert-analysis-imports)) diff --git a/init/km-tex.el b/init/km-tex.el index 5cf362f..633f63f 100644 --- a/init/km-tex.el +++ b/init/km-tex.el @@ -5,26 +5,6 @@ "/usr/texbin" ":" (getenv "PATH"))) -;; for viewing in-frame -;;http://www.sigmafield.org/2009/10/03/using-doc-view-with-auto-revert-to-view-latex-pdf-output-in-emacs/ -;;(setq TeX-PDF-mode t) -;;(add-hook 'doc-view-mode-hook 'auto-revert-mode) - -;; reftex -;; mostly from http://www.kieranhealy.org/esk/starter-kit-latex.html -;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode -;; (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) -;; (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) -;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil) -;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t) -;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode -;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode - -;; ;; Make RefTeX faster -;; (setq reftex-enable-partial-scans t) -;; (setq reftex-save-parse-info t) -;; (setq reftex-use-multiple-selection-buffers t) - ;; commented out the rest of it because something was causing it to ;; prompt for master file in org mode (defun km/org-mode-reftex-setup () @@ -32,8 +12,7 @@ ;; (and (buffer-file-name) ;; (file-exists-p (buffer-file-name)) ;; (reftex-parse-all)) - (define-key org-mode-map (kbd "C-c [") 'reftex-citation) - ) + (define-key org-mode-map (kbd "C-c [") 'reftex-citation)) (add-hook 'org-mode-hook 'km/org-mode-reftex-setup) -- cgit v1.2.3