我是在windows下用的emacs。我在google上没有找到windows下emacs的论坛,所以只好来这里提问了。
我配置好semantic之后,semantic不能解析我在c文件中include的头文件。不知道是什么原因,下面是我的配置文件,我是刚学emacs,配置文件基本上都是copy的网上的。
;设置默认工作目录
(setq default-directory "D:/program/")
;插件路径
;(setq load-path (cons (expand-file-name "~/.emacs.d") load-path))
;配置颜色主题
(add-to-list 'load-path "~/plugins/color-theme/");设置color-theme的路径,用来配置颜色主题
(require 'color-theme);加载color-theme
(color-theme-initialize)
(color-theme-oswald)
;配置显示行号
(add-to-list 'load-path "~/plugins/linum/");设置linum的路径,用来显示行号
(require 'linum);加载linum
(global-linum-mode t)
;配置cedet
(load-file "~/plugins/cedet/common/cedet.el")
(global-ede-mode 1)
;(semantic-load-enable-minimum-features)
;配置semantic的检索范围
(add-to-list 'semanticdb-project-roots "D:/program/")
;配置semantic搜索的头文件目录
(global-semanticdb-minor-mode 1)
(global-semantic-show-parser-state-mode 1)
(semantic-add-system-include "C:/cygwin/usr/include" 'c-mode)
(semantic-add-system-include "C:/cygwin/usr/include" 'c++-mode)
(setq semanticdb-search-system-databases t)
(setq semanticdb-default-save-directory "~/.semanticdb")
(semantic-load-enable-code-helpers)
;配置auto-complete
(add-to-list 'load-path "~/plugins/auto-complete/");设置auto-complete的路径
(require 'auto-complete)
;配置ecb
(add-to-list 'load-path "~/plugins/ecb/");设置ecb的路径
(require 'ecb)
;(ecb-activate)
;显示为口的问题;解决gbk编码
(setq font-encoding-alist
(cons '("gb2312.1980" . chinese-gbk) font-encoding-alist))
(create-fontset-from-fontset-spec
"-*-Courier New-normal-r-*-*-16-*-*-*-c-*-fontset-chinese,
chinese-gb2312:-outline-微软雅黑-normal-r-normal-normal-*-*-96-96-p-*-gb2312.1980-0" t)
(setq default-frame-alist
(append
'((font . "fontset-chinese"))
default-frame-alist))
;自定义按键
;删除一行
(defun delete-whole-line nil
"delete the whole line"
(interactive)
(beginning-of-line);光标移动到行首
(push-mark);做个标记
(beginning-of-line 2);移动到下一行行首
(kill-region (point) (mark));光标和标记之间的删掉
)
(global-set-key [f1] 'shell);F1进入Shell
(global-set-key [C-return] 'kill-this-buffer);C-return关闭当前buffer
(global-set-key (kbd "C-d") 'delete-whole-line);删除一行
;普通设置
(setq visible-bell t);关闭烦人的出错时的提示声
(setq inhibit-startup-message t);关闭起动时闪屏
(setq make-backup-files nil);不产生备份文件(filename~)
(setq auto-save-default nil);不产生临时文件(#filename#)
(tool-bar-mode nil);去掉那个大大的工具栏
(scroll-bar-mode nil);去掉滚动条
(column-number-mode t);显示列号
(fset 'yes-or-no-p 'y-or-n-p);用y/n代替yes/no
(setq frame-title-format "emacs@%b");在标题栏显示buffer的名字
(setq initial-frame-alist '((top . 10) (left . 120) (width . 100) (height . 35)));启动时设置窗口大小
(show-paren-mode t);显示括号匹配
;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 3))
(defun down-slightly () (interactive) (scroll-down 3))
(global-set-key [wheel-up] 'down-slightly)
(global-set-key [wheel-down] 'up-slightly)
;c 程序配置
;配置cc-mode,默认emacs携带了cc-mode
(require 'cc-mode);加载cc-mode
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
(setq imenu-sort-function 'imenu--sort-by-name)
(defun linux-c-mode()
(define-key c-mode-map [return] 'newline-and-indent)
(define-key c-mode-map [(control \d)] 'delete-whole-line)
(interactive)
(auto-complete-mode)
(c-set-style "K&R")
(c-toggle-auto-state)
(c-toggle-hungry-state)
(setq c-basic-offset 4)
(imenu-add-menubar-index)
(which-function-mode)
)
(add-hook 'c-mode-hook 'linux-c-mode)
;(require 'gas-mode);用于asm
;汇编配置
;快速编译
;(defun quick-compile ()
; "A quick compile funciton for asm"
; (interactive)
; (compile (concat "ml /I. /Zm /c /Ta " (buffer-name (current-buffer))))
;)
;(defun asm-mode-config()
; (define-key asm-mode-map [(control \d)] 'delete-whole-line)
; (define-key asm-mode-map [(f7)] 'quick-compile)
;)
;(add-hook 'asm-mode-hook 'asm-mode-config)
配置semantic时出现问题
-
- 帖子: 1
- 注册时间: 2009-11-15 0:26
-
- 帖子: 94
- 注册时间: 2009-02-25 19:44
Re: 配置semantic时出现问题
我也没弄成功过,在linux下挺正常的,建个project,打开global支持,就可以通过global找到所有头文件了,到了windows下就只能找当前目录下的头文件。