请帮我解决这个问题。我不确定这是否是一个重复的问题,但我找不到与我的情景相关的讨论。
我正在使用 Emacs 23 和 cedet 1.0.1 。当我在.emacs文件中配置自动完成时,每当我尝试从Emacs打开或保存.c文件时,我都会收到此错误。它挂了很长时间然后把这个错误扔进了* Messages * buffer。在缓冲区中还有一个长序列保存文件和写入行。
请帮我解决这个问题。
if: Wrong type argument: (or eieio-object-p class-p), [object semantic-bookmark-ring "Ring" (0 3 . [[object semantic-bookmark "ac-config-default" ("ac-config-default" code nil nil [12669 12688]) nil 20 "/home/santanu/.emacs" 1 mark] [object semantic-bookmark "main" ("main" function (:arguments (("argc" variable (:type "int") (reparse-symbol arg-sub-list) #<overlay from 1 to 1 in hello.c>) ("argv" variable (:pointer 1 :dereference 1 :type "char") (reparse-symbol arg-sub-list) #<overlay from 1 to 1 in hello.c>)) :type "int") (unlink-copy-hook (semantic--tag-unlink-copy-secondary-overlays) link-hook (semantic--tag-link-secondary-overlays) secondary-overlays (#<overlay from 1 to 1 in hello.c> #<overlay from 1 to 1 in hello.c> #<overlay from 1 to 1 in hello.c>) unlink-hook (semantic--tag-unlink-secondary-overlays)) #<overlay from 1 to 1 in hello.c>) nil 0 "/host/santanu/programming/c_projects/datastructures/src/main/hello.c" 1 edit] [object semantic-bookmark "stdio.h" ("stdio.h" include (:system-flag t) (unlink-hook (semantic--tag-unlink-secondary-overlays) secondary-overlays (#<overlay from 1 to 1 in hello.c>) dependency-file "/usr/include/stdio.h" link-hook (semantic--tag-link-secondary-overlays) unlink-copy-hook (semantic--tag-unlink-copy-secondary-overlays) ...) #<overlay from 1 to 1 in hello.c>) nil 0 "/host/santanu/programming/c_projects/datastructures/src/main/hello.c" 1 mark] nil nil nil nil nil nil nil ...]) 0]
To Remove Middle Tag: (main)
Mark set
To Remove Middle Tag: (main) [2 times]
编辑:有关该问题的新更新
无意中我发现问题不是由于自动完成。这是由于我编写的一个Elisp函数在保存之前应用A代我的C代码。这是函数和我的c-mode-hook。
(defun astyle-this-buffer (pmin pmax)
(interactive "r")
(shell-command-on-region pmin pmax
"astyle" ;; add options here...
(current-buffer) t
(get-buffer-create "*Astyle Errors*") t))
(defun ansi-c-mode-hook ()
"turns off syntactic indentation and sets indent-region-function"
(setq c-syntactic-indentation nil)
;;(setq indent-region-function 'astyle-this-buffer)
(setq compile-command "bash cbuild.c")
(setq enable-local-variables :all)
(global-set-key (kbd "C-c .te") '(lambda ()
(interactive)
(run-command 'test-command)))
(global-set-key (kbd "C-c .cs") '(lambda ()
(interactive)
(run-command 'check-code-style))))
如果我取消注释行(setq indent-region-function 'astyle-this-buffer)
,则会在保存时出现上述错误。那么函数astyle-this-buffer
有什么问题?我记得的是我从stackoverflow.com的一些帖子中获取了它。