/ Published in: Lisp
Expand |
Embed | Plain Text
;;; ;;; Emacs initialization file ;;; ;;; Kevin Christen ;;; ;;; ;;; General initialization ;;; (column-number-mode 1) (tool-bar-mode -1) (put 'eval-expression 'disabled nil) (put 'narrow-to-region 'disabled nil) (setq calendar-latitude 32.8) (setq calendar-longitude -96.8) (setq calendar-location-name "Dallas, TX") (setq confirm-kill-emacs (function yes-or-no-p)) (setq default-fill-column 75) (setq default-major-mode 'text-mode) (setq dired-chmod-program "chmod") (setq-default indent-tabs-mode nil) (setq inhibit-startup-message t) (setq kill-whole-line t) (setq next-line-add-newlines nil) (setq site-lisp-dir (concat (getenv "EMACS_DIR") "/site-lisp")) (setq user-full-name "Kevin Christen") (setq visible-bell t) ;;; ;;; Things that depend on the OS ;;; (cond ;; Linux ((string-equal system-type "gnu/linux") (set-default-font "10x20") (require 'gnuserv-compat)) ;; Windows ((string-equal system-type "windows-nt") (set-default-font ; "-raster-ProFontWindows-normal-r-normal-normal-23-172-96-96-c-*-iso10646-1" "-raster-System-bold-r-normal-normal-13-97-96-96-p-*-iso10646-1") ;; w32-print setup. Got w32-print.el from Emacs on NT home page. (setq-default w32-print-enable-keymappings nil w32-print-gs-command "d:/bin/gstools/gs5.50/gswin32c.exe" w32-print-gs-destination "//DFW/Konica 7050PS (5th Floor)" w32-print-gs-device "ljet4" w32-print-gs-device-dpi '300 w32-print-gs-lib "d:/bin/gstools/gs5.50;d:/bin/gstools/gs5.50/fonts" w32-print-gs-path "d:/bin/gstools/gs5.50" w32-print-gs-version "4.03" w32-print-gs-view-path "d:/bin/gstools/gsview" w32-print-lpr-destination "//DFW/Konica 7050PS (5th Floor)" w32-print-ps-preview nil w32-print-use-faces nil) (load "w32-print" 'noerror 'nomessage))) ;;; ;;; Things that depend on a GUI ;;; (cond (window-system (global-font-lock-mode t) (show-paren-mode 1) (require 'color-theme) (color-theme-initialize) (color-theme-blue-sea)) (t (menu-bar-mode -1))) ;;; ;;; Start the server ;;; (require 'server) (server-edit) ;;; ;;; Global key assignments ;;; ;;; toggle comments on a region (global-set-key [f5] (function (lambda (point-min point-max) (interactive "r") (save-excursion (goto-char point-min) (skip-chars-forward " \t\n") ;skip whitespace (if (looking-at ;looking at beginning of comment? (substring comment-start 0 ;strip trailing whitespace from comment-start (string-match "[ \t\n]*$" comment-start))) (uncomment-region point-min point-max) (comment-region point-min point-max)))))) (global-set-key [f6] 'indent-region) (global-set-key [f7] 'call-last-kbd-macro) ;;; run `compile' command with point at end of buffer (global-set-key [f8] (if (< emacs-major-version 20) (function (lambda () (interactive) (call-interactively 'compile) (set-buffer "*compilation*") (set-window-point (get-buffer-window "*compilation*") (goto-char (point-max))))) 'compile)) ;;; run `revert-buffer', with no confirmation (global-set-key [f9] (function (lambda () (interactive) (revert-buffer t t)))) ;;; ;;; Make bash work. From the NT emacs home page ;;; (setq shell-file-name "bash") (setq explicit-shell-file-name shell-file-name) ;; Run a dos shell if explicitly desired (defun dos-shell () (interactive) (let ((explicit-shell-file-name "cmd")) (shell))) ;;; ;;; visual-basic-mode, from the Emacs for Windows NT FAQ ;; (autoload 'visual-basic-mode "visual-basic-mode" "Visual Basic mode." t) ;; (setq auto-mode-alist (append '(("\\.\\(frm\\|bas\\|cls\\|ctl\\)$" . ;; visual-basic-mode)) auto-mode-alist)) ;; (setq visual-basic-ide-pathname ;; "d:/Program Files/Microsoft Visual Studio/VB98/VB6.EXE") ;; (add-hook 'visual-basic-mode-hook ;; '(lambda () (setq visual-basic-mode-indent 4))) ;; (autoload 'vbp-mode "visual-basic-mode" "VBP mode." t) ;; (setq auto-mode-alist (append '(("\\.\\(vbg\\|vbp\\)$" . ;; vbp-mode)) auto-mode-alist)) ;; (autoload 'vbp-mode "vbp-mode" "VBP mode." t) ;;; ;;; css-mode ;;; (autoload 'css-mode "css-mode") (setq cssm-indent-function #'cssm-c-style-indenter) (setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist)) ;;; ;;; cc-mode setup ;;; ;;; Got cc-mode v5.26 from http://www.python.org/emacs/cc-mode and ;;; installed it in d:/bin/emacs/site-lisp/cc-mode. Make sure it gets ;;; picked up. ;;; (setq load-path (cons (concat site-lisp-dir "/cc-mode") load-path)) (setq auto-mode-alist (cons '("\\.g$" . java-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.jad$" . java-mode) auto-mode-alist)) ; The built in idl-mode is for OMG idl. (setq auto-mode-alist (cons '("\\.idl$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) (defconst medhost-c++-style '((c-basic-offset . 2) (c-cleanup-list . (defun-close-semi empty-defun-braces list-close-comma scope-operator)) (c-comment-only-line-offset . (0 . 0)) (c-hanging-braces-alist . ((substatement-open . (before after)))) (c-hanging-colons-alist . ((access-label after) (case-label after) (inher-intro) (label after) (member-init-intro))) (c-offsets-alist . ((access-label . -) (arglist-close . 0) (block-open . 0) (inline-open . 0) (substatement-open . 0)))) "MedHost's C and C++ formatting style") (defconst kmc-c-style '((c-basic-offset . 3) (c-cleanup-list . (brace-else-brace defun-close-semi empty-defun-braces list-close-comma scope-operator)) (c-comment-only-line-offset . (0 . 0)) (c-hanging-braces-alist . ((block-open after) (block-close . (before after)) (brace-list-open) (brace-list-close) (class-open after) (class-close . (before after)) (defun-open . (before after)) (defun-close . (before after)) (inline-open after) (inline-close) (substatement-open after))) (c-hanging-colons-alist . ((access-label after) (case-label after) (inher-intro) (label after) (member-init-intro))) (c-offsets-alist . ((arglist-close . 0) (block-open . 0) (substatement-open . 0)))) "KMC's C/C++ formatting style") (add-hook 'c-mode-common-hook (function (lambda () (c-add-style "MedHost's C and C++ formatting style" medhost-c++-style t) (c-toggle-auto-state 1) (c-toggle-hungry-state 1) (setq indent-tabs-mode nil) (turn-on-auto-fill)))) (defconst kmc-java-style '((c-basic-offset . 3) (c-cleanup-list . (defun-close-semi empty-defun-braces list-close-comma)) (c-comment-only-line-offset . (0 . 0)) (c-hanging-braces-alist . ((block-open after) (block-close . (before after)) (brace-list-open) (brace-list-close) (class-open . (before after)) (class-close . (before after)) (defun-open after) (defun-close . (before after)) (inline-open . (before after)) (inline-close . (before after)) (substatement-open after))) (c-hanging-colons-alist . ((access-label after) (case-label after) (inher-intro) (label after) (member-init-intro))) (c-offsets-alist . ((access-label . 0) (arglist-close . 0) (block-open . 0) (inline-open . 0) (substatement-open . 0)))) "KMC's Java formatting style") (add-hook 'java-mode-hook (function (lambda () (c-add-style "kmc-java" kmc-java-style t)))) ;;; ;;; emacs-lisp-mode setup ;;; (add-hook 'emacs-lisp-mode-hook '(lambda () (turn-on-auto-fill))) ;;; ;;; html-mode and related file types ;;; (let ((tidy "~/elisp/tidy.el")) (if (file-exists-p tidy) (load tidy))) (setq auto-mode-alist (cons '("\\.jsp\\'" . html-mode) auto-mode-alist)) ;;; ;;; java-mode ;;; (add-hook 'java-mode-hook '(lambda () (c-set-style "java") (setq c-basic-offset 3))) ;;; ;;; JDEE ;;; ;(setq browse-url-new-window-p t) ;(require 'cedet) ;(require 'jde) ;;; ;;; nXML mode ;;; (load "rng-auto.el") (setq auto-mode-alist (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\|html\\)\\'" . nxml-mode) auto-mode-alist)) (setq magic-mode-alist (cons (cons (car (rassoc 'xml-mode magic-mode-alist)) 'nxml-mode) magic-mode-alist)) (add-hook 'nxml-mode-hook '(lambda () (turn-on-auto-fill))) ;;; ;;; perl-mode setup (cperl) ;;; (cond ((< emacs-major-version 20) (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)) (t (load "cperl-mode") (fset 'perl-mode (symbol-function 'cperl-mode)))) (add-hook 'cperl-mode-hook '(lambda () (turn-on-auto-fill))) ;;; ;;; Python mode ;;; (add-hook 'python-mode-hook '(lambda () (turn-on-auto-fill))) ;;; ;;; Ruby mode ;;; (autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t) (setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist)) (setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) interpreter-mode-alist)) (add-hook 'ruby-mode-hook '(lambda () (turn-on-auto-fill))) (autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process" t) (autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode") (add-hook 'ruby-mode-hook '(lambda () (inf-ruby-keys))) (autoload 'rubydb "rubydb3x" "Ruby debugger" t) ;;; ;;; SGML mode (also XML) ;;; ;; (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) ;; (autoload 'xml-mode "psgml" "Major mode to edit XML files." t) ;; (setq auto-mode-alist (append '(("\\.xml$" . xml-mode) ;; ("\\.xsl$" . xml-mode)) ;; auto-mode-alist)) ;; (add-hook 'sgml-mode-hook ;; '(lambda () (setq sgml-insert-missing-element-comment nil))) ;; (add-hook 'xml-mode-hook ;; '(lambda () ;; (setq sgml-validate-command "java sax.SAXCount -v %s %s"))) ;; (setq sgml-local-ecat-files '("d:/share/docbook/xml/4.1.2/docbook.ecat")) ;;; ;;; Subversion ;;; (require 'psvn) ;;; ;;; text-mode setup ;;; (add-hook 'text-mode-hook '(lambda () (turn-on-auto-fill))) ; ;; Visual SourceSafe ; (setq ; ss-program "d:\\Bin\\VSS\\WIN32\\SS.EXE" ; ss-project-dirs '(("^e:\\\\home\\\\kchristen\\\\srcsafe\\\\" . ; "$/NextGen/")) ; ss-tmp-dir "c:\\tmp") ; (if (< emacs-major-version 20) ; (load "source-safe-menu") ; (load "source-safe")) ;;; A crude remapping of C-x C-q to do SourceSafe checkin and checkout ; (global-set-key ; "\C-x\C-q" ; (function ; (lambda () ; (interactive) ; (let ((ss-working-dir "^e:/home/kchristen/srcsafe")) ; (if (string-match ss-working-dir (buffer-file-name)) ; (if (ss-file-checked-out-p (buffer-file-name)) ; (ss-update) ; (ss-checkout)) ; (toggle-read-only)))))) ;;; sql-mode. See ~/.sql-mode for the rest ; (setq load-path (cons (concat site-lisp-dir "/sql-mode") load-path)) ; (defvar sql-dataserver-type 'oracle) ; (require 'sql-mode) ; (sql-initialize) (autoload 'sql-ms "sql" "SQL mode for MS SQL Server." t) ;;; ;;; Changes for Visual C++ ;;; ;; Visual C++ generates make files with dos line terminators, but that ;; start with a comment ("#"). Emacs takes this to be a file that should ;; be opened using a unix coding system. Override that behavior. (modify-coding-system-alist 'file "\\.mak\\'" 'iso-latin-1-dos) ;;; ;;; Stuff set by the `customize' command ;;; (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(compilation-scroll-output t) '(compile-command "ant -emacs -find build.xml") '(cperl-auto-newline t) '(cperl-brace-offset -4) '(cperl-clobber-lisp-bindings t) '(cperl-continued-statement-offset 4) '(cperl-electric-lbrace-space t) '(cperl-electric-linefeed t) '(cperl-electric-parens nil) '(cperl-font-lock t) '(cperl-indent-level 4) '(cperl-info-on-command-no-prompt t) '(cperl-label-offset -4) '(cperl-lazy-help-time 5) '(jde-ant-enable-find t) '(jde-ant-read-target t) '(jde-bug-jdk-directory "d:/bin/jdk1.3.1_01") '(jde-bug-vm-includes-jpda-p t) '(jde-build-function (quote (jde-ant-build))) '(jde-compile-option-debug (quote ("all" (t nil nil)))) '(jde-db-debugger (quote ("JDEbug" "" . "Executable")) t) '(jde-jdk-doc-url "file:///D:/bin/jdk1.3.1_01/docs/api/index.html") '(nxml-auto-insert-xml-declaration-flag t)) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. ) (put 'downcase-region 'disabled nil)
You need to login to post a comment.
