ProofGeneral/PG@99f91e873e -> ProofGeneral/PG@3a99da2755 agda/agda@fbf9d159c3 -> agda/agda@4f82f9b90a amake/flutter.el@004c91e070 -> amake/flutter.el@e71235d400 babashka/neil@a38be9f082 -> babashka/neil@6728367eff beancount/beancount-mode@71c1622246 -> beancount/beancount-mode@7b437abcf0 chachi/cuda-mode@7dd07a20c3 -> chachi/cuda-mode@c3dae31b3d clojure-emacs/cider@105da319b0 -> clojure-emacs/cider@8fdb53e8be dominikh/go-mode.el@636d36e37a -> dominikh/go-mode.el@602d73e226 emacs-geiser/geiser@b6b4ac070d -> emacs-geiser/geiser@97ce88463f emacs-geiser/guile@d5175439c0 -> emacs-geiser/guile@5a856c2982 emacs-gnuplot/gnuplot@7138b139d2 -> emacs-gnuplot/gnuplot@4c6b18f71f emacs-lsp/lsp-dart@1f52e81c93 -> emacs-lsp/lsp-dart@9ffbafb7dc emacs-lsp/lsp-haskell@18a7c7881f -> emacs-lsp/lsp-haskell@ba49fa9822 emacs-lsp/lsp-java@4909c14b90 -> emacs-lsp/lsp-java@868600bf7f emacs-lsp/lsp-metals@fa4072cbe7 -> emacs-lsp/lsp-metals@0dc938be11 emacs-lsp/lsp-sourcekit@bb2b7e0278 -> emacs-lsp/lsp-sourcekit@63ff1ab638 emacs-lsp/lsp-treemacs@1d43e9e030 -> emacs-lsp/lsp-treemacs@fb1a07ae0a emacs-straight/adaptive-wrap@f5bc153273 -> emacs-straight/adaptive-wrap@d75665b9c8 emacs-straight/auctex@451b0f08b0 -> emacs-straight/auctex@08881d08ce emacs-straight/csv-mode@cdb73a771b -> emacs-straight/csv-mode@6979fc18eb emacs-straight/org-mode@f398724bd5 -> emacs-straight/org-mode@6a5d0ed342 emacs-straight/rainbow-mode@0740f31f30 -> emacs-straight/rainbow-mode@2e6b18609c emacs-straight/sml-mode@d114e5a27f -> emacs-straight/sml-mode@021233f60a emacsmirror/paredit@9a2c4b37fc -> emacsmirror/paredit@037b9b8acb ericdallo/jet.el@7d5157aac6 -> ericdallo/jet.el@c9a92675ef erlang/otp@2a64588d4a -> erlang/otp@c66bf53cde factor/factor@d143007778 -> factor/factor@31dc1a386b fosskers/sly-overlay@4c6135c260 -> fosskers/sly-overlay@d629450590 fxbois/web-mode@005aa62d6f -> fxbois/web-mode@0c83581d1e gcv/julia-snail@f7784c5007 -> gcv/julia-snail@dff92c4250 greghendershott/racket-mode@40ecb87f40 -> greghendershott/racket-mode@dba66c4536 hhvm/hack-mode@ccf20511f0 -> hhvm/hack-mode@343e45f2a6 https://repo.or.cz/org-contacts.git@d0cb221502c9 -> https://repo.or.cz/org-contacts.git@f0a430442b2a hvesalai/emacs-scala-mode@4c6d636b86 -> hvesalai/emacs-scala-mode@bd0638c32a idris-hackers/idris-mode@38dd2380dc -> idris-hackers/idris-mode@09de86a8f0 ifitzpatrick/graphql-doc.el@d37140267e -> ifitzpatrick/graphql-doc.el@17755a2466 jart/disaster@16bba9afb9 -> jart/disaster@b20f8e1ef9 joaotavora/sly@ba40c8f054 -> joaotavora/sly@742355f755 jorgenschaefer/emacs-buttercup@a1a86b027f -> jorgenschaefer/emacs-buttercup@bf01a33f8b jrblevin/markdown-mode@8aab017f47 -> jrblevin/markdown-mode@6102ac5b73 jschaf/powershell.el@f2da15857e -> jschaf/powershell.el@38727f1cda jwiegley/emacs-async@f317b0c9c3 -> jwiegley/emacs-async@43f97d7e68 ledger/ledger-mode@b0e65f74a5 -> ledger/ledger-mode@a6be7a2d79 nonsequitur/inf-ruby@0cfe8b2fb1 -> nonsequitur/inf-ruby@b234625c85 ocaml/dune@96ed5fb42f -> ocaml/dune@a7924e322e ocaml/merlin@9fa77dbe81 -> ocaml/merlin@e016abfac6 oer/org-re-reveal@dbd8ffb3e5 -> oer/org-re-reveal@91610ba9b0 org-noter/org-noter@68646b685a -> org-noter/org-noter@6f292d7f1e org-roam/org-roam@8667e44187 -> org-roam/org-roam@0b9fcbc97b rust-lang/rust-mode@a529a45181 -> rust-lang/rust-mode@c87f6f82bd seagle0128/grip-mode@7c42b8f61d -> seagle0128/grip-mode@9adac9c989 technomancy/fennel-mode@a4ddd1750f -> technomancy/fennel-mode@f4bd34e1c3 From this point on, Org will be pinned to tagged releases.
:lang cc
Description unfold
This module adds support for the C-family of languages: C, C++, and Objective-C.
- Code completion (
company-irony
) - eldoc support (
irony-eldoc
) - Syntax-checking (
flycheck-irony
) - Code navigation (
rtags
) - File Templates (c-mode, c++-mode)
- Snippets (cc-mode, c-mode, c++-mode)
- Several improvements to C++11 indentation and syntax highlighting.
Maintainers
Module flags
- +lsp
-
Enable LSP support for
c-mode
,c++-mode
, andobjc-mode
. Requires [[doom-module::tools lsp]] and a langserver (supports ccls, clangd, and cquery). Replaces irony & rtags. - +tree-sitter
- Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.
Packages
- doom-package:cmake-mode
- doom-package:company-glsl
- doom-package:cuda-mode
- doom-package:demangle-mode
- doom-package:disaster
- doom-package:glsl-mode
- doom-package:modern-cpp-font-lock unless doom-module:+tree-sitter
- doom-package:opencl-mode
-
- doom-package:ccls if doom-module::tools lsp -eglot
-
else
- doom-package:company-irony
- doom-package:company-irony-c-headers
- doom-package:flycheck-irony
- doom-package:helm-rtags if doom-module::completion helm
- doom-package:irony
- doom-package:irony-eldoc
- doom-package:ivy-rtags if doom-module::completion ivy
- doom-package:rtags
Hacks
No hacks documented for this module.
TODO Changelog
This module does not have a changelog yet.
Installation
Enable this module in your doom!
block.
This module's requirements change depending on how you use it.
- If doom-module:+lsp is enabled, you need one of clangd v9+ or ccls.
- If doom-module:+lsp is not enabled, you need irony-server and rtags.
-
Other features in this module depend on:
- (optional) glslangValidator, for GLSL completion in
glsl-mode
- (optional) cmake, for code completion in
cmake-mode
- (optional) glslangValidator, for GLSL completion in
- You will need a C/C++ compiler, like
gcc
orclang
.
LSP servers
lsp-mode
and eglot
support a few LSP servers, but clangd
and ccls
are
recommended.
- clangd (must be v9 or newer)
-
clangd is included with
llvm
which should be available through your OS' package manager.-
Linux:
- Debian & Ubuntu:
$ apt-get install clangd
- Fedora & CentOS/RHEL 8+:
$ dnf install clang-tools-extra
- openSUSE:
$ zypper install clang
- Arch:
$ pacman -S clang
- Debian & Ubuntu:
-
BSDs:
- NetBSD & OpenBSD:
$ pkg_add clang-tools-extra
- NetBSD & OpenBSD:
- macOS:
$ brew install llvm
// 1GB+ installation! May take a while! - Windows: use the win64 installer from LLVM's GitHub release page.
-
- ccls
- Available in many OS' package managers as
ccls
. Otherwise, there are alternative install methods listed in the project's wiki. - cmake-language-server
- available through
pip
on most distributions
irony-server
Irony powers the code completion, eldoc and syntax checking systems.
After installing its dependencies (Clang and CMake), run M-x
irony-install-server
in Emacs.
macOS
Due to linking issues, macOS users must compile irony-server manually:
brew install cmake
brew install llvm
git clone https://github.com/Sarcasm/irony-mode irony-mode
mkdir irony-mode/server/build
pushd irony-mode/server/build
DEST="$HOME/.emacs.d/.local/etc/irony-server/"
cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm \
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
-DCMAKE_INSTALL_PREFIX="$DEST" ../
cmake --build . --use-stderr --config Release --target install
install_name_tool -change @rpath/libclang.dylib \
/usr/local/opt/llvm/lib/libclang.dylib \
"$DEST/bin/irony-server"
# Cleanup
popd
rm -rf irony-mode
rtags
Code navigation requires an rtags server (rdm
) installed. This should be
available through your OS's package manager.
This module will auto-start rdm
when you open C/C++ buffers (so long as one
isn't already running). If you prefer to run it yourself:
rdm &
rc -J $PROJECT_ROOT # loads PROJECT_ROOT's compile_commands.json
:editor format
The formatter used is doom-executable:clang-format which should be installed alongside clang
.
For more info, see doom-module::editor format.
TODO Usage
This module's usage documentation is incomplete. Complete it?
- Enable this module.
- Enable the
+lsp
flag for the appropriate modules you want LSP support for (e.g.:lang (python +lsp)
or:lang (rust +lsp)
), - Install the prerequisite LSP servers through your package manager or other means. You can find a list of supported servers on the lsp-mode project page.
- Run
$ doom sync
on the command line and restart Emacs.
Eglot-specific bindings
When using doom-module:+lsp and doom-module::tools lsp +eglot, doom-package:lsp-mode is replaced with doom-package:eglot, and an additional function to get inheritance type hierarchy is added:
Binding | Description |
---|---|
<localleader> c t | Display inheritance type hierarchy (upwards) |
<prefix> <localleader> c t | Display inheritance type hierarchy (downwards) |
TODO Configure
This module's configuration documentation is incomplete. Complete it?
Project compile settings
By default, a set of default compile settings are defined in
+cc-default-compiler-options
for C, C++ and Objective C. Irony, rtags and
flycheck will fall back to these. This variable does nothing for LSP users.
For a more universal solution: both LSP servers and irony will recognize a
compilation database (a compile_commands.json
file). There are many ways to
generate one. Here is an example using CMake and bear:
# For CMake projects
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
# For non-CMake projects
make clean
bear make
Use M-x +cc/reload-compile-db
to reload your compile db in an already-open
C/C++/ObjC buffer.
Known issues with bear on macOS
MacOS' System Integrity Protection (SIP) might interfere with bear if make
is
under /usr/bin/
which results in an empty compilation database.
From the bear readme:
Security extension/modes on different operating systems might disable library preloads. This case Bear behaves normally, but the result compilation database will be empty. (Please make sure it's not the case when reporting bugs.) Notable examples for enabled security modes are: OS X 10.11 (check with csrutil status | grep 'System Integrity Protection'), and Fedora, CentOS, RHEL (check with sestatus | grep 'SELinux status').
Workaround could be to disable the security feature while running Bear. (This might involve reboot of your computer, so might be heavy workaround.) Another option if the build tool is not installed under certain directories. Or use tools which are using compiler wrappers. (It injects a fake compiler which does record the compiler invocation and calls the real compiler too.) An example for such tool might be scan-build. The build system shall respect CC and CXX environment variables.
A workaround might be to install make
via Homebrew which puts gmake
under
/usr/local/
:
brew install make
make clean
bear gmake
Additional info:
Configure LSP servers
Search for your combination of (LSP client package, LSP server)
. You are using
doom-package:lsp-mode by default, doom-package:eglot if you have doom-module::tools lsp +eglot active in
$DOOMDIR/init.el
file.
LSP-mode with clangd
(after! lsp-clangd
(setq lsp-clients-clangd-args
'("-j=3"
"--background-index"
"--clang-tidy"
"--completion-style=detailed"
"--header-insertion=never"
"--header-insertion-decorators=0"))
(set-lsp-priority! 'clangd 2))
This will both set your clangd flags and choose clangd
as the default LSP
server everywhere clangd can be used.
LSP-mode with ccls
(after! ccls
(setq ccls-initialization-options '(:index (:comments 2) :completion (:detailedLabel t)))
(set-lsp-priority! 'ccls 2)) ; optional as ccls is the default in Doom
This will both set your ccls flags and choose ccls as the default server. CCLS
documentation lists available options, use t
for true
, :json-false
for
false
, and :json-null
for null
.
Eglot with clangd
(set-eglot-client! 'cc-mode '("clangd" "-j=3" "--clang-tidy"))
This will both set your clangd flags and choose clangd as the default server (if
it is the last set-eglot-client! 'cc-mode
in your config).
Eglot with ccls
(set-eglot-client! 'cc-mode '("ccls" "--init={\"index\": {\"threads\": 3}}"))
This will both set your ccls flags and choose ccls as the default server (if it
is the last set-eglot-client! 'cc-mode
in your config). CCLS documentation
lists available options
Troubleshooting
There are no known problems with this module. Report one?
Frequently asked questions
This module has no FAQs yet. Ask one?
TODO Appendix
This module has no appendix yet. Write one?