   (company-mode)
   (whitespace-mode)
   (define-key prog-mode-map (kbd "<C-tab>") 'company-complete)
-  (define-key prog-mode-map (kbd "C-.") 'my-imenu))
+  (define-key prog-mode-map (kbd "C-.") 'helm-semantic-or-imenu))
 
 (add-hook 'prog-mode-hook 'my-prog-mode-hook)
+
+(require 'etags)
+(defun push-tag-mark () (xref-push-marker-stack))    ;; hooks for semantic
+(defun pop-tag-mark () (xref-pop-marker-stack))
 
 (defun my-c-mode-common-hook ()
   (setq fill-column 90)
-  (setq rtags-completions-enabled t
-        ;; rtags-display-current-error-as-tooltip t
-        ;; rtags-autostart-diagnostics t
-        rtags-use-helm t
-        rtags-show-containing-function t
-        ;; rtags-track-container t)
-        )
-  ;; (rtags-diagnostics)
+  (semantic-mode 1))
+
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
+
+(with-eval-after-load 'cc-mode
   (define-key c-mode-base-map (kbd "<C-tab>") 'company-complete)
-  (define-key c-mode-base-map (kbd "M-.") 'rtags-find-symbol-at-point)
-  (define-key c-mode-base-map (kbd "M-,") 'rtags-location-stack-back)
+  (define-key c-mode-base-map (kbd "M-.") 'semantic-ia-fast-jump)
   (define-key c-mode-base-map (kbd "C-M-\\") 'clang-format-region)
-  (define-key c-mode-base-map (kbd "M-?") 'rtags-display-summary)
+  (define-key c-mode-base-map (kbd "M-?") 'semantic-ia-show-summary)
   (define-key c-mode-base-map (kbd "C-i") 'clang-format)
-  (define-key c-mode-base-map (kbd "C-.") 'my-imenu))
-
-(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
+  (define-key c-mode-base-map (kbd "C-.") 'helm-semantic-or-imenu))
 
 (add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
 ;; (setq cider-auto-mode nil)

  (define-key company-active-map (kbd "\C-d") 'company-show-doc-buffer)
  (define-key company-active-map (kbd "M-.") 'company-show-location))

(require 'rtags)
(require 'popup)
(require 'company)
(require 'company-rtags)

(add-to-list 'company-backends 'company-rtags)

(defun my-imenu ()
  (interactive)
  (if (rtags-is-indexed)
      (rtags-imenu)
    (helm-semantic-or-imenu nil)))

(defun my-prog-mode-hook ()
  (highlight-symbol-mode)


(with-eval-after-load 'whitespace
  (diminish 'whitespace-mode))

(setq whitespace-line-column 90
      whitespace-style '(face trailing newline))

