All Projects → Sarcasm → Irony Mode

Sarcasm / Irony Mode

Licence: gpl-3.0
A C/C++ minor mode for Emacs powered by libclang

Projects that are alternatives of or similar to Irony Mode

Cmake Ide
Use Emacs as a C/C++ IDE
Stars: ✭ 661 (-22.33%)
Mutual labels:  clang, libclang, emacs
Color coded
A vim plugin for libclang-based highlighting of C, C++, ObjC
Stars: ✭ 841 (-1.18%)
Mutual labels:  clang, libclang
Deoplete Clang
deoplete.nvim source for C/C++/Obj-C/Obj-C++ with clang-python3
Stars: ✭ 186 (-78.14%)
Mutual labels:  clang, libclang
Dstep
A tool for converting C and Objective-C headers to D modules
Stars: ✭ 177 (-79.2%)
Mutual labels:  clang, libclang
Dpp
Directly include C headers in D source code
Stars: ✭ 189 (-77.79%)
Mutual labels:  clang, libclang
Cppast.net
CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
Stars: ✭ 228 (-73.21%)
Mutual labels:  clang, libclang
cxxd
C/C++ language server implemented on top of Clang frontend.
Stars: ✭ 145 (-82.96%)
Mutual labels:  libclang, clang
bootstrap
Bootstrap Go bindings for Clang's C API
Stars: ✭ 18 (-97.88%)
Mutual labels:  libclang, clang
Easyclangcomplete
💥 Robust C/C++ code completion for Sublime Text 3
Stars: ✭ 537 (-36.9%)
Mutual labels:  clang, libclang
Cxxhttp
Asynchronous, Header-only C++ HTTP-over-(TCP|UNIX Socket|STDIO) Library
Stars: ✭ 24 (-97.18%)
Mutual labels:  clang
Vim Clang Format
Vim plugin for clang-format, a formatter for C, C++, Obj-C, Java, JavaScript, TypeScript and ProtoBuf.
Stars: ✭ 837 (-1.65%)
Mutual labels:  clang
Char Menu
Create your own menu for fast insertion of arbitrary symbols
Stars: ✭ 19 (-97.77%)
Mutual labels:  emacs
Emacs Slack
slack client for emacs
Stars: ✭ 928 (+9.05%)
Mutual labels:  emacs
Emacs Anywhere
Configurable automation + hooks called with application information
Stars: ✭ 917 (+7.76%)
Mutual labels:  emacs
.emacs.d
bdd's Emacs configuration, split from bdd/.dotfiles/emacs directory.
Stars: ✭ 8 (-99.06%)
Mutual labels:  emacs
Pfr
std::tuple like methods for user defined types without any macro or boilerplate code
Stars: ✭ 896 (+5.29%)
Mutual labels:  clang
Jucipp
A lightweight & cross-platform IDE supporting the most recent C++ standards. This project has moved to https://gitlab.com/cppit/jucipp.
Stars: ✭ 887 (+4.23%)
Mutual labels:  libclang
Dakrone Light Theme
Dakrone's custom light Emacs theme
Stars: ✭ 9 (-98.94%)
Mutual labels:  emacs
Clif
Binding generator to wrap C++ for Python using LLVM.
Stars: ✭ 845 (-0.71%)
Mutual labels:  clang
Perfect Margin
[emacs] auto center emacs windows, work with minimap and/or linum-mode
Stars: ✭ 26 (-96.94%)
Mutual labels:  emacs

Irony-Mode

A C/C++ minor mode powered by libclang

irony-mode is an Emacs minor-mode that aims at improving the editing experience for the C, C++ and Objective-C languages. It works by using a combination of an Emacs package and a C++ program (irony-server) exposing libclang.

Features:

Dependencies

Elisp dependencies

These dependencies will be installed automatically when using the standard installation procedure described below.

Package Comment
cl-lib Built-in since Emacs 24.3
json Built-in since Emacs 23.1
YASnippet Optional. May be used to provide post-completion expansion of function arguments

Irony-Server prerequisites

irony-server provides the libclang interface to irony-mode. It uses a simple protocol based on S-expression. This server, written in C++ and requires the following packages to be installed on your system:

Installation

The recommended way to install irony-mode and its dependencies is to use a package manager.

  • Using MELPA

      M-x package-install RET irony RET
    
  • Using apt on Debian ≥10 and derivatives

      sudo apt install elpa-irony
    

