(setq homeDir (getenv "HOME")) ;;; ;;; Added /usr/local/lib below, should be done in global start-up file ;;; TAG, 12/2/2007 ;;; (setq load-path (cons nil ; load-path <- (nil mine global) (cons (concat homeDir "/lib/emacs") (cons "/usr/local/lib/emacs/site-lisp" load-path)))) ; used in rmail-mode (setq fullhostname (system-name)) (setq hostname ; used in .emacs. (substring fullhostname 0 (progn (string-match "\\." fullhostname) (- (match-end 0) 1)))) (load "tilde") ; for mode-line (add-hook 'find-file-hooks 'make-tilde-file-name) ;("" mode-line-modified mode-line-buffer-identification " " global-mode-string " %[(" mode-name minor-mode-alist "%n" mode-line-process ")%]----" (-3 . "%p") "-%-") ;(setq default-mode-line-format "%[%b%*: %f (%m) %p %M%]") ;(setq default-mode-line-format '("%[%b%*: " tilde-buffer-file-name " (" mode-name my-minor-mode-alist "%n" mode-line-process ") " (-3 . "%p") " " global-mode-string "%] %-")) (setq default-mode-line-format '("%[%b%*: " tilde-buffer-file-name " (" mode-name my-minor-mode-alist "%n" mode-line-process ") " (-3 . "%p") "%] %-")) (setq my-minor-mode-alist '((mc-write-mode mc-write-mode-string) (mc-read-mode mc-read-mode-string) (abbrev-mode " Ab") (overwrite-mode overwrite-mode) (auto-fill-function " Fi") (defining-kbd-macro " Def") (isearch-mode isearch-mode) (outline-minor-mode " Ot"))) (setq visible-bell t) (setq next-line-add-newlines nil) (setq default-major-mode 'text-mode) (setq abbrev-file-name "~/lib/emacs/abbrev_defs") (setq auto-mode-alist (cons '("\\.tex$" . LaTeX-mode) (cons '("\\.emacs\\.*" . emacs-lisp-mode) auto-mode-alist))) (setq mail-self-blind nil) ; Don't send BCC to self automatically (setq TeX-default-mode 'LaTeX-mode) (load "ctlz") ; define Control-Z-Prefix (load "misc") ; my-save-buffer, scroll-other-down, my-underline-line (substitute-key-definition 'save-buffer 'my-save-buffer ctl-x-map) (substitute-key-definition 'save-buffer 'my-save-buffer esc-map) (set-input-mode nil nil 1) ; for 8-bit input (standard-display-european t) (defun make-backspace-ctrlh () "Set Ctrl-H to do the functions of DEL" (interactive) (global-set-key "\C-h" 'backward-delete-char-untabify) (global-set-key "\e\C-h" 'backward-kill-word) (message "Ctrl-H now deletes")) (if (equal window-system 'x) (progn (set-background-color "wheat")) ; tan (progn (menu-bar-mode -1))) ;(tool-bar-mode -1) (global-set-key "`" 'ESC-prefix) (global-set-key "\C-[\C-y" 'insert-buffer) (global-set-key "\e`" 'toggle-read-only) (global-set-key "\C-\\" 'isearch-forward) (global-set-key "\C-s" 'isearch-forward) (global-set-key "\C-q" 'quoted-insert) (global-set-key "\C-h" 'backward-delete-char-untabify) ;(global-set-key "`" 'self-insert-command) ; undo simple.el (global-set-key "\C-c\C-p" 'edit-picture) (global-set-key "\C-cg" 'gnus) (global-set-key "\C-ch" 'gopher) (global-set-key "\C-x\C-i" 'insert-file) (global-set-key "\C-x\C-l" 'goto-line) (global-set-key "\C-x\C-n" 'narrow-to-region) (global-set-key "\C-x\C-u" 'undo) (global-set-key "\C-x," 'unexpand-abbrev) (global-set-key "\C-x!" 'shell) (global-set-key "\C-x_" 'my-underline-line) ; from misc.el (global-set-key "\C-xn" 'other-window) (global-set-key "\C-xd" 'delete-window) (global-set-key "\C-xp" '(lambda () (interactive) (other-window -1))) ;from misc.el (global-set-key "\C-xr" 'rmail) (global-set-key "\C-xs" 'save-buffer) (global-set-key "\C-xw" 'widen) (global-set-key "\C-z\C-b" 'make-backspace-ctrlh) (global-set-key "\C-z\C-r" 're-search-backward) (global-set-key "\C-z\C-s" 're-search-forward) (global-set-key "\C-z\C-e" 'compile) (global-set-key "\C-zs" 'save-some-buffers) (global-set-key "\C-_" 'help-command) (define-key help-map "\C-_" 'help-for-help) (global-set-key "\C-[j" 'fill-paragraph) (global-set-key "\C-[r" 'replace-string) (global-set-key "\C-[s" 'center-line) (global-set-key "\C-[q" 'query-replace) (global-set-key "\C-z\C-p" 'post-linux-digest) (global-set-key "\C-z\C-f" 'file-linux-digest) ;(setq term-file-prefix nil) ; prevent overruling of below (global-set-key "\C-[OA" 'previous-line) (global-set-key "\C-[OB" 'next-line) (global-set-key "\C-[OC" 'forward-char) (global-set-key "\C-[OD" 'backward-char) (global-set-key "\C-[[[A" 'help-command); f1 (global-set-key "\C-[[[B" 'save-buffer) ; f2 (global-set-key "\C-[[[C" 'scroll-other-window-down) ; f3; from misc.el (global-set-key "\C-[[[D" 'scroll-other-window) ; f4 (global-set-key [f1] 'help-command) ; f1 (global-set-key [f2] 'save-buffer) ; f2 (global-set-key [f3] 'scroll-other-window-down) ; f3; from misc.el (global-set-key [f4] 'scroll-other-window) ; f4 (global-set-key "\C-[[[H" 'beginning-of-buffer) (global-set-key "\C-[[[u" 'scroll-down) (global-set-key "\C-[[[t" 'scroll-up) (global-set-key "\C-[[23~" 'backward-kill-word) ; f11 (global-set-key "\C-[[24~" 'kill-word) ; f12 (global-set-key [f11] 'backward-kill-word) ; f11 (global-set-key [f12] 'kill-word) ; f12 (global-set-key "\eOP" 'help-command) ; f1 on MacBook (global-set-key "\eOQ" 'save-buffer) ; f2 on MacBook (global-set-key "\eOR" 'scroll-other-window-down) ; f3; from misc.el (global-set-key "\eOS" 'scroll-other-window) ; f4 (global-set-key "\C-cb" 'remote-file-open) ; filehandler.el (global-set-key "\C-cr" 'remote-file-retrieve) (global-set-key [kp-f1] 'help-command) (define-key help-map [kp-f1] 'help-for-help) (global-set-key [kp-f2] 'save-buffer) (quietly-read-abbrev-file "~/lib/emacs/abbrev_defs") (add-hook 'write-file-hooks 'time-stamp) (setq text-mode-hook '(lambda () (auto-fill-mode 1) (abbrev-mode 1) (setq paragraph-separate (concat paragraph-separate "\\|[^a-zA-Z0-9]*$")) (setq paragraph-start paragraph-separate) (setq outline-regexp "[0-9]+\\.[0-9.]*") ; for numbered sections (setq outline-minor-mode-prefix "") (outline-minor-mode 1) )) (setq TeX-mode-hook '(lambda () (my-LaTeX-mode-hook) (setq my-LaTeX-quote-keys nil))) (autoload 'my-LaTeX-mode-hook "mytex") ; ; Set indentation for DONLab style (add-hook 'c-mode-common-hook ; C/C++/Java '(lambda () (progn (DONc-setup) (setq c-auto-newline nil)))) (autoload 'DONc-setup "DONc") (add-hook 'java-mode-hook ; Java '(lambda () (progn (DONjava-setup) (setq c-auto-newline nil)))) (autoload 'DONjava-setup "DONjava") (add-hook 'perl-mode-hook '(lambda () (progn (DONperl-setup) (setq c-auto-newline nil)))) (autoload 'DONperl-setup "DONperl") ; ; For Gnus ; (setq gnus-select-method '(nntp "lantana.tenet.res.in")) (setq gnus-local-organization "TeNeT Group, Dept of CS&E, I.I.T., Madras") (setq gnus-nntp-server "lantana.tenet.res.in") (display-time) ;; Caution: Assumes $MAILHOST is set only if $MAIL is not mounted locally (if (getenv "MAILHOST") (progn (setq display-time-mail-file (concat homeDir "/.mailstamp")) ; before display-mode's hook, this zeros the mailstamp file (add-hook 'rmail-after-get-new-mail-hook '(lambda () (progn (write-region "" nil display-time-mail-file nil 0)))))) (setq rmail-file-name "~/mail/RMAIL") ; finds file before rmail-mode-hook ;;; (add-hook 'rmail-mode-hook '(lambda () ; (setq rmail-preserve-inbox t) (setq case-fold-search t) (setq rmail-pop-password-required t) (cd "~/") (if (equal buffer-file-name (expand-file-name rmail-file-name)) (setq rmail-inbox-list (list (if (not (or (equal "kuruvi" hostname); NFS mount of $MAIL causes (equal "lantana" hostname) (equal "juniper" hostname))) "po:tag" ; problems, use POP3 (getenv "MAIL"))))) ; set Reply-to: field to user@domainname (setq mail-host-address (substring fullhostname (progn (string-match "\\." fullhostname) (match-end 0)))) (setq mail-default-reply-to (concat (getenv "USER") "@" mail-host-address)) (if (string= mail-default-reply-to "tag@iitm.ernet.in") (progn (setq mail-host-address "tenet.res.in") (setq mail-default-reply-to (concat "tag" "@" mail-host-address)))) (setq rmail-delete-after-output t) (setq rmail-last-rmail-file "~/mail/donlab") ; default for saving msgs (setq rmail-ignored-headers (concat "^via:\\|^mail-from:\\|^origin:" "\\|^lantana-x-mailscanner.*:" "\\|^list-.*:\\|^delivered-to:" "\\|^status:\\|^received:\\|^x400-received:" "\\|^.*message.*id:\\|^summary-line:\\|^.*content.*:" "\\|^x-[^:]*:\\|mime-version:\\|^content-type:" "\\|^received-spf:" "\\|^return-path:\\|^references:")) (setq rmail-output-file-alist '( ("[Dd][Oo][Nn][Ll][Aa][Bb]" . "~/mail/donlab") ("From:.*guardian.co.uk" . "~/mail/guardian") ("[Mm]\\.?[Tt][Ee][Cc][Hh]\\|[Mm]\\.?[Ss]\\|[Pp]\\.?[Hh][Dd]" . "~/mail/pg") ("[Bb]\\.?[Tt][Ee][Cc][Hh]" . "~/mail/ug") ; ("" rmime-cancel) ; for rmime.el (".*" . "~/mail/"))) (my-pgp-setup) (define-key rmail-mode-map "\C-c\C-b" 'mime-base64-decode-save) (define-key rmail-mode-map "\C-c\C-g" 'mail-guardian-archive-index) (define-key rmail-mode-map "i" 'rmail-input-dir) (define-key rmail-mode-map "r" 'rmail-reply-nocc) (define-key rmail-mode-map "v" 'rmime-mode) (define-key rmail-mode-map "D" 'mail-spam-save) (define-key rmail-mode-map "R" 'rmail-reply))) (load-library "etach") (autoload 'mail-spam-save "myrmail") (autoload 'rmail-input-dir "myrmail") (autoload 'rmail-reply-nocc "myrmail") (autoload 'mail-guardian-archive-index "myrmail") ;;; for MIME ;(add-hook 'rmail-show-message-hook 'rmime-format) ;(add-hook 'rmail-edit-mode-hook 'rmime-cancel) ;(autoload 'rmime-format "rmime" "" nil) (autoload 'rmime-mode "rmime" "" t) (setq rmail-summary-mode-hook '(lambda () (define-key rmail-summary-mode-map "\eOA" 'rmail-summary-previous-all) (define-key rmail-summary-mode-map "\eOB" 'rmail-summary-next-all) (define-key rmail-summary-mode-map "D" 'mail-spam-save) (substitute-key-definition 'next-line 'rmail-summary-next-all rmail-summary-mode-map) (substitute-key-definition 'previous-line 'rmail-summary-previous-all rmail-summary-mode-map))) (setq mail-mode-hook '(lambda () (define-key mail-mode-map "\C-c^" 'my-mark-words) ; from misc.el (define-key mail-mode-map "\C-ci" 'mail-put-initials) (define-key mail-mode-map "\C-c\C-a" 'mail-find-alias) (define-key mail-mode-map "\C-c\C-f\C-f" 'my-mail-fcc) (define-key mail-mode-map "\C-c\C-w" 'my-mail-signature) (if (< emacs-major-version 20) (define-key mail-mode-map "\C-cy" 'mail-yank-original-region) (define-key mail-mode-map "\C-cy" 'mail-yank-region)) (setq mail-yank-prefix "> ") (my-pgp-setup) (setq paragraph-start (concat paragraph-start "\\|--text follows this line--$\\|[ -=_.^]*$\\|" mail-yank-prefix "$")) (setq paragraph-separate paragraph-start) (setq mail-default-archive-file-name "~/mail/sent-rmail"))) ; ;(add-hook 'mail-send-hook (setq mail-send-hook '(lambda () (progn (mail-archive-fcc)))) (autoload 'my-mail-fcc "myrmail") (autoload 'mail-archive-fcc "myrmail") (autoload 'mail-put-initials "myrmail") (autoload 'mail-find-alias "myrmail") (autoload 'mail-yank-original-region "myrmail") (autoload 'mime-base64-decode-save "myrmail") ;; for PGP (autoload 'mc-install-write-mode "mailcrypt" nil t) (autoload 'mc-install-read-mode "mailcrypt" nil t) (autoload 'mc-setversion "mc-setversion" nil t) ;(add-hook 'mail-mode-hook 'mc-install-write-mode) ; for writing modes ;(add-hook 'rmail-mode-hook 'mc-install-read-mode) ; for reading modes (defun my-pgp-setup () ; (if (equal "lantana" hostname) ; (mc-setversion "gpg") ; (mc-setversion "5.0")) ; (setq mc-passwd-timeout 600) nil) ; (load-library "filehandler") ;(abbrev-mode 1) (put 'narrow-to-region 'disabled nil) (put 'eval-expression 'disabled nil) (defconst inhibit-startup-message '1 "*Non-nil inhibits the initial startup messages. This is for use in your personal init file, once you are familiar with the contents of the startup message.") (load "myloaddefs") ; constants for isearch ;(server-start) ;;; Commands added by calc-private-autoloads on Wed Sep 22 07:54:07 1993. ;(autoload 'calc-dispatch "calc" "Calculator Options" t) ;(autoload 'full-calc "calc" "Full-screen Calculator" t) ;(autoload 'full-calc-keypad "calc" "Full-screen X Calculator" t) ;(autoload 'calc-eval "calc" "Use Calculator from Lisp") ;(autoload 'defmath "calc" nil t t) ;(autoload 'calc "calc" "Calculator Mode" t) ;(autoload 'quick-calc "calc" "Quick Calculator" t) ;(autoload 'calc-keypad "calc" "X windows Calculator" t) ;(autoload 'calc-embedded "calc" "Use Calc inside any buffer" t) ;(autoload 'calc-embedded-activate "calc" "Activate =>'s in buffer" t) ;(autoload 'calc-grab-region "calc" "Grab region of Calc data" t) ;(autoload 'calc-grab-rectangle "calc" "Grab rectangle of data" t) ;(autoload 'edit-kbd-macro "macedit" "Edit Keyboard Macro" t) ;(autoload 'edit-last-kbd-macro "macedit" "Edit Keyboard Macro" t) ;(autoload 'read-kbd-macro "macedit" "Read Keyboard Macro" t) ;(global-set-key "\e#" 'calc-dispatch) ;;; End of Calc autoloads. ;; For diary ;;;;;;;;;;;;; (diary) ;;;;;;;;;;;;;;;;;;; ; Load desktop last ;;;;;;;;;;;;;;;;;;; ; so su/sudo doesnt use desktop (if (and (equal (getenv "USER") (getenv "LOGNAME")) (not (boundp 'no-desktop-flag))) (progn (load "desktop") (desktop-load-default) (desktop-read) (setq desktop-globals-to-save '(desktop-missing-file-warning search-ring regexp-search-ring register-alist)))) ;;; run local start file, if it exists (let ((local-rc-file (concat homeDir "/.emacs." hostname))) (if (file-exists-p local-rc-file) (load-file local-rc-file)))