From b94080967f1d7938a24ac9b4fa7104a43e10a9cb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 28 Nov 2011 17:04:43 -0500 Subject: [PATCH] Split .emacs configuration files into logical blocks. --- src/.emacs | 103 ++----------------- src/.emacs-admin | 51 +-------- src/.emacs.d/load/wtk_centralized_backups.el | 21 ++++ src/.emacs.d/load/wtk_common.el | 14 +++ src/.emacs.d/load/wtk_epa.el | 6 ++ src/.emacs.d/load/wtk_layout.el | 2 + src/.emacs.d/load/wtk_org.el | 16 +++ 7 files changed, 72 insertions(+), 141 deletions(-) create mode 100644 src/.emacs.d/load/wtk_centralized_backups.el create mode 100644 src/.emacs.d/load/wtk_common.el create mode 100644 src/.emacs.d/load/wtk_epa.el create mode 100644 src/.emacs.d/load/wtk_layout.el create mode 100644 src/.emacs.d/load/wtk_org.el diff --git a/src/.emacs b/src/.emacs index 74fabc5..e937874 100644 --- a/src/.emacs +++ b/src/.emacs @@ -5,102 +5,15 @@ ; Lisp comments begin with a ";" -;------------------------------------------------------------------------------ -; Make operating on buffers more convienient - -(setq inhibit-startup-message t) ; no splash screen -(fset 'yes-or-no-p 'y-or-n-p) ; use y or n instead of yes or n -(setq require-final-newline t) ; always end a file with a newline -(setq backup-by-copying-when-mismatch t) ; preserve file's owner and group -(when (fboundp 'global-font-lock-mode) ; turn on font-lock mode - (global-font-lock-mode t)) -(setq transient-mark-mode t) ; enable visual feedback on selections -(global-set-key "\C-xg" 'goto-line) ; bind the goto-line function - -; Make scripts executable on Save (saves having to do the chmod every time) -;(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) - -;------------------------------------------------------------------------------ -; Set up a more organized version control -; -; Backups are saved to ~/.backup, and autosaves to ~/.autosave If -; ~/.backup doesn't exist it is created. If ~/.autosave doesn't exist -; it is created, the standard autosave procedure is followed. -; -; following J.T. Halbert at http://www.math.umd.edu/~halbert/dotemacs.html -; and the Emacs manual at -; http://www.gnu.org/software/emacs/manual/html_node/emacs/Backup-Names.html - -(setq backup-directory-alist (quote ((".*" . "~/.backup")))) -(defconst use-backup-dir t) ; Use backup directory - -; From http://www.delorie.com/gnu/docs/emacs/emacs_125.html -; Emacs records interrupted sessions for later recovery in files named -; `~/.emacs.d/auto-save-list/.saves-pid-hostname'. The -; `~/.emacs.d/auto-save-list/.saves-' portion of these names comes -; from the value of auto-save-list-file-prefix. -(setq auto-save-list-file-prefix "~/.auto-save-list/.saves-") - -; redefining the make-auto-save-file-name function in order to get -; autosave files sent to a single directory. Note that this function -; looks first to determine if you have a ~/.autosave/ directory. If -; you do not it proceeds with the standard auto-save procedure. -(defun make-auto-save-file-name () - "Return file name to use for auto-saves of current buffer.." - (if buffer-file-name - (if (file-exists-p "~/.autosave/") - (concat (expand-file-name "~/.autosave/") "#" - (replace-regexp-in-string "/" "!" buffer-file-name) - "#") - (concat - (file-name-directory buffer-file-name) - "#" - (file-name-nondirectory buffer-file-name) - "#")) - (expand-file-name - (concat "#%" (buffer-name) "#")))) - -;------------------------------------------------------------------------------ -; Personal tweaks - -; Setup bundled EasyPG (encryption with gpg) -; from minor emacs wizardry -; http://emacs.wordpress.com/2008/07/18/keeping-your-secrets-secret/ -(require 'epa) -;(epa-file-enable) -; end EasyPG - -; setup org-mode -; http://orgmode.org/manual/Activation.html -; The following lines are always needed. Choose your own keys. -(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) -(global-set-key "\C-cl" 'org-store-link) -(global-set-key "\C-ca" 'org-agenda) -(global-set-key "\C-cb" 'org-iswitchb) - -(setq browse-url-browser-function 'browse-url-firefox) ; loki hack - -(defun org-time-stamp-now () - "Insert the current timestamp in org-mode, without recourse to the calendar." - (interactive) - (org-insert-time-stamp (current-time) 'with-hm 'inactive)) -(global-set-key "\C-cn" 'org-time-stamp-now) -; end org-mode - ; Emacs Load Path ;(setq load-path (cons "~/.emacs.d/load" load-path)) + +; Load useful customizations +(load "wtk_common.el") +(load "wtk_centralized_backups.el") +(load "wtk_layout.el") +(load "wtk_epa.el") +(load "wtk_org.el") + ; Load querty.el, for switching keyboard mappings. ;(load "querty.el") - -;(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. -; '(safe-local-variable-values (quote ((noweb-code-mode . c-mode))))) -;(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. -; ) diff --git a/src/.emacs-admin b/src/.emacs-admin index 1e7e20a..b589e09 100644 --- a/src/.emacs-admin +++ b/src/.emacs-admin @@ -5,50 +5,9 @@ ; Lisp comments begin with a ";" -;------------------------------------------------------------------------------ -; Make operating on buffers more convienient +; Emacs Load Path +;(setq load-path (cons "~/.emacs.d/load" load-path)) -(setq inhibit-startup-message t) ; no splash screen -(fset 'yes-or-no-p 'y-or-n-p) ; use y or n instead of yes or n -(setq require-final-newline t) ; always end a file with a newline -(setq backup-by-copying-when-mismatch t) ; preserve file's owner and group -(when (fboundp 'global-font-lock-mode) ; turn on font-lock mode - (global-font-lock-mode t)) -(setq transient-mark-mode t) ; enable visual feedback on selections -(global-set-key "\C-xg" 'goto-line) ; bind the goto-line function - -; Make scripts executable on Save (saves having to do the chmod every time) -(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) - -;------------------------------------------------------------------------------ -; Set up a more organized version control -; -; Backups are saved to ~/.backup, and autosaves to ~/.autosave If -; ~/.backup doesn't exist it is created. If ~/.autosace doesn't exist -; it is created, the standard autosave procedure is followed. -; -; following J.T. Halbert at http://www.math.umd.edu/~halbert/dotemacs.html -; and the Emacs manual at -; http://www.gnu.org/software/emacs/manual/html_node/emacs/Backup-Names.html - -(setq backup-directory-alist (quote ((".*" . "~/.backup")))) -(defconst use-backup-dir t) ; Use backup directory - -; redefining the make-auto-save-file-name function in order to get -; autosave files sent to a single directory. Note that this function -; looks first to determine if you have a ~/.autosaves/ directory. If -; you do not it proceeds with the standard auto-save procedure. -(defun make-auto-save-file-name () - "Return file name to use for auto-saves of current buffer.." - (if buffer-file-name - (if (file-exists-p "~/.autosaves/") - (concat (expand-file-name "~/.autosaves/") "#" - (replace-regexp-in-string "/" "!" buffer-file-name) - "#") - (concat - (file-name-directory buffer-file-name) - "#" - (file-name-nondirectory buffer-file-name) - "#")) - (expand-file-name - (concat "#%" (buffer-name) "#")))) +; Load useful customizations +(load "wtk_common.el") +(load "wtk_centralized_backups.el") diff --git a/src/.emacs.d/load/wtk_centralized_backups.el b/src/.emacs.d/load/wtk_centralized_backups.el new file mode 100644 index 0000000..2e66dc9 --- /dev/null +++ b/src/.emacs.d/load/wtk_centralized_backups.el @@ -0,0 +1,21 @@ +;------------------------------------------------------------------------------ +; Set up a more organized version control +; +; Backups are saved to ~/.emacs.d/.backup, and autosaves to +; ~/.emacs.d/.autosave. If ~/.emacs.d/.backup doesn't exist it is +; created. If ~/.emacs.d/.autosave doesn't exist it is created, the +; standard autosave procedure is followed. +; +; following J.T. Halbert at http://www.math.umd.edu/~halbert/dotemacs.html +; and the Emacs manual at +; http://www.gnu.org/software/emacs/manual/html_node/emacs/Backup-Names.html + +(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/.backup")))) +(defconst use-backup-dir t) ; Use backup directory + +; From http://www.delorie.com/gnu/docs/emacs/emacs_125.html +; Emacs records interrupted sessions for later recovery in files named +; `~/.emacs.d/auto-save-list/.saves-pid-hostname'. The +; `~/.emacs.d/auto-save-list/.saves-' portion of these names comes +; from the value of auto-save-list-file-prefix. +(setq auto-save-list-file-prefix "~/.emacs.d/.auto-save-list/.saves-") diff --git a/src/.emacs.d/load/wtk_common.el b/src/.emacs.d/load/wtk_common.el new file mode 100644 index 0000000..cefe9f6 --- /dev/null +++ b/src/.emacs.d/load/wtk_common.el @@ -0,0 +1,14 @@ +;------------------------------------------------------------------------------ +; Make operating on buffers more convienient + +(setq inhibit-startup-message t) ; no splash screen +(fset 'yes-or-no-p 'y-or-n-p) ; use y or n instead of yes or n +(setq require-final-newline t) ; always end a file with a newline +(setq backup-by-copying-when-mismatch t) ; preserve file's owner and group +(when (fboundp 'global-font-lock-mode) ; turn on font-lock mode + (global-font-lock-mode t)) +(setq transient-mark-mode t) ; enable visual feedback on selections +(global-set-key "\C-xg" 'goto-line) ; bind the goto-line function + +; Make scripts executable on Save (saves having to do the chmod every time) +(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) diff --git a/src/.emacs.d/load/wtk_epa.el b/src/.emacs.d/load/wtk_epa.el new file mode 100644 index 0000000..976fee9 --- /dev/null +++ b/src/.emacs.d/load/wtk_epa.el @@ -0,0 +1,6 @@ +; Setup bundled EasyPG (encryption with gpg) +; from minor emacs wizardry +; http://emacs.wordpress.com/2008/07/18/keeping-your-secrets-secret/ +(require 'epa) +;(epa-file-enable) +; end EasyPG diff --git a/src/.emacs.d/load/wtk_layout.el b/src/.emacs.d/load/wtk_layout.el new file mode 100644 index 0000000..04bdb20 --- /dev/null +++ b/src/.emacs.d/load/wtk_layout.el @@ -0,0 +1,2 @@ +(setq fill-column 78) ;; set M-q wrapping just under the std terminal width +(setq default-tab-width 2) diff --git a/src/.emacs.d/load/wtk_org.el b/src/.emacs.d/load/wtk_org.el new file mode 100644 index 0000000..b124416 --- /dev/null +++ b/src/.emacs.d/load/wtk_org.el @@ -0,0 +1,16 @@ +; setup org-mode +; http://orgmode.org/manual/Activation.html +; The following lines are always needed. Choose your own keys. +(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) +(global-set-key "\C-cl" 'org-store-link) +(global-set-key "\C-ca" 'org-agenda) +(global-set-key "\C-cb" 'org-iswitchb) + +(setq browse-url-browser-function 'browse-url-firefox) ; loki hack + +(defun org-time-stamp-now () + "Insert the current timestamp in org-mode, without recourse to the calendar." + (interactive) + (org-insert-time-stamp (current-time) 'with-hm 'inactive)) +(global-set-key "\C-cn" 'org-time-stamp-now) +; end org-mode -- 2.26.2