Paste number 4185: My .emacs

Paste number 4185: My .emacs
Pasted by: GnuVince
When:12 years, 3 months ago
Share:Tweet this! |
Paste contents:
Raw Source | XML | Display As
;; Vince's .emacs file
;; Vincent Foley-Bourgon (
;; Started on: 2001/10/13
;; Last updated: 2004/02/01

(add-to-list 'load-path "~/elisp")

;; Mouse wheel
(autoload 'mwheel-install "mwheel" "Enable wheel mouse")

;; Server mode, so clients can connect

;; Viper-mode
(setq viper-mode t)
(require 'viper)
(setq cw/python-mode-viper-modifier-map (make-sparse-keymap)) 
(define-key cw/python-mode-viper-modifier-map 
    (kbd "<backspace>") 'py-electric-backspace) 
 'python-mode 'insert-state cw/python-mode-viper-modifier-map)

(define-key viper-insert-global-user-map "\C-h" 'help)
(define-key viper-vi-global-user-map "\C-h" 'help)

;; Accents
(iso-accents-mode t)
(require 'iso-insert)
(standard-display-european 1)
(set-input-mode nil nil 1)

;; No backup files (file~)
(setq make-backup-files nil)
;(setq auto-save-visited-file-name t)

;; Syntax highlighting, visible marking, no cursor blinking and no tooltips!
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
(setq transient-mark-mode t)
(blink-cursor-mode nil)
(tooltip-mode nil)

;; Pc mode selection (yeah I know it's not Emacs-like, but I don't care)
;(load-library "pc-mode")


;; Remove the annoying tool bar and the menubar
(if (string-match "21." emacs-version)
    (tool-bar-mode -1))
;(menu-bar-mode -1)

;; Line an column numbers
(line-number-mode t)
(column-number-mode t)

;; Smooth scrolling
(setq scroll-step 1)

;; Always answer 'y' or 'n'
(fset 'yes-or-no-p 'y-or-n-p)

;; Match parentheses
(show-paren-mode 1)

;; Remapping
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
(global-set-key [delete] 'delete-char)
(global-set-key "\M-g" 'goto-line)
(global-set-key "\C-s" 'isearch-forward-regexp)
(global-set-key "\C-r" 'isearch-backward-regexp)
(global-set-key "\C-xw" 'compare-windows)
(global-set-key [(control =)] 'other-window)
(global-set-key "\C-p" 'dabbrev-expand)
(global-set-key [(control right)] 'forward-word)
(global-set-key [(control left)] 'backward-word)
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key [(control x) (control j)] 'lj-compose)

;; Display time (what is this comment for anyway?)

;; Do not add lines to the buffer when we press down at the bottom of the file
(setq next-line-add-newlines nil)

;; Emacs colors
(set-background-color "black")
(set-foreground-color "white")
(set-cursor-color "cyan")

;; Load emacs-lisp-mode when loading a xxx.emacs file
(add-to-list 'auto-mode-alist '("\\.emacs" . emacs-lisp-mode))

;; Load the Python major mode
(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)
(autoload 'python-mode "python-mode" "Python editing mode." t)

(defun py-backspace ()
  (local-set-key [backspace] 'py-electric-backspace))

(defun run-external ()
  (shell-command (concat "python " (buffer-name))))

(add-hook 'python-mode-hook '(lambda ()
          (local-set-key "\C-c\C-z" 'run-external)))

;; End Python mode

;; Load the O'Caml mode (tuareg)
(setq auto-mode-alist (cons '("\\.ml\\w?" . tuareg-mode) auto-mode-alist))
(autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
(add-hook 'tuareg-mode-hook
          '(lambda ()
            (local-set-key "\C-m" 'newline-and-indent)))

;; Ruby mode
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(add-to-list 'auto-mode-alist '("\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(defun ruby-indent ()
  (local-set-key "\C-m" 'ruby-reindent-then-newline-and-indent))
(add-hook 'ruby-mode-hook 'ruby-indent)

;; eRuby
(setq mmm-global-mode 'maybe)
(setq mmm-submode-decoration-level 2)
	:submode ruby-mode
 	:front "<%"
 	:back "%>")))

 (add-hook 'html-helper-mode-hook
 		  '(lambda ()
 			 (setq mmm-classes '(eruby))
 			  'mmm-default-submode-face "gray28")

(add-to-list 'auto-mode-alist '("\\.rhtml$" . html-helper-mode))
(add-to-list 'mmm-mode-ext-classes-alist '(html-helper-mode "\\.rhtml$" eruby))

;; My own cc-mode indenting scheme
(defun add-my-style ()
  (add-to-list 'c-style-alist
                 (c-basic-offset . 4)
                 (c-comment-only-line-offset . 0)
                 (c-offsets-alist . ((statement-block-intro . +)
                                     (knr-argdecl-intro . 0)
                                     (substatement-open . 0)
                                     (label . 0)
                                     (inline-open . 0)
                                     (statement-cont . +))))))

;; PHP mode
(autoload 'php-mode "php-mode" "Major mode for editing PHP code" t)
(add-to-list 'auto-mode-alist '("\\.php" . php-mode))
(add-hook 'php-mode-hook
          '(lambda ()
            (local-set-key "\C-m" 'newline-and-indent)
            (c-set-style "vince")))

;; Java mode
(add-to-list 'auto-mode-alist '("\\.java" . java-mode))
(add-hook 'java-mode-hook
          '(lambda ()
            (load-file "~/emacs/java.emacs")))


;; Lisp stuff
(add-to-list 'load-path "/home/vince/elisp/slime/")
(require 'slime)
(setq inferior-lisp-program "/usr/bin/sbcl")
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))

;; C-Sharp mode (Remember to remove this when cc-mode has C# support)
(add-hook 'csharp-mode-hook
          '(lambda ()
            (setq c-basic-offset 4)))

;; Default mode: Text. And add the auto-fill hook
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

(add-hook 'kill-emacs-hook (lambda ()
          (mapcar (lambda (buf)
                    (with-current-buffer buf
                     (delete-auto-save-file-if-necessary t)))

;; LiveJournal
(require 'ljupdate)
(add-hook 'lj-update-mode-hook
		  '(lambda ()
			 (load-file "~/elisp/lj.el")))
;; End of the LiveJournal things

;; Tabs are 4 spaces wide
;(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)

(put 'narrow-to-region 'disabled nil)
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(ecb-options-version "2.21"))
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.