Emacs语义线

时间:2013-12-26 02:41:48

标签: emacs-semantic

我尝试了显示here的解决方案,但这对我不起作用。即使只是禁用装饰模式也行不通。所以现在我想知道我的文本上面的这些行是什么,以及我如何禁用它们。也许它甚至不是语义?我不太确定......

这是我的dotfile:

(add-to-list 'load-path "~/.emacs.d/")

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)

;; auto-complete stuff
;;(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(auto-complete-mode 1)

(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)


(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 'semantic/scope)
(require 'xcscope)
(require 'semantic/symref)
;(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 ")))

;;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)

enter image description here

2 个答案:

答案 0 :(得分:0)

我能够通过禁用其中一个叠加层来解决我的问题。我查看了使用C-u C-x =下划线的其中一行的属性,并禁用了其中一个语法检查叠加层。我不确定为什么语法叠加层强调一切,特别是因为我的代码编译得很好。

答案 1 :(得分:0)

至少在使用C ++ 11/14代码时,“semantic-show-unmatched-syntax-mode”显示太多误报。

除此之外,它有时会进入错误状态,在修复语法错误后仍会显示警告。它可能有助于禁用和重新设置次要模式( M-x semantic-show-unmatched-syntax-mode)。

要全局禁用语法检查,请更改~/.emacs

(global-semantic-show-unmatched-syntax-mode 0)

;;; if you need it, you can use a shortcut to enable/disable it again, e.g.:
(global-set-key [f12] 'semantic-show-unmatched-syntax-mode)