我的 emacs 配置文件 (未整理)

类别:编程语言 点击:0 评论:0 推荐:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;  Rokia's .emacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;cygwin
;;  ;; This assumes that Cygwin is installed in C:\cygwin (the
;;  ;; default) and that C:\cygwin\bin is not already in your
;;  ;; Windows Path (it generally should not be).
;;  ;;
  (setq exec-path (cons "d:/cygwin/bin" exec-path))
  (setenv "PATH" (concat "d:\\cygwin\\bin;" (getenv "PATH")))

(setq gnus-group-name-charset-group-alist '((".*" . gb2312)))
;;;;;;gbk
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq w32-charset-info-alist
    (cons '("gbk" w32-charset-gb2312 . 936) w32-charset-info-alist))

;;;;for change default font size.
(create-fontset-from-fontset-spec
"-*-Courier New-normal-r-*-*-12-*-*-*-c-*-fontset-gbk" t)

(load-file "e:/emacs/site-lisp/mule-gbk/chinese-gbk.el")
(load-file "e:/emacs/site-lisp/mule-gbk/fontset-gbk.el")

(set-w32-system-coding-system 'chinese-gbk)
(set-selection-coding-system 'chinese-gbk)
(set-keyboard-coding-system 'chinese-gbk)
(set-language-environment 'chinese-gbk)
(setq locale-coding-system 'chinese-gbk)
(setq current-language-environment "chinese-gbk")

(load-file "../site-lisp/mule-gbk/characters-gbk.el")

;; (setq default-frame-alist
;;  '(
;;     (foreground-color . "Wheat")
;;     (background-color . "DarkSlateGray")
;;     (cursor-color     . "Orchid")
;;    )
;; )

(setq default-frame-alist
      (append
       '((font . "fontset-gbk"))
       default-frame-alist))


;(load "chinese-gbk")
;(set-keyboard-coding-system 'chinese-gbk)

;; (set-w32-system-coding-system 'chinese-iso-8bit)
;; (set-language-environment    'chinese-gbk);Chinese-GB)   ;ÕâÒ»¾ä×îÖØÒª
;; (set-keyboard-coding-system  'chinese-iso-8bit) ;ÊäÈë
;; (set-terminal-coding-system  'chinese-iso-8bit)
;; (set-clipboard-coding-system 'chinese-iso-8bit)
;; (set-selection-coding-system 'chinese-iso-8bit)

;; Õâ¸ö¿ÉÒÔÈÃEmacsÿ´ÎÍ˳ö¶¼±£´æµ±Ç°µÄ״̬
(require 'session)
(add-hook 'after-init-hook 'session-initialize)


;; (setq-default case-fold-search t)
;; (setq-default comment-column 40)
;; (setq-default fill-column 64)

;; (setq max-specpdl-size 1000)
;; (setq auto-save-interval 200)
;; (setq search-highlight t)
;; (setq query-replace-highlight t)
;; (setq enable-recursive-minibuffers t)
;; (setq insert-default-directory nil)
;; (setq bookmark-save-flag 1)

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aspell;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(setq ispell-program-name  "aspell")
;; (setq-default ispell-dictionary  "c:/cygwin/lib/aspell")
;; (setq-default ispell-dictionary  "american")
;; (setq ispell-dictionary  "en-only.rws")
;; (setq ispell-library-directory "c:/cygwin/lib/aspell")
;; (setq-default ispell-local-dictionary "american")
;; (setq ispell-local-dictionary "american")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq visible-bell t)
(setq column-number-mode t)
(setq default-directory  "D:/icitmain/Icit/sw/ICit_App/")
(setq sentence-end "\\([¡££¡£¿]¡ª¡ª\\|[.?!][]\"\')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq adaptive-fill-regexp "[ \t]+\\|[ \t]*\\([0-9]+[\\.¡¢]\\|\\*+\\)[ \t]*\\|[ \t]*\>")
(setq adaptive-fill-first-line-regexp "^\\* *$\\|[ \t]*")

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

(show-paren-mode t)
(setq show-paren-style 'parentheses)

(setq frame-title-format "emacs@%b")
(auto-image-file-mode t)
(global-font-lock-mode t)

(setq version-control t)
(setq kept-new-versions 3)
(setq delete-old-versions t)
(setq kept-old-versions 2)
(setq dired-kept-versions 1)

(line-number-mode t)
(column-number-mode t)


;;goto-last-change
(require 'goto-last-change)
(autoload 'goto-last-change "goto-last-change"
  "Set point to the position of the last change." t)
(global-set-key "\C-x\C-\\" 'goto-last-change)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;°´¼ü°ó¶¨
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key [f3] 'gnus-unplugged);;ÕâÀﶨÒåºó£¬¿ÉÒÔͨ¹ý°´F3¼üÀ´Æô¶¯gnus
(global-set-key "\M-o" 'other-window)
(global-set-key [f4] 'appt-add)
(global-set-key "\C-c\C-g" 'goto-line)
(global-set-key "\C-ci" 'overwrite-mode)
(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)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;Program
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-hook 'c-mode-hook    'imenu-add-menubar-index)
(add-hook 'c++-mode-hook  'imenu-add-menubar-index)
(add-hook 'c-mode-hook         'hs-minor-mode)
(add-hook 'c-mode-hook         (function (lambda()(interactive)
          (c-set-style "bsd"))))
(add-hook 'c++-mode-hook         'hs-minor-mode)
(add-hook 'c++-mode-hook         (function (lambda()(interactive)
          (c-set-style "bsd"))))


;;open related head/cpp file


(defun dd-open-h-cpp (p)
"open related header file or cpp file"
(interactive "p")  
    (setq wholename (buffer-file-name))
      (setq nameext (file-name-extension wholename))
      (if (string= nameext "h")
   (
    (lambda()
      (setq namenew (concat (file-name-sans-extension wholename) ".cpp"))
        ( if(= p 0)
     (find-file namenew)
   (find-file-other-window namenew)
   )
       
      )
    )
      
 )
      (if (string= nameext "cpp")
   (
    (lambda()
      (setq namenew (concat (file-name-sans-extension wholename) ".h"))
        ( if(= p 0)
     (find-file namenew)
   (find-file-other-window namenew)
   )

        )
     
    )
      
 )
)

(global-set-key [(control f7)] (lambda () (interactive) (dd-open-h-cpp 0)))
(global-set-key [(control f6)] (lambda () (interactive) (dd-open-h-cpp 1)))


;;;;;; suffix associate
(setq auto-mode-alist
      (append
       '(("\\.ot" . outline-mode ))
       '(("\\.h" . c++-mode ))             
       auto-mode-alist)

)

 

;;diary
(setq diary-file "~/diary")
(setq mark-diary-entries-in-calendar t)
(setq diary-mail-addr "[email protected]")
(add-hook 'diary-hook 'appt-make-list)
(global-set-key [(control f8)] 'calendar)t 
;;appointment
(setq appt-issue-message t)

 

;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;move line
;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;

(defun my-move-region-up (p)                  ;;ÏòÉÏÒƶ¯±¾ÐÐ
  "move current region up"
  (interactive "p")
  (let ((c (current-column)))
    (beginning-of-line)
    (kill-region )
;    (previous-line p)
 ;   (beginning-of-line)
;    (yank)
;    (previous-line 1)
;    (move-to-column c))

))

(defun my-move-line-up (p)                  ;;ÏòÉÏÒƶ¯±¾ÐÐ
  "move current line up"
  (interactive "p")
  (let ((c (current-column)))
    (beginning-of-line)
    (kill-line 1)
    (previous-line p)
    (beginning-of-line)
    (yank)
    (previous-line 1)
    (move-to-column c)))

(defun my-move-line-down (p)                ;;ÏòÏÂÒƶ¯±¾ÐÐ
  "move current line down"
  (interactive "p")
  (let ((c (current-column)))
    (beginning-of-line)
    (kill-line 1)
    (next-line p)
    (beginning-of-line)
    (yank)
    (previous-line 1)
    (move-to-column c)))
(defun my-dup-line-down ()                  ;;¸´ÖƱ¾Ðе½ÏÂÒ»ÐÐ
  "duplicate this line at next line"
  (interactive)
  (let ((c (current-column)))
    (beginning-of-line)
    (ue-select-line-down)
    (beginning-of-line)
    (yank)
    (previous-line 1)
    (move-to-column c)))

(defvar ue-selection-last-point nil
  "Indicates whether to kill-append or kill-new")
(defvar ue-selection-total-lines 0
  "Total number of lines appended so far to the last item in kill-ring")

(defun ue-selection-update-cont ()
  "Update `ue-selection-last-point' variable"
  (if (and this-command
           (string= (format "%s" this-command)
                    "ue-select-line-down-continued"))
      (setq ue-selection-last-point (point))
    (setq ue-selection-total-lines 0)
    (setq ue-selection-last-point  nil)))

(add-hook 'post-command-hook 'ue-selection-update-cont)

(defun ue-select-line-down-continued ()     ;;Á¬Ðø¸´ÖƶàÐÐ
  "like Shift+down in UltraEdit, but do no selection.
;; Just put these continuous lines all toghether as a new item in kill-ring.
;; Messages will appear in minibuffer telling you how many lines were copied.
;; Continuous commands with no interruption append new lines to the item.
;; Any non-ue-select-line-down-continued command will stop gathering new lines
;; and make a new item in kill-ring.

;; post-command-hook is used in detecting the continuity of this command.
;; check `ue-selection-update-cont' and `post-command-hook'."
  (interactive)
  (let ((s (point)))
    (setq next-line-add-newlines t)
    (next-line 1)
    (setq next-line-add-newlines nil)
    (if (and ue-selection-last-point
             (= (save-excursion
                  (when (> (count-lines (point-min) (point)) 1)
                    (previous-line 1))
                  (point))
                ue-selection-last-point))
        (progn
          (kill-append (buffer-substring s (point)) nil)
          (setq ue-selection-total-lines (1+ ue-selection-total-lines))
          (message (format "%s lines copied" ue-selection-total-lines)))
      (kill-new (buffer-substring s (point)))
      (message "1 line copied")
      ;; some errors will cause post-command-hook deletion
      ;; so add-hook every time after we add the first line
      (add-hook 'post-command-hook 'ue-selection-update-cont)
      (setq ue-selection-total-lines 1))))

(defun ue-select-line-down ()
  "like Shift+down in UltraEdit."
  (interactive)
  (let ((s (point)))
  (setq next-line-add-newlines t)
  (next-line 1)
  (setq next-line-add-newlines nil)
  (kill-new (buffer-substring s (point)))))


;(global-set-key   [C-M-up]        'my-move-region-up)
(global-set-key   [C-S-up]        'my-move-line-up)
(global-set-key   [C-S-down]      'my-move-line-down)
(global-set-key   [C-M-down]      'my-dup-line-down)
(global-set-key   [S-down]        'ue-select-line-down-continued)

(global-set-key [C-M-left] (function (lambda()(interactive)
           (enlarge-window 10))))
(global-set-key [C-M-right] (function (lambda()(interactive)
           (enlarge-window-horizontally 10))))


;;; gnuserv
;;   (load "gnuserv")
;;   (gnuserv-start)

 

 

(defun my-retate-windows ()
  (interactive)
  (if (= (count-windows) 2)
      (let* ((wl    (window-list))
             (w1    (frame-first-window))
             (w2    (if (equal w1 (car wl)) (cadr wl) (car wl)))
             (b1    (window-buffer w1))
             (b2    (window-buffer w2))
             (first (if (equal (current-buffer) b1) t nil)))
        (if (= (window-width) (frame-width))
            (split-window-horizontally)
          (split-window-vertically))
        (other-window 2)
        (delete-window)
        (switch-to-buffer b1)
        (other-window 1)
        (switch-to-buffer b2)
        (when first (other-window 1)))
    (message "There are not exactly 2 windows.")))
(global-set-key [(control f5)] 'my-retate-windows)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;; End of file!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;dired
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(put 'dired-find-alternate-file 'disabled nil)


  (require 'dired)
  (require 'dired-x)
  ;; C-x C-j                 Ìøתµ½µ±Ç°ÎļþËùÔÚĿ¼µÄ dired »º³å[x]
  (global-set-key "\C-x\C-j" 'dired-jump)
;;   (define-key dired-mode-map "b" 'dired-mark-extension)
;;   (define-key dired-mode-map "c" 'dired-up-directory)
;;   (define-key dired-mode-map "e" 'dired-mark-files-containing-regexp)
     (define-key dired-mode-map "E" 'chunyu-dired-open-explorer)
;;   (define-key dired-mode-map "r" 'dired-mark-files-regexp)
;;   (define-key dired-mode-map "/" 'dired-mark-directories)
;;   (define-key dired-mode-map "K" 'dired-kill-subdir)
;;   (define-key dired-mode-map [(control ?/)] 'dired-undo)

  (defun chunyu-dired-open-explorer ()
    (interactive)
    (let ((file-name (dired-get-file-for-visit)))
      (if (file-exists-p file-name)
          (w32-shell-execute "open" file-name nil 1))))

  (setq dired-listing-switches "-avl" ;; ls ÎļþÁбí²ÎÊý
        dired-recursive-copies 'top   ;; ¸´ÖÆĿ¼ʱ£¬µÝ¹é¸´ÖÆËùÓÐ×ÖĿ¼
        dired-recursive-deletes 'top  ;; ɾ³ýĿ¼ʱ£¬µÝ¹éɾ³ýËùÓÐ×ÖĿ¼
        cvs-dired-use-hook 'always)
   ;; ä¯ÀÀ CVS ʱ£¬×Ô¶¯´ò¿ª pcl-cvs ½çÃæ
     (add-hook 'dired-load-hook
               (lambda ()
                 (load "dired-x")
                 ;; Set dired-x global variables here.  For example:
                 ;; (setq dired-guess-shell-gnutar "gtar")
                 ;; (setq dired-x-hands-off-my-keys nil)
                 ))
     (add-hook 'dired-mode-hook
               (lambda ()
                 ;; Set dired-x buffer-local variables here.  For example:
                 ;; (dired-omit-mode 1)
                 ))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;dired
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;dired end

;;;;;;;scroll screen with cursor being fixed.

;; (defun my-scroll-screen-down (&optional line)
;;   "Scroll the screen down by one (or more) line"
;;   (interactive "p")
;; ; (when (not (memq last-command '(my-scroll-screen-down my-scroll-screen-up)))
;;   (when (string= "d" "d")
;;    (setq temporary-goal-column
;;           (mod (current-column) (if truncate-lines (screen-width) (window-width)
;;   (scroll-up line)
;;   (vertical-motion line)
;;   (forward-char
;;    (if (< (- (line-end-position) (point)) temporary-goal-column)
;;        (- (line-end-position) (point))
;;      temporary-goal-column)))))))

;; (defun my-scroll-screen-up (&optional line)
;;   "Scroll the scroll up by one line"
;;   (interactive "p")
;;   (my-scroll-screen-down (- 0 line)))

;ÔÚ¿´infoʱ°ó¶¨µ½jºÍk
;; Info-mode j k scroll screen

  (global-set-key [(control &)] (function (lambda() (interactive) (scroll-down 1))))
  (global-set-key [(control *)] (function (lambda() (interactive) (scroll-up 1))))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;global && shell
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; ;;cygwin
;;  ;; This assumes that Cygwin is installed in C:\cygwin (the
;;  ;; default) and that C:\cygwin\bin is not already in your
;;  ;; Windows Path (it generally should not be).
;;  ;;
  (setq exec-path (cons "C:/cygwin/bin" exec-path))
  (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH")))
;;  ;;
;;  ;; NT-emacs assumes a Windows command shell, which you change
;;  ;; here.
;;  ;;
  (setq process-coding-system-alist '(("bash" . undecided-unix)))
  (setq shell-file-name "bash")
  (setenv "SHELL" shell-file-name)
  (setq explicit-shell-file-name shell-file-name)
;;  ;;
;;  ;; This removes unsightly ^M characters that would otherwise
;;  ;; appear in the output of java applications.
;;  ;;
  (add-hook 'comint-output-filter-functions
            'comint-strip-ctrl-m)

(setq tramp-default-method "ftp")
(menu-bar-mode -1)
(tool-bar-mode -1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;edit enhance
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;goto-last-change
(require 'goto-last-change)
(autoload 'goto-last-change "goto-last-change"
  "Set point to the position of the last change." t)
(global-set-key "\C-x\C-\\" 'goto-last-change)

(defun my-switch-buffer ()
   "Like switch-buffer but in the opposite direction"
    (interactive "")
    (other-window -1)
)

(set-language-environment    'Chinese-GB)
(set-keyboard-coding-system 'chinese-iso-8bit)
(set-selection-coding-system 'chinese-iso-8bit)
(global-font-lock-mode t)
;(transient-mark-mode nil)
( auto-revert-mode t)

;;ÉèÖþä×Ó½áβ
(setq sentence-end "\\(\\.\\|¡£\\|\\?\\)")

;;ÔÚ±êÌâÀ¸ÏÔʾbufferµÄÃû×Ö£¬¶ø²»ÊÇ [email protected] ÕâÑùûÓõÄÌáʾ¡£
(setq frame-title-format "emacs@%b")

;;Èà Emacs ¿ÉÒÔÖ±½Ó´ò¿ªºÍÏÔʾͼƬ¡£
(auto-image-file-mode)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;Program
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-hook 'c-mode-hook    'imenu-add-menubar-index)
(add-hook 'c++-mode-hook  'imenu-add-menubar-index)
(setq compilation-scroll-output t)

;; (add-to-list 'load-path "C:/emacs/site-lisp/semantic-1.4.4")
;; (setq semantic-load-turn-everything-on t)
;; (require 'semantic-load)

; Visual C++ Debug:
;(setq compile-command '("nmake /f .mak" . 10))
;(setq compile-command '("nmake /f .mak" . 10))
;Visual C++ Release:
;(setq compile-command '("nmake -f .mak CFG=\"MyProject - Win32 Release\"" . 10))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;Dired Mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(put 'dired-find-alternate-file 'disabled nil)
;;Windows ÉÏÓÃÏà¹ØÁªµÄ³ÌÐò´ò¿ªÎļþ
  (eval-after-load "dired"
    '(progn
       ;; Dired Ô­À´µÄ ¡°o¡± ¶ÔÎÒÀ´Ëµ»ù±¾Ã»Óá£
       (define-key dired-mode-map "o" 'chunyu-dired-open-explorer)))

  (defun chunyu-dired-open-explorer ()
    (interactive)
    (let ((file-name (dired-get-file-for-visit)))
      (if (file-exists-p file-name)
          (w32-shell-execute "open" file-name nil 1))))

;  ͬʱ´ò¿ªËùÓÐ×ö±ê¼ÇµÄÎļþ£º
  (defun dired-execute-file (&optional arg)
    (interactive "P")
    (mapcar #'(lambda (file) (w32-shell-execute "open" file))
            (dired-get-marked-files nil arg)))

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;folding-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(load-library  "folding")
(declare (special fold-fold-on-startup
    fold-keys-already-setup
    ))
   
(setq fold-fold-on-startup t)
(folding-mode-add-find-file-hook)

(setq fold-keys-already-setup nil)
(add-hook 'folding-mode-hook
   (function (lambda()
        (unless fold-keys-already-setup
   (setq fold-keys-already-setup t)
   (define-prefix-command 'ctl-f-folding-mode-prefix)
   (define-key 'ctl-f-folding-mode-prefix "f" 'fold-fold-region)
   (define-key  'ctl-f-folding-mode-prefix "e" 'fold-enter)
   (define-key 'ctl-f-folding-mode-prefix "x" 'fold-exit)
   (define-key  'ctl-f-folding-mode-prefix "b" 'fold-whole-buffer)
   (define-key 'ctl-f-folding-mode-prefix "o" 'fold-open-buffer)
   (define-key 'ctl-f-folding-mode-prefix "h" 'fold-hide)
   (define-key 'ctl-f-folding-mode-prefix "s" 'fold-show)
   (define-key 'ctl-f-folding-mode-prefix "t" 'fold-top-level)
   (define-key 'ctl-f-folding-mode-prefix "f" 'fold-fold-region)
   )
        (local-set-key "\C-f" 'ctl-f-folding-mode-prefix))))

(fold-add-to-marks-list 'sgml-mode
   "<!-- {"
    "<!-- } -->" " --> ")
(fold-add-to-marks-list 'c-mode "/* <" "/* > */" "*/")
(fold-add-to-marks-list 'c++-mode
   "//<" "//>" "")
(fold-add-to-marks-list 'LaTeX-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'latex2e-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'latex-mode "%%%% {{{" "%%%% }}}" " ")
(fold-add-to-marks-list 'BibTeX-mode "%%% {{{" "%%% }}}" " ")
(fold-add-to-marks-list 'lisp-mode ";;; {" ";;; }" "")
(fold-add-to-marks-list 'lex-mode" /* {{{ " " /* }}} */ " "*/")
(fold-add-to-marks-list 'html-mode "<!-- { " "<!-- } -->" "-->")
(fold-add-to-marks-list 'shell-script-mode "# {{{" "# }}}" nil)
(fold-add-to-marks-list 'sh-mode "# {{{ " "# }}}" nil)


(autoload 'folding-mode "folding"
 "Minor mode that simulates a folding editor" t)

 (defun folding-mode-find-file-hook ()
   "One of the hooks called whenever a `find-file' is successful."
   (and (assq 'folded-file (buffer-local-variables))
        folded-file
        (folding-mode 1)
        (kill-local-variable 'folded-file)))
(require 'folding)


;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;;;;;;;;;;;;;;;;;;;gnus
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; (add-to-list 'load-path "c:/emacs/site-lisp/gnus-5.10.6/lisp")
;; (setq gnus-group-name-charset-group-alist '((".*" . gb2312)))
;; (require 'info)
;; (setq Info-default-directory-list
;;       (cons "c:/emacs/site-lisp/gnus-5.10.6/texi" Info-default-directory-list))

;; ;; (require 'gnus-load)
;; ;; (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.
;; ;;  '(canlock-password "f596c5b174e1700a189a83b4299fceb848a98c00"))
;; ;; (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.
;; ;;  )

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;interface
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;Daily Life
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


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

;;todo
(setq todo-file-do "~/todo/do")
(setq todo-file-done "~/todo/done")
(setq todo-file-top "~/todo/top")

;;diary
(setq diary-file "~/diary")
(setq mark-diary-entries-in-calendar t)
(setq diary-mail-addr "[email protected]")
(add-hook 'diary-hook 'appt-make-list)
(global-set-key [(control f8)] 'calendar)t 
(global-set-key [(control f9)] 'calculator)
(global-set-key [(control f4)] 'ffap)
(global-set-key "\C-c\C-v"        (function (lambda()(interactive)
          (scroll-up 1))))
(global-set-key "\C-c\C-c"        (function (lambda()(interactive)
          (scroll-down 1))))
;;appointment
(setq appt-issue-message t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wiki;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;;wiki
(load "emacs-wiki")

(require 'emacs-wiki)

(add-hook 'emacs-wiki-mode-hook
      (lambda ()
        (define-key emacs-wiki-mode-map (kbd "C-c C-h") 'emacs-wiki-preview-html)
        (define-key emacs-wiki-mode-map (kbd "C-c C-c") 'emacs-wiki-preview-source)
        (define-key emacs-wiki-mode-map (kbd "C-c C-v") 'emacs-wiki-change-project)

))

;; (setq emacs-wiki-grep-command "glimpse -nyi "%W"")

(setq emacs-wiki-publishing-directory "publish")

(setq emacs-wiki-directories '("~/WiKi"))
(setq emacs-wiki-meta-charset "gb2312")
(setq emacs-wiki-style-sheet      "")

(setq emacs-wiki-inline-relative-to 'emacs-wiki-publishing-directory)

(defun emacs-wiki-preview-source ()
  (interactive)
  (emacs-wiki-publish-this-page)
  (find-file (emacs-wiki-published-file)))

(defun emacs-wiki-preview-html ()
  (interactive)
  (emacs-wiki-publish-this-page)
  (browse-url (emacs-wiki-published-file)))

(setq emacs-wiki-projects
      `(("default" . ((emacs-wiki-directories . ("~/WiKi"))))
        ("work" . ((fill-column . 65)
                (emacs-wiki-directories . ("~/workwiki/"))))))

;; (setq emacs-wiki-projects
;;       `(("default" . ((emacs-wiki-directories . ("~/WiKi"))))
;;         ("work" . ((fill-column . 65)
;;                 (emacs-wiki-directories . ("~/workwiki/"))))))

 

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;

本文地址:http://com.8s8s.com/it/it23581.htm