;; -*- coding:big5; -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; * 如果在執行某個外部程式時,Emacs 出現找不到程式的錯誤,那麼你可以調整變數 `exec-path' 的 ;; 值或是在 autoexec.bat 中設定 `path' 環境變數以使得該程式的路徑被包含進來 ;; ;; * 關於 coding system: ;; ;; code: a code stands for a font, the map between codes and fonts is ;; described by a coding system ;; coding system: describe how codes are mapped to fonts ;; display code: draw the corresponding font for the code on screen by a coding system ;; coding: map(convert) emacs-mule code to other code ;; decoding: map(convert) other code to emacs-mule code ;; ;; * 關於 Desktop 的設定 ;; ;; The first time you save the state of the Emacs session, you must do it manually, with ;; the command `M-x desktop-save'(after you have run the command, it will ask you where ;; to save the desktop file). Once you have done that, exiting Emacs will save the state ;; again--not only the present Emacs session, but also subsequent sessions. ;; ;; In order for Emacs to recover the state from a previous session, you must start it ;; with the same current directory as you used when you started the previous ;; session. This is because `desktop-read' looks in the current directory(and then the ;; home directory) for the file to read. This means that you can have separate saved ;; sessions in different directories; the directory in which you start Emacs will ;; control which saved session to use. ;; ;; If you save a desktop file in your home directory it will act as a default desktop ;; when you start Emacs from a directory that doesn't have its own. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;(require 'desktop) ;;(require 'extraserv) (require 'tempbuf) (require 'php-mode) ;; You need to revert the buffer if the buffer is read from the source file before `xcscope' ;; is loaded/required, or cscope may not take effect in that buffer. (require 'xcscope) (load "boshiamy") (load "boshiamy-cue") (load "zhuyin") (load "leim-list") (load "cemacs") ;; Override the incorrect language environment set in 'cemacs.el'. ;; `C-h v language-info-alist' should reveal valid values for function ;; `set-language-environment'. (set-language-environment "UTF-8") ;;;;;;;;;;;;;;;;;;;;;(setq inhibit-startup-screen t) ;; Correct the path in order to make the function `update-file-autoloads' valid. (setq-default source-directory "~/emacs/") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Custom 區塊 ;; ;; 由 `Custom' 所產生的程式碼,這些設定也可以透過 M-x customize-saved 來修改。如果想要移除某 ;; 個設定時,請勿直接從程式碼中移除,應該先執行 M-x customize-saved 然後點選欲刪除的設定項目 ;; 之 [State] 按鈕再選 Erase Customization 刪除 ;; ;; 一些常用的 Custom 命令: ;; ;; `M-x customize-option <RET> OPTION <RET>' ;; Set up a customization buffer with just one option, OPTION. ;; ;; `M-x customize-face <RET> FACE <RET>' ;; Set up a customization buffer with just one face, FACE. ;; ;; `M-x customize-group <RET> GROUP <RET>' ;; Set up a customization buffer with just one group, GROUP. ;; ;; `M-x customize-apropos <RET> REGEXP <RET>' ;; Set up a customization buffer with all the options, faces and ;; groups that match REGEXP. ;; ;; `M-x customize-changed-options <RET> VERSION <RET>' ;; Set up a customization buffer with all the options, faces and ;; groups whose meaning has changed since Emacs version VERSION. ;; ;; `M-x customize-saved' ;; Set up a customization buffer containing all options and faces ;; that you have saved with customization buffers. ;; ;; `M-x customize-customized' ;; Set up a customization buffer containing all options and faces ;; that you have customized but not saved. ;; (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. '(backup-directory-alist (quote (("." . "~/backup")))) '(column-number-mode t) '(default-input-method "boshiamy ") '(delete-selection-mode t nil (delsel)) '(desktop-save-mode nil nil (desktop)) '(ecb-layout-window-sizes (quote (("jl3" (0.6682926829268293 . 0.9821428571428571) (0.14146341463414633 . 0.30357142857142855) (0.2097560975609756 . 0.30357142857142855) (0.35121951219512193 . 0.42857142857142855) (0.35121951219512193 . 0.25)) ("jl2" (0.15609756097560976 . 0.26785714285714285) (0.1951219512195122 . 0.26785714285714285) (0.35121951219512193 . 0.3392857142857143) (0.35121951219512193 . 0.19642857142857142) (0.35121951219512193 . 0.17857142857142858)) ("jl" (0.35121951219512193 . 0.19642857142857142) (0.15609756097560976 . 0.26785714285714285) (0.1951219512195122 . 0.26785714285714285) (0.35121951219512193 . 0.3392857142857143) (0.35121951219512193 . 0.17857142857142858)) ("jj3" (0.22439024390243903 . 0.26785714285714285) (0.22439024390243903 . 0.32142857142857145) (0.22439024390243903 . 0.39285714285714285)) ("jj1" (0.35121951219512193 . 0.21428571428571427) (0.35121951219512193 . 0.125) (0.35121951219512193 . 0.125) (0.35121951219512193 . 0.23214285714285715) (0.35121951219512193 . 0.17857142857142858) (0.35121951219512193 . 0.10714285714285714))))) '(enable-extraserv-log nil) '(eol-mnemonic-dos "(DOS)") '(file-name-coding-system (quote utf-8-unix) t) '(global-font-lock-mode t nil (font-lock)) '(global-hl-line-mode t nil (hl-line)) '(iswitchb-mode t) '(latex-run-command "pdflatex") '(line-number-mode t) '(show-paren-delay 0) '(show-paren-mode t nil (paren)) '(show-paren-style (quote mixed)) '(tex-dvi-view-command "\"C:\\Program Files\\Adobe\\Acrobat 5.0\\Acrobat\\Acrobat.exe\"") '(transient-mark-mode t) '(truncate-lines t) '(truncate-partial-width-windows nil) '(x-select-enable-clipboard t)) (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. ) ;; ;; Custom 區塊 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enable the following commands (put 'downcase-region 'disabled nil) (put 'narrow-to-region 'disabled nil) ;;(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)) ;; ;;(extraserv-start) ;; 下面這段程式可以得到相似的結果 ;; ;; (or (assoc 'font default-frame-alist) ;; (push (cons 'font "fontset-standard") ;; default-frame-alist)) (set-default-font "fontset-standard") ;; (add-hook 'dired-mode-hook 'turn-on-tempbuf-mode) ;; (add-hook 'custom-mode-hook 'turn-on-tempbuf-mode) ;; (add-hook 'w3-mode-hook 'turn-on-tempbuf-mode) ;; (add-hook 'Man-mode-hook 'turn-on-tempbuf-mode) ;; (add-hook 'view-mode-hook 'turn-on-tempbuf-mode) ;; (add-hook 'find-file-hooks 'turn-on-tempbuf-mode) ;; (turn-on-tempbuf-mode) ;;(set-frame-position (selected-frame) ;; (- (x-display-pixel-width) 390) ;; (- (x-display-pixel-height) 430)) ;;(set-frame-size (selected-frame) 40 20) ;;(w32-maximize-frame) ;; * #1 等待 1.5 秒,以便讓 (w32-maximize-frame) 的動作完成 ;; ;; * fill-column 的設定要擺在調整視窗大小之後 ;;(sleep-for 1.5) ; #1 ;;(setq-default auto-fill-function 'do-auto-fill ;; fill-column (- (frame-width) 2)) ;; #1 讓 Emacs 能與 clipboard 正常地交換繁體中文字可以參考 info 文件中的 `Specifying a Coding ;; System' 主題 ;;(set-message-beep 'silent) ;;(set-selection-coding-system 'utf-8-unix) ; #1 (setq-default frame-title-format '((:eval (concat "## GNU Emacs ## -- [" (cond (buffer-file-name buffer-file-name) ((and (boundp 'dired-directory) dired-directory) dired-directory) (t (buffer-name))) "]")))) ;; #1~#3 的目的是加上額外的 info 文件搜尋路徑,其中 #2 的路徑中應該要存放 `Emacs Lisp ;; Reference Manual' 的 info 檔,除此之外我們也將 Cygwin 以及 ELisp manual 這兩個項目加到 ;; Info Directory 中,加入的方法是將以下的文字附加到 <EmacsDir>/info/dir 檔的後面: ;; ;; External documents ;; * Emacs Lisp: (elisp). Emacs Lisp Reference Manual. ;; * Cygwin Info: (c:/PROGRAM FILES/cygwin/usr/info/dir). The Info Directory of ;; ;; 其中 <EmacsDir> 是 Emacs 所在的目錄 (if (not (boundp 'Info-additional-directory-list)) (setq-default Info-additional-directory-list nil)) (setq-default Info-additional-directory-list (append Info-additional-directory-list '("c:/Program Files/emacs-21.2/info/elisp/" "~/cygwin/usr/info/" "~/cygwin/usr/share/info"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; * the list below are some possible situations ;; ;; "\n\n\n" ;; "" ;; "aa" ;; "aa\n" ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun delete-trailing-newline () (interactive) (save-excursion (when (/= (point-min) (point-max)) (goto-char (point-max)) (goto-char (if (search-backward-regexp "[^\n]" (point-min) t 1) (1+ (point)) (point-min))) (delete-char (- (point-max) (point)))))) ;; * any argument's value of this function can be nil (defun normalize-blank (view-tab-width old-tab-width new-tab-width) (interactive) (delete-trailing-whitespace) (delete-trailing-newline) (unless old-tab-width (setq old-tab-width 8)) (setq tab-width old-tab-width) (untabify (point-min) (point-max)) (when new-tab-width (setq tab-width new-tab-width) (tabify (point-min) (point-max))) (when view-tab-width (setq tab-width view-tab-width))) ;; * date and time format: Fri, 13 Dec 1901 20:45:54 (Taiwan) (defun insert-current-date-time (&optional area) (let ((weekday-abbr '((0 . "Sun") (1 . "Mon") (2 . "Tue") (3 . "Wed") (4 . "Thu") (5 . "Fri") (6 . "Sat"))) (month-abbr '((1 . "Jan") (2 . "Feb") (3 . "Mar") (4 . "Apr") (5 . "May") (6 . "Jun") (7 . "Jul") (8 . "Aug") (9 . "Sep") (10 . "Oct") (11 . "Nov") (12 . "Dec"))) (curr-time (decode-time))) (setq area (if area (concat " (" area ")") "")) (insert (cdr (assoc (nth 6 curr-time) weekday-abbr)) (format ", %d " (nth 3 curr-time)) (cdr (assoc (nth 4 curr-time) month-abbr)) (format " %d %02d:%02d:%02d" (nth 5 curr-time) (nth 2 curr-time) (nth 1 curr-time) (nth 0 curr-time)) area))) ;; Enter command `M-x c-set-justin-style' in `c++-mode' to setup my indentation style for C++. (defun c-set-justin-style () (interactive) (c-add-style "justin" '("k&r" (c-basic-offset . 3))) (c-set-style "justin")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; 過時的程式碼 ;; ;;(defun insert-current-date-time (&optional area) ;; (let ((weekday-abbr '(("0" . "Sun") ("1" . "Mon") ("2" . "Tue") ("3" . "Wed") ("4" . "Thu") ("5" . "Fri") ("6" . "Sat"))) ;; (month-abbr '(("01" . "Jan") ("02" . "Feb") ("03" . "Mar") ("04" . "Apr") ("05" . "May") ("06" . "Jun") ("07" . "Jul") ("08" . "Aug") ("09" . "Sep") ("10" . "Oct") ("11" . "Nov") ("12" . "Dec")))) ;; (setq area (if area (concat " (" area ")") "")) ;; (insert (cdr (assoc (format-time-string "%w") weekday-abbr)) ;; (format-time-string ", %e ") ;; (cdr (assoc (format-time-string "%m") month-abbr)) ;; " " ;; (format-time-string "%Y %T") ;; area))) ;; show-paren-delay 的設定要放在 show-paren-mode 之前,否則可能無效 ;;(setq-default show-paren-style 'mixed ;; show-paren-delay 0) ;;(show-paren-mode t) ;;(column-number-mode t) ;;(line-number-mode t) ;;(delete-selection-mode t) ;;(global-font-lock-mode t) ;;(global-hl-line-mode t) ;;(transient-mark-mode t) ;;(setq-default truncate-lines t ;; backup-directory-alist '(("." . "~/backup")) ;; eol-mnemonic-dos "(DOS)") ;;(setq-default frame-title-format ;; '("## GNU Emacs ## -- [" ;; (buffer-file-name "%f" ;; (dired-directory ;; dired-directory ;; "%b")) ;; "]")) ;;(setq-default frame-title-format ;; '("## GNU Emacs ## -- [" ;; (:eval (encode-coding-string (cond (buffer-file-name buffer-file-name) ;; ((and (boundp 'dired-directory) ;; dired-directory) ;; dired-directory) ;; (t (buffer-name))) ;; 'chinese-big5-dos)) ;; "]")) ;; 使這一行生效可以窺得 emacs、extraserv 之間的通訊 ;;(get-buffer-create log-buffer) ;; ;; 過時的程式碼 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (put 'upcase-region 'disabled nil)