lang/cc: fix rtags in other c*-mode derived modes; fix cleanup hook

Also fixed rtags cleanup in doom-cleanup-hook to only kill the server if
there are no more C/C++ buffers open.
This commit is contained in:
Henrik Lissner 2018-03-01 13:17:07 -05:00
parent cde3a3ee78
commit 28adf5825f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 21 additions and 8 deletions

View file

@ -88,3 +88,14 @@ compilation dbs."
nconc (list "-I" path)))
(doom-project-root)))))
;;;###autoload
(defun +cc|init-rtags ()
"Start an rtags server in c-mode and c++-mode buffers."
(when (memq major-mode '(c-mode c++-mode))
(rtags-start-process-unless-running)))
;;;###autoload
(defun +cc|cleanup-rtags ()
"Kill rtags server(s) if there are no C/C++ buffers open."
(unless (doom-buffers-in-mode '(c-mode c++-mode) (buffer-list))
(rtags-cancel-process)))