Browse files

Initial commit

  • Loading branch information...
0 parents commit 3ecbb6d82be800453ee0e2588052a20d3a8f9b5a @kevintweber committed Oct 2, 2012
6 .gitignore
@@ -0,0 +1,6 @@
+authinfo.gpg
+auto-save-list/*
+backups/*
+games/*
+tramp
+!*/empty
31 auto-insert/cpp-template.cpp
@@ -0,0 +1,31 @@
+/*
+ @@@PACKAGE@@@
+
+ Copyright (C) @@@YEAR@@@ Kevin Weber
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@@@FILE@@@.hpp"
+
+namespace @@@PACKAGE@@@ {
+
+//----------------------------------------------------------------------------------
+} // namespace @@@PACKAGE@@@
+//----------------------------------------------------------------------------------
36 auto-insert/hpp-template.hpp
@@ -0,0 +1,36 @@
+/*
+ @@@PACKAGE@@@
+
+ Copyright (C) @@@YEAR@@@ Kevin Weber
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+//----------------------------------------------------------------------------------
+/*!
+ \file @@@FILE@@@.hpp
+ \brief
+*/
+//----------------------------------------------------------------------------------
+#ifndef @@@PACKAGE@@@_@@@FILE@@@_H
+#define @@@PACKAGE@@@_@@@FILE@@@_H
+
+namespace @@@PACKAGE@@@ {
+
+//----------------------------------------------------------------------------------
+} // namespace @@@PACKAGE@@@
+//----------------------------------------------------------------------------------
+#endif // @@@PACKAGE@@@_@@@FILE@@@_H
+//----------------------------------------------------------------------------------
15 auto-insert/php-template.class.php
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ *
+ */
+class @@@FILE@@@
+{
+ /**
+ * Constructor.
+ */
+ public function __construct()
+ {
+
+ }
+}
16 auto-insert/xhtml-template.html
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title></title>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <meta name="copyright" content="Copyright @@@YEAR@@@, Kevin Weber. All rights reserved.">
+ <link rel="stylesheet" href="css/base.css" media="all" />
+ </head>
+ <body class="">
+
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
+ <script type="text/javascript">
+ </script>
+ </body>
+</html>
0 auto-save-list/empty
No changes.
0 backups/empty
No changes.
2 bookmarks.bmk
@@ -0,0 +1,2 @@
+% Bookmark
+- --------
39 expansions/c-keywords.txt
@@ -0,0 +1,39 @@
+Custom abbreviation expansions.
+
+*** c++ keywords ***
+asm auto bool
+break case catch
+char class const
+const_cast continue default
+delete do double
+dynamic_cast else
+enum explicit export
+extern false float
+for friend goto
+if inline int
+long mutable namespace
+new operator private
+protected public register
+reinterpret_cast return
+short signed sizeof
+static static_cast struct
+switch template this
+throw true try
+typedef typeid typename
+union unsigned using
+virtual void volatile
+wchar_t while
+
+*** c++ preprocessor keywords ***
+#define #error #if
+#ifdef #ifndef #else
+#elif #endif #include
+#line #pragma #undef
+
+*** c++ standard library keywords ***
+vector list deque
+set multiset map
+multimap hash_set hash_multiset
+hash_map hash_multimap
+bitset valarray string
+iterator const_iterator
98 expansions/css-properties.txt
@@ -0,0 +1,98 @@
+azimuth <angle> | [[ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards | inherit
+background-attachment scroll | fixed | inherit
+background-color <color> | transparent | inherit
+background-image <uri> | none | inherit
+background-position [ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit
+background-repeat repeat | repeat-x | repeat-y | no-repeat | inherit
+background ['background-color' || 'background-image' || 'background-repeat' || 'background-attachment' || 'background-position'] | inherit
+border-collapse collapse | separate | inherit
+border-color [ <color> | transparent ]{1,4} | inherit
+border-spacing <length> <length>? | inherit
+border-style <border-style>{1,4} | inherit
+border-top border-right border-bottom border-left [ <border-width> || <border-style> || 'border-top-color' ] | inherit
+border-top-color border-right-color border-bottom-color border-left-color <color> | transparent | inherit
+border-top-style border-right-style border-bottom-style border-left-style <border-style> | inherit
+border-top-width border-right-width border-bottom-width border-left-width <border-width> | inherit
+border-width <border-width>{1,4} | inherit
+border [ <border-width> || <border-style> || 'border-top-color' ] | inherit
+bottom <length> | <percentage> | auto | inherit
+caption-side top | bottom | inherit
+clear none | left | right | both | inherit
+clip <shape> | auto | inherit
+color <color> | inherit
+content normal | none | [ <string> | <uri> | <counter> | attr(<identifier>) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
+counter-increment [ <identifier> <integer>? ]+ | none | inherit
+counter-reset [ <identifier> <integer>? ]+ | none | inherit
+cue-after <uri> | none | inherit
+cue-before <uri> | none | inherit
+cue [ 'cue-before' || 'cue-after' ] | inherit
+cursor [ [<uri> ,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress ] ] | inherit
+direction ltr | rtl | inherit
+display inline | block | list-item | run-in | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inherit
+elevation <angle> | below | level | above | higher | lower | inherit
+empty-cells show | hide | inherit
+float left | right | none | inherit
+font-family [[ <family-name> | <generic-family> ] [, <family-name>| <generic-family>]* ] | inherit
+font-size <absolute-size> | <relative-size> | <length> | <percentage> | inherit
+font-style normal | italic | oblique | inherit
+font-variant normal | small-caps | inherit
+font-weight normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
+font [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
+height <length> | <percentage> | auto | inherit
+left <length> | <percentage> | auto | inherit
+letter-spacing normal | <length> | inherit
+line-height normal | <number> | <length> | <percentage> | inherit
+list-style-image <uri> | none | inherit
+list-style-position inside | outside | inherit
+list-style-type disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit
+list-style [ 'list-style-type' || 'list-style-position' || 'list-style-image' ] | inherit
+margin-right margin-left <margin-width> | inherit
+margin-top margin-bottom <margin-width> | inherit
+margin <margin-width>{1,4} | inherit
+max-height <length> | <percentage> | none | inherit
+max-width <length> | <percentage> | none | inherit
+min-height <length> | <percentage> | inherit
+min-width <length> | <percentage> | inherit
+orphans <integer> | inherit
+outline-color <color> | invert | inherit
+outline-style <border-style> | inherit
+outline-width <border-width> | inherit
+outline [ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit
+overflow visible | hidden | scroll | auto | inherit
+padding-top padding-right padding-bottom padding-left <padding-width> | inherit
+padding <padding-width>{1,4} | inherit
+page-break-after auto | always | avoid | left | right | inherit
+page-break-before auto | always | avoid | left | right | inherit
+page-break-inside avoid | auto | inherit
+pause-after <time> | <percentage> | inherit
+pause-before <time> | <percentage> | inherit
+pause [ [<time> | <percentage>]{1,2} ] | inherit
+pitch-range <number> | inherit
+pitch <frequency> | x-low | low | medium | high | x-high | inherit
+play-during <uri> [ mix || repeat ]? | auto | none | inherit
+position static | relative | absolute | fixed | inherit
+quotes [<string> <string>]+ | none | inherit
+richness <number> | inherit
+right <length> | <percentage> | auto | inherit
+speak-header once | always | inherit
+speak-numeral digits | continuous | inherit
+speak-punctuation code | none | inherit
+speak normal | none | spell-out | inherit
+speech-rate <number> | x-slow | slow | medium | fast | x-fast | faster | slower | inherit
+stress <number> | inherit
+table-layout auto | fixed | inherit
+text-align left | right | center | justify | inherit
+text-decoration none | [ underline || overline || line-through || blink ] | inherit
+text-indent <length> | <percentage> | inherit
+text-transform capitalize | uppercase | lowercase | none | inherit
+top <length> | <percentage> | auto | inherit
+unicode-bidi normal | embed | bidi-override | inherit
+vertical-align baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> | <length> | inherit
+visibility visible | hidden | collapse | inherit
+voice-family [[<specific-voice> | <generic-voice> ],]* [<specific-voice> | <generic-voice> ] | inherit
+volume <number> | <percentage> | silent | x-soft | soft | medium | loud | x-loud | inherit
+white-space normal | pre | nowrap | pre-wrap | pre-line | inherit
+widows <integer> | inherit
+width <length> | <percentage> | auto | inherit
+word-spacing normal | <length> | inherit
+z-index auto | <integer> | inherit
5,064 expansions/php-keywords.txt
5,064 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
0 games/empty
No changes.
1,004 init.el
@@ -0,0 +1,1004 @@
+;;****************************************************************************
+;;
+;; Kevin Weber's Emacs customizations
+;;
+;;****************************************************************************
+;; Globals
+;;****************************************************************************
+(message "Starting Emacs customizations.")
+
+;; Do not show the start-up screen.
+(setq inhibit-startup-screen t)
+
+;; Change the startup message.
+(setq initial-scratch-message
+ (format ";; Scratch buffer created %s\n\n"
+ (format-time-string "%Y-%m-%d at %T")))
+
+;; Set random seed.
+(random t)
+
+;; Load common Lisp extensions.
+(require 'cl)
+(require 'misc)
+
+;; Set folder for additional scripts.
+(add-to-list 'load-path "~/.emacs.d/plugins")
+(add-to-list 'load-path "~/.emacs.d/plugins/themes")
+
+;; Load the functions file
+(load "~/.emacs.d/ktw-functions.el")
+
+;; Set email address.
+(setq user-mail-address "kevintweber@gmail.com")
+
+;; Don't add new lines to the end of a file when using down-arrow key
+(setq next-line-add-newlines nil)
+
+;; Make all "yes or no" prompts show "y or n" instead
+(fset 'yes-or-no-p 'y-or-n-p)
+
+;; Always remove trailing whitespace.
+(setq delete-trailing-whitespace t)
+(add-hook 'before-save-hook 'delete-trailing-whitespace)
+
+;; Remove the toolbar.
+(tool-bar-mode -1)
+
+;; Set titles for frame and icon (%f == file name, %b == buffer name)
+(setq frame-title-format
+ '("Emacs: " (:eval (if (buffer-file-name)
+ (abbreviate-file-name (buffer-file-name))
+ "%b")) " [%*]"))
+
+;; Use the clipboard to copy and paste.
+(setq x-select-enabled-clipboard t)
+
+;; Use trash can
+(setq delete-by-moving-to-trash t)
+
+;;****************************************************************************
+;; Modes - Global
+;;****************************************************************************
+;; Open unidentified files in text mode.
+(setq default-major-mode 'text-mode)
+
+;; Always show the latest version of a buffer.
+(global-auto-revert-mode 1)
+
+;; Always show the mark.
+(transient-mark-mode 1)
+
+;; Use column and line numbering.
+(line-number-mode 1)
+(column-number-mode 1)
+
+;; Use size indication mode.
+(size-indication-mode 1)
+
+;; Transparently open compressed files
+(auto-compression-mode t)
+
+;;****************************************************************************
+;; Auto-completions and expansions
+;;****************************************************************************
+;;
+;; Use skeletons for file-level expansions, and use snippets for simple
+;; expansions.
+;;
+;; Use dabbrev for auto-completion
+;;
+
+;; Abbrev mode always on.
+(abbrev-mode 1)
+(setq default-abbrev-mode t)
+
+;; Preserve case when expanding.
+(setq dabbrev-case-replace nil)
+
+;; Expand symbols and words.
+(setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_")
+
+;; Global abbrevs
+(define-abbrev-table 'global-abbrev-table
+ '(
+ ("zzda" "" ktw-skeleton-date 0)
+ ("zzgpl2" "" ktw-skeleton-gpl2 0)
+ ("zzgpl3" "" ktw-skeleton-gpl3 0)
+ ))
+
+;; Abbrevs are set to be manually editted.
+;; Don't automatically save.
+(setq save-abbrevs nil)
+
+;; Use snippets for simple abbrevs.
+(require 'snippet)
+
+;; Enable skeleton-pair-insert globally
+(setq skeleton-pair t)
+
+;; Load the skeletons file
+(load "~/.emacs.d/ktw-skeletons.el")
+
+;;****************************************************************************
+;; Auto-insert
+;;****************************************************************************
+;; Location of auto-insert directory
+(setq auto-insert-directory "~/.emacs.d/auto-insert/")
+
+;; List of file types to auto-insert.
+(setq auto-insert-alist
+ '(
+ ("\\.cpp$" . ["cpp-template.cpp" ktw-auto-update])
+ ("\\.hpp$" . ["hpp-template.hpp" ktw-auto-update])
+ ("\\.html?$" . ["xhtml-template.html" ktw-auto-update])
+ ("\\.class.php$" . ["php-template.class.php" ktw-auto-update])
+ ))
+
+;; Turn on auto-insert
+(auto-insert-mode 1)
+
+;;****************************************************************************
+;; Backups
+;;****************************************************************************
+;; Disable backup files.
+(setq make-backup-files t)
+
+;; Save all backups in special (hidden) folder.
+(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
+
+;; Backup by copying the files.
+(setq backup-by-copying t)
+
+;; Number backup files.
+(setq version-control t)
+
+;; Keep three old versions.
+(setq kept-old-versions 3)
+
+;; Delete old versions.
+(setq delete-old-versions t)
+
+;;****************************************************************************
+;; Bookmarks
+;;****************************************************************************
+;; Save on each bookmark change.
+(setq bookmark-save-flag 1)
+
+;;****************************************************************************
+;; Buffers
+;;****************************************************************************
+(require 'ibuffer)
+
+(setq ibuffer-saved-filter-groups
+ (quote (("default"
+ ("Project: Site Kitchen"
+ (or
+ (filename . "kevin/sf_dev/ktw/")
+ (filename . "kevin/sf_dev/ktw-data/")))
+ ("Programming" ;; prog stuff not already in MyProjectX
+ (or
+ (mode . c-mode)
+ (mode . c++-mode)
+ (mode . makefile-mode)))
+ ("Web Programming"
+ (or
+ (mode . css-mode)
+ (mode . css-simple-mode)
+ (mode . html-mode)
+ (mode . js2-mode)
+ (mode . nxml-mode)
+ (mode . php-mode)
+ (mode . sgml-mode)
+ (mode . yaml-mode)))
+ ("Emacs"
+ (filename . ".emacs.d/"))
+ ("Files"
+ (filename . ".*"))
+ ("File Management"
+ (or
+ (mode . dired-mode)
+ (mode . shell-mode)))
+ ("Documentation"
+ (or
+ (mode . Info-mode)
+ (mode . apropos-mode)
+ (mode . woman-mode)
+ (mode . help-mode)
+ (mode . Man-mode)))
+ ))))
+
+(add-hook 'ibuffer-mode-hook (lambda ()
+ (ibuffer-switch-to-saved-filter-groups "default")))
+
+(define-key ibuffer-mode-map "e" 'ktw-ibuffer-ediff-marked-buffers)
+
+;; Turn on iSwitch Mode.
+(iswitchb-mode 1)
+
+;;****************************************************************************
+;; Calendar
+;;****************************************************************************
+(require 'calendar)
+(require 'holidays)
+(require 'solar)
+
+;; Set location and timezone.
+(setq calendar-latitude 39.9729)
+(setq calendar-longitude -86.1179)
+(setq calendar-location-name "Carmel, IN (USA)")
+(setq calendar-time-zone -300)
+(setq calendar-standard-time-zone-name "EST")
+(setq calendar-daylight-time-zone-name "EDT")
+
+;; Redefine holidays to get rid of wacky holidays.
+(setq calendar-holidays
+ '((holiday-fixed 1 1 "New Year's Day")
+ (holiday-float 1 1 3 "Martin Luther King Day")
+ (holiday-fixed 2 2 "Groundhog Day")
+ (holiday-fixed 2 14 "Valentine's Day")
+ (holiday-float 2 1 3 "President's Day")
+ (holiday-fixed 3 17 "St. Patrick's Day")
+ (holiday-fixed 4 1 "April Fools' Day")
+ (holiday-float 5 0 2 "Mother's Day")
+ (holiday-float 5 1 -1 "Memorial Day")
+ (holiday-fixed 5 5 "Cinco de Mayo")
+ (holiday-float 5 6 3 "Armed Forces Day")
+ (holiday-fixed 6 14 "Flag Day")
+ (holiday-float 6 0 3 "Father's Day")
+ (holiday-fixed 7 4 "Independence Day")
+ (holiday-float 9 1 1 "Labor Day")
+ (holiday-float 10 1 2 "Columbus Day")
+ (holiday-fixed 10 31 "Halloween")
+ (holiday-fixed 11 11 "Veteran's Day")
+ (holiday-float 11 4 4 "Thanksgiving")
+ (holiday-fixed 12 31 "New Year's Eve")
+
+ ;; Birthdays
+ (holiday-fixed 8 17 "Kevin's birthday")
+ (holiday-fixed 10 6 "Cathy's birthday")
+ (holiday-fixed 8 1 "Krystal's birthday")
+
+ ;; Miscellaneous
+ (holiday-fixed 3 14 "Pi Day")
+ (holiday-fixed 4 15 "Tax Day")
+ (holiday-fixed 4 22 "Earth Day")
+ (holiday-fixed 10 23 "Mole Day")
+
+ ;; Christian holidays
+ (holiday-fixed 12 8 "Solemnity of the Immaculate Conception")
+ (holiday-fixed 12 25 "Christmas")
+ (holiday-fixed 1 1 "Solemnity of Mary, Mother of God")
+ (holiday-fixed 1 4 "Feast of St. Elizabeth Ann Seton")
+ (holiday-float 1 0 -1 "Epiphany" 8)
+ (holiday-fixed 1 28 "Feast of St. Thomas Acquinas")
+ (holiday-fixed 2 2 "Presentation of the Lord")
+ (holiday-fixed 2 23 "Feast of St. Polycarp")
+ (holiday-fixed 3 19 "Feast of St. Joseph")
+ (holiday-fixed 3 26 "The Annunciation of the Lord")
+ (holiday-fixed 5 10 "Feast of St. Damien de Veuster of Moloka'i")
+ (holiday-fixed 5 31 "The Visitation of the Virgin Mary to Elizabeth")
+ (holiday-fixed 6 24 "Solemnity of the Nativity of St. John the Baptist")
+ (holiday-fixed 6 29 "Feast of St. Peter and St. Paul")
+ (holiday-fixed 7 31 "Feast of St. Ignatius of Loyola")
+ (holiday-fixed 8 9 "Feast of St. Teresia Benedicta of the Cross (Edith Stein)")
+ (holiday-fixed 8 14 "Feast of St. Maximillian Mary Kolbe")
+ (holiday-fixed 8 15 "Solemnity of the Assumption of Mary")
+ (holiday-fixed 8 28 "Feast of St. Augustine")
+ (holiday-fixed 9 21 "Feast of St. Matthew")
+ (holiday-fixed 10 1 "Feast of St. Therese of the Child Jesus")
+ (holiday-fixed 10 4 "Feast of St. Francis of Assisi")
+ (holiday-fixed 11 1 "All Saints Day")
+ (holiday-fixed 11 2 "All Souls Day")
+ (holiday-fixed 12 26 "Feast of St. Stephen")
+ (holiday-advent -7 "Solemnity of Jesus Christ the King")
+ (holiday-advent 0 "Advent")
+ (holiday-easter-etc)
+ (holiday-easter-etc -7 "Palm Sunday")
+ (holiday-easter-etc 39 "Ascension of the Lord")
+ (holiday-easter-etc 49 "Pentecost")
+ (holiday-easter-etc 56 "Solemnity of the Most Holy Trinity")
+
+ (solar-equinoxes-solstices)
+ (holiday-sexp calendar-daylight-savings-starts
+ (format "Daylight Saving Time Begins %s"
+ (solar-time-string
+ (/ calendar-daylight-savings-starts-time
+ (float 60))
+ calendar-standard-time-zone-name)))
+ (holiday-sexp calendar-daylight-savings-ends
+ (format "Daylight Saving Time Ends %s"
+ (solar-time-string
+ (/ calendar-daylight-savings-ends-time
+ (float 60))
+ calendar-daylight-time-zone-name)))))
+
+;; Mark holidays in calendar.
+(setq calendar-mark-holidays-flag t)
+
+;;****************************************************************************
+;; Completion and Expansion
+;;****************************************************************************
+;; Ignore case when completing.
+(setq completion-ignore-case t)
+
+;; Ignore case when completing buffer and file names.
+(setq read-buffer-completion-ignore-case t)
+(setq read-file-name-completion-ignore-case t)
+
+;; Enable interactive completion mode in minibuffer
+(icomplete-mode 1)
+(require 'icomplete+)
+
+;;****************************************************************************
+;; Doxygen
+;;****************************************************************************
+(require 'ktw-doxygen)
+
+;;****************************************************************************
+;; Ediff
+;;****************************************************************************
+(require 'ediff)
+
+;; Ediff windows should be side-by-side.
+(setq ediff-split-window-function 'split-window-horizontally)
+
+;;****************************************************************************
+;; Flyspell
+;;****************************************************************************
+;; No need to have flyspell print messages for each suggested word.
+(setq flyspell-issue-message-flag nil)
+
+;;****************************************************************************
+;; Font Lock
+;;****************************************************************************
+;; Require colors in all editing modes.
+(require 'font-lock)
+(global-font-lock-mode 1)
+
+;; Enable JIT lock mode
+(require 'jit-lock)
+(jit-lock-mode 1)
+
+;; Enable stealthy buffer fontification.
+(setq jit-lock-stealth-time 1)
+
+;; Turn on file-name-shadow-mode
+(file-name-shadow-mode 1)
+
+;; Highlight when searching and replacing.
+(setq search-highlight t)
+(setq query-replace-highlight t)
+
+;; Highlight current line.
+;;(progn
+;; (defface hl-line '((t (:background "cornsilk1")))
+;; "Face to use for `hl-line-face'." :group 'hl-line)
+;; (setq hl-line-face 'hl-line)
+;; (global-hl-line-mode t))
+
+;;****************************************************************************
+;; Gtags mode
+;;****************************************************************************
+(require 'gtags)
+
+(defun ktw-gtags-mode-hook ()
+ "Kevin Weber's gtags mode customization hook."
+ (local-set-key (kbd "M-.") 'gtags-find-tag) ;; find a tag, also M-.
+ (local-set-key (kbd "M-,") 'gtags-find-rtag) ;; reverse tag
+ (diminish 'gtags-mode "G")
+ )
+(add-hook 'gtags-mode-hook 'ktw-gtags-mode-hook)
+
+;;****************************************************************************
+;; Highlight Changes
+;;****************************************************************************
+;; Turn on highlight changes mode globally.
+(global-highlight-changes-mode t)
+
+;; but do not show changes initially.
+(setq highlight-changes-visibility-initial-state nil)
+
+;; Change highlight colors.
+(set-face-foreground 'highlight-changes nil)
+(set-face-foreground 'highlight-changes nil)
+(set-face-background 'highlight-changes "#ccffcc")
+(set-face-background 'highlight-changes-delete "#ddddff")
+
+;;****************************************************************************
+;; I-Edit mode
+;;****************************************************************************
+(require 'iedit)
+
+;;****************************************************************************
+;; Indentation
+;;****************************************************************************
+;; Set tab width to 2 spaces
+(setq tab-width 2)
+
+;; Use spaces (not tabs) for indenting
+(setq indent-tabs-mode nil)
+
+;;****************************************************************************
+;; Kill ring
+;;****************************************************************************
+(require 'browse-kill-ring)
+
+;;****************************************************************************
+;; Mode line
+;;****************************************************************************
+(require 'diminish)
+
+(eval-after-load "abbrev" '(diminish 'abbrev-mode))
+(eval-after-load "eldoc" '(diminish 'eldoc-mode))
+
+;;****************************************************************************
+;; Org mode
+;;****************************************************************************
+;; Customizations used for org-mode.
+(defun ktw-org-mode-hook ()
+ "Kevin Weber's org mode customization hook."
+ ;; Required customizations for org-mode.
+ (local-set-key "\C-cl" 'org-store-link)
+ (local-set-key "\C-ca" 'org-agenda)
+ (local-set-key "\C-cb" 'org-iswitchb)
+
+ ;; Personal customizations.
+ (local-set-key "\C-ct" 'org-set-tags)
+ (local-set-key "\C-cp" 'org-set-property)
+ (local-set-key [(control tab)] 'ktw-bury-buffer)
+
+ ;; Agenda setup
+ (setq org-agenda-files '("~/home.org"))
+ (auto-fill-mode 1)
+ (setq fill-column 80)
+ (setq org-log-done time)
+ (setq org-use-fast-todo-selection t)
+ (setq org-todo-keywords
+ '((sequence "TODO(t)" "STARTED(s)" "WAITING(w)" "|" "DONE(d!/!)")))
+ )
+(add-hook 'org-mode-hook 'ktw-org-mode-hook)
+
+;;****************************************************************************
+;; Remember mode
+;;****************************************************************************
+(require 'remember)
+(org-remember-insinuate)
+(setq remember-data-file "~/.emacs.d/ktw-remember.org")
+
+;;****************************************************************************
+;; Search
+;;****************************************************************************
+;; Make searches case insensitive
+(setq case-fold-search t)
+
+;;****************************************************************************
+;; Scrolling
+;;****************************************************************************
+;; Make page up & page down remember current line
+(setq scroll-preserve-screen-position t)
+
+;; Scroll one line at a time. (Disable scroll jumping.)
+(setq scroll-step 1)
+
+;;Scroll-margin: restricts how close point can come to the top or bottom of a window
+(setq scroll-margin 0)
+
+;; Other necessary variables that I don't quite understand.
+(setq scroll-conservatively 0)
+(setq scroll-up-aggresively 0.01)
+(setq scroll-down-aggressively 0.01)
+
+;; Turn on the scroll bar.
+(scroll-bar-mode 1)
+(set-scroll-bar-mode 'right)
+
+;;****************************************************************************
+;; Themes
+;;****************************************************************************
+(require 'color-theme)
+(color-theme-initialize)
+(setq color-theme-is-global t)
+(setq color-theme-is-cumulative t)
+
+(set-background-color "#ffffd0")
+(set-face-foreground 'font-lock-string-face "SlateBlue4")
+
+(setq ktw-read-only-color "gray50")
+(setq ktw-overwrite-color "red")
+(setq ktw-normal-color "gray10")
+
+(add-hook 'post-command-hook 'ktw-set-cursor-according-to-mode)
+
+;;****************************************************************************
+;; Tramp
+;;****************************************************************************
+(require 'tramp)
+
+;; Verbosity level: (2: erros and warnings only)
+(setq tramp-verbose 2)
+
+;; Auth-source
+(require 'auth-source)
+(setq auth-sources '((:source "~/.emacs.d/authinfo.gpg" :host t :protocol t)))
+(setq epa-file-cache-passphrase-for-symmetric-encryption t)
+
+;;****************************************************************************
+;; Uniquify
+;;****************************************************************************
+(require 'uniquify)
+(setq uniquify-buffer-name-style 'post-forward)
+(setq uniquify-separator ":")
+
+;;****************************************************************************
+;; Windows
+;;****************************************************************************
+(require 'windmove)
+(windmove-default-keybindings 'meta)
+
+;;****************************************************************************
+;; Keybindings
+;;****************************************************************************
+;; F1 - F4: Movement
+;;
+;; F1 - Goto line
+;; Shift F1 - Move cursor to matching paren
+;; Control F1 - Toggle line number mode
+;; F2 - Bookmark jump
+;; Shift F2 - Bookmark set
+;; F3 - Diff of current buffer with file
+;; F3 - ktw-html-tag-region-or-point (html-mode)
+;; F4 - Toggle to other window
+;; Shift F4 - Toggle between source and header file (c-mode)
+;; Shift F4 - Switch to php mode (html-mode)
+;; Shift F4 - Switch to html (php-mode)
+;; Control F4 - Match source/header in other window (c-mode)
+;;
+;; F5 - F8: Programming
+;;
+;; F5 - Comment region
+;; Shift F5 - Uncomment region
+;; F7 - Compile
+;; F8 - GDB
+;; Control F8 - Toggle tool bar
+;;
+;; F9 - F12: Other
+;;
+;; F9 - Kill this buffer
+;; Shift F9 - Kill buffer
+;; Control F9 - Kill all buffers
+;; F10 - Shell
+;; F11 - Spellcheck word at point
+;; Shift F11 - Spellcheck and complete word
+;; Control F11 - Spellcheck entire buffer
+;; F12 - Toggle highlight changes mode.
+;; Shift F12 - Remove highlight under point.
+;;
+;; Control PageUp - Scroll other frame up.
+;; Control PageDown - Scroll other frame down.
+;;
+;; Meta PageUp - Jump to previous change.
+;; Meta PageDown - Jump to next change.
+;;
+;; Home - Move to beginning of buffer
+;; End - Move to end of buffer
+;; Control Home - Move to beginning of other buffer
+;; Control End - Move to end of other buffer
+;;
+;; Control z - Undo
+;; Control Shift z - Repeat-complex-command
+;; Control ; - IEdit mode
+;;
+;; Tab - ktw-smart-tab
+;; Control Tab - ktw-bury-buffer
+;;Control Shift Tab - Bury-buffer
+;;
+;; Super <up> - ktw-move-line-up
+;; Super <down> - ktw-move-line-down
+;;
+;; C-c <right> - HideShow - Show block (c-mode)
+;; C-c <left> - HideShow - Hide block (c-mode)
+;; C-c <up> - HideShow - Hide all blocks (c-mode)
+;; C-c <down> - HideShow - Show all blocks (c-mode)
+;;
+;; C-c d - Copy-from-above-command
+;; C-c f - Fix frames
+;; C-c k - Browse kill ring
+;; C-c r - Remember
+;; C-c C-r - Open remember file.
+;; C-c s - Find symfony file on Boo.
+;; C-c x - Revert buffer.
+;; C-c y - Popup menu - yank menu.
+;;
+;; C-c a - Agenda (org mode)
+;; C-c b - ISwitch buffer (org mode)
+;; C-c l - Store link (org mode)
+;; C-c p - Set property (org mode)
+;; C-c t - Set tags (org mode)
+;;
+;; C-x C-b - iBuffer
+;;
+;; Super i - Open .emacs.d/init.el file
+;; Super s - Open *scratch* buffer
+
+(global-set-key [f1] 'goto-line)
+(global-set-key [(shift f1)] 'ktw-bounce-paren)
+(global-set-key [(control f1)] 'linum-mode)
+(global-set-key [f2] 'bookmark-jump)
+(global-set-key [(shift f2)] 'bookmark-set)
+(global-set-key [f3] 'vc-diff)
+(global-set-key [f4] 'other-window)
+(global-set-key [f5] 'comment-region)
+(global-set-key [(shift f5)] 'uncomment-region)
+(global-set-key [f7] 'compile)
+(global-set-key [f8] 'gdb)
+(global-set-key [(control f8)] 'tool-bar-mode)
+(global-set-key [f9] 'kill-this-buffer)
+(global-set-key [(shift f9)] 'kill-buffer)
+(global-set-key [(control f9)] 'ktw-kill-all-buffers)
+(global-set-key [f10] 'shell)
+(global-set-key [f11] 'ispell-word)
+(global-set-key [(shift f11)] 'ispell-complete-word)
+(global-set-key [(control f11)] 'ktw-spell-check-buffer)
+(global-set-key [f12] 'highlight-changes-visible-mode)
+(global-set-key [(shift f12)] 'highlight-changes-remove-highlight)
+
+(global-set-key [(control next)] 'scroll-other-window)
+(global-set-key [(control prior)] 'scroll-other-window-down)
+
+(global-set-key [(meta next)] 'highlight-changes-next-change)
+(global-set-key [(meta prior)] 'highlight-changes-previous-change)
+
+(global-set-key [home] 'beginning-of-buffer)
+(global-set-key [end] 'end-of-buffer)
+(global-set-key [(control home)] 'beginning-of-buffer-other-window)
+(global-set-key [(control end)] 'end-of-buffer-other-window)
+
+(global-set-key [(control z)] 'undo)
+(global-set-key [(control shift z)] 'repeat-complex-command)
+(global-set-key (kbd "C-;") 'iedit-mode)
+
+(global-set-key [(tab)] 'ktw-smart-tab)
+(global-set-key [(control tab)] 'ktw-bury-buffer)
+(global-set-key [(control shift iso-lefttab)] 'bury-buffer)
+
+(global-set-key (kbd "s-<up>") 'ktw-move-line-up)
+(global-set-key (kbd "s-<down>") 'ktw-move-line-down)
+
+(global-set-key (kbd "C-c a") 'apropos)
+(global-set-key (kbd "C-c b") 'ktw-buffer-filepath)
+(global-set-key (kbd "C-c d") 'ktw-duplicate-current-line-or-region)
+(global-set-key (kbd "C-c h") 'ktw-help)
+(global-set-key (kbd "C-c k") 'browse-kill-ring)
+(global-set-key (kbd "C-c r") 'remember)
+(global-set-key (kbd "C-c x") 'revert-buffer)
+(global-set-key (kbd "C-c y") (lambda () (interactive)
+ (popup-menu 'yank-menu)))
+(global-set-key (kbd "C-c C-r") 'ktw-review-remember-file)
+(global-set-key (kbd "C-c 1") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:public_html/")))
+(global-set-key (kbd "C-c 2") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/ktw/")))
+(global-set-key (kbd "C-c 3") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/ktw-data/")))
+(global-set-key (kbd "C-c 4") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/site/")))
+(global-set-key (kbd "C-c 5") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/site-data/")))
+(global-set-key (kbd "C-c 6") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/shop/")))
+(global-set-key (kbd "C-c 7") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:sf_dev/shop-data/")))
+(global-set-key (kbd "C-c 8") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:sk:~/")))
+(global-set-key (kbd "C-c 9") (lambda () (interactive)
+ (ktw-find-file-with-hint "/ssh:boo:/usr/share/php/symfony/symfony-1.4/")))
+
+(global-set-key (kbd "C-x C-b") 'ktw-ibuffer)
+
+(global-set-key (kbd "<C-s-up>") 'previous-error)
+(global-set-key (kbd "<C-s-down>") 'next-error)
+
+(global-set-key [(super i)] (lambda () (interactive)
+ (find-file "~/.emacs.d/init.el")))
+(global-set-key [(super s)] (lambda () (interactive)
+ (switch-to-buffer "*scratch*")))
+
+(global-unset-key [(control meta left)]) ;; This key conflicts with Compiz.
+(global-unset-key [(control meta right)]);; This key conflicts with Compiz.
+(global-unset-key [(control shift meta left)]) ;; This key conflicts with Compiz.
+(global-unset-key [(control shift meta right)]);; This key conflicts with Compiz.
+(global-unset-key [(control meta up)]) ;; This key conflicts with Compiz.
+(global-unset-key [(control meta down)]) ;; This key conflicts with Compiz.
+
+;;****************************************************************************
+;; Programming
+;;****************************************************************************
+;; Show matching parenthesis.
+(show-paren-mode t)
+(setq show-paren-style 'mixed)
+
+;; Define the compile command
+(set-default 'compile-command "make")
+
+;; Scroll compilation output.
+(setq compilation-scroll-output 'first-error)
+
+;; Close the compilation window after 10 seconds on success.
+;;(setq compilation-finish-functions 'ktw-compilation-autoclose)
+
+;; Use the nice GDB-many-windows layout.
+(setq gdb-many-windows t)
+
+;;****************************************************************************
+;; C mode common
+;;****************************************************************************
+;; Customizations used for all c based languages.
+(defun ktw-c-mode-common-hook ()
+ "Kevin Weber's common c mode customization hook."
+ (local-set-key [(shift f4)] 'ff-find-other-file)
+ (local-set-key [(control f4)] 'ktw-match-source-header)
+ (local-set-key (kbd "C-c <right>") 'hs-show-block)
+ (local-set-key (kbd "C-c <left>") 'hs-hide-block)
+ (local-set-key (kbd "C-c <up>") 'hs-hide-all)
+ (local-set-key (kbd "C-c <down>") 'hs-show-all)
+ (local-set-key [(return)] 'newline-and-indent)
+ (c-set-style "k&r")
+ (setq c-basic-offset 2)
+ (hs-minor-mode 1)
+ (setq hs-set-up-overlay 'ktw-display-code-line-counts)
+ (c-toggle-electric-state 1)
+ (c-toggle-hungry-state 1)
+ (gtags-mode t)
+ (ktw-doxygen-font-lock)
+ )
+(add-hook 'c-mode-common-hook 'ktw-c-mode-common-hook)
+
+;;****************************************************************************
+;; C++ mode
+;;****************************************************************************
+;; Customizations used for C++.
+(defun ktw-c++-mode-hook ()
+ "Kevin Weber's c++ mode customization hook."
+ (c-set-offset 'innamespace 0) ;; Don't indent the namespace.
+ )
+(add-hook 'c++-mode-hook 'ktw-c++-mode-hook)
+
+;; C++ Abbrev table definitions.
+(define-abbrev-table 'c++-mode-abbrev-table
+ '(
+ ("zzcd" "" ktw-skeleton-cpp-class-declaration 0)
+ ("zzci" "" ktw-skeleton-cpp-class-implementation 0)
+ ("zzcl" "" ktw-skeleton-cpp-comment-line 0)
+ ))
+
+;; C++ snippets
+(snippet-with-abbrev-table
+ 'c++-mode-abbrev-table
+ ("zzfi" . "//----------------------------------------------------------------------------------
+// $${funcName}()
+//----------------------------------------------------------------------------------
+$${returnType} $${class}::$${funcName}($${parameters})$${ const}
+{\n$>$.\n}\n")
+ ("zzfor" . "for ($${int} $${i} = $${0}; $${i} < $${10}; ++$${i}) {
+$>$.
+}")
+ ("zzswitch" . "switch ($${variable}) {
+case $${FirstCase}:$>
+$>$.
+$>break;\n
+default:$>
+$>break;
+$>}\n")
+ ("zzwhile" . "$>$${className} $${iter}($${container}$${.begin()});
+$>$${className} $${End}($${container}$${.end()});
+$>while ($${iter} != $${End}) {
+$>$.
+$>++$${iter};
+$>}\n"))
+
+;;****************************************************************************
+;; CSS mode
+;;****************************************************************************
+;; Use css-mode-simple
+(require 'css-simple-mode)
+
+;; Customizations used for CSS.
+(defun ktw-css-simple-mode-hook ()
+ "Kevin Weber's css mode customization hook."
+ (c-toggle-electric-state 1)
+ (c-toggle-hungry-state 1)
+ )
+(add-hook 'css-simple-mode-hook 'ktw-css-simple-mode-hook)
+
+;;****************************************************************************
+;; Emacs Lisp mode
+;;****************************************************************************
+
+;; Customizations used for emacs lisp mode.
+(defun ktw-emacs-lisp-mode-hook ()
+ "Kevin Weber's emacs lisp mode customization hook."
+ (local-set-key [(return)] 'newline-and-indent)
+ (c-toggle-electric-state 1)
+ (c-toggle-hungry-state 1)
+ (turn-on-eldoc-mode)
+ (setq mode-name "el")
+ )
+(add-hook 'emacs-lisp-mode-hook 'ktw-emacs-lisp-mode-hook)
+
+;; Emacs snippets
+(define-abbrev-table 'lisp-mode-abbrev-table ())
+(snippet-with-abbrev-table
+ 'lisp-mode-abbrev-table
+ ("zzdefun" . "defun $${ktw-function} ()\n$>\"$${Insert documentation here.}\"
+ $>$.\n")
+ ("zztitle" . ";;********************************************************************************
+;; $${Title}
+;;********************************************************************************\n"))
+
+;;****************************************************************************
+;; HTML mode
+;;****************************************************************************
+;; Customizations used for HTML.
+(defun ktw-html-mode-hook ()
+ "Kevin Weber's html mode customization hook."
+ (local-set-key [f3] 'ktw-html-insert-tag)
+ (local-set-key [(shift f4)] 'php-mode)
+ (local-unset-key (kbd "C-c 1"))
+ (local-unset-key (kbd "C-c 2"))
+ (c-toggle-electric-state 1)
+ (c-toggle-hungry-state 1)
+ )
+(add-hook 'html-mode-hook 'ktw-html-mode-hook)
+
+;; HTML snippets
+(define-abbrev-table 'html-mode-abbrev-table ())
+(snippet-with-abbrev-table
+ 'html-mode-abbrev-table
+ ("zza" . "<a href=\"$${linkLocation}\">$.</a>")
+ ("zzimg" . "<img class=\"$${classNames}\" src=\"$${srcLocation}\" alt=\"$${altName}\" />")
+ ("zzmeta" . "<meta name=\"$${name}\" content=\"$${content}\" />\n"))
+
+;;****************************************************************************
+;; Javascript - js2 mode
+;;****************************************************************************
+(defun ktw-js2-mode-hook ()
+ "Kevin Weber's js2 mode customization hook."
+ (setq js2-mirror-mode nil)
+ )
+(add-hook 'js2-mode-hook 'ktw-js2-mode-hook)
+
+;;****************************************************************************
+;; Lisp-Interaction mode
+;;****************************************************************************
+;; Customizations used for lisp interaction mode.
+(defun ktw-lisp-interaction-mode-hook ()
+ "Kevin Weber's lisp interaction mode customization hook."
+ (local-set-key [(return)] 'newline-and-indent)
+ (c-toggle-electric-state 1)
+ (c-toggle-hungry-state 1)
+ (turn-on-eldoc-mode)
+ )
+(add-hook 'lisp-interaction-mode-hook 'ktw-lisp-interaction-mode-hook)
+
+;;****************************************************************************
+;; Makefile mode
+;;****************************************************************************
+(defun ktw-makefile-mode-hook ()
+ "Kevin Weber's makefile mode customization hook."
+ (setq show-trailing-whitespace t)
+ )
+(add-hook 'makefile-mode-hook 'ktw-makefile-mode-hook)
+
+;;****************************************************************************
+;; nXML mode
+;;****************************************************************************
+;;; Use nxml-mode instead of sgml, xml or html mode.
+(mapc
+ (lambda (pair)
+ (if (or (eq (cdr pair) 'xml-mode)
+ (eq (cdr pair) 'sgml-mode)
+ (eq (cdr pair) 'html-mode))
+ (setcdr pair 'nxml-mode)))
+ auto-mode-alist)
+
+(defun ktw-nxml-mode-hook ()
+ "Kevin Weber's php mode customization hook."
+ (local-set-key [(return)] 'newline-and-indent)
+ (setq nxml-slash-auto-complete-flag t)
+ (local-set-key [(shift f4)] 'php-mode)
+ )
+(add-hook 'nxml-mode-hook 'ktw-nxml-mode-hook)
+
+;;****************************************************************************
+;; PHP mode
+;;****************************************************************************
+(require 'php-mode)
+
+(defun ktw-php-mode-hook ()
+ "Kevin Weber's php mode customization hook."
+ (local-set-key [(shift f4)] 'nxml-mode)
+ (ktw-background-buffer "*PHP Expansions*" "/home/kevin/.emacs.d/expansions/php-keywords.txt")
+ (when (equal mode-name "PHP/lh") ;; Will run php lint when saving php file.
+ (when (equal file-remote-p nil)
+ (setq compilation-exit-message-function
+ (lambda (status code msg)
+ (when (and (eq status 'exit) (zerop code))
+ (kill-buffer "*compilation*"))))
+ (make-local-variable 'after-save-hook)
+ (add-hook 'after-save-hook
+ (lambda ()
+ (if (buffer-file-name)
+ (compile (format "php -l %s" (buffer-file-name))))))))
+ )
+(add-hook 'php-mode-hook 'ktw-php-mode-hook)
+
+(add-to-list 'auto-mode-alist '("\\.module\\'" . php-mode)) ;; Drupal extension
+(add-to-list 'auto-mode-alist '("\\.inc\\'" . php-mode)) ;; Drupal extension
+
+;; PHP Abbrev table definitions.
+(define-abbrev-table 'php-mode-abbrev-table
+ '(
+ ("zzcl" "" ktw-skeleton-php-class 0)
+ ("zzfu" "" ktw-skeleton-php-function 0)
+ ("zzgs" "" ktw-skeleton-php-getter-setter 0)
+ ))
+
+;;****************************************************************************
+;; SGML mode
+;;****************************************************************************
+(defun ktw-sgml-mode-hook ()
+ "Kevin Weber's sgml mode customization hook."
+ (local-set-key [(return)] 'newline-and-indent)
+ )
+(add-hook 'sgml-mode-hook 'ktw-sgml-mode-hook)
+
+;;****************************************************************************
+;; Shell mode
+;;****************************************************************************
+(defun ktw-shell-mode-hook ()
+ "Kevin Weber's shell mode customization hook."
+ (font-lock-mode -1)
+ )
+(add-hook 'shell-mode-hook 'ktw-shell-mode-hook)
+
+;;****************************************************************************
+;; TADS mode
+;;****************************************************************************
+(require 'tads-mode)
+
+;;(defun ktw-tads-mode-hook ()
+;; "Kevin Weber's TADS mode customization hook."
+;; )
+;;(add-hook 'tads-mode-hook 'ktw-tads-mode-hook)
+
+;; TADS snippets
+(define-abbrev-table 'tads-mode-abbrev-table ())
+(snippet-with-abbrev-table
+ 'tads-mode-abbrev-table
+ ("zzdobjfor" . "dobjFor($${Verb}) {\n$>action() {\n$>$.\n}$>\n}$>\n")
+ ("zzverb" . "DefineTAction($${Verb});\nVerbRule($${Verb})\n$>($${'$${verb}'})
+: $${Verb}Action\nverbPhrase = '$${verb/verbing} (what)'\n;$>"))
+
+;;****************************************************************************
+;; YAML mode
+;;****************************************************************************
+(require 'yaml-mode)
+
+(defun ktw-yaml-mode-hook ()
+ "Kevin Weber's YAML mode customization hook."
+ (local-set-key [(return)] 'newline-and-indent)
+ )
+(add-hook 'yaml-mode-hook 'ktw-yaml-mode-hook)
+
+;;****************************************************************************
+;; Final
+;;****************************************************************************
+(ktw-maximize-emacs)
+(ktw-welcome-buffer)
+
+(message "Emacs customizations complete.")
+
+;;****************************************************************************
+;; End
+;;****************************************************************************
669 ktw-functions.el
@@ -0,0 +1,669 @@
+;;****************************************************************************
+;;
+;; Kevin Weber's Emacs customizations
+;;
+;;****************************************************************************
+;; Variables
+;;****************************************************************************
+(defvar ktw-current-year (format-time-string "%Y" (current-time))
+ "The current year in YYYY format.")
+
+;;****************************************************************************
+;; Functions
+;;****************************************************************************
+;; General
+;;****************************************************************************
+;; Batch replace-string
+(defun ktw-batch-replace-string (list &optional beg end)
+ "Will run replace-string on an array of values."
+ (barf-if-buffer-read-only)
+ (or beg (setq beg (point-min)))
+ (or end (setq end (point-max)))
+ (save-excursion
+ (while list
+ (goto-char beg)
+ (let* ((pair (pop list))
+ (first (pop pair))
+ (second (pop pair)))
+ (if (symbolp first) (setq first (symbol-value first)))
+ (if (symbolp second) (setq second (symbol-value second)))
+ (while (search-forward first end t)
+ (replace-match second t))))))
+
+;; ;; Will duplicate the current line immediately below.
+;; (defun ktw-duplicate-current-line ()
+;; "Will duplicate the current line immediately below.
+
+;; Note: This function does not work on the last line of a buffer."
+;; (interactive "*")
+;; (beginning-of-line nil)
+;; (let ((b (point)))
+;; (end-of-line nil)
+;; (copy-region-as-kill b (point)))
+;; (beginning-of-line 2)
+;; (open-line 1)
+;; (yank)
+;; (back-to-indentation))
+
+;; Will print the path of the current buffer to the minibuffer.
+(defun ktw-buffer-filepath ()
+ "Will output the path of the current buffer to the minibuffer."
+ (interactive)
+ (let ((pathname (or buffer-file-truename "--- Not Applicable ---")))
+ (message (concat "Path: " pathname))))
+
+;; Will return the date 'numDays' from today.
+(defun ktw-calendar-future-date (numDays)
+ "Returns the date in numDays from today in a list (month day year)."
+ (let ((now (decode-time
+ (time-add (current-time) (seconds-to-time (* numDays 86400))))))
+ (list (nth 4 now) (nth 3 now) (nth 5 now))))
+
+(defun ktw-calendar-upcoming-holidays (numDays)
+ "Returns a list of the upcoming holidays for the next 'numDays' of days."
+ (let ((result (list)))
+ (dotimes (i numDays)
+ (let ((h (calendar-check-holidays (ktw-calendar-future-date (+ 1 i)))))
+ (when h
+ (setq result
+ (append result
+ (list (concat
+ (format-time-string "%A, %B %e, %Y" (time-add (current-time) (seconds-to-time (* (+ 1 i) 86400))))
+ ": " (car h))))))))
+ result))
+
+;; Duplicate the current line or region
+(defun ktw-duplicate-current-line-or-region (arg)
+ "Duplicates the current line or region ARG times.
+If there's no region, the current line will be duplicated. However, if
+there's a region, all lines that region covers will be duplicated."
+ (interactive "p")
+ (let (beg end (origin (point)))
+ (if (and mark-active (> (point) (mark)))
+ (exchange-point-and-mark))
+ (setq beg (line-beginning-position))
+ (if mark-active
+ (exchange-point-and-mark))
+ (setq end (line-end-position))
+ (let ((region (buffer-substring-no-properties beg end)))
+ (dotimes (i arg)
+ (goto-char end)
+ (newline)
+ (insert region)
+ (setq end (point)))
+ (goto-char (+ origin (* (length region) arg) arg)))))
+
+;; Find file, but with a hint.
+(defun ktw-find-file-with-hint (hint)
+ "The `find-file' function, but with a hint of where to start finding."
+ (interactive)
+ (let ((default-directory hint))
+ (call-interactively 'find-file)))
+
+;; Will return the line number at point.
+(defun ktw-get-line ()
+ "Return the line number at point."
+ (interactive)
+ (save-excursion
+ (beginning-of-line)
+ (let ((opoint (point))
+ (nline))
+ (goto-char 1)
+ (setq nline (1+ (count-lines (point) opoint)))
+ nline)))
+
+(defun ktw-help ()
+ "If function given tries to `describe-function' if variable
+uses 'describe-variable', otherwise uses `manual-entry' to display
+manpage of a `current-word'."
+ (interactive)
+ (let ((var (variable-at-point))
+ (fn (function-called-at-point)))
+ (if (symbolp var)
+ (describe-variable var)
+ (if fn
+ (describe-function fn)
+ (if (eq major-mode 'java-mode)
+ (java-describe (current-word))
+ (man (current-word)))))))
+
+;; Indent the whole buffer.
+(defun ktw-indent-whole-buffer ()
+ "Will indent the whole buffer without selecting it."
+ (interactive "*")
+ (save-excursion
+ (delete-trailing-whitespace)
+ (indent-region (point-min) (point-max) nil)
+ (untabify (point-min) (point-max))))
+
+;; Inserts the current date and time.
+(defun ktw-insert-current-date ()
+ "Insert date at point."
+ (interactive "*")
+ (insert (format-time-string "%Y-%m-%d" (current-time))))
+
+;; Inserts the current date and time.
+(defun ktw-insert-current-date-time ()
+ "Insert date and time at point."
+ (interactive "*")
+ (insert (format-time-string "%Y-%m-%d (%I:%M %p)" (current-time))))
+
+;; Inserts the current buffer name.
+(defun ktw-insert-file-name ()
+ "Insert buffer-file-name at point."
+ (interactive "*")
+ (insert buffer-file-name))
+
+;; Insert a bit of lorem ipsum text.
+(defun ktw-insert-lorem ()
+ "Insert some text of lorem ipsum."
+ (interactive "*")
+ (insert "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do "
+ "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim "
+ "ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut "
+ "aliquip ex ea commodo consequat. Duis aute irure dolor in "
+ "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla "
+ "pariatur. Excepteur sint occaecat cupidatat non proident, sunt in "
+ "culpa qui officia deserunt mollit anim id est laborum."))
+
+;; Inserts the current date and time.
+(defun ktw-insert-timestamp ()
+ "Insert timestamp at point."
+ (interactive "*")
+ (insert (format-time-string "%Y%m%d%H%M%S" (current-time))))
+
+;; Converts a list to a regexp.
+(defun ktw-list-to-regexp (altlist)
+ "Will convert a list to a regexp expression. Used in mode definitions."
+ (let ((regexp "\\("))
+ (mapcar (lambda(elem)
+ (setq regexp (concat regexp elem "\\|")))
+ altlist)
+ (concat (substring regexp 0 -2) ; cutting the last "\\|"
+ "\\)")))
+
+(defun ktw-move-region (n)
+ "Move the current line up or down by N lines."
+ (interactive "p")
+ (setq col (current-column))
+ (beginning-of-line) (setq start (point))
+ (end-of-line) (forward-char) (setq end (point))
+ (let ((line-text (delete-and-extract-region start end)))
+ (forward-line n)
+ (insert line-text)
+ ;; restore point to original column in moved line
+ (forward-line -1)
+ (forward-char col)))
+
+(defun ktw-move-line-up ()
+ "Will cut a line and paste it one line higher."
+ (interactive)
+ (ktw-move-region -1)
+)
+
+(defun ktw-move-line-down ()
+ "Will cut a line and paste it one line lower."
+ (interactive)
+ (ktw-move-region +1)
+)
+
+;; Use the system notification for a message.
+(defun ktw-popup (title msg)
+ "Show a popup or echo it if not possible."
+ (interactive)
+ (if (eq window-system 'x)
+ (shell-command (concat "notify-send -i /usr/share/icons/hicolor/48x48/apps/emacs23.png '" title "' '" msg "'"))
+ (message (concat title ": " msg))))
+
+;; Will print a list
+(defun ktw-print-list (list)
+ "Print each element of LIST on a line of its own."
+ (while list
+ (print (car list))
+ (setq list (cdr list))))
+
+;; Opens the remember file for review.
+(defun ktw-review-remember-file ()
+ "Displays the remember file for review."
+ (interactive)
+ (find-file-other-window remember-data-file))
+
+;; Scroll both windows to home.
+(defun ktw-scroll-both-windows-end ()
+ "Scrolls both windows to the end of the buffer."
+ (interactive)
+ (end-of-buffer)
+ (end-of-buffer-other-window 0)
+)
+
+;; Scroll both windows to end.
+(defun ktw-scroll-both-windows-home ()
+ "Scrolls both windows to the beginning of the buffer."
+ (interactive)
+ (beginning-of-buffer)
+ (beginning-of-buffer-other-window 0)
+)
+
+;; Smart-tab
+(defun ktw-smart-tab ()
+ "This smart tab is minibuffer compliant: it acts as usual in
+ the minibuffer. Else, if mark is active, indents region. Else if
+ point is at the end of a symbol, expands it. Else indents the
+ current line."
+ (interactive)
+ (if (minibufferp)
+ (unless (minibuffer-complete)
+ (dabbrev-expand nil))
+ (if mark-active
+ (indent-region (region-beginning)
+ (region-end))
+ (if snippet
+ (snippet-next-field)
+ (if (looking-at "\\_>")
+ (dabbrev-expand nil)
+ (indent-for-tab-command))))))
+
+;; Spell check entire document
+(defun ktw-spell-check-buffer ()
+ "Spell check the entire buffer."
+ (interactive)
+ (ispell-region (point-min) (point-max))
+)
+
+;; Will notify if buffer contains tabs.
+;; code snippet GUID 32F94179-A86B-4780-8645-8A526BD8533A
+(defun ktw-tab-validation (buffer)
+ (interactive "bValidate buffer:")
+ (save-excursion
+ (unless (equal (buffer-name (current-buffer)) buffer)
+ (switch-to-buffer buffer))
+ (if (re-search-forward "\t" nil t)
+ (error "Buffer %s contains tabs" buffer))))
+
+;; Will convert all tabs to spaces in the entire buffer.
+(defun ktw-untabify-buffer ()
+ "Untabify whole buffer."
+ (interactive)
+ (untabify (point-min) (point-max)))
+
+(defun word-count ()
+ "Count words in buffer."
+ (interactive)
+ (shell-command-on-region (point-min) (point-max) "wc -w"))
+
+;;****************************************************************************
+;; Buffer Cycling
+;;****************************************************************************
+(defvar ktw-buffer-ignore-regexp "^[ *\*].*[\*]$"
+ "A regexp for buffers to ignore.")
+
+(defun ktw-good-buffers (ignore-regexp)
+ "Will remove the buffers matching 'hated-regexp' from the `buffer-list'."
+ (delete nil
+ (append
+ (mapcar (lambda (this-buffer)
+ (if (string-match ignore-regexp (buffer-name this-buffer))
+ nil
+ this-buffer))
+ (buffer-list(selected-frame))))))
+
+(defun ktw-bury-buffer ()
+ "Will bury the current buffer and cycle to the next buffer in the
+list of `ktw-good-buffers'."
+ (interactive)
+ (setq list (ktw-good-buffers ktw-buffer-ignore-regexp))
+ (when (> (length list) 1)
+ (bury-buffer)
+ (switch-to-buffer (nth 1 list))))
+
+;; Will kill all non-temporary buffers.
+(defun ktw-kill-all-buffers ()
+ "Will kill all non-ignored buffers.
+
+See also `ktw-buffer-ignore-regexp'."
+ (interactive)
+ (setq list (ktw-good-buffers ktw-buffer-ignore-regexp))
+ (while list
+ (let ((buffer (car list)))
+ (if (buffer-modified-p buffer)
+ (kill-buffer-ask buffer)
+ (kill-buffer buffer)))
+ (setq list (cdr list)))
+ (kill-buffer "*Completions*"))
+
+;;****************************************************************************
+;; Cursor
+;;****************************************************************************
+;; http://emacs-fu.blogspot.com/2009/12/changing-cursor-color-and-shape.html
+(defun ktw-set-cursor-according-to-mode ()
+ "Change cursor color and type according to some minor modes. See `cursor-type'."
+ (cond
+ (buffer-read-only
+ (set-cursor-color ktw-read-only-color)
+ (setq cursor-type 'box))
+ (overwrite-mode
+ (set-cursor-color ktw-overwrite-color)
+ (setq cursor-type 'box))
+ (t
+ (set-cursor-color ktw-normal-color)
+ (setq cursor-type 'box))))
+
+;;********************************************************************************
+;; Hide/Show
+;;********************************************************************************
+;; Overlay customization.
+(defun ktw-display-code-line-counts (ov)
+ "Customizes the hideshow overlay."
+ (when (eq 'code (overlay-get ov 'hs))
+ (overlay-put ov 'display
+ (propertize
+ (format " ... (%d lines hidden)"
+ (count-lines (overlay-start ov)
+ (overlay-end ov)))
+ 'face 'font-lock-type-face))))
+
+;;********************************************************************************
+;; iBuffer
+;;********************************************************************************
+(defun ktw-ibuffer ()
+ "Open ibuffer with cursour pointed to most recent buffer name."
+ (interactive)
+ (let ((recent-buffer-name (buffer-name)))
+ (ibuffer)
+ (ibuffer-jump-to-buffer recent-buffer-name)))
+
+(defun ktw-ibuffer-ediff-marked-buffers ()
+ "Ediff compare two selected buffers."
+ (interactive)
+ (let* ((marked-buffers (ibuffer-get-marked-buffers))
+ (len (length marked-buffers)))
+ (unless (= 2 len)
+ (error (format "%s buffer%s been marked (needs to be 2)"
+ len (if (= len 1) " has" "s have"))))
+ (ediff-buffers (car marked-buffers) (cadr marked-buffers))))
+
+;;********************************************************************************
+;; Movement
+;;********************************************************************************
+;; Move cursor to end of matching parenthesis, brace, or bracket.
+;; Made by Joe Casadonte (joc)
+(defun ktw-bounce-paren()
+ "Will bounce between matching parens just like % in vi"
+ (interactive)
+ (let ((prev-char (char-to-string (preceding-char)))
+ (next-char (char-to-string (following-char))))
+ (cond ((string-match "[[{(<]" next-char) (forward-sexp 1))
+ ((string-match "[\]})>]" prev-char) (backward-sexp 1))
+ (t (error "%s" "Not on a parenthesis, brace, or bracket")))))
+
+;;********************************************************************************
+;; Opacity (I know its silly, but fun!)
+;;********************************************************************************
+;; Change emacs opacity.
+(defun ktw-opacity-modify (&optional dec)
+ "Modify the transparency of the emacs frame; if DEC is t,
+ decrease the transparency, otherwise increase it in 10%-steps.
+
+ To remove any opacity modifications, use the `ktw-opacity-remove'
+ function."
+ (let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting
+ (oldalpha (if alpha-or-nil alpha-or-nil 100))
+ (newalpha (if dec (- oldalpha 10) (+ oldalpha 10))))
+ (when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
+ (modify-frame-parameters nil (list (cons 'alpha newalpha))))))
+
+;; Make emacs 10% more opaque.
+(defun ktw-opacity-add ()
+ "Will increase the opacity of emacs by 10%."
+ (interactive)
+ (ktw-opacity-modify t))
+
+;; Make emacs 10% less opaque.
+(defun ktw-opacity-subtract ()
+ "Will decrease the opacity of emacs by 10%."
+ (interactive)
+ (ktw-opacity-modify))
+
+;; Remove any opacity modifications.
+(defun ktw-opacity-remove ()
+ "Will return the opacity of emacs to neutral."
+ (interactive)
+ (modify-frame-parameters nil `((alpha . 100))))
+
+;;********************************************************************************
+;; Window/Frame functions
+;;********************************************************************************
+;; Make the emacs frame maximized.
+(defun ktw-maximize-emacs ()
+ "Maximize the emacs window. See `x-send-client-message'."
+ (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
+ '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
+ (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
+ '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
+ )
+
+;;********************************************************************************
+;; Yank
+;;********************************************************************************
+;; Automatically indent yanked text if in programming-modes
+(defvar yank-indent-modes '(emacs-lisp-mode
+ c-mode c++-mode
+ tcl-mode sql-mode
+ perl-mode cperl-mode
+ java-mode jde-mode
+ lisp-interaction-mode
+ LaTeX-mode TeX-mode
+ yaml-mode)
+ "Modes in which to indent regions that are yanked (or yank-popped)")
+
+(defvar yank-advised-indent-threshold 1000
+ "Threshold (# chars) over which indentation does not automatically occur.")
+
+(defun yank-advised-indent-function (beg end)
+ "Do indentation, as long as the region isn't too large."
+ (if (<= (- end beg) yank-advised-indent-threshold)
+ (indent-region beg end nil)))
+
+(defadvice yank (after yank-indent activate)
+ "If current mode is one of `yank-indent-modes', indent yanked text, but
+with prefix arg don't indent."
+ (if (and (not (ad-get-arg 0))
+ (member major-mode yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+(defadvice yank-pop (after yank-pop-indent activate)
+ "If current mode is one of `yank-indent-modes', indent yanked text.
+With a prefix arg, don't indent."
+ (if (and (not (ad-get-arg 0))
+ (member major-mode yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+;;********************************************************************************
+;; C/C++
+;;********************************************************************************
+
+;; Auto-close compilation buffer when successful.
+(defvar ktw-compilation-timer 10
+ "The number of seconds to wait before closing the Compilation buffer
+after a successful compilation.")
+(defun ktw-compilation-autoclose (buffer string)
+ "Will close the compilation window after success."
+ (if (equal "*compilation*" (buffer-name buffer))
+ (cond ((and (string-match "finished" string)
+ (not (string-match "warning" string)))
+ (message "Build maybe successful: closing window.")
+ (run-with-timer ktw-compilation-timer nil 'kill-buffer buffer))
+ (t
+ (message "Compilation exited abnormally: %s" string)))))
+
+;; Update gtags
+(defun ktw-gtags-update ()
+ "Update the gnu global tag file if present."
+ (interactive)
+ (if (= 0 (call-process "global" nil nil nil " -p"))
+ (shell-command "global -u && echo 'Updated tagfile.'")))
+
+;; Will insert comment line.
+(defun ktw-insert-comment-line ()
+ "Will insert a C++-style comment line."
+ (interactive "*")
+ (insert "//----------------------------------------------------------------------------------\n"))
+
+;; Displays the source/header in the opposite buffer.
+(defun ktw-match-source-header ()
+ "Displays the matched source/header file in the opposite buffer."
+ (interactive)
+ (ff-find-other-file t)
+ (other-window -1))
+
+;;********************************************************************************
+;; HTML
+;;********************************************************************************
+
+;; Insert HTML comment
+(defun ktw-html-insert-comment (pt mk)
+ "Will insert a xhtml comment around the region or point."
+ (interactive "*d\nm")
+ (or (mark-active) (setq mk pt))
+ (insert (concat "<!--" (delete-and-extract-region pt mk) "-->"))
+ (goto-char (+ pt 4)))
+
+;; Will tag the region or the point if there is no region.
+(defun ktw-html-insert-tag (tag pt mk)
+ "Insert a tag around the region or point."
+ (interactive "*sXML/HTML Tag: \nd\nm")
+ (or (mark-active) (setq mk pt))
+ (let ((tagbeg (concat "<" tag ">"))
+ (tagend (concat "</" tag ">")))
+ (insert (concat tagbeg (delete-and-extract-region pt mk) tagend))
+ (goto-char (+ pt (length tagbeg)))))
+
+;;****************************************************************************
+;; PHP
+;;****************************************************************************
+
+;; PHP lint
+(defun ktw-php-lint ()
+ "Will lint the current php buffer."
+ (interactive)
+ (compile (format "php -l %s" (buffer-file-name))))
+
+;;****************************************************************************
+;; nXML
+;;****************************************************************************
+(defadvice nxml-electric-slash (after nxml-electric-slash-indent activate)
+ "Will `indent' after electric-slash function."
+ (indent-according-to-mode))
+
+;;********************************************************************************
+;; YAML
+;;********************************************************************************
+(defadvice yaml-indent-line (after yaml-indent-line-untabify activate)
+ "Will `untabify' after indentations."
+ (untabify (line-beginning-position) (point)))
+
+;;****************************************************************************
+;; Auto-insert
+;;****************************************************************************
+;; Will finish the auto insert.
+(defun ktw-auto-update ()
+ "Will complete the auto insert.
+
+Important: This function should only be used to update auto-insert
+file templates."
+ (let ((filename (file-name-sans-extension
+ (file-name-nondirectory (buffer-file-name))))
+ (fileext (file-name-extension buffer-file-name))
+ (currentyear (format-time-string "%Y" (current-time))))
+ (cond
+
+ ;; HTML
+ ((not (equal (string-match "html?" fileext) nil))
+ (let ()
+ (ktw-batch-replace-string '(("@@@YEAR@@@" currentyear)))
+ (goto-char 238)))
+
+ ;; PHP
+ ((not (equal (string-match "php" fileext) nil))
+ (let ((basefilename (substring filename 0 (search "." filename))))
+ (ktw-batch-replace-string '(("@@@YEAR@@@" currentyear)
+ ("@@@FILE@@@" basefilename)))
+ (goto-char 14)))
+
+ ;; C++ headers
+ ((not (equal (string-match "\\(hpp\\|h\\|\hh\\|H\\)$" fileext) nil))
+ (let ((packagename (read-string "Package name: ")))
+ (ktw-batch-replace-string '(("@@@YEAR@@@" currentyear)
+ ("@@@FILE@@@" filename)
+ ("@@@PACKAGE@@@" packagename)))
+ (forward-line 30)))
+
+ ;; C++ source files.
+ ((not (equal (string-match "\\(cpp\\|c\\|\cc\\|C\\)$" fileext) nil))
+ (let ((packagename (read-string "Package name: ")))
+ (ktw-batch-replace-string '(("@@@YEAR@@@" currentyear)
+ ("@@@FILE@@@" filename)
+ ("@@@PACKAGE@@@" packagename)))
+ (forward-line 27)))
+ )))
+
+;;****************************************************************************
+;; Background buffer
+;;****************************************************************************
+(defun ktw-background-buffer (buffername filename)
+ "Will build a buffer from file and place the buffer in the background.
+
+The goal of this is to be able to automatically place certain peices of
+text in a buffer, but not disrupt the editting environment. This is useful
+with dabbrev.el, where only buffers present are scanned for expansions."
+ (unless (and (not (file-exists-p filename)) (get-buffer buffername))
+ (let* ((currentbuffer (buffer-name))
+ (filebuffername (find-file filename))
+ (ktw-abbrev-string (buffer-string)))
+ (save-excursion
+ (other-window 1)
+ (with-output-to-temp-buffer buffername
+ (kill-buffer filebuffername)
+ (princ
+ ktw-abbrev-string))
+ (bury-buffer buffername)
+ (other-window -1)
+ (switch-to-buffer currentbuffer)))))
+
+;;****************************************************************************
+;; Welcome buffer
+;;****************************************************************************
+(defun ktw-welcome-buffer ()
+ "Will build and display the *Welcome* buffer."
+ (with-output-to-temp-buffer "*Welcome*"
+ (let* ((commands (loop for s being the symbols
+ when (commandp s) collect s))
+ (command (nth (random (length commands)) commands))
+ (ktw-upcoming-list (ktw-calendar-upcoming-holidays 14))
+ (ktw-holiday-list (calendar-check-holidays(calendar-current-date)))
+ (ktw-holiday-string
+ (if ktw-holiday-list
+ (concat ": " (mapconcat 'identity ktw-holiday-list ", "))))
+ (ktw-sunrise-string (sunrise-sunset)))
+ (princ
+ (concat "*** Welcome to Emacs " emacs-version " ***\n\n"
+ (format-time-string "%A, %B %e, %Y" (current-time))
+ ktw-holiday-string "\n\n"
+ (substring ktw-sunrise-string
+ (+ 2 (string-match ":" ktw-sunrise-string)))
+ "\n\n*** Upcoming Holidays ***\n\n"
+ (if (= 0 (length ktw-upcoming-list))
+ "None"
+ (mapconcat 'identity ktw-upcoming-list "\n"))
+ "\n\n*** Tip for the Day ***\n\n"
+ (describe-function command)
+ "\n\nInvoke with:\n\n"
+ (with-temp-buffer
+ (where-is command t)
+ (buffer-string)))))))
+
+;;****************************************************************************
+;; End
+;;****************************************************************************
0 ktw-remember.org
No changes.
240 ktw-skeletons.el
@@ -0,0 +1,240 @@
+;;********************************************************************************
+;;
+;; Kevin Weber's Emacs customizations
+;;
+;;********************************************************************************
+;; Skeletons
+;;********************************************************************************
+
+;; ktw-skeleton-cpp-class-declaration
+(define-skeleton ktw-skeleton-cpp-class-declaration
+ "Insert a class declaration."
+ "Class name: "
+ (ktw-insert-comment-line)
+ "///" \n
+ "/*!" \n
+ "\\todo Finish implementation of " str "." \n
+ "\\date " (format-time-string "%B, %Y") \n
+ "*/" > \n
+ (ktw-insert-comment-line)
+ "class " str \n
+ " : boost::totally_ordered<" str ">" \n
+ "{" \n
+ "public:" > \n
+ "/// Default Constructor" \n
+ str "(void);" \n \n
+ "/// Copy Constructor" \n
+ str "(const " str "& Source);" \n \n
+ "/// Assignment Operator" \n
+ str "& operator=(const " str "& Source);" \n \n
+ "/// Destructor" \n
+ "~" str "(void);" \n \n
+ "/// Less-than Operator" \n
+ "bool operator<(const " str "& rhs) const;" \n \n
+ "/// Equality Operator" \n
+ "bool operator==(const " str "& rhs) const;" \n \n
+ "/// Synopsis: Traditional swap function." \n
+ "void Swap(" str "& Source);" \n \n
+ "// Friends" \n
+ "friend std::ostream& operator<<(std::ostream& out, const " str "& src);" \n \n
+ "protected:" > \n
+ "private:" > \n
+ "};" > \n
+ "/// Stream output operator" \n
+ "std::ostream& operator<<(std::ostream& out, const " str "& src);" \n
+)
+
+;; ktw-skeleton-cpp-class-implementation
+(define-skeleton ktw-skeleton-cpp-class-implementation
+ "Insert a class implementation."
+ "Class name: "
+ > (ktw-insert-comment-line)
+ > "//" \n
+ > "// Class: " str \n
+ > "//" \n
+ > (ktw-insert-comment-line)
+ "// " str ": Public Member Functions" \n
+ (ktw-insert-comment-line)
+ "// Default Constructor" \n
+ (ktw-insert-comment-line)
+ str "::" str "(void)" \n
+ "{" \n
+ _ \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Copy Constructor" \n
+ (ktw-insert-comment-line)
+ str "::" str "(const " str "& Source)" \n
+ "{" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Assignment Operator" \n
+ (ktw-insert-comment-line)
+ str "& " str "::operator=(const " str "& Source)" \n
+ "{" \n
+ str " temp(Source);" \n
+ "Swap(temp);" \n
+ "return *this;" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Destructor" \n
+ (ktw-insert-comment-line)
+ str "::~" str "(void)" \n
+ "{" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Less-than Operator" \n
+ (ktw-insert-comment-line)
+ "bool " str "::operator<(const " str "& rhs) const" \n
+ "{" > \n
+ "return ? < rhs.?;" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Equality Operator" \n
+ (ktw-insert-comment-line)
+ "bool " str "::operator==(const " str "& rhs) const" \n
+ "{" > \n
+ "return ? == rhs.?;" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// Swap()" \n
+ (ktw-insert-comment-line)
+ "void " str "::Swap(" str "& rhs)" \n
+ "{" > \n
+ "// std::swap(?, rhs.?);" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+ "// " str ": Protected Member Functions" \n
+ (ktw-insert-comment-line)
+ (ktw-insert-comment-line)
+ "// " str ": Private Member Functions" \n
+ (ktw-insert-comment-line)
+ (ktw-insert-comment-line)
+ "// Stream output operator" \n
+ (ktw-insert-comment-line)
+ "std::ostream& operator<<(std::ostream& out, const " str "& src)" \n
+ "{" \n
+ "return out;" \n
+ "}" > \n
+ (ktw-insert-comment-line)
+)
+
+;; ktw-skeleton-cpp-comment-line
+(define-skeleton ktw-skeleton-cpp-comment-line
+ "Insert a comment line."
+ nil
+ "//----------------------------------------------------------------------------------" \n
+ _ \n)
+
+;; ktw-skeleton-date
+(define-skeleton ktw-skeleton-date
+ "Insert a date."
+ nil
+ (format-time-string "%B %e, %Y"))
+
+;; ktw-skeleton-gpl2
+(define-skeleton ktw-skeleton-gpl2
+ "Insert a GPL2 license."
+ nil
+ "This program is free software; you can redistribute it and/or modify" \n
+ "it under the terms of the GNU General Public License as published by" \n
+ "the Free Software Foundation; either version 2, or (at your option)" \n
+ "any later version." \n \n
+ "This program is distributed in the hope that it will be useful," \n
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of" \n
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" \n
+ "GNU General Public License for more details." \n \n
+ "You should have received a copy of the GNU General Public License" \n
+ "along with this program; if not, write to the Free Software Foundation," \n
+ "Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA." \n
+ )
+
+;; ktw-skeleton-gpl3
+(define-skeleton ktw-skeleton-gpl3
+ "Insert a GPL3 license."
+ "Program name: "
+ "This file is part of " str "." \n \n
+ str " is free software: you can redistribute it and/or modify" \n
+ "it under the terms of the GNU General Public License as published by" \n
+ "the Free Software Foundation, either version 3 of the License, or" \n
+ "(at your option) any later version." \n \n
+ str " is distributed in the hope that it will be useful," \n
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of" \n
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" \n
+ "GNU General Public License for more details." \n \n
+ "You should have received a copy of the GNU General Public License" \n
+ "along with " str ". If not, see <http://www.gnu.org/licenses/>." \n
+ _
+ )
+
+;; ktw-skeleton-php-class
+(define-skeleton ktw-skeleton-php-class
+ "Insert a class."
+ "Class name: "
+ "/**" > \n
+ "*" > \n
+ "*/" > \n
+ "class " str \n
+ "{" \n
+ "/**" > \n
+ "* Constructor." > \n
+ "*/" > \n
+ "public function __construct()" > \n
+ "{" > \n
+ _ \n
+ "}" > \n \n
+ "/**" > \n
+ "* Destructor." > \n
+ "*/" > \n
+ "public function __destruct()" > \n
+ "{" > \n
+ "}" > \n \n
+ "/**" > \n
+ "* Convert to string magic method." > \n
+ "*/" > \n
+ "public function __toString()" > \n
+ "{" > \n
+ "}" > \n
+ "}" > \n
+ )
+
+;; ktw-skeleton-php-getter-setter
+(define-skeleton ktw-skeleton-php-getter-setter
+ "Insert a getter and setter pair."
+ nil
+ "/**" > \n
+ "* Getter for '" (setq v1 (skeleton-read "Variable name (in lower case): ")) "'." > \n
+ "*" > \n
+ "* @return mixed The value of '" v1 "'" > \n
+ "*/" > \n
+ "public function get" (upcase-initials v1) "()" > \n
+ "{" > \n
+ "return $this->" v1 ";"> \n
+ "}" > \n \n
+ "/**" > \n
+ "* Setter for '" v1 "'." > \n
+ "*" > \n
+ "* @param mixed $value The new value of '" v1 "'" > \n
+ "*/" > \n
+ "public function set" (upcase-initials v1) "($value)" > \n
+ "{" > \n
+ "$this->" v1 " = $value;" > \n
+ "}" > \n
+ _
+ )
+
+;; ktw-skeleton-php-getter-setter
+(define-skeleton ktw-skeleton-php-function
+ "Insert a function skeleton."
+ "Function name: "
+ "/**" > \n
+ "*" _ > \n
+ "*/" > \n
+ "public function " str "()" > \n
+ "{" > \n \n
+ "}" > \n
+ )
+
+;;***************************************************************************
+;; End
+;;***************************************************************************
1,668 plugins/color-theme.el
@@ -0,0 +1,1668 @@
+;;; color-theme.el --- install color themes
+
+;; Copyright (C) 1999, 2000 Jonadab the Unsightly One <jonadab@bright.net>
+;; Copyright (C) 2000, 2001, 2002, 2003 Alex Schroeder <alex@gnu.org>
+;; Copyright (C) 2003, 2004, 2005, 2006 Xavier Maillard <zedek@gnu.org>
+
+;; Version: 6.6.0
+;; Keywords: faces
+;; Author: Jonadab the Unsightly One <jonadab@bright.net>
+;; Maintainer: Xavier Maillard <zedek@gnu.org>
+;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ColorTheme
+
+;; This file is not (YET) part of GNU Emacs.
+
+;; This is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free
+;; Software Foundation; either version 2, or (at your option) any later
+;; version.
+;;
+;; This is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+;; for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+;; MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; Please read README and BUGS files for any relevant help.
+;; Contributors (not themers) should also read HACKING file.
+
+;;; Thanks
+
+;; Deepak Goel <deego@glue.umd.edu>
+;; S. Pokrovsky <pok@nbsp.nsk.su> for ideas and discussion.
+;; Gordon Messmer <gordon@dragonsdawn.net> for ideas and discussion.
+;; Sriram Karra <karra@cs.utah.edu> for the color-theme-submit stuff.
+;; Olgierd `Kingsajz' Ziolko <kingsajz@rpg.pl> for the spec-filter idea.
+;; Brian Palmer for color-theme-library ideas and code
+;; All the users that contributed their color themes.
+
+
+
+;;; Code:
+(eval-when-compile
+ (require 'easymenu)
+ (require 'reporter)
+ (require 'sendmail))
+
+(require 'cl); set-difference is a function...
+
+;; for custom-face-attributes-get or face-custom-attributes-get
+(require 'cus-face)
+(require 'wid-edit); for widget-apply stuff in cus-face.el
+
+(defconst color-theme-maintainer-address "zedek@gnu.org"
+ "Address used by `submit-color-theme'.")
+
+;; Emacs / XEmacs compatibility and workaround layer
+
+(cond ((and (facep 'tool-bar)
+ (not (facep 'toolbar)))
+ (put 'toolbar 'face-alias 'tool-bar))
+ ((and (facep 'toolbar)
+ (not (facep 'tool-bar)))
+ (put 'tool-bar 'face-alias 'toolbar)))
+
+(defvar color-theme-xemacs-p (and (featurep 'xemacs)
+ (string-match "XEmacs" emacs-version))
+ "Non-nil if running XEmacs.")
+
+;; Add this since it appears to miss in emacs-2x
+(or (fboundp 'replace-in-string)
+ (defun replace-in-string (target old new)
+ (replace-regexp-in-string old new target)))
+
+;; face-attr-construct has a problem in Emacs 20.7 and older when
+;; dealing with inverse-video faces. Here is a short test to check
+;; wether you are affected.
+
+;; (set-background-color "wheat")
+;; (set-foreground-color "black")
+;; (setq a (make-face 'a-face))
+;; (face-spec-set a '((t (:background "white" :foreground "black" :inverse-video t))))
+;; (face-attr-construct a)
+;; => (:background "black" :inverse-video t)
+
+;; The expected response is the original specification:
+;; => (:background "white" :foreground "black" :inverse-video t)
+
+;; That's why we depend on cus-face.el functionality.
+
+(cond ((fboundp 'custom-face-attributes-get)
+ (defun color-theme-face-attr-construct (face frame)
+ (if (atom face)
+ (custom-face-attributes-get face frame)
+ (if (and (consp face) (eq (car face) 'quote))
+ (custom-face-attributes-get (cadr face) frame)
+ (custom-face-attributes-get (car face) frame)))))
+ ((fboundp 'face-custom-attributes-get)
+ (defalias 'color-theme-face-attr-construct
+ 'face-custom-attributes-get))
+ (t
+ (defun color-theme-face-attr-construct (&rest ignore)
+ (error "Unable to construct face attributes"))))
+
+(defun color-theme-alist (plist)
+ "Transform PLIST into an alist if it is a plist and return it.
+If the first element of PLIST is a cons cell, we just return PLIST,
+assuming PLIST to be an alist. If the first element of plist is not a
+symbol, this is an error: We cannot distinguish a plist from an ordinary
+list, but a list that doesn't start with a symbol is certainly no plist
+and no alist.
+
+This is used to make sure `default-frame-alist' really is an alist and not
+a plist. In XEmacs, the alist is deprecated; a plist is used instead."
+ (cond ((consp (car plist))
+ plist)
+ ((not (symbolp (car plist)))
+ (error "Wrong type argument: plist, %S" plist))
+ ((featurep 'xemacs)
+ (plist-to-alist plist)))); XEmacs only
+
+;; Customization
+
+(defgroup color-theme nil
+ "Color Themes for Emacs.
+A color theme consists of frame parameter settings, variable settings,
+and face definitions."
+ :version "20.6"
+ :group 'faces)
+
+(defcustom color-theme-legal-frame-parameters "\\(color\\|mode\\)$"
+ "Regexp that matches frame parameter names.
+Only frame parameter names that match this regexp can be changed as part
+of a color theme."
+ :type '(choice (const :tag "Colors only" "\\(color\\|mode\\)$")
+ (const :tag "Colors, fonts, and size"
+ "\\(color\\|mode\\|font\\|height\\|width\\)$")
+ (regexp :tag "Custom regexp"))
+ :group 'color-theme
+ :link '(info-link "(elisp)Window Frame Parameters"))
+
+(defcustom color-theme-legal-variables "\\(color\\|face\\)$"
+ "Regexp that matches variable names.
+Only variables that match this regexp can be changed as part of a color
+theme. In addition to matching this name, the variables have to be user
+variables (see function `user-variable-p')."
+ :type 'regexp
+ :group 'color-theme)
+
+(defcustom color-theme-illegal-faces "^w3-"
+ "Regexp that matches face names forbidden in themes.
+The default setting \"^w3-\" excludes w3 faces since these
+are created dynamically."
+ :type 'regexp
+ :group 'color-theme
+ :link '(info-link "(elisp)Faces for Font Lock")
+ :link '(info-link "(elisp)Standard Faces"))
+
+(defcustom color-theme-illegal-default-attributes '(:family :height :width)
+ "A list of face properties to be ignored when installing faces.
+This prevents Emacs from doing terrible things to your display just because
+a theme author likes weird fonts."
+ :type '(repeat symbol)
+ :group 'color-theme)
+
+(defcustom color-theme-is-global t
+ "*Determines wether a color theme is installed on all frames or not.
+If non-nil, color themes will be installed for all frames.
+If nil, color themes will be installed for the selected frame only.
+
+A possible use for this variable is dynamic binding. Here is a larger
+example to put in your ~/.emacs; it will make the Blue Sea color theme
+the default used for the first frame, and it will create two additional
+frames with different color themes.
+
+setup:
+ \(require 'color-theme)
+ ;; set default color theme
+ \(color-theme-blue-sea)
+ ;; create some frames with different color themes
+ \(let ((color-theme-is-global nil))
+ \(select-frame (make-frame))
+ \(color-theme-gnome2)
+ \(select-frame (make-frame))
+ \(color-theme-standard))
+
+Please note that using XEmacs and and a nil value for
+color-theme-is-global will ignore any variable settings for the color
+theme, since XEmacs doesn't have frame-local variable bindings.
+
+Also note that using Emacs and a non-nil value for color-theme-is-global
+will install a new color theme for all frames. Using XEmacs and a
+non-nil value for color-theme-is-global will install a new color theme
+only on those frames that are not using a local color theme."
+ :type 'boolean
+ :group 'color-theme)
+
+(defcustom color-theme-is-cumulative t
+ "*Determines wether new color themes are installed on top of each other.
+If non-nil, installing a color theme will undo all settings made by
+previous color themes."
+ :type 'boolean
+ :group 'color-theme)
+
+(defcustom color-theme-directory nil
+ "Directory where we can find additionnal themes (personnal).
+Note that there is at least one directory shipped with the official
+color-theme distribution where all contributed themes are located.
+This official selection can't be changed with that variable.
+However, you still can decide to turn it on or off and thus,
+not be shown with all themes but yours."
+ :type '(repeat string)
+ :group 'color-theme)
+
+(defcustom color-theme-libraries (directory-files
+ (concat
+ (file-name-directory (locate-library "color-theme"))
+ "/themes") t "^color-theme")
+ "A list of files, which will be loaded in color-theme-initialize depending
+on `color-theme-load-all-themes' value.
+This allows a user to prune the default color-themes (which can take a while
+to load)."
+ :type '(repeat string)
+ :group 'color-theme)
+
+(defcustom color-theme-load-all-themes t
+ "When t, load all color-theme theme files
+as presented by `color-theme-libraries'. Else
+do not load any of this themes."
+ :type 'boolean
+ :group 'color-theme)
+
+(defcustom color-theme-mode-hook nil
+ "Hook for color-theme-mode."
+ :type 'hook
+ :group 'color-theme)
+
+(defvar color-theme-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "RET") 'color-theme-install-at-point)