my emacs configuration(for Windows)

宦高岑
2023-12-01

(setq transient-mark-mode t)
(set-w32-system-coding-system 'chinese-iso-8bit)

(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.
 '(cua-mode nil)
 '(global-font-lock-mode t nil (font-core))
 '(load-home-init-file t t)
 '(show-paren-mode nil)
 '(tool-bar-mode nil nil (tool-bar))
 '(transient-mark-mode 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.
 '(default ((t (:size "10pt" :family "Tahoma")))))

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

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

(set-default 'case-fold-search t)

;;
;; Below is for syntax highlighting
(cond ((fboundp 'global-font-lock-mode)
       ;; Turn on font-lock in all modes that support it
       (global-font-lock-mode t)
       ;; Maximum colors
       (setq font-lock-maximum-decoration t)))
;;

;; Below is for python-mode
;(setq auto-mode-alist
;      (cons '("//.py$" . python-mode) auto-mode-alist))
;(setq interpreter-mode-alist
;      (cons '("python" . python-mode) interpreter-mode-alist))
;(autoload 'python-mode "python-mode" "Python editing mode." t)
;;

(defun my-c-mode-common-hook ()
  ;; other customizations

  (setq tab-width 4

        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode t)
  ;; we like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state 1)
  ;; keybindings for all supported languages.  We can put these in
  ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
  ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
  (define-key c-mode-base-map "/C-m" 'c-context-line-break)
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;for chinese input under win2k/xp
;;configuration
(create-fontset-from-fontset-spec
"-*-Tahoma-normal-r-*-*-12-*-*-*-c-*-*-*,
;;fontset-most,
      chinese-gb2312:-*-Tahoma-normal-r-*-*-12-*-*-*-c-*-gb2312-*" t)

(setq default-frame-alist
      (append
       '((font . "-*-Tahoma-normal-r-*-*-12-*-*-*-c-*-fontset-most"))
       default-frame-alist))

(set-keyboard-coding-system 'chinese-iso-8bit)
(set-selection-coding-system 'chinese-iso-8bit)
;;end of chinese input configuration

; Key Bindings
;

;
; most of these strange key bindings are from the original Tops-20 Emacs
; my fingers are still wired the old way

;
(setq html-helper-do-write-file-hooks t)
(setq html-helper-build-new-buffer t)
(setq html-helper-address-string "
<a href=/"http://project7/bmerrill/">Brad Merrill</a>
<a href=/"mailto:bmerrill@microsoft.com/">&lt;bmerrill@microsoft.com&gt;</a>
")


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; extension to mode mapping
;
(setq auto-mode-alist
      (append '(
        ("//.s?html?//'" . html-helper-mode)
;;        ("//.asp$" . html-helper-mode)
;;        ("//.as[phm]x$" . html-helper-mode)
        ("//.html$" . html-helper-mode)
        ("//.htm$" . html-helper-mode)
                ("//.md$" . emacs-lisp-mode)
        ("//.txt$" . text-mode)
        ("//.cs$" . csharp-mode)
                   
        ) auto-mode-alist ))


(setq-default compile-command "nmake")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Misc
;
(setq max-specpdl-size 1000)
(setq auto-save-interval 200)
(setq-default case-fold-search t)
(setq-default comment-column 40)
(setq completion-auto-help nil)
(setq enable-recursive-minibuffers t)
(setq-default fill-column 64)
(setq inhibit-startup-message t)
(setq insert-default-directory nil)
(setq-default indent-tabs-mode nil)


(load "font-lock")
(setq font-lock-maximum-decoration t)
(global-font-lock-mode t)

;
; html helper
;
(autoload 'html-helper-mode "html-helper-mode" "HTML Helper Mode" t)

(setq-default compilation-error-regexp-alist
 '(
 ; Microsoft JVC:
 ;sample.java(6,1) : error J0020: Expected 'class' or 'interface'
 ("//(//([a-zA-Z]://)?[^:(/t/n]+//)(//([0-9]+//)[,]//([0-9]+//)) : //(error//|warning//) J[0-9]+:" 1 3 4)

 ; Microsoft C/C++:
 ;  keyboard.c(537) : warning C4005: 'min' : macro redefinition
 ;  d:/tmp/test.c(23) : error C2143: syntax error : missing ';' before 'if'
 ;VC EEi
 ;e:/projects/myce40/tok.h(85) : error C2236: unexpected 'class' '$S1'
 ;myc.cpp(14) : error C3149: 'class System::String' : illegal use of managed type 'String'; did you forget a '*'?
    ("//(//([a-zA-Z]://)?[^:(/t/n]+//)(//([0-9]+//)) /
: //(error//|warning//) C[0-9]+:" 1 3)
 ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;              C# Mode support
;;;
(autoload 'csharp-mode "cc-mode")

(c-add-style "myC#Style"
  '("C#"
  (c-basic-offset . 2)
  (c-comment-only-line-offset . (0 . 0))
  (c-offsets-alist . (
    (c                     . c-lineup-C-comments)
    (inclass           . 0)
    (namespace-open       . +)
    (namespace-close       . +)
    (innamespace       . 0)
    (class-open           . +)
    (class-close       . +)
    (inclass           . 0)
    (defun-open           . +)
    (defun-block-intro     . 0)
    (inline-open       . +)
    (inline-close       . 0)
    (statement-block-intro . 0)
    (statement-cont       . +)
    (brace-list-intro      . +)
    (topmost-intro-cont    . 0)
    (block-open           . +)
    (block-close       . 0)
    (arglist-intro       . +)
;    (arglist-cont       . 0)
    (arglist-close       . 0)
    ))
  ))

(defun my-csharp-mode-hook ()
  (cond (window-system
     (turn-on-font-lock)
     (c-set-style "k&r")
;myC#Style")
     )))
(add-hook 'csharp-mode-hook 'my-csharp-mode-hook)
(setq auto-mode-alist
      (append '(
        ("//.cs$" . csharp-mode)
        ) auto-mode-alist ))

(setq compilation-error-regexp-alist
    (append '(
;C# Compiler
;t.cs(6,18): error SC1006: Name of constructor must match name of class
;
("//(//([a-zA-Z]://)?[^:(/t/n]+//)(//([0-9]+//)[,]//([0-9]+//)): //(error//|warning//) CS[0-9]+:" 1 3 4)
        )
    compilation-error-regexp-alist))

(setq make-backup-files nil)
;;vb mode
;;  (setq any mode-customization variables you want here)
  (autoload 'visual-basic-mode "visual-basic-mode" "Visual Basic mode." t)
  (setq auto-mode-alist (append '(("//.//(frm//|bas//|cls//|vb//)$" .
                                  visual-basic-mode)) auto-mode-alist))

(display-time)
 类似资料:

相关阅读

相关文章

相关问答