My .Emacs


;color highlighting
(global-font-lock-mode t)
(setq transient-mark-mode t)

;turn off the anoy sound
(setq visible-bell t)

;set line number (does not work)
(setq column-number-mode t)
(setq line-number-mode t)
(setq default-fill-coloum 60)

;set major mode
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;set TAB
(setq indent-tabs-mode t)
(setq tab-width 4)

;do not jump when encounter a parentheses
(show-paren-mode t)
(setq show-paran-style 'parentheses)

;do not jump when scroll
(setq scroll-step 1
      scroll-margin 3
      scroll-conservatively 10000)

;set font
(set-default-font "-*-Courier New-normal-r-*-*-20-*-*-*-c-*-Fontset-gbk")

;set color
;(set-foreground-color "black")
;(set-background-color "gray")
(require 'color-theme)
;(color-theme-initialize)
(setq color-theme-is-global t)
(color-theme-robin-hood)

;set cursor type
;(setq-default cursor-type 'bar)

;set date-time
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)

;change kill-ring
(setq kill-ring-max 50)

(fset 'yes-or-no-p 'y-or-n-p)

(setq kill-whole-line t)

;restor current session when next run
;(require 'session)
;(add-hook 'after-init-hook 'session-initialize)

;-    backup ploicies
(setq make-backup-files nil)
;(setq version-control t)
;(setq keep-old-versions 2)
;(setq keep-new-versions 5)
;(setq delete-old-versions t)
;(setq backup-directory-alist '(("". "~//tmp")))

; maximize the window when start Emacs
(defun w32-restore-frame()
  "Restore a minimized frame"
  (interactive)
  (w32-send-sys-command 61728))

(defun w32-maximize-frame()
  "Maximize the current frame"
  (interactive)
  (w32-send-sys-command 61488))

(w32-maximize-frame)

;bind key
(defun kill-buffer-directly() (interactive)
  (kill-buffer nil))

(global-set-key [f1]   'help)
(global-set-key [f2]   'save-buffer)
(global-set-key [f3]   'find-file)
(global-set-key [f4]   'kill-buffer-directly)
(global-set-key [f5]   'shell)
(global-set-key [S-f5] 'eshell)
(global-set-key [f6]   'other-window)
(global-set-key [f9]   'goto-line)
(global-set-key [f12]  'calendar)

(global-set-key (kbd "C-z") 'undo) ;C-z run "iconify-or-deiconify-frame"

default
(global-set-key (kbd "C-'") 'set-mark-command)
;(global-set-key [(meta ?/)] 'hippie-expand)
(global-set-key (kbd "C-;") 'hippie-expand)

;kill buffer when exit the shell (M-x shell)
(defun wcy-shell-mode-hook-func()
 (set-process-sentinel (get-buffer-process(current-buffer))
   #'wcy-shell-mode-kill-buffer-on-exit)
)

(defun wcy-shell-mode-kill-buffer-on-exit(process state)
  (kill-buffer(current-buffer))
)

(add-hook 'shell-mode-hook 'wcy-shell-mode-hook-func)

;set directory
(setq default-directory "~//PracticalCommonLisp//")

;; SLIME support
;; then you can execute M-x slime to spawn a slime-mode lisp process    

  
(setq inferior-lisp-program "D://clisp-2.41//clisp.exe")
(add-to-list 'load-path "D://emacs-21.3//slime-2.0")
(require 'slime)
(slime-setup)

;; clisp coding support
(load "D://clisp-2.41//emacs//clisp-coding.el")
(load "D://clisp-2.41//emacs//clisp-indent.el")

;; (setq hippie-expand-try-functions-list
;;         '(try-expand-dabbrev
;;           try-expand-dabbrev-visible
;;           try-expand-dabbrev-all-buffers
;;           try-expand-dabbrev-from-kill
;;           try-complete-file-name-partially
;;           try-complete-file-name
;;           try-expand-all-abbrevs
;;           try-expand-list
;;           try-expand-line
;;           try-complete-lisp-symbol-partially
;;           try-complete-lisp-symbol))

;;ruby
;;~/.site-lisp means <EMacs dir>/site-lisp
(add-to-list 'load-path "~/.site-lisp/el")
(require 'pabbrev)

(add-to-list 'load-path "~/.site-lisp/ruby-mode")
(require 'ruby-mode)
(require 'ruby-electric)

(defun ruby-eval-buffer() (interactive)
       "Evaluate the buffer with ruby."
       (shell-command-on-region (point-min) (point-max) "ruby"))

(defun my-ruby-mode-hook ()
  (font-lock-mode t)
  (setq standard-indent 2)
  (pabbrev-mode t)
  (ruby-electric-mode t)
  (define-key ruby-mode-map "C-x/C-e" 'ruby-eval-buffer))

(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)

(setq auto-mode-alist (cons '("//.rb//'" . ruby-mode) auto-mode-alist))

(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)

;run.pl file shortcut
(defun perl-eval-buffer() (interactive)
       "Evaluate the buffer with perl."
       (shell-command-on-region (point-min) (point-max) "perl"))

;cperl-mode
(add-to-list 'auto-mode-alist '("" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
(add-hook 'cperl-mode-hook 'n-cperl-mode-hook t)
(defun n-cperl-mode-hook ()
  (setq cperl-indent-level 4)
  (setq cperl-continued-statement-offset 0)
  (setq cperl-extra-newline-before-brace t)
  (set-face-background 'cperl-array-face "wheat")
  (set-face-background 'cperl-hash-face "wheat")
  (define-key cperl-mode-map "C-x/C-e" 'perl-eval-buffer)
  )
 

(setq initial-frame-alist '((top . 310) (left . 0) (width . 90) (height . 20)))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值