升级cedet发现的问题
Table of Contents
1 cedet升级到1.1版
- 2012-04-20发现了cedet升级到了1.1版,立刻下载编译
- ecb提示只兼容cedet版本 1.0.6pre ~ 1.0.9,在ecb-upgrade.el下找到
;; ---------------------------------------------------------------------- ;; all needs for the requirements check ;; ---------------------------------------------------------------------- ;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: maybe we should set this to pre6 (defconst ecb-required-cedet-version-min '(1 0 2 6)) (defconst ecb-required-cedet-version-max '(1 0 4 9))
- 改成,支持到cedet1.1.4.9
;; ---------------------------------------------------------------------- ;; all needs for the requirements check ;; ---------------------------------------------------------------------- ;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: maybe we should set this to pre6 (defconst ecb-required-cedet-version-min '(1 0 2 6)) (defconst ecb-required-cedet-version-max '(1 1 4 9))
- 运行jdee时出现:“JDEE requires a version of CEDET between 1.0beta2 and 1.0 (found 1.1beta)”的错误
- 配置jde运行时不进行版本检查
(jde-check-version-flag nil))
2 加载c-mode出错
- load-file一个c文件,提示“File mode specification error: (wrong-type-argument stringp 1)”
- 设置: M-x customize-variable debug-on-error –> always,再次load-file一个c文 件,提示
Debugger entered--Lisp error: (wrong-type-argument stringp 1) string-match("\n" 1 0) split-string(1 "\n") semantic-cpp-defs(1) semantic-gcc-setup() byte-code("\306\307 BC\310\311...") semantic-default-c-setup() run-hooks(c-mode-common-hook c-mode-hook) apply(run-hooks (c-mode-common-hook c-mode-hook)) run-mode-hooks(c-mode-common-hook c-mode-hook) c-mode()
- 可以看出,是加载c-mode时调用c-mode-hook,查看"C-h v c-mode-hook",看到内容 是:(semantic-default-c-setup cscope:hook)
- 加载semantic-default-c-setup出错,定位到semantic-cpp-defs函数内
- 查看"C-h f semantic-cpp-defs",定位到semantic-gcc.el
- semantic-cpp-defs(1),第一句,(let ((lines (split-string str "\n")),判断str 是数字1,报出string-match("\n" 1 0)第二个参数,wrong-type-argument
- 问题是传到semantic-cpp-defs的参数应该是个字符串,怎么是个数字1?
- 暂且不管问题怎么产生的,在semantic-cpp-defs中加一个判断,避开这个问题
;; TODO 120422 ;; change by a machine of awareness ;; (defun semantic-cpp-defs (str) ;; "Convert CPP output STR into a list of cons cells with defines for C++." ;; (let ((lines (split-string str "\n")) ;; (lst nil)) ;; (dolist (L lines) ;; (let ((dat (split-string L))) ;; (when (= (length dat) 3) ;; (add-to-list 'lst (cons (nth 1 dat) (nth 2 dat)))))) ;; lst)) (defun semantic-cpp-defs (str) "Convert CPP output STR into a list of cons cells with defines for C++." (let ((lines nil) (lst nil)) (if (not (numberp str)) (setq lines (split-string str "\n"))) (dolist (L lines) (let ((dat (split-string L))) (when (= (length dat) 3) (add-to-list 'lst (cons (nth 1 dat) (nth 2 dat)))))) lst))