Accessing a newer Clang and LLVM Toolchain on Debian and derivatives

The backports mechanism is the recommended and officially supported method of accessing newer versions than Debian stable provides.

    sudo apt install -t $release_name-backports elpa-irony

If the llvm-toolchain backport is not new enough please use the following repository: LLVM Debian/Ubuntu nightly packages. This repository is maintained by Sylvestre Ledru, who is responsible for the official Debian package. His repository also supports Ubuntu and derivatives. When using this unofficial repository the MELPA package of irony-mode should be used in preference to the elpa-irony package.

Configuration

(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)

(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

Windows considerations

irony-mode should work fine on Windows but there are some things to take care of first.

  • libclang.dll is expected to be available in the PATH or in Emacs' exec-path.

  • Emacs >= 24.4 is required. A bug in previous versions makes irony unuseable (Emacs bug #18420).

  • w32-pipe-read-delay default value of 50 should be changed. This should not cause any issue on today's version of Windows. The default value of 50 may be lowered in mainline Emacs in future versions, until then, I suggest to set it to 0.

  • w32-pipe-buffer-size, introduced by Emacs 25, can be set to a larger value than the default to improve irony-server communication performances (c.f. https://github.com/Sarcasm/irony-mode/issues/321). The variable to customize is irony-server-w32-pipe-buffer-size.

Windows configuration tweaks to add to your Emacs configuration:

;; Windows performance tweaks
;;
(when (boundp 'w32-pipe-read-delay)
  (setq w32-pipe-read-delay 0))
;; Set the buffer size to 64K on Windows (from the original 4K)
(when (boundp 'w32-pipe-buffer-size)
  (setq irony-server-w32-pipe-buffer-size (* 64 1024)))

Usage

On the first run, irony-mode will ask you to build and install irony-server. To do so, type M-x irony-install-server RET.

To tune irony-mode, use customize:

M-x customize-group RET irony RET

In order to provide context sensitive and accurate information, irony-mode needs to know about the compiler flags used to parse the current buffer. The best way to achieve this is to use a Compilation Database.

Compilation Database

In order to work correctly, irony-mode needs to know the compile flags. irony-cdb aims to provide as automatic as possible compile flags discovery, with minimal user input.

Please refer to irony-cdb-autosetup-compile-options and irony-cdb-compilation-databases.

Right now irony-cdb supports the following compilation databases:

  • JSON Compilation Database - A JSON formatted file generated by various build tools. The file is named compile_commands.json, it lists the compile options associated to each file in the project.

    • CMake >= 2.8.5 will generate a compilation database in the build directory when issuing the following command cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON <...>.

    • ninja >= 1.2 will generate a JSON Compilation Database when using the compdb tool.

    • Bear generates a JSON Compilation Database file by "monitoring" the build of a project. The typical usage for a make-based project will be bear -- make -B.

  • .clang_complete - A file at the root of your project containing the compilation flags, one per line. This is compatible with the with plugin Rip-Rip/clang_complete. If you want to generate the .clang_complete automatically, take a look at the cc_args.py documentation.

More detailed information on compilation database is available here:

FAQ

It's slow, why?

A bug in old version of Clang (at least '3.1-8') caused the completion to fail on the standard library types. To eliminate this bug an optimisation has been disabled in the parsing of a translation unit. This result in a slower parsing.

This only affect old versions of Clang (< 3.2), it is suggested to update your libclang installation if you want to take advantage of the optimizations.

libclang.so: cannot open shared object file...

Compiling irony-server succeed but you have the following message when you try to run the irony-server executable:

'irony-server: error while loading shared libraries: libclang.so: cannot open shared object file: No such file or directory

When libclang is installed in a non-standard location (one that is missing from the path list of the dynamic loader, see ld.so.conf) you can tell CMake to use the rpath when installing the target irony-server. To enable rpath in CMake use the following command:

cmake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON <args...>

If you're running OS X, you can also use install_name_tool to explicitly tell irony-server where an appropriate version of libclang.dylib lives. For example, Homebrew (with brew install llvm --with-clang) will install a libclang.dylib library at /usr/local/opt/llvm/lib/libclang.dylib; you can instruct irony-server to use this with something like:

install_name_tool -change @rpath/libclang.dylib /usr/local/opt/llvm/lib/libclang.dylib irony-server
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].