新手请教一个Emacs报错问题

Vim、Emacs配置和使用
回复
liujiely
帖子: 3
注册时间: 2009-06-10 14:34

新手请教一个Emacs报错问题

#1

帖子 liujiely » 2009-11-08 8:54

问题1:每次使用tab自动补全时,就会弹出以下信息:
Warning: `semantic-toplevel-bovine-cache' is an obsolete variable; use
`semantic--buffer-cache' instead.
Warning: `semantic-find-nonterminal-by-overlay' is an obsolete function; use
`semantic-find-tag-by-overlay' instead.
我尝试将semantic-1.3.3换成semantic-1.4.4,但是还是无法自动补全。

问题2:保存.c文件时,会弹出以下信息:
semantic--tag-link-to-buffer: Wrong type argument: integer-or-marker-p, nil

折腾了好久了都无法解决这2个问题。以下是我得~/.emacs文件,请帮我看看,不胜感激。。。
;; 自动缩进
(add-hook 'c-mode-hook '(lambda() (c-set-style "Ellemtel")))
(add-hook 'c-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'c-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'c++-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'c++-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'c++-mode-hook '(lambda() (c-set-style "stroustrup")))
(add-hook 'java-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'java-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'scheme-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'scheme-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'perl-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'perl-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'javascript-mode-hook (lambda () (local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'javascript-mode-hook (lambda () (setq comment-column 48) ))
(add-hook 'idlwave-mode-hook
(lambda ()
(local-set-key [(return)] 'newline-and-indent) ))
(add-hook 'f90-mode-hook
(lambda ()
(local-set-key [(return)] 'newline-and-indent)))
(setq c-basic-offset 2)



(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)
'(cua-mode t nil (cua-base))
'(ecb-options-version "2.40")
'(inhibit-startup-screen 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.
'(default ((t (:stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 128 :width normal :family "adobe-courier")))))



;; quick shift between emacs buffer windows
(windmove-default-keybindings 'meta)




;光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线
;(mouse-avoidance-mode 'animate)



;滚动页面时比较舒服,不要整页的滚动
(setq scroll-step 1
scroll-margin 3
scroll-conservatively 10000)




;; 支持emacs和外部程序的粘贴
(setq x-select-enable-clipboard t)



(global-set-key [f11] 'my-fullscreen)
;全屏
(defun my-fullscreen ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_FULLSCREEN" 0))
)



;字体设置
(set-default-font "Mono-14")
(set-fontset-font "fontset-default"
'unicode '("Mono-14" . "unicode-bmp"))
(setq default-frame-alist
(append '((font . "Mono-14")) default-frame-alist))



;该函数用于最大化,状态值为1说明最大化后不会被还原
;因为这里有两次最大化 (分别是水平和垂直)
(defun my-maximized ()
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
(my-maximized)




;;;;打开代码折叠功能
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)



;F5 quick search files
(global-set-key [(f5)] 'speedbar)



;hippie zi dong bu quan
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
(setq tags-file-name "~/TAGS")



;; save last file dir as default
(require 'saveplace)
(setq-default save-place t)



;滚动条在右侧
;(set-scroll-bar-mode 'right)



;在标题栏显示buffer的名字
(setq frame-title-format "%b@emacs")



;以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)



;光标不闪
(blink-cursor-mode nil)


;;显示行号
(require 'linum)
(global-linum-mode t)




;;;; CC-mode配置 http://cc-mode.sourceforge.net/
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
;;;;我的C/C++语言编辑策略
(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-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;预处理设置
(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)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;;;我的C++语言编辑策略
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
)



(load-file "~/elisp/cedet-1.0pre6/common/cedet.el")
(setq semanticdb-project-roots
(list
(expand-file-name "/")))
(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
)
)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
(global-set-key [(f5)] 'speedbar)
'(compile-command "make")




;Allows syntax highlighting to work, among other things
(global-font-lock-mode 1)
;These lines are required for ECB
(add-to-list 'load-path "~/emacs-plugin/eieio-0.17")
(add-to-list 'load-path "~/emacs-plugin/speedbar-0.14beta4")
(add-to-list 'load-path "~/emacs-plugin/semantic-1.3.3")
(setq semantic-load-turn-everything-on t)
(require 'semantic-load)
; This installs ecb - it is activated with M-x ecb-activate
(add-to-list 'load-path "~/emacs-plugin/ecb-2.40")
;(require 'ecb-autoloads)
(require 'ecb)
;; 自动启动ecb,并且不显示每日提示
(setq ecb-auto-activate t
ecb-tip-of-the-day nil)


;;Emacs lisp 功能集锦
;;上次的变量,寄存器,文件等
(require 'session)
(add-hook 'after-init-hook 'session-initialize)

;;(setq desktop-load-locked-desktop t)
;;(desktop-save-mode 1)
回复