From ffbe0905bafb79f5f0a5e3b0f0df6d33057c535a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 28 Sep 2008 18:07:05 -0400 Subject: [PATCH] Initial commit. --- .emacs | 83 +++++++++++++++++++++++++++++++++ auto-modes.el | 55 ++++++++++++++++++++++ autoloads.el | 11 +++++ diff-buffer-against-file.el | 18 +++++++ load-paths.el | 26 +++++++++++ mode-hooks.el | 7 +++ mode-hooks/basic-mode-hooks.el | 6 +++ mode-hooks/csharp-mode-hooks.el | 7 +++ mode-hooks/css-mode-hooks.el | 36 ++++++++++++++ mode-hooks/nxml-mode-hooks.el | 14 ++++++ mode-hooks/ruby-mode-hooks.el | 7 +++ modes/.gitignore | 1 + win32.el | 2 + 13 files changed, 273 insertions(+) create mode 100644 .emacs create mode 100644 auto-modes.el create mode 100644 autoloads.el create mode 100644 diff-buffer-against-file.el create mode 100644 load-paths.el create mode 100644 mode-hooks.el create mode 100644 mode-hooks/basic-mode-hooks.el create mode 100644 mode-hooks/csharp-mode-hooks.el create mode 100644 mode-hooks/css-mode-hooks.el create mode 100644 mode-hooks/nxml-mode-hooks.el create mode 100644 mode-hooks/ruby-mode-hooks.el create mode 100644 modes/.gitignore create mode 100644 win32.el diff --git a/.emacs b/.emacs new file mode 100644 index 0000000..3dbc9d5 --- /dev/null +++ b/.emacs @@ -0,0 +1,83 @@ +;; Disable auto-save for all file buffers +(setq auto-save-default nil) + +(global-set-key "\C-m" 'newline-and-indent) +(global-font-lock-mode t) + +;; Set the frame title to the name of the buffer, if supported. +(setq frame-title-format "%b") + +;; Disable the menu bar +(menu-bar-mode -1) + +;; The most important statement in this file. +;; Do not display a splash screen on startup. +(setq inhibit-splash-screen t) + +;; Mode Line +(setq line-number-mode t) +(setq column-number-mode t) +(display-time) + + +;; Don't force a newline at the end of every file. +;; Doing so can screw up HTML, where a newline is more +;; or less equivalent to a space. +(setq require-final-newline nil) + + +;; Unicode +;; (set-language-environment "UTF-8") +(prefer-coding-system 'utf-8-unix) +(set-terminal-coding-system 'utf-8-unix) +(set-keyboard-coding-system 'utf-8-unix) + +(setq inhibit-iso-escape-detection t) + +;; Don't leave backups everywhere. +(setq backup-inhibited t) + +;; Add this to load-path manually, then add the rest in load-paths.el +(add-to-list 'load-path "~/.home/emacs/") +(load-library "load-paths") + +(if (eq system-type 'cygwin) + (load-library "win32")) + + +;; Need this for ignore-errors, and some modes. +(require 'cl) + +(load-library "auto-modes") +(load-library "mode-hooks") +(load-library "autoloads") + + +(defun load-erc() + (interactive) + (ignore-errors + (load-library "erc") + ) + ) + +(global-set-key "\C-ce" 'load-erc) + + +;; Never ask me anything, emacs. +(setq save-abbrevs nil) + + +(load-library "diff-buffer-against-file") +(global-set-key "\C-cd" 'diff-buffer-against-file) + + +;; These next functions override the defaults provided by emacs. They +;; prevent warning messages related to file modification times, +;; particularly on weird filesystems. + +;;(defun ask-user-about-supersession-threat (fn) +;; ) + +;;(defun verify-visited-file-modtime (bf) +;; t +;; ) diff --git a/auto-modes.el b/auto-modes.el new file mode 100644 index 0000000..39abd42 --- /dev/null +++ b/auto-modes.el @@ -0,0 +1,55 @@ +(setq auto-mode-alist + (append + (list + + ;; apache-mode + '("\\.htaccess$" . apache-mode) + '("httpd\\.conf$" . apache-mode) + '("srm\\.conf$" . apache-mode) + '("access\\.conf$" . apache-mode) + '("apache[12]\?\\.conf$" . apache-mode) + '("commonapache[12]\?\\.conf$" . apache-mode) + + ;; basic-mode + '("\\.class\\.asp$" . basic-mode) + '("\\.vbs$" . basic-mode) + + ;; csharp-mode + '("\\.ascx$" . csharp-mode) + '("\\.cs$" . csharp-mode) + + ;; css-mode + '("\\.css$" . css-mode) + + ;; ecmascript-mode + '("\\.js$" . ecmascript-mode) + + ;; haskell-mode + '("\\.hs$" . haskell-mode) + + ;; nagios-mode + '("\\.cfg$" . nagios-mode) + + ;; nxml-mode + '("\\.asp$" . nxml-mode) + '("\\.aspx$" . nxml-mode) + '("\\.xml$" . nxml-mode) + '("\\.?html$" . nxml-mode) + '("\\.config$" . nxml-mode) + '("\\.tpl$" . nxml-mode) + '("\\.rdf$" . nxml-mode) + '("\\.xul$" . nxml-mode) + + ;; php-mode + '("\\.php$" . php-mode) + + ;; python-mode + '("\\.py$" . python-mode) + + ;; ruby-mode + '("\\.rake$" . ruby-mode) + '("\\.rb$" . ruby-mode) + + ) + + auto-mode-alist)) diff --git a/autoloads.el b/autoloads.el new file mode 100644 index 0000000..e1c9bb7 --- /dev/null +++ b/autoloads.el @@ -0,0 +1,11 @@ +(autoload 'apache-mode "apache-mode" nil t) +(autoload 'basic-mode "basic-mode" nil t) +(autoload 'csharp-mode "csharp-mode" nil t) +(autoload 'css-mode "css-mode" nil t) +(autoload 'ecmascript-mode "ecmascript-mode" nil t) +(autoload 'haskell-mode "haskell-mode" nil t) +(autoload 'nagios-mode "nagios-mode" nil t) +(autoload 'nxml-mode "nxml-mode" nil t) +(autoload 'php-mode "php-mode" nil t) +(autoload 'python-mode "python-mode" nil t) +(autoload 'ruby-mode "ruby-mode" nil t) diff --git a/diff-buffer-against-file.el b/diff-buffer-against-file.el new file mode 100644 index 0000000..11f0ebf --- /dev/null +++ b/diff-buffer-against-file.el @@ -0,0 +1,18 @@ +(defun diff-buffer-against-file (context) + "diff the current (edited) buffer against the file of the same name" + (interactive "P") + (let (($file (concat "\"" buffer-file-name "\"")) + ($temp_buffer "emacs.diff") + ($temp_file "/tmp/emacs.diff")) + + (delete-other-windows) + (push-mark (point) t) + (generate-new-buffer $temp_file) + (copy-to-buffer $temp_buffer (point-min) (point-max)) + (set-buffer $temp_buffer) + (write-file $temp_file) + (shell-command (concat (if context "diff -c " "diff ") $file " " $temp_file)) + (kill-buffer $temp_file) + (pop-mark) + ) + ) diff --git a/load-paths.el b/load-paths.el new file mode 100644 index 0000000..5814a9a --- /dev/null +++ b/load-paths.el @@ -0,0 +1,26 @@ +(setq load-path + (append + (list + + ;; From ~/.home + "~/.home/emacs/modes/basic-mode/" + "~/.home/emacs/modes/csharp-mode/" + "~/.home/emacs/modes/nagios-mode/" + "~/.home/emacs/modes/ecmascript-mode/" + + ;; From /usr/share/emacs + "/usr/share/emacs/site-lisp/apache-mode/" + "/usr/share/emacs/site-lisp/css-mode/" + "/usr/share/emacs/site-lisp/erc/" + "/usr/share/emacs/site-lisp/haskell-mode/" + "/usr/share/emacs/site-lisp/nxml-mode/" + "/usr/share/emacs/site-lisp/php-mode/" + "/usr/share/emacs/site-lisp/ruby-mode/" + "/usr/share/emacs/site-lisp/ruby1.9-elisp/" + + ;; From /usr/share/emacs21 + "/usr/share/emacs21/site-lisp/css-mode/" + "/usr/share/emacs21/site-lisp/php-mode/" + ) + + load-path)) diff --git a/mode-hooks.el b/mode-hooks.el new file mode 100644 index 0000000..1f7acd4 --- /dev/null +++ b/mode-hooks.el @@ -0,0 +1,7 @@ +(add-to-list 'load-path "~/.home/emacs/mode-hooks/") + +(load-library "basic-mode-hooks") +(load-library "nxml-mode-hooks") +(load-library "css-mode-hooks") +(load-library "ruby-mode-hooks") +(load-library "csharp-mode-hooks") diff --git a/mode-hooks/basic-mode-hooks.el b/mode-hooks/basic-mode-hooks.el new file mode 100644 index 0000000..7633e4f --- /dev/null +++ b/mode-hooks/basic-mode-hooks.el @@ -0,0 +1,6 @@ +(defun bm-set-indent-level() + (setq basic-indent-level 2) + ) + + +(add-hook 'basic-mode-hook (function bm-set-indent-level)) diff --git a/mode-hooks/csharp-mode-hooks.el b/mode-hooks/csharp-mode-hooks.el new file mode 100644 index 0000000..7162142 --- /dev/null +++ b/mode-hooks/csharp-mode-hooks.el @@ -0,0 +1,7 @@ +(defun csm-hook() + ;; csharp-mode overrides this somewhere. Fix that. + (setq require-final-newline nil) + ) + + +(add-hook 'csharp-mode-hook (function csm-hook)) diff --git a/mode-hooks/css-mode-hooks.el b/mode-hooks/css-mode-hooks.el new file mode 100644 index 0000000..de053f8 --- /dev/null +++ b/mode-hooks/css-mode-hooks.el @@ -0,0 +1,36 @@ +(defun cssm-right-brace-macro() + (interactive) + (cssm-insert-right-brace-and-indent) + (forward-char) + ) + + +(defun cssm-hook() + + (cssm-leave-mirror-mode) + (setq cssm-indent-function 'cssm-c-style-indenter) + + (define-key cssm-mode-map (read-kbd-macro "}") 'cssm-right-brace-macro) + + ;; Add "focus" to the list of pseudo-selectors + (add-to-list 'cssm-pseudos "focus") + + ;; Redefine the CSS regular expressions to allow underscores + (setq cssm-font-lock-keywords + (list + (cons (cssm-list-2-regexp cssm-keywords) font-lock-keyword-face) + (cons "\\.[a-zA-Z][-a-zA-Z_0-9.]+" font-lock-variable-name-face) + (cons (concat ":" (cssm-list-2-regexp cssm-pseudos)) + font-lock-variable-name-face) + (cons "#[a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]\\)?" + font-lock-reference-face) + (cons "\\[.*\\]" font-lock-variable-name-face) + (cons "#[-a-zA-Z_0-9]*" font-lock-function-name-face) + (cons "rgb(\\s-*[0-9]+\\(\\.[0-9]+\\s-*%\\s-*\\)?\\s-*,\\s-*[0-9]+\\(\\.[0-9]+\\s-*%\\s-*\\)?\\s-*,\\s-*[0-9]+\\(\\.[0-9]+\\s-*%\\s-*\\)?\\s-*)" + font-lock-reference-face) + ) + ) + ) + + +(add-hook 'css-mode-hook (function cssm-hook)) diff --git a/mode-hooks/nxml-mode-hooks.el b/mode-hooks/nxml-mode-hooks.el new file mode 100644 index 0000000..0ea14bc --- /dev/null +++ b/mode-hooks/nxml-mode-hooks.el @@ -0,0 +1,14 @@ +(defun nxmlm-hook() + + (custom-set-faces + ;; Get rid of that goddamn underline face + '(rng-error-face ((t (:foreground "yellow" :weight light))))) + + ;; Start flyspell, checking only prog-mode faces. + (flyspell-prog-mode) + + ;; And add normal xml text to that list of prog-mode faces. + (add-to-list 'flyspell-prog-text-faces 'nxml-text-face) + ) + +(add-hook 'nxml-mode-hook (function nxmlm-hook)) diff --git a/mode-hooks/ruby-mode-hooks.el b/mode-hooks/ruby-mode-hooks.el new file mode 100644 index 0000000..043780e --- /dev/null +++ b/mode-hooks/ruby-mode-hooks.el @@ -0,0 +1,7 @@ +(defun rbm-hook() + ;; Put ruby-mode back into newline-and-indent + (define-key ruby-mode-map "\C-m" 'ruby-reindent-then-newline-and-indent) + ) + + +(add-hook 'ruby-mode-hook (function rbm-hook)) diff --git a/modes/.gitignore b/modes/.gitignore new file mode 100644 index 0000000..80e609a --- /dev/null +++ b/modes/.gitignore @@ -0,0 +1 @@ +[^.]* \ No newline at end of file diff --git a/win32.el b/win32.el new file mode 100644 index 0000000..e229b29 --- /dev/null +++ b/win32.el @@ -0,0 +1,2 @@ +(setq explicit-shell-file-name "bash.exe") +(setq shell-file-name explicit-shell-file-name) -- 2.43.2