key上。而直接用Emacs的话,各种插件的版本号冲突解决和配置要花开发者不少时间,而使用现代IDE。既能享受emacs key的快捷。又能省去Emacs配置和麻烦。何乐而不为。
- Emacs 23.4.1。raspberrypi自带。
- cscope-15.7a,raspberrypi自带,可是没有cscope-indexer和xcscope.el,奇怪,可能仅仅是raspberrypi是这样。
- cscope-15.8a,下载。仅仅解压。然后把cscope-indexer加上运行权限然后拷贝到/usr/bin中。把xcsope.el拷贝到~/.emacs.d/lisp/。
- ecb-2.40。下载,这个没得选,解压后放到~/.emacs.d/lisp/ecb中。
- cedet-1.0.1。下载,不要用1.1,避免了还要改动ecb的版本号检查,解压后放到~/.emacs.d/lisp/cedet中。
- linum.el,下载最新的,放到~/.emacs.d/lisp/。
- session.el。下载最新的,放到~/.emacs.d/lisp/。
- color-theme.el,下载最新的。放到~/.emacs.d/lisp/。
- session-2.3.a。下载,解压到~/.emacs.d/lisp/。
-f batch-byte-compile *.el。但即使编译了成了.elc。在树莓派上的速度还是非常慢。只是也合理。
以下是具体的配置:
(setq default-major-mode 'text-mode)
(global-font-lock-mode t)
(auto-image-file-mode t)
(transient-mark-mode t)
(show-paren-mode t)
(column-number-mode t)
(tool-bar-mode nil)
(setq-default make-backup-files nil)
(mouse-avoidance-mode 'animate)
;; Autorevert stuff
(autoload 'auto-revert-mode "autorevert" nil t)
(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)
(autoload 'global-auto-revert-mode "autorevert" nil t)
;; Load session
(require 'session)
;; Load linum
(require 'linum)
;; load color-theme
(require 'color-theme)
;; Load xcscope
;; Load cedet
(load-file "~/.emacs.d/lisp/cedet/common/cedet.elc")
(global-ede-mode 1)
(ede-cpp-root-project "sensor_worker" :file "~/workspace/c/sensor_worker/Makefile")
(semantic-load-enable-code-helpers)
(global-srecode-minor-mode 1)
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "//>")
(hippie-expand nil)
(indent-for-tab-command)
)
(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
)
;; C/C++ setting
(require 'cc-mode)
(setq c-basic-offset 4)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(defun my-c-mode-common-hook()
(setq tab-width 4)
(setq indent-tabs-mode nil)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(ctrl tab)] 'semantic-ia-complete-symbol-menu)
(define-key c-mode-base-map [(f9)] 'compile)
(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)
(c-set-style "user")
(hl-line-mode t)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(setq auto-mode-alist (cons '("//.h$" . c++-mode) auto-mode-alist))
;; Load ecb
(add-to-list 'load-path "~/.emacs.d/lisp/ecb")
(require 'ecb)
(global-set-key [f12] 'ecb-activate)
(global-set-key [C-f12] 'ecb-deactivate)
(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.
'(ecb-options-version "2.40"))
(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.
)
版权声明:本文博客原创文章,博客,未经同意,不得转载。