lang/cc: new command +cc/reload-compile-commands #305

This commit is contained in:
Henrik Lissner 2017-12-26 23:39:21 -05:00
parent fa98d79bf4
commit 869a85a46b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -1,5 +1,24 @@
;;; lang/cc/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +cc/reload-compile-commands (&optional force-p)
"Reload the current project's compile_commands.json file."
(interactive "P")
(unless (memq major-mode '(c-mode c++-mode objc-mode))
(user-error "Not a C/C++/ObjC buffer"))
(unless (doom-project-has! "compile_commands.json")
(user-error "No compile_commands.json file"))
;; first rtag
(when (and (featurep 'rtags)
rtags-enabled
(executable-find "rc"))
(with-temp-buffer
(message "Reloaded compile commands for rtags daemon")
(rtags-call-rc :silent t "-J" (doom-project-root))))
;; then irony
(when (and (featurep 'irony) irony-mode)
(+cc|irony-init-compile-options)))
;;;###autoload
(defun +cc*align-lambda-arglist (orig-fun &rest args)
"Improve indentation of continued C++11 lambda function opened as argument."