Emacs semantic lines

486 views Asked by At

I tried a solution shown here which did not work for me. Even just disabling decoration mode did not work. So now I am wondering exactly what these lines above my text are, and how I can disable them. Maybe it's not even semantic? I'm not really sure...

Here's my 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

There are 2 answers

2
foboi1122 On BEST ANSWER

I was able to solve my problem by disabling one of the overlays. I looked at the properties of one of the lines with underline using C-u C-x = and disabled one of the syntax check overlays. I'm not really sure why the syntax overlay was underlining everything especially since my code compiled fine.

0
Philipp Claßen On

At least when working with C++11/14 code, "semantic-show-unmatched-syntax-mode" shows too many false positive.

Besides that, it sometimes enters a buggy state where warnings are still shown after you fixed the syntax error. It may help to disable and renable the minor mode (M-x semantic-show-unmatched-syntax-mode).

To disable the syntax check globally, change your ~/.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)