我的 .emacs 文件

(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.
 '(case-fold-search t)
 '(current-language-environment "UTF-8")
 '(default-input-method "rfc1345")
 '(global-font-lock-mode t nil (font-lock))
 '(tool-bar-mode nil))
(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.
 )

(add-to-list 'load-path    "~/lib/emacs-rails")
(add-to-list 'load-path    "~/lib/emacs")
(add-to-list 'load-path    "~/lib/emacs/yaml-mode")
(add-to-list 'load-path    "~/lib/emacs/color-theme-6.6.0/")

;;(require 'cedet)

;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
;;To startup quickly
;; Select one of the following
;;(semantic-load-enable-code-helpers)
;; (semantic-load-enable-guady-code-helpers)
;; (semantic-load-enable-excessive-code-helpers)

;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)

;;To startup quickly
;;(require 'ecb-autoloads)

;;(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(setq auto-mode-alist  (cons '("\\.rjs$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '("\\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '("\\.rhtml$" . nxml-mode) auto-mode-alist))

(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)

(require 'snippet)
(require 'rails)

(defun try-complete-abbrev (old)
   (if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
      '(try-complete-abbrev
    try-complete-file-name
    try-expand-dabbrev))

(add-hook 'ruby-mode-hook
          (lambda()
            (add-hook 'local-write-file-hooks
                      '(lambda()
                         (save-excursion
                           (untabify (point-min) (point-max))
                           (delete-trailing-whitespace)
                           )))
            (set (make-local-variable 'indent-tabs-mode) 'nil)
            (set (make-local-variable 'tab-width) 2)
            (imenu-add-to-menubar "IMENU")
            (require 'ruby-electric)
            (ruby-electric-mode t)
            (local-set-key "\t" 'hippie-expand)
            ))

(add-hook 'nxml-mode-hook
          (lambda ()
            (setq local-abbrev-table nxml-mode-abbrev-table)))
;;;; Some personal setting

(global-set-key "\M-q" 'nxml-complete)

;;(add-hook 'ruby-mode-hook
;;        (lambda ()
;;          (local-set-key "\M-e" 'hippie-expand)))

;;(local-set-key "\M-left" 'ecb-nav-goto-previous)
(global-set-key (quote [M-right]) 'ecb-nav-goto-next)
(global-set-key (quote [M-left]) 'ecb-nav-goto-previous)

;; Setup for buffer switch
(global-set-key "\C-x\C-b" 'bs-show)    ;; or another key
(global-set-key "\M-p"  'bs-cycle-previous)
(global-set-key "\M-n"  'bs-cycle-next)
;; End of setup for buffer switch

;; tabbar.el

;; Setup for tabbar
(require 'tabbar)
(tabbar-mode)
(global-set-key (quote [C-S-down]) 'tabbar-backward-group)
(global-set-key (quote [C-S-up]) 'tabbar-forward-group)
(global-set-key (quote [C-S-left]) 'tabbar-backward)
(global-set-key (quote [C-S-right]) 'tabbar-forward)
;; end of setup for tabbar

(setq x-select-enable-clipboard t)

(setq visible-bell t)

(setq default-directory "~/project/rforum")

(setq make-backup-files nil)

(mouse-avoidance-mode 'animate)

(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))


(set-default-font "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso10646-1" )

;;(set-default-font "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso10646-1" )

;;disable welcome screen
(setq inhibit-startup-message t)

(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; set color

(require 'color-theme)
(color-theme-initialize)
(color-theme-gnome2)
;;(color-theme-dark-blue)


;; for yaml

(require 'yaml-mode)

(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(add-hook 'yaml-mode-hook
          '(lambda ()
             (define-key yaml-mode-map "\C-m" 'newline-and-indent)))

;; for javascript

(autoload 'javascript-mode "javascript" nil t)
(add-to-list 'auto-mode-alist '( "\\.js\\'" . javascript-mode))

你可能感兴趣的:(JavaScript,XP,Ruby,Rails,emacs)