`

我的 emacs 配置文件

阅读更多
; Set up nesC syntax highlighting
(autoload 'nesc-mode "nesc.el")
(add-to-list 'auto-mode-alist '("\\.nc\\'" . nesc-mode))

; Delete selected text
(delete-selection-mode t)

; Nice highlighting
(setq-default transient-mark-mode t)
(global-font-lock-mode t)
; Good-looking code
(show-paren-mode 1)
(column-number-mode 1)

; Changes Emacs 21 made that I don't like
(blink-cursor-mode -1)
(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.
 '(blink-cursor-mode nil)
 '(c-basic-offset (quote set-from-style))
 '(column-number-mode t)
;'(cua-mode t)
 '(cua-mode t nil (cua-base))
 '(ecb-options-version "2.32")
 '(inhibit-startup-screen t)
 '(mouse-drag-copy-region nil)
 '(show-paren-mode t)
 '(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.
 )

; no sound
(setq visible-bell t )
; no start picture
;(setq inhibit-startup-message t)

; show title
(setq frame-title-format "emacs@%b")


; emacs window start position and size
(setq default-frame-alist
'((height . 35) (width . 100) (top . 80) (left . 80) (menu-bar-lines . 10) (tool-bar-lines . 10)))


; mouse behavior
(mouse-wheel-mode t)    ;enable Mouse-wheel
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))


;;line number
(add-to-list 'load-path "~/Emacs/")
(require 'display-line-number)
;;line number face
(make-face 'my-display-line-number-face)
(copy-face 'default 'my-display-line-number-face)
(set-face-attribute 'my-display-line-number-face t
		    :foreground "cyan"
		    :background "#3c5473")
(setq display-line-number-face 'my-display-line-number-face)
(setq display-line-number-format "%3d ")
;;display line number for all files
(global-display-line-number-mode 1)
;(add-hook 'c-mode-hook 'display-line-number-mode)
;(add-hook 'cc-mode-hook 'display-line-number-mode)

;(require 'linum)
;(setq linum-face 'my-display-line-number-face)
;(setq linum-format "%3d ")
;(add-hook 'find-file-hooks (lambda () (linum-mode 1)))
;(global-set-key [f6] 'linum-mode)


;; Load CEDET.
;; See cedet/common/cedet.info for configuration details.
(load-file "~/Emacs/cedet-1.0pre6/common/cedet.el")
;; Enable EDE (Project Management) features
;(global-ede-mode 1)

;; Enable EDE for a pre-existing C++ project
;; (ede-cpp-root-project "NAME" :file "~/myproject/Makefile")

;; Enabling Semantic (code-parsing, smart completion) features
;; Select one of the following:

;; * This enables the database and idle reparse engines
(semantic-load-enable-minimum-features)

;; * This enables some tools useful for coding, such as summary mode
;;   imenu support, and the semantic navigator
(semantic-load-enable-code-helpers)

;;short-cut for speedbar
(global-set-key[(f4)] 'speedbar-get-focus)
;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

;; * This enables even more coding tools such as intellisense mode
;;   decoration mode, and stickyfunc mode (plus regular code helpers)
;; (semantic-load-enable-gaudy-code-helpers)

;; * This enables the use of Exuberent ctags if you have it installed.
;;   If you use C++ templates or boost, you should NOT enable it.
;; (semantic-load-enable-all-exuberent-ctags-support)

;; Enable SRecode (Template management) minor-mode.
;; (global-srecode-minor-mode 1)


;; LOAD ecb
(add-to-list 'load-path "~/Emacs/ecb-2.32")
(require 'ecb-autoloads)


;;Color theme
(add-to-list 'load-path "~/Emacs/color-theme-6.6.0/")
(require 'color-theme)
;;initialize color theme
(color-theme-initialize)
;;select a color theme
(color-theme-classic)


;; set tab indent
(setq indent-tabs-mode nil)
(setq default-tab-width 4)
(setq tab-width 4)
(setq tab-stop-list ())
(loop for x downfrom 40 to 1 do
      (setq tab-stop-list (cons (* x 4) tab-stop-list)))

(defconst my-c-style
  '((c-tab-always-indent        . nil)
    (c-comment-only-line-offset . 0)
    (c-hanging-braces-alist     . ((brace-list-open)
								   (brace-entry-open)
				                   (statement-cont)
								   (substatement-open after)
								   (block-close . c-snug-do-while)
								   (extern-lang-open after)
								   (namespace-open after)
								   (module-open after)
								   (composition-open after)
								   (inexpr-class-open after)
								   (inline-open after)
								   (class-open after)
								   (inexpr-class-close before)))
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (inher-intro)
				                   (statement)	
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
                                   empty-defun-braces
                                   defun-close-semi))
    (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
                                   (substatement-open . 0)
				                   (cpp-macro . 0)
                                   (case-label        . 4)
                                   (block-open        . 0)
                                   (knr-argdecl-intro . -)))
    (c-hanging-semi&comma-criteria  
	 . (c-semi&comma-no-newlines-before-nonblanks
		c-semi&comma-no-newlines-for-oneline-inliners 
		c-semi&comma-inside-parenlist))
    (c-echo-syntactic-information-p . t)
    )
  "My C Programming Style")

;; offset customizations not in my-c-style
(setq c-offsets-alist '((member-init-intro . ++)))

;; Customizations for all modes in CC Mode.
(defun my-c-mode-common-hook ()
  ;; add my personal style and set it for the current buffer
  (c-add-style "PERSONAL" my-c-style t)
  ;; other customizations
  (setq tab-width 4
        ;; this will make sure spaces are used instead of tabs
        indent-tabs-mode nil)
  ;; we like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state 1)
  ;; key bindings 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)


;; cancel select copy
(setq x-select-enable-primary nil)


工具的配置和安装, 附件中工具解压,copy到~/Emacs/
nesc.el (从nesc.tar解压出)放到/usr/local/share/emacs/site-lisp/ or
/usr/share/ncc/editor-modes/emacs/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics