2017-08-21 20:07:07 +02:00
#+TITLE : :lang cc
2017-05-04 10:40:51 +02:00
2017-05-25 20:08:50 +02:00
This module adds support for the C-family of languages: C, C++, and Objective-C.
2017-05-04 10:40:51 +02:00
2017-05-25 20:08:50 +02:00
+ Code completion (~company-irony~ )
+ eldoc support (~irony-eldoc~ )
+ Syntax-checking (~flycheck-irony~ )
+ Code navigation (~irony~ )
+ File Templates ([[../../feature/file-templates/templates/c-mode ][c-mode ]], [[../../feature/file-templates/templates/c++-mode ][c++-mode ]])
+ Snippets ([[https://github.com/hlissner/emacs-snippets/tree/master/cc-mode ][cc-mode ]], [[https://github.com/hlissner/emacs-snippets/tree/master/c-mode ][c-mode ]], [[https://github.com/hlissner/emacs-snippets/tree/master/c++-mode ][c++-mode ]])
2017-08-21 20:07:07 +02:00
+ Several improvements to C++11 indentation and syntax highlighting.
2017-05-04 10:40:51 +02:00
2017-05-25 20:08:50 +02:00
#+begin_quote
2017-08-21 20:07:07 +02:00
C contends with Haskell and Ruby for my favorite language. That said, it's more accurate to say I write C, but with two or three C++ features.
2017-05-04 10:40:51 +02:00
2017-05-25 20:08:50 +02:00
The module provides nominal support for Objective-C, which I really only use to inspect generated glue code for iOS mobile apps. Otherwise, I prefer Swift.
#+end_quote
2017-05-04 10:40:51 +02:00
2017-08-21 20:07:07 +02:00
* Table of Contents :TOC:
- [[#install ][Install ]]
- [[#macos ][MacOS ]]
- [[#arch-linux ][Arch Linux ]]
* Install
2017-05-25 20:08:50 +02:00
This module requires ~irony-server~ for most of its features, which depends on ~cmake~ and ~libclang~ .
2017-05-04 10:40:51 +02:00
2017-08-21 20:07:07 +02:00
** MacOS
2017-05-25 20:08:50 +02:00
Due to linking issues, MacOS users must compile irony-server manually:
2017-05-04 10:40:51 +02:00
#+BEGIN_SRC sh :tangle (if (doom-system-os 'macos) "yes")
2017-05-04 10:46:12 +02:00
brew install cmake
2017-05-25 20:08:50 +02:00
brew install llvm # 1gb+ installation! May take a while!
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/$(hostname)/etc/irony-server/ "
cmake -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
2017-05-04 10:46:12 +02:00
#+END_SRC
2017-08-21 20:07:07 +02:00
** Arch Linux
2017-05-04 10:46:12 +02:00
#+BEGIN_SRC sh :tangle (if (doom-system-os 'arch) "yes")
sudo pacman --needed --noconfirm -S clang cmake
2017-05-04 10:40:51 +02:00
#+END_SRC
2017-05-25 20:08:50 +02:00
Then run ~M-x irony-install-server~ in Emacs.
2017-08-21 20:07:07 +02:00