my emacs configure

原创 2011年10月18日 10:00:42
(setq split-height-threshold nil)
(setq split-width-threshold 0)

;;shell 乱码
(setq ansi-color-for-comint-mode t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

(defun quick-compile ()  
"A quick compile funciton for C++"  
(compile (concat "g++ " (buffer-name (current-buffer)) " -g -pg")))  
;;Short key F9  
(global-set-key [(f9)] 'quick-compile) 

(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")

;; 去掉工具栏
(tool-bar-mode nil)

;;(menu-bar-mode nil)

;; 设置字体
;; 方法为: emacs->options->Set Default Font->"M-x describe-font"查看当前使用的字体名称、字体大小
(set-default-font " -bitstream-Courier 10 Pitch-normal-normal-normal-*-19-*-*-*-m-0-iso10646-1")

;; 显示列号
(setq column-number-mode t)
(setq line-number-mode t)

(global-set-key [(f4)] 'speedbar-get-focus)  

;; 实现全屏效果,快捷键为f11
(global-set-key [f11] 'my-fullscreen) 
(defun my-fullscreen ()
nil 0 nil "_NET_WM_STATE" 32

;; 最大化
(defun my-maximized ()
nil 0 nil "_NET_WM_STATE" 32
nil 0 nil "_NET_WM_STATE" 32

;; 启动emacs时窗口最大化

(require 'color-theme)

;===================== cedet设置 =====================================

(add-to-list 'load-path "/home/ben/Downloads/cedet-1.0/cedet-1.0/speedbar")
(add-to-list 'load-path "/home/ben/Downloads/cedet-1.0/cedet-1.0/eieio")
(add-to-list 'load-path "/home/ben/Downloads/cedet-1.0/cedet-1.0/semantic")
(add-to-list 'load-path "/home/ben/Downloads/cedet-1.0/cedet-1.0/common")
(require 'cedet)

;; Ecb的操作:
;; C-c . g d 目录列表窗口
;; C-c . g s 源码窗口
;; C-c . g m 方法和变量窗口
;; C-c . g h 历史窗口
;; C-c . g l 最后选择过的编辑窗口
;; C-c . g 1 编辑窗口1
;; C-c . g n 编辑窗口n
;; C-c . l c 选择版面
;; C-c . l r 重画版面
;; C-c . l t 拴牢版面(锁定版面)
;; C-c . l w 拴牢可见的ecb窗口
;; C-c . \   拴牢编绎窗口


(add-to-list 'load-path "/usr/share/emacs/mylisp")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb-2.40")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cscope-15.7a/contrib/xcscope") 
(require 'xcscope)

(define-key global-map [(control f3)]  'cscope-set-initial-directory)
(define-key global-map [(control f4)]  'cscope-unset-initial-directory)
(define-key global-map [(control f5)]  'cscope-find-this-symbol)
(define-key global-map [(control f6)]  'cscope-find-global-definition)
(define-key global-map [(control f7)]  'cscope-find-global-definition-no-prompting)
(define-key global-map [(control f8)]  'cscope-pop-mark)
(define-key global-map [(control f9)]  'cscope-next-symbol)
(define-key global-map [(control f10)] 'cscope-next-file)
(define-key global-map [(control f11)] 'cscope-prev-symbol)
(define-key global-map [(control f12)] 'cscope-prev-file)
(define-key global-map [(meta f9)]     'cscope-display-buffer)
(define-key global-map [(meta f10)]    'cscope-display-buffer-toggle)

;;Goto-line short-cut key                                                                                                   
(global-set-key "\C-l" 'goto-line)

(setq cscope-do-not-update-database t)

(require 'linum)                                                   
(global-linum-mode 1)

;; 设置缩进
(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        . t)
    (c-comment-only-line-offset . 4)
    (c-hanging-braces-alist     . ((substatement-open after)
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
    (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
                                   (substatement-open . 0)
                                   (case-label        . 4)
                                   (block-open        . 0)
                                   (knr-argdecl-intro . -)))
    (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) 
;; 回车缩进
(global-set-key "\C-m" 'newline-and-indent)
(global-set-key (kbd "C-<return>") 'newline)

(set-background-color "DarkSlateGray")
          (set-foreground-color "Wheat")
          (set-face-background 'modeline "lightgoldenrod2")
          (set-face-foreground 'modeline "DarkSlateGray")
          (set-cursor-color "Orchid")
          (set-face-foreground 'font-lock-comment-face "Gray")
          (set-face-foreground 'font-lock-string-face "Gold3")
          (set-face-foreground 'font-lock-function-name-face "LightBlue")
          (set-face-foreground 'font-lock-keyword-face "cyan1")
          (set-face-foreground 'font-lock-type-face "Violet")
          (set-face-foreground 'font-lock-builtin-face "Cyan")
          (set-face-foreground 'font-lock-variable-name-face "Gold")
          (set-face-foreground 'font-lock-constant-face "Magenta")
          (set-face-foreground 'scroll-bar "Wheat")
          (set-face-background 'scroll-bar "lightgoldenrod2")
          (set-face-foreground 'tool-bar "Wheat")
          (set-face-background 'tool-bar "lightgoldenrod2")
          (set-face-foreground 'font-lock-builtin-face "Cyan")

;; 显示时间,格式如下
(display-time-mode 1) 
(setq display-time-24hr-format t) 
(setq display-time-day-and-date t) 
(transient-mark-mode t) 
(setq inhibit-startup-message t)

;;;; 自动启动ecb,并且不显示每日提示
(setq ecb-auto-activate t
      ecb-tip-of-the-day nil)

(defun define-trivial-mode(mode-prefix file-regexp &optional command)
  (or command (setq command mode-prefix))
  (let ((mode-command (intern (concat mode-prefix "-mode"))))
    (fset mode-command
          `(lambda ()
             (toggle-read-only t)
         (start-process ,mode-prefix nil
                ,command (buffer-file-name))
         (let ((obuf (other-buffer (current-buffer) t)) ;; Select correct buffer
           (kbuf (current-buffer)))
           (set-buffer obuf)                ;; set it as current
           (kill-buffer kbuf))))                ;; kill temporary buffer
    (add-to-list 'auto-mode-alist (cons file-regexp mode-command))))

(define-trivial-mode "evince" "//.pdf$")

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

(put 'upcase-region 'disabled nil)
  ;; 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.
 '(ecb-options-version "2.40")
 '(truncate-partial-width-windows t))
  ;; 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.
 (setq semanticdb-project-roots 
(expand-file-name "/")))
;;(global-set-key [(control tab)] 'senator-complete-symbol);
(global-set-key [(control tab)] ' senator-completion-menu-popup)
;; (global-set-key [(control tab)] 'semantic-ia-complete-symbol-menu)

(global-set-key [f1] 'delete-other-windows)
(global-set-key [f2] 'list-buffers)
(global-set-key [f3] 'calendar)
(global-set-key [f4] 'ibuffer)
(global-set-key [f11] 'undo)
(global-set-key [f12] 'eval-current-buffer)
(global-set-key [f5]  'ecb-maximize-window-directories)
(global-set-key [f6] 'ecb-maximize-window-sources)
(global-set-key [f7] 'ecb-maximize-window-methods)
(global-set-key [f8] 'ecb-maximize-window-history)
(global-set-key [f11] 'undo)
(global-set-key [f12] 'eval-current-buffer)

(global-set-key [M-left] 'windmove-left)
(global-set-key [M-right] 'windmove-right)
(global-set-key [M-up] 'windmove-up)
(global-set-key [M-down] 'windmove-down)

(define-key global-map [(control f1)] 'ecb-hide-ecb-windows)
(define-key global-map [(control f2)] 'ecb-show-ecb-windows)


本人安装环境为centos7,其他linux版本也大同小异,可参考操作。 1. 下载emacs-25.3.tar.gz到centos,用tar –vxzf 命令解压; 2. 进入解压后的目录,...
  • guanjintao
  • guanjintao
  • 2018年02月05日 15:32
  • 62

ubuntu12.10 下手动编译emacs24.2

1.执行./configure命令出现如下错误: configure: error: You seem to be running X, but no X development libraries...
  • HappyPonder
  • HappyPonder
  • 2012年12月17日 23:14
  • 5819


. 准备工作 (1)安装svn、ssh sudo apt-get install ssh subversion (2)安装texinfo(为了编译man包) sudo apt-get insta...
  • gqb666
  • gqb666
  • 2014年06月22日 14:12
  • 4020

my .emacs

Learning is always from book.Reading "Learning gnu Emacs,2nd(Debra Cameron,Bill Rosenblatt, Eric Ray...
  • ramacess
  • ramacess
  • 2006年05月25日 13:53
  • 980

My .Emacs

;color highlighting(global-font-lock-mode t)(setq transient-mark-mode t);turn off the anoy sound(set...
  • EricYeung
  • EricYeung
  • 2007年05月05日 01:37
  • 744

my simple vim configure

" ~/.vimrc " ty vimrc configure " " " syntax highlight " syn on " " show line number " ...
  • Dorrn
  • Dorrn
  • 2015年01月05日 18:58
  • 198

my xterm configure

1 !===============================   2 ! - Setting for xterm   3 ! --------------------   4 XTerm...
  • sprawling
  • sprawling
  • 2016年11月19日 10:44
  • 90

configure of my larbin

larbin.conf################################################ Who are you ?# mail of the one who launc...
  • wonderful_ha
  • wonderful_ha
  • 2011年06月29日 20:51
  • 608

my emacs configuration(for Windows)

(setq transient-mark-mode t)(set-w32-system-coding-system chinese-iso-8bit)(custom-set-variables  ;;...
  • fiba66
  • fiba66
  • 2006年05月03日 10:41
  • 1216

my Emacs favorites

WangYins Emacs PageGNU EmacsEmacsWiKi 
  • fiba66
  • fiba66
  • 2006年05月09日 20:49
  • 535
您举报文章:my emacs configure