0

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

Community
  • 1
  • 1
foboi1122
  • 1,727
  • 4
  • 19
  • 36
  • Is this only happening in C++ mode? – Justin Wood Dec 26 '13 at 03:08
  • @JustinWood I just tried it in java mode and it happens as well when I call a class method. http://imgur.com/01yeCl7 – foboi1122 Dec 26 '13 at 06:00
  • 1
    @tobol1122 Try to deactivate the `global-semantic-...` functions one by one. My first guess would be to comment out `(global-semantic-show-unmatched-syntax-mode t)` even if the syntax looks right. Looks like the parser drops out of sync and error recovery does not work. But, that is just a guess. Maybe I am wrong. – Tobias Dec 26 '13 at 21:12
  • @Tobias thank you for your continued help, I was able to solve this problem – foboi1122 Dec 26 '13 at 22:32

2 Answers2

0

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.

foboi1122
  • 1,727
  • 4
  • 19
  • 36
  • 1
    It would be nice if you could give the code for disabling the overlay in your answer. This would also help to estimate how serious the problem is. – Tobias Dec 27 '13 at 07:28
  • Sorry, I was trying to find the code again but I couldn't remember it because I had figured it out late last night with the help of the good people from emacs IRC. I will try to update this answer again once I figure out what I did. – foboi1122 Dec 27 '13 at 11:14
0

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)
Philipp Claßen
  • 41,306
  • 31
  • 146
  • 239