;; Breezy : .emacs, v 2.75 2004/03/24 05:49:45 ghoseb Exp $ Modified by ;; Baishampayan Ghose .emacs (GNU Emacs 22.0.5.1) 2005/07/01 ;(setq debug-on-error t) ;; *************************************************************** ;; General display customization ;; *************************************************************** (setq inhibit-startup-message t) (setq additional-paths '("/home/ghoseb" "/home/ghoseb/.emacs-lisp" "/usr/share/emacs/site-lisp")) (setq load-path (append additional-paths load-path)) (setq font-lock-maximum-decoration t) (setq visible-bell t) (setq require-final-newline t) (setq resize-minibuffer-frame t) (setq column-number-mode t) (setq-default transient-mark-mode t) (setq next-line-add-newlines nil) (setq blink-matching-paren nil) (global-font-lock-mode 1 t) (blink-cursor-mode -1) (tool-bar-mode -1) (tooltip-mode -1) ;; ***************************************************************** ;; Emacs IRC Client ;; ***************************************************************** ;(require 'erc) ;; ***************************************************************** ;; Save everything in UTF-8 ;; ***************************************************************** (prefer-coding-system 'utf-8) (set-language-environment 'UTF-8) (set-default-coding-systems 'utf-8) (setq file-name-coding-system 'utf-8) (setq default-buffer-file-coding-system 'utf-8) (setq coding-system-for-write 'utf-8) (set-keyboard-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-clipboard-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (setq default-process-coding-system '(utf-8 . utf-8)) (add-to-list 'auto-coding-alist '("." . utf-8)) ;; ***************************************************************** ;; Don't take any backups ;; ***************************************************************** (setq backup-inhibited t) ;; ******************************* ;; Initialization for template ;; ******************************* (require 'template) (template-initialize) ;; ****************************** ;; Stuff for SVN Mode ;; ****************************** (require 'vc-svn) ;; *************************************************************** ;; My frame setup... ;; *************************************************************** ;(if window-system ; (setq default-frame-alist ; '((cursor-color . "white") ; (cursor-type . box) ; (foreground-color . "white") ; (background-color . "black"))) ; (require 'color-theme) ; (color-theme-greiner)) (setq initial-frame-alist '((top . 26) (left . 465) (width . 85) (height . 65))) (setq frame-title-format "GNU Emacs %f") (setq icon-title-format "%b") ;; *************************************************************** ;; News and mail customizations ;; *************************************************************** ;;general mail account name settings (setq user-mail-address "b.ghose@gnu.org.in") (setq user-full-name "Baishampayan Ghose") ;; *************************************************************** ;; Scrolling Setup ;; *************************************************************** (setq scroll-step 4) ;; *************************************************************** ;; Basic Modes and Editing ;; *************************************************************** (setq default-major-mode 'text-mode) (add-hook 'text-mode-hook 'turn-on-auto-fill) (setq auto-mode-alist (cons '("Wishlist" . text-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("README" . text-mode) auto-mode-alist)) ;; *************************************************************** ;; sh mode for conf files ;; *************************************************************** (setq auto-mode-alist (cons '("\\.conf$" . sh-mode) auto-mode-alist)) ;; *************************************************************** ;; Tab setup ;; *************************************************************** (setq-default tab-width 4 standard-indent 4 indent-tabs-mode nil) ;; *************************************************************** ;; Word Count ;; *************************************************************** (defun wc () "Count the words in the current buffer, show the result in the minibuffer" (interactive) ; *** This is the line that you need to add (save-excursion (save-restriction (widen) (goto-char (point-min)) (let ((count 0)) (while (forward-word 1) (setq count(1+ count))) (message "There are %d words in the buffer" count))))) ;; **************************************************************** ;; Function to turn on Linux C indenting ;; **************************************************************** ;(defun linux-c-mode () ; "C mode with adjusted defaults for use with the Linux kernel." ; (interactive) ; (c-mode) ; (setq c-indent-level 8) ; (setq c-brace-imaginary-offset 0) ; (setq c-brace-offset -8) ; (setq c-argdecl-indent 8) ; (setq c-label-offset -8) ; (setq c-continued-statement-offset 8) ; (setq indent-tabs-mode nil) ; (setq tab-width 8)) ; Remember the -*- linux-c -*- bit, too. ;(setq auto-mode-alist (cons '("~/src/linux.*/.*\\.[ch]$" . linux-c-mode) ; auto-mode-alist)) ;; The above is not required with newer Emacs, ;; the hook below is sufficient. (add-hook 'c-mode-common-hook (lambda () (c-set-style "linux"))) ;; ************************************************************** ;; Auto fill mode ;; ************************************************************** (add-hook 'c-mode-common-hook 'turn-on-auto-fill) (global-set-key (kbd "C-c q") 'auto-fill-mode) ;; *************************************************************** ;; Set number mode ;; *************************************************************** (require 'setnu+) ;; *************************************************************** ;; Setup AUCTex ;; *************************************************************** (require 'tex-site) ;(load "auctex.el" nil t t) (load "preview-latex.el" nil t t) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil) (add-hook 'LaTeX-mode-hook 'turn-on-auto-fill) ;; *************************************************************** ;; Misc Key Mappings ;; *************************************************************** (global-set-key [f1] 'search-forward) (global-set-key [f3] 'search-backward) (global-set-key [f2] 'replace-string) (global-set-key [f4] 'set-justification-full) ;JUSTIFY (global-set-key [f5] 'set-mark-command) ;MARK (global-set-key [f6] 'kill-ring-save) ;COPY (global-set-key [f7] 'yank) ;PASTE (global-set-key [f8] 'kill-region) ;DELETE (global-set-key [f9] 'setnu-mode) ;SETNU (global-set-key [f11] 'wc) ;WORD COUNT (global-set-key [f12] 'save-buffer) ;SAVE ;(global-set-key "\C-cf" 'font-lock-mode) (global-set-key "\C-ca" 'auto-fill-mode) ; 'y' for 'yes', 'n' for 'no' (fset 'yes-or-no-p 'y-or-n-p) (setq query-replace-highlight t) (setq search-highlight t) (global-set-key (kbd "RET") 'newline-and-indent) ;; **************************************************************** ;; line-to-top-of-window extension ;; **************************************************************** ;; Line to top of window (defun line-to-top-of-window() "Move the line point is on to the top of the window" (interactive) (recenter 0)) ;; Bind the function to the [F6] key ;; (global-set-key [f6] 'line-to-top-of-window) ;; **************************************************************** ;; Fill adapt mode ;; **************************************************************** (require 'filladapt) (add-hook 'c-mode-hook 'turn-off-filladapt-mode) ;; **************************************************************** ;; psgml mode ;; **************************************************************** (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) (autoload 'xml-mode "psgml" "Major mode to edit XML files." t) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(add-log-full-name "Baishampayan Ghose") '(add-log-mailing-address "b.ghose@gnu.org.in") '(add-log-time-format (quote add-log-iso8601-time-string)) '(blink-cursor-mode nil) '(column-number-mode t) '(current-language-environment "UTF-8") '(erc-email-userid "ghoseb") '(erc-interpret-mirc-color t) '(erc-user-full-name "Baishampayan Ghose") '(fill-column 72) '(global-font-lock-mode t) '(load-home-init-file t t) '(python-guess-indent t) '(python-honour-comment-indentation t) '(show-paren-mode t) '(transient-mark-mode t)) ;; ****************************************************************** ;; Customized syntax highlighting colors ;; ****************************************************************** (set-default-font "-misc-fixed-medium-r-normal--10-*-*-*-*-*-*-*") (set-foreground-color "#dbdbdb") (set-background-color "#000000") (set-cursor-color "#ff0000") (if (> (display-color-cells) 20) (custom-set-faces '(font-lock-builtin-face ((t (:foreground "deepskyblue")))) '(font-lock-comment-face ((t (:foreground "gray60")))) '(font-lock-doc-face ((t (:foreground "darkkhaki")))) '(font-lock-keyword-face ((t (:foreground "magenta")))) '(font-lock-function-name-face ((t (:foreground "green")))) '(font-lock-string-face ((t (:foreground "red")))) '(font-lock-type-face ((t (:foreground "cyan")))) '(font-lock-variable-name-face ((t (:foreground "yellow")))) '(modeline ((t (:foreground "plum1" :background "navy")))) '(region ((t (:background "sienna")))) '(highlight ((t (:foreground "black" :background "darkseagreen2")))) '(diff-added-face ((t (:foreground "green")))) '(diff-changed-face ((t (:foreground "yellow")))) '(diff-header-face ((t (:foreground "cyan")))) '(diff-hunk-header-face ((t (:foreground "magenta")))) '(diff-removed-face ((t (:foreground "red"))))) ) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(diff-added-face ((t (:foreground "green"))) t) '(diff-changed-face ((t (:foreground "yellow"))) t) '(diff-header-face ((t (:foreground "cyan"))) t) '(diff-hunk-header-face ((t (:foreground "magenta"))) t) '(diff-removed-face ((t (:foreground "red"))) t) '(font-lock-builtin-face ((t (:foreground "deepskyblue")))) '(font-lock-comment-face ((t (:foreground "gray60")))) '(font-lock-doc-face ((t (:foreground "darkkhaki")))) '(font-lock-function-name-face ((t (:foreground "green")))) '(font-lock-keyword-face ((t (:foreground "magenta")))) '(font-lock-string-face ((t (:foreground "red")))) '(font-lock-type-face ((t (:foreground "cyan")))) '(font-lock-variable-name-face ((t (:foreground "yellow")))) '(highlight ((t (:foreground "black" :background "darkseagreen2")))) '(mode-line ((t (:foreground "plum1" :background "navy")))) '(region ((t (:background "sienna")))))