Я начинаю немного экспериментировать с использованием emacs в качестве моей разработки, и я столкнулся с небольшими проблемами. Я хочу использовать cscope с семантикой для довольно надежного поиска в моей базе кода. Однако после установки cscope (с apt-get install cscope
) и перемещения xscope.el
в мой ~/.emacs.d/
, мне все еще не удается вызвать некоторые настройки с моим файлом .emacs. Когда я пытаюсь позвонить (semanticdb-enable-cscope-databases)
, я получаю сообщение об ошибке, что определение функции символа недействительно. Я использую emacs 24.3настройка семантики с помощью cscope
(semantic-mode 1)
(global-ede-mode 1)
(require 'semantic/ia)
;; Semantic
(global-semantic-idle-completions-mode t)
(global-semantic-decoration-mode t)
(global-semantic-highlight-func-mode t)
(global-semantic-show-unmatched-syntax-mode t)
;; auto-complete stuff
(add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(ac-config-default)
(add-hook 'c-mode-common-hook '(lambda()
;; ac-omni-completion-sources is made buffer local so
;; you need to add it to a mode hook to activate on
;; whatever buffer you want to use it with. This
;; example uses C mode (as you probably surmised).
;; auto-complete.el expects ac-omni-completion-sources to be
;; a list of cons cells where each cell's car is a regex
;; that describes the syntactical bits you want AutoComplete
;; to be aware of. The cdr of each cell is the source that will
;; supply the completion data. The following tells autocomplete
;; to begin completion when you type in a . or a ->
(add-to-list 'ac-omni-completion-sources
(cons "\\." '(ac-source-semantic)))
(add-to-list 'ac-omni-completion-sources
(cons "->" '(ac-source-semantic)))
;; ac-sources was also made buffer local in new versions of
;; autocomplete. In my case, I want AutoComplete to use
;; semantic and yasnippet (order matters, if reversed snippets
;; will appear before semantic tag completions).
(setq ac-sources '(ac-source-semantic ac-source-yasnippet))
))
(require 'xcscope)
(semanticdb-enable-cscope-databases) ;;This is causing problems
;;C mode
(require 'cc-mode)
;;Color theme
(require 'color-theme)
(setq color-theme-is-global t)
(add-to-list 'load-path "/home/bob/.emacs.d/theme/ample-theme/ample-theme.el")
;;(require 'ample-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-jsc-dark)))
;;set font
(set-face-attribute 'default nil :family "Anonymous Pro" :height 140)
;;line numbers
(global-linum-mode 1)
(custom-set-variables '(linum-format (quote "%4d \u2502 ")))
;;treat .h files at C++
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
;; use F5 as compile
(global-set-key [(f5)] 'compile)
;; make compilation window smaller
(setq compilation-window-height 8)
'semantic - tag-deep-copy-value' доступно только при загрузке' semantic/scope.el'. Поместите функцию в соответствующие переключатели режима или в 'eval-after-load'. Я не думаю, что установка '.emacs.d' в' load-path' является такой хорошей идеей. Этот каталог предназначен для конфигурации. Я помещал свои файлы личной библиотеки в '~/share/emacs'. – Tobias
@Tobias, спасибо! так что это будет означать, что мне нужно вызвать (требуется «семантика/область») правильно? Я переведу свои пакеты emacs. – foboi1122
@Tobias, я добавил (требуется «семантика/область видимости») в верхней части моего точечного файла, и он все еще не может обнаружить базу данных semanticdb-enable-cscope – foboi1122