我的emacs配置

 有点乱,有空整理一下

;; Red Hat Linux default .emacs initialization file  ; -*- mode: emacs-lisp -*-

;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)


;; turn on font-lock mode
(global-font-lock-mode t)

;; set bookmard default file
(setq bookmark-default-file "~/.emacs.d/.emacs.bmk")

;;change title
(setq frame-title-format "%b@SMILE")
;; enable visual feedback on selections
(setq-default transient-mark-mode t)

;; always end a file with a newline
(setq require-final-newline t)

;; stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)

;; display column-number
(setq column-number-mode t)
(setq line-number-mode t)
;; active C-x < and C-x >
(put 'scroll-left 'disabled nil)

;;
(show-paren-mode 1)

;;------------------------------------------------------
;;set cursor color white
(set-cursor-color "white")
;;set mouse color white
(set-mouse-color "white")

;;------------------------------------------------------
;;  use color theme
(add-to-list 'load-path "/usr/share/emacs/site-lisp/color-theme-6.6.0")
(require 'color-theme)
(color-theme-initialize)
;(color-theme-dark-blue2)
(color-theme-calm-forest)
;(color-theme-tty-dark)

;;------------------------------------------------------
;;   set foreground and background color
;(set-foreground-color "white")
;(set-background-color "gray15")

;(set-face-foreground 'highlight "white")
;(set-face-background 'highlight "blue")
;(set-face-foreground 'region "cyan")
;(set-face-background 'region "blue")
;(set-face-foreground 'secondary-selection "skyblue")
;(set-face-background 'secondary-selection "darkblue")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;     set calendar look 
(setq calendar-load-hook
'(lambda ()
(set-face-foreground 'diary-face "skyblue")
(set-face-background 'holiday-face "slate blue")
(set-face-foreground 'holiday-face "white")))

;; ---------------------------------------
;; Load CEDET
(load-file "/usr/share/emacs/site-lisp/ecb/cedet/common/cedet.el")

;; Enabling various SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
;; Select one of the following
(semantic-load-enable-code-helpers)
;; (semantic-load-enable-guady-code-helpers)
;; (semantic-load-enable-excessive-code-helpers)

;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)
;; ---------------------------------------
;; set semantic search scope
(setq semanticdb-project-roots (list (expand-file-name "/")))
(setq semanticdb-default-save-directory "~/.emacs.d/semantic")

;;------------------------------------------------------
(require 'ecb)
;;(setq ecb-auto-activate t)

;;-----------------------------------------------
;;auot expand meta-/
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers
try-expand-list
try-expand-list-all-buffers
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
try-complete-file-name-partially
try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-whole-kill))

(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)

(setq auto-mode-alist (append '(("//.h$" . c++-mode)) auto-mode-alist))

;;------------------------------------
;;  my c language method
(defun my-c-mode-common-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  ;;; hungry-delete and auto-newline
  (c-toggle-auto-hungry-state 1)

;;--------------------------------------------------------
;; define hotkey
(global-set-key (kbd "<f7>") 'compile)
(global-set-key (kbd "<f9>") 'list-bookmarks)
(global-set-key [(f10)] 'bookmark-set)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)

;;------------------------------------------------------
;;  macro preprocessor
(setq c-macro-shrink-window-flag t)
  (setq c-macro-preprocessor "cpp")
  (setq c-macro-cppflags " ")
  (setq c-macro-prompt-flag t)
  (setq hs-minor-mode t)
  (setq abbrev-mode t)
  (setq tab-width 4 indent-tabs-mode nil)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;;-----------------------------------
;;   my c++  method
(defun my-c++-mode-hook()
  (setq tab-width 4 indent-tabs-mode nil)
  (c-set-style "stroustrup")
)
(add-hook 'c++-mode-hook 'my-c++-mode-hook)

;;-----------------------------------
;; comment method
(load-file "/usr/share/emacs/site-lisp/gnome-doc.el")

;;----------------------------------------------
;; another auto expand
;(defun my-indent-or-complete ()
;   (interactive)
;   (if (looking-at "//>")
;    (hippie-expand nil)
;    (indent-for-tab-command))
; )
;
;(global-set-key [(control tab)] 'my-indent-or-complete)
;
;(autoload 'senator-try-expand-semantic "senator")
;
;(setq hippie-expand-try-functions-list
;    '(
;  senator-try-expand-semantic
;  try-expand-dabbrev
;  try-expand-dabbrev-visible
;  try-expand-dabbrev-all-buffers
;  try-expand-dabbrev-from-kill
;  try-expand-list
;  try-expand-list-all-buffers
;  try-expand-line
;        try-expand-line-all-buffers
;        try-complete-file-name-partially
;        try-complete-file-name
;        try-expand-whole-kill
;        )
;)
;;------------------------------------------------

;;disable bell
(setq visible-bell nil)

;;enable copy from clipboard
(setq x-select-enable-clipboard t)

;;replace yes to y
(fset 'yes-or-no-p 'y-or-n-p)

;;scroll setp
(setq scroll-step 1
scroll-margin 3
scroll-conservatively 10000)

;;disable startup message
(setq inhibit-startup-message t)

;;auto display picture
(auto-image-file-mode)

;;insert time stamp
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S baiy")

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

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; coding style42
;(add-hook 'c-mode-hook43
;        '(lambda ()
;           (c-set-style "stroustrup")
;           (imenu-add-menubar-index)))
;;        (c-toggle-auto-state)))

;(add-hook 'c++-mode-hook49
;        '(lambda ()
;           (c-set-style "stroustrup")
;           (imenu-add-menubar-index)))
 ;;        (c-toggle-auto-state)))

(when window-system
  ;; enable wheelmouse support by default
  (mwheel-install)
  ;; use extended compound-text coding for X clipboard
  (set-selection-coding-system 'compound-text-with-extensions))

(require 'setnu)(setnu-mode t)
(require 'xcscope)

;;set shell color
;(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
;(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;(setq ansi-color-for-comint-mode t)

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(ecb-options-version "2.31"))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )

;;------------------------------------------------------
;;   set fonts
(create-fontset-from-fontset-spec
(concat
"-*-courier-medium-r-normal-*-14-*-*-*-*-*-fontset-courier,"
"chinese-gb2312:-*-simsun-medium-r-*-*-14-*-*-*-c-*-gb2312*-*,"
"mule-unicode-0100-24ff:-*-simsun-medium-r-*-*-14-*-*-*-c-*-iso10646*-*,"
"korean-ksc5601:-*-*-medium-r-*-*-14-*-*-*-*-*-ksc5601*-*,"
"chinese-cns11643-5:-*-simsun-medium-r-*-*-14-*-*-*-c-*-gbk*-*,"
"chinese-cns11643-6:-*-simsun-medium-r-*-*-14-*-*-*-c-*-gbk*-*,"
"chinese-cns11643-7:-*-simsun-medium-r-*-*-14-*-*-*-c-*-gbk*-*,"
"sjis:-*-medium-r-normal--14-*-jisx0208*-*"))

;(set-default-font "fontset-courier")
(setq default-frame-alist
(append '((font . "fontset-courier")) default-frame-alist))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值