lang/cc: new command +cc/reload-compile-commands #305
This commit is contained in:
parent
fa98d79bf4
commit
869a85a46b
1 changed files with 19 additions and 0 deletions
|
@ -1,5 +1,24 @@
|
||||||
;;; lang/cc/autoload.el -*- lexical-binding: t; -*-
|
;;; 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
|
;;;###autoload
|
||||||
(defun +cc*align-lambda-arglist (orig-fun &rest args)
|
(defun +cc*align-lambda-arglist (orig-fun &rest args)
|
||||||
"Improve indentation of continued C++11 lambda function opened as argument."
|
"Improve indentation of continued C++11 lambda function opened as argument."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue