;;; -*- mode: emacs-lisp; mode:font-lock; coding: gb2312 -*- ;;; common.el ;; ~/Emacs/configurations/common.el ;; made by Haiyong Zheng AT http://www.flyzhy.org ; ;; Set up the Emacs own function ;; ; ;;; inhibit the startup message (setq inhibit-startup-message t) ; ;;; set up Chinese environment (set-language-environment 'Chinese-GB) (set-keyboard-coding-system 'cn-gb) (set-clipboard-coding-system 'cn-gb) (set-terminal-coding-system 'cn-gb) (set-buffer-file-coding-system 'cn-gb) (set-selection-coding-system 'ctext) (modify-coding-system-alist 'process "*" 'cn-gb) (setq default-process-coding-system '(cn-gb . cn-gb)) (setq-default pathname-coding-system 'cn-gb) ; ;;; set up sentence-end to recognize Chinese punctuationg ;; so that you have no need to insert two spaces after Chinese period (setq sentence-end "\\([¡££¡£¿]\\|¡­¡­\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*") (setq sentence-end-double-space nil) ; ;;; display the buffer name on the titlebar (setq frame-title-format "emacs@%b") ; ;;; set up text-mode to be the default major mode ;; but not the ugly fundamental-mode (setq default-major-mode 'text-mode) ; ;;; syntax highlight (global-font-lock-mode t) ; ;;; no visual feedback on selection (setq-default transient-mark-mode nil) ; ;;; no end a file with newline (setq require-final-newline nil) ;; Stop at the end of the file, not just add lines (setq next-line-add-newlines nil) ; ;;; enable wheelmouse support by default ;(cond (window-system (mwheel-install))) ; ;;; set up the parentheses matching (show-paren-mode t) (setq show-paren-style 'parentheses) ; ;;; display the chosen area (transient-mark-mode t) ; ;;; display the column number (setq column-number-mode t) ; ;;; set fill-column to be 60 (setq default-fill-column 60) ; ;;; display images automatically (auto-image-file-mode t) ; ;;; set kill-ring-max to be 200 to avoid delete something important (setq kill-ring-max 200) ; ;;; display the compressed file automatically (auto-compression-mode t) ; ;;; substitute the yes/no to y/n (fset 'yes-or-no-p 'y-or-n-p) ; ;;; inhibit beep (set-default 'visible-bell t) ; ;;; inhibit blink in console (setq ring-bell-function (lambda () t)) ; ;;; set default saved variables number to be 5000 (set-default 'max-specpdl-size 5000) ; ;;; set the syntax highlight mode to be executed in necessary situation ;; in order to speed up the file scrolling (set-default 'lazy-lock-defer-on-scrolling 't) ; ;;; set up the display format of time (setq display-time-day-and-date t) (setq display-time-format "%m/%d %H:%M") (setq display-time-24hr-format t) (display-time) ; ;;; set up the time stamp of the last modified files (add-hook 'write-file-hooks 'time-stamp) (setq time-stamp-format "%:u %02m/%02d/%04y %02H:%02M:%02S (%s)") ; ;;; set up the convert between CJK and UTF (when (boundp 'utf-translate-cjk) (setq utf-translate-cjk t) (custom-set-variables '(utf-translate-cjk t))) (if (fboundp 'utf-translate-cjk-mode) (utf-translate-cjk-mode 1)) (put 'narrow-to-page 'disabled nil) ; ;;; set up toolbar and menubar ;; toolbar (setq tool-bar-mode t); ;; no menubar (setq menu-bar-mode nil); ; ;;; use clipboard (setq x-select-enable-clipboard t) ; ;;; let dired can copy and delete directories recursively (setq dired-recursive-copies 'top) (setq dired-recursive-deletes 'top) ; ;;; hippie-expand ;; M-/ (global-set-key [(meta ?/)] 'hippie-expand) (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)) ; ;;; ask for y or n before killing emacs ;(setq confirm-kill-emacs 'yes-or-no-p) (setq confirm-kill-emacs 'y-or-n-p)