1 (let ((base (file-name-directory
3 (file-name-directory (or load-file-name
4 (when (boundp 'bytecomp-filename) bytecomp-filename)
6 (add-to-list 'load-path (concat base
7 (file-name-as-directory "rtags")
8 (file-name-as-directory "src")))
9 (add-to-list 'load-path (concat base
10 (file-name-as-directory "elpa")
11 (file-name-as-directory "company-0.9.2")))
13 (setq rtags-path (concat base
14 (file-name-as-directory "rtags")
15 (file-name-as-directory "build")
16 (file-name-as-directory "bin"))))
20 ;; ;; ensure that we use only rtags checking
21 ;; ;; https://github.com/Andersbakken/rtags#optional-1
22 ;; (defun setup-flycheck-rtags ()
24 ;; (flycheck-select-checker 'rtags)
25 ;; ;; RTags creates more accurate overlays.
26 ;; (setq-local flycheck-highlighting-mode nil)
27 ;; (setq-local flycheck-check-syntax-automatically nil))
29 ;; only run this if rtags is installed
30 (when (require 'rtags nil :noerror)
31 ;; make sure you have company-mode installed
33 (define-key c-mode-base-map (kbd "\C-c.")
34 (function rtags-find-symbol-at-point))
35 (define-key c-mode-base-map (kbd "\C-c,")
36 (function rtags-find-references-at-point))
37 (define-key c-mode-base-map (kbd "\C-cn")
38 (function rtags-next-diag))
39 ;; disable prelude's use of C-c r, as this is the rtags keyboard prefix
40 ;; (define-key prelude-mode-map (kbd "C-c r") nil)
41 ;; install standard rtags keybindings. Do M-. on the symbol below to
42 ;; jump to definition and see the keybindings.
43 (rtags-enable-standard-keybindings)
44 ;; comment this out if you don't have or don't use helm
45 (setq rtags-use-helm t)
46 ;; company completion setup
47 (setq rtags-autostart-diagnostics t)
49 (setq rtags-completions-enabled t)
50 (push 'company-rtags company-backends)
52 (define-key c-mode-base-map (kbd "<C-tab>") (function company-complete))
53 ;; use rtags flycheck mode -- clang warnings shown inline
54 ;; (require 'flycheck-rtags)
55 ;; c-mode-common-hook is also called by c++-mode
56 ;; (add-hook 'c-mode-common-hook #'setup-flycheck-rtags)