(setq enable-local-variables 1) (setq perl-indent-level 2) (setq tab-width 4) (setq tab-interval 4) (setq make-backup-files t) (setq next-line-add-newlines nil) (setq set-fill-column 80) (setq version-control t) ; Allow numbered backups (setq visible-bell t) (setq c-indent-level -2) (setq-default indent-tabs-mode nil) (setq tex-dvi-view-command "/usr/bin/dvips -o view.ps") ;; FRAME DEFINITION ;; Colorization of my choice, or nearly so (setq default-frame-alist '((background-color . "White")) font-lock-face-attributes '((font-lock-comment-face "Sienna") (font-lock-string-face "ForestGreen") (font-lock-keyword-face "red") ;;(font-lock-function-name-face "OrangeRed") (font-lock-function-name-face "MediumVioletRed") (font-lock-variable-name-face "BlueViolet") (font-lock-type-face "VioletRed") ; (font-lock-reference-face "Red")) ) (setq default-frame-alist '((cursor-color . "red") (foreground-color . "navy") (background-color . "white") ; (top . 20) (left . 10) ; (width . 80) (height . 40) ; (font . "-*-7X14-medium-r-*-*-13-97-*-*-p-60-*-ansi-") )) ;;(setq initial-frame-alist '((top . 5) (left . 70))) (set-face-background 'modeline "gray") ;(set-face-background 'zmacs-region "red") ;(set-face-foreground 'zmacs-region "yellow") ;(set-face-background 'highlight "blue") ; Ie when selecting buffers ;(set-face-foreground 'highlight "yellow") ;(modify-syntax-entry "_" "w") (let ((process-connection-type nil)) ; try not to hog a pty for this. (display-time)) (setq frame-title-format "Emacs - %f") (setq icon-title-format "Emacs - %b") ;;; Resize the minibuffer so its entire contents are visible. ;(setq resize-minibuffer-mode t) ;(resize-minibuffer-mode) ;(set-default-font "-*-Lucida Console-normal-r-*-*-13-97-*-*-p-70-*-ansi-") (set-default-font "8x16") (add-hook 'shell-mode-hook '(lambda () (setq comint-completion-addsuffix '("/" . ""))) t) ;; Use my own compile.el (cond ((file-exists-p "~/lisp/compile.elc") (load-file "~/lisp/compile.elc"))) (cond ((file-exists-p "~/lisp/directory-files-deep") (load-file "~/lisp/directory-files-deep.el"))) ;; Use cross referance tools (cond ((file-exists-p "~/lisp/cxref.el") (load-file "~/lisp/cxref.el"))) ;;; Append ~/lisp to the load-path if it exist. (cond ((file-exists-p "~/lisp") (setq load-path (cons (expand-file-name "~/lisp") load-path)))) ; Add my util file. (cond ((or (file-exists-p "~/lisp/util.el") (file-exists-p "~/lisp/util.elc")) (load "util"))) ;;; Set frame size and position ;(set-frame-position (selected-frame) 70 5) ;(set-frame-height (selected-frame) 30) ;(set-frame-width (selected-frame) 80) ;;; Colorized fonts (setq font-lock-maximum-decoration t) (global-font-lock-mode t) (setq query-replace-highlight t) ;highlight during query (setq search-highlight t) ;incremental search highlights ;;; Setup C/C++/Java indentation (require 'cc-mode) ;; This will work after redumping ;;(setq c-site-default-style "local") ;; Use this until redumping (add-hook 'c-mode-hook (function (lambda () (setq c-file-style "local")))) (add-hook 'c++-mode-hook (function (lambda () (setq c-file-style "local")))) ;;; Setup Java mode stuff (cond ((file-exists-p "~/lisp") (setq c-brace-offset -2) (autoload 'java-mode "lisp/java-mode" "java mode" t nil) (setq auto-mode-alist (append '(("\\.java$" . java-mode)) auto-mode-alist)))) (add-hook 'java-mode-hook 'my-java-mode-hook) (defun my-java-mode-hook () (cond (window-system (require 'andersl-java-font-lock) (turn-on-font-lock)))) (add-hook 'font-lock-mode-hook (function (lambda () (if (eq major-mode 'java-mode) (setq font-lock-keywords java-font-lock-keywords))))) ;(cond ((file-exists-p "~/lisp/hilit-java.elc") ; (load "~/lisp/hilit-java"))) ;;; Go into c++-mode or perl-mode depending on file extention ;; (setq auto-mode-alist ;; (append '(("\\.C$" . c++-mode) ;; ("\\.cc$" . c++-mode) ;; ("\\.cpp$" . c++-mode) ;; ("\\.cxx$" . c++-mode) ;; ("\\.hxx$" . c++-mode) ;; ("\\.h$" . c++-mode) ;; ("\\.hh$" . c++-mode) ;; ("\\.idl$" . c++-mode) ;; ("\\.c$" . c-mode) ;; ("\\.pl$" . perl-mode) ;; ("\\.pm$" . perl-mode) ;; ("\\.java$" . java-mode) ;; ("\\.?[Ff][Aa][Qq]$" . faq-mode) ;; ("\\.txt$" . text-mode)) ;; auto-mode-alist)) ;;; Used for switching frames (fix for C-x 5 o being "fixed") ;(defun raise-and-focus-on-frame (frame) ; "Raise frame and give it input focus if in foreground." ; (raise-frame frame) ; (make-frame-invisible frame) ; (make-frame-visible frame)) ;;; Re-bind some keys ;(global-unset-key "\C-x5o") ;(global-set-key "\C-x5o" 'raise-and-focus-on-frame) (global-set-key "\eg" 'fill-region) ;(global-set-key "\C-cg" 'gnus) ;(global-set-key "\C-cu" 'gnus-uudecode-marked-articles) ;(global-set-key "\C-cl" 'recenter) (global-set-key [C-up] 'enlarge-window) (global-set-key [C-down] 'shrink-window) ;;; Set up some function keys (global-set-key (quote [f1]) (quote enlarge-window 1)) (global-set-key [f2] 'shrink-window) (global-set-key [f3] 'ispell-word) (global-set-key [f4] 'call-last-kbd-macro) (global-set-key [f5] 'next-error) (global-set-key [f6] 'compile) ;(global-set-key [f7] 'ediff-files) (message "Hi! Greetings from GNU Emacs %s! This is before key binding action." emacs-version) (global-set-key [f7] 'complete-tag) (message "Hi again! Another greetings from %s! This is *after* key binding action." emacs-major-version) (global-set-key [f8] 'hilit-highlight-buffer) (global-set-key [f9] 'undo) (global-set-key [f10] 'other-window) (global-set-key [f11] 'goto-line) (global-set-key [f12] 'bury-buffer) (global-unset-key "\C-x\C-c") (global-set-key "\C-x\M-c" 'save-buffers-kill-emacs) ;;; Setup ange-ftp ;(cond ((file-exists-p "e:/bin/ftp.exe") ; (setq ange-ftp-ftp-program-name "e:/bin/ftp.exe"))) ;(setq ange-ftp-tmp-name-template ; (concat (expand-file-name (getenv "TEMP")) "/ange-ftp")) ;(setq ange-ftp-gateway-tmp-name-template ; (concat (expand-file-name (getenv "TEMP")) "/ange-ftp")) ;;; Mail related stuff ;;; Some place to put copies for me (setq mail-archive-file-name "~/mail/my_messages_at_cdot") (setq rmail-delete-after-output t) ;;; Set up rmail headers to ignore (setq rmail-ignored-headers "^distribution:\\|^errors-to:\\|^message-id:\\|^originating-client:\\|^path:\\|^precedence:\\|^received:\\|^repository:\\|^status:\\|^summary-line:\\|^x-envelope-to:\\|^x-vms-to:\\|^x-mailer:\\|^x-listserver:\\|^x-listserver-version:\\|^content-length:\\|^posted-date:\\|^content-type:\\|^mime-version:\\|^x-mailing-list:\\|^x-mailing-list-archive:\\|^sender:\\|^X-Listprocessor-Version:\\|^contect-transfer-encoding:\\|^X-Loop:\\|^X400:\\|^X-:\\|^Resent-From:\\|^Resent-Sender:\\|^Encoding:\\|^Return-Path:\\|^Mr-Received:\\|^Autoforward:\\|^Importance:\\|^Priority:\\|^Sensetivity:\\|^Ua-Content-Id:\\|^X400-Mts-Identifier:\\|^Hop-Count:\\|^References:\\|^Lines:") ;;; Set up fill mode in a few places. (setq set-fill-column 80) (setq mail-mode-hook ; do auto fill mode in mail mode '(lambda () (auto-fill-mode 1))) (setq text-mode-hook ; do auto fill mode in text mode '(lambda () (auto-fill-mode t))) (setq fundamenta-mode-hook ; do auto fill mode in fundamental mode '(lambda () (auto-fill-mode t))) ;;; Supercite-2.3 (setq sc-nested-citation-p t) (setq sc-fixup-whitespace-p nil) (setq sc-auto-fill-region-p nil) (setq sc-electric-references-p nil) (setq sc-citation-leader "") (setq mail-yank-hooks 'sc-cite-original) ;;; Other stuff (setq news-reply-mode-hook '(lambda () (auto-fill-mode 1) (abbrev-mode 1))) (setq news-post-mode-hook '(lambda () (auto-fill-mode 1) (abbrev-mode 1))) (setq news-reply-followup-to-mode-hook '(lambda () (auto-fill-mode 1) (abbrev-mode 1))) ;;; GNUS defaults ;(setq tcp-program-name "nttcp") (setq gnus-use-generic-from "kmrnews") (setq gnus-nntp-server "kmrnews") (setq gnus-your-organization "Raytheon") (setq gnus-user-full-name "Sarir Khamsi") (setq gnus-article-maybe-hightlight t) (setq gnus-user-from-line "khamsi@kmrmail.kmr.ll.mit.edu") ;; Some stuff to speed up GNUS startup (setq gnus-check-new-newsgroups 'ask-server) (setq gnus-read-active-file t) ;; was 'some (setq gnus-fetch-old-headers nil) ;even "some" setting takes too long (setq gnus-asynchronous t) (setq gnus-keep-backlog 10) ;;; Set up abbreviation mode (setq-default abbrev-mode t) (cond ((file-exists-p "~/.abbrev_defs") (read-abbrev-file "~/.abbrev_defs"))) (setq save-abbrevs t) (defun shell-mode-settings () (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt nil t) (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m nil t) (setq tab-width 4)) (add-hook 'shell-mode-hook 'shell-mode-settings) ;;; Set up POP3 stuff (setq user-full-name "Srinivasachar Achar") (setq user-mail-address "achar@cdotb.ernet.in") (setq rmail-primary-inbox-list '("po:achar") rmail-pop-password-required t) (setq smtpmail-default-smtp-server "ws9.cdotb.ernet.in") ;(setq smtpmail-local-domain "pophost1") ;(setq send-mail-function 'smtpmail-send-it) (setenv "MAILHOST" "ws9.cdotb.ernet.in") ;(load-library "smtpmail") ;;; Setup functions to allow toggling between quoting args and not (defun sk-quote-process-args (state) (interactive "sState: ") (cond ((equal state "t") (setq win32-quote-process-args t)) (not equal (state "t") (setq win32-quote-process-args t)))) (global-set-key "\C-cV" 'get-clipboard) (global-set-key "\C-cC" 'set-clipboard) ;;; Setup ispell4 stuff (cond ((file-exists-p "c:/bin/ispell.exe") (autoload 'ispell-word "ispell4" "Check spelling of word at or before point" t) (autoload 'ispell-complete-word "ispell4" "Complete word at or before point" t) (autoload 'ispell-region "ispell4" "Check spelling of every word in the region" t) (autoload 'ispell-buffer "ispell4" "Check spelling of every word in the buffer" t) (setq ispell-command "c:/bin/ispell.exe" ispell-look-dictionary "c:/bin/ispell.words" ispell-look-command "c:/bin/look.exe" ispell-command-options (list "-d" "c:/bin/ispell.dict")))) ;;; Setup the desktop package. (load "desktop") (desktop-load-default) (desktop-read) (put 'eval-expression 'disabled nil) ;;; Setup MIME stuff ;(load "mime-setup") ;;; User specific stuff ;;; Bag the scrollbars ;(scroll-bar-mode nil) ;(menu-bar-mode nil) ;(setq load-path (cons "c:/usr/local/emacs-19.34/site-lisp" load-path)) ;;; Load VM (cond ((file-exists-p "~/lisp/.vm") (load-file "~/lisp/.vm"))) ;;; WoMan stuff for reading man pages in emacs (autoload 'woman "woman" "Decode and browse a UN*X man page." t) (autoload 'woman-find-file "woman" "Find, decode and browse a specific UN*X man-page file." t) ;;; Microsoft IntelliPoint support (defvar mouse-wheel-scroll-amount 20 "*Number of lines to scroll per click of the mouse wheel.") (defun mouse-wheel-handler (event) "Scroll the current buffer by `mouse-wheel-scroll-amount'." (interactive "e") (condition-case nil (if (< (car (cdr (cdr event))) 0) (scroll-up mouse-wheel-scroll-amount) (scroll-down mouse-wheel-scroll-amount)) (error nil))) ;;; Start off in "home" dir. (cd (getenv "HOME")) ;;; Fix wierd shell problem. (add-hook 'sh-mode-hook (defun my-shell-mode-hook () (sh-set-shell "c:/usr/local/gnuwin32/b18/H-i386-cygwin32/bin/bash"))) ;;; Show matching parens (require 'paren) (show-paren-mode 1) ;;; Set up faq-mode ;(load "faq-mode") ;; achar (setq transient-mark-mode t) (setq tab-width 4) (setq default-tab-width 4) (setq line-number-mode t) (column-number-mode t) ;; html-helper-mode (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) (setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist)) (setq html-helper-do-write-file-hooks t) ; Set true to get timestamps updating (setq html-helper-build-new-buffer t) ; Set true to get template in buffer (setq html-helper-address-string "G. Srinivasachar <achar@cdotb.ernet.in>") (setq tempo-interactive t) (setq html-helper-use-expert-menu t) ; Set true to get the full HTML menu (setq html-helper-htmldtd-version "\n"); Select HTML 3.0 style as default ;;(add-hook 'html-helper-load-hook '(lambda () (progn (load "hhm-extra") ;; (load "hhm-table") ;; (load "hhm-netscape")))) (add-hook 'html-helper-mode-hook '(lambda () (auto-fill-mode 1))) (add-to-list 'auto-mode-alist '("\\.html\\'" . html-mode)) ;; METAMAIL ;(require 'transparent) (defvar rmail-never-execute-automatically t "*Prevent metamail from happening semi-automatically") ;(define-key rmail-mode-map "!" 'rmail-execute-content-type) (defun rmail-check-content-type () "Check for certain Content Type headers in mail" (rmail-maybe-execute-content-type nil)) (defun rmail-execute-content-type () "Check for certain Content Type headers in mail" (interactive) (rmail-maybe-execute-content-type t)) (defun rmail-handle-content-type (ctype override dotoggle) (let (oldpt (oldbuf (current-buffer)) (fname (make-temp-name "/tmp/rmailct"))) (cond ((and rmail-never-execute-automatically (not override)) (progn (if dotoggle (rmail-toggle-header)) (message (concat "You can use '!' to run an interpreter for this '" ctype "' format mail.")))) ((or override (getenv "MM_NOASK") (y-or-n-p (concat "Run an interpreter for this '" ctype "' format mail? "))) (progn (save-restriction (goto-char (point-max)) (setq oldpt (point)) (goto-char 0) (widen) (write-region (point) oldpt fname 'nil "silent")) (if dotoggle (rmail-toggle-header)) (if (and window-system (getenv "DISPLAY")) (progn (switch-to-buffer-other-window "METAMAIL") (erase-buffer) (pop-to-buffer oldbuf) (start-process "metamail" "METAMAIL" "metamail" "-m" "rmail" "-p" "-x" "-d" "-z" "-q" fname) (message "Starting metamail. Sending output to METAMAIL buffer.")) (progn (switch-to-buffer "METAMAIL") (erase-buffer) (sit-for 0) (transparent-window "METAMAIL" "metamail" (list "-m" "rmail" "-p" "-d" "-z" "-q" fname) nil (concat "\n\r\n\r*****************************************" "*******************************\n\rPress any key " "to go back to EMACS\n\r\n\r***********************" "*************************************************\n\r") ))))) (t (progn (if dotoggle (rmail-toggle-header)) (message (concat "You can use the '!' keystroke to " "execute the external viewing program."))))))) (defun rmail-maybe-execute-content-type (dorun) "Check for certain Content Type headers in mail" (cond ((not (getenv "NOMETAMAIL")) (let* ((ct nil) (needs-toggled nil)) (save-excursion (save-restriction (widen) (goto-char (rmail-msgbeg rmail-current-message)) (forward-line 1) (if (and dorun (= (following-char) ?1)) (setq needs-toggled t)) (if (= (following-char) ?0) (narrow-to-region (progn (forward-line 2) (point)) (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) 'move) (point))) (narrow-to-region (point) (progn (search-forward "\n*** EOOH ***\n") (beginning-of-line) (point)))) (setq ct (mail-fetch-field "content-type" t)))) (cond (ct (cond ((and (not (string= (downcase ct) "text")) (not (string= (downcase ct) "text/plain")) (not (string= (downcase ct) "text/plain; charset=us-ascii"))) (progn (if needs-toggled (rmail-toggle-header)) (rmail-handle-content-type ct dorun needs-toggled))) (needs-toggled (rmail-toggle-header))))))))) (autoload 'mime-mode "mime" "Minor mode for editing MIME message." t) ;; GNATS (autoload 'edit-pr "gnats" "Command to edit a problem report." t) (autoload 'view-pr "gnats" "Command to view a problem report." t) (autoload 'unlock-pr "gnats" "Unlock a problem report." t) (autoload 'query-pr "gnats" "Command to query information about problem reports." t) (autoload 'send-pr-mode "send-pr" "Major mode for sending problem reports." t) (autoload 'send-pr "send-pr" "Command to create and send a problem report." t) (setq c-indent-level 8) (setq c-argdecl-indent 4) (setq c-brace-offset 0) (setq c-continued-brace-offset 0) (setq c-label-offset -4) (setq c-continued-statement-offset 4) (setq x-fixed-font-alist '("Font Menu" ("Misc" ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1") ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1") ("lucida 13" "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-*-1") ("7x13" "-misc-fixed-medium-r-normal--13-120-75-75-c-70-*-1") ("7x14" "-misc-fixed-medium-r-normal--14-130-75-75-c-70-*-1") ("9x15" "-misc-fixed-medium-r-normal--15-140-*-*-c-*-*-1") ("") ("clean 8x8" "-schumacher-clean-medium-r-normal--*-80-*-*-c-*-*-1") ("clean 8x14" "-schumacher-clean-medium-r-normal--*-140-*-*-c-*-*-1") ("clean 8x10" "-schumacher-clean-medium-r-normal--*-100-*-*-c-*-*-1") ("clean 8x16" "-schumacher-clean-medium-r-normal--*-160-*-*-c-*-*-1") ("") ("sony 8x16" "-sony-fixed-medium-r-normal--16-120-100-100-c-80-*-1") ("") ("-- Courier --") ("Courier 10" "-adobe-courier-medium-r-normal--*-100-*-*-m-*-*-1") ("Courier 12" "-adobe-courier-medium-r-normal--*-120-*-*-m-*-*-1") ("Courier 14" "-adobe-courier-medium-r-normal--*-140-*-*-m-*-*-1") ("Courier 18" "-adobe-courier-medium-r-normal--*-180-*-*-m-*-*-1") ("Courier 18-b" "-adobe-courier-bold-r-normal--*-180-*-*-m-*-*-1") ))) (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. ) (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. ) (setq view-diary-entries-initially t) (setq appt-issue-message t) (setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode) auto-mode-alist)) ;;(diary) ;(load-file (expand-file-name "/export/home/asd/tools/emacs-22.3/lisp/dired-explore.el")) ;;(require 'directory-files-deep) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil)