{"id":15010995,"url":"https://github.com/sarcasm/irony-mode","last_synced_at":"2025-04-09T04:04:47.941Z","repository":{"id":1739200,"uuid":"2564641","full_name":"Sarcasm/irony-mode","owner":"Sarcasm","description":"A C/C++ minor mode for Emacs powered by libclang","archived":false,"fork":false,"pushed_at":"2023-10-18T19:21:46.000Z","size":1215,"stargazers_count":914,"open_issues_count":170,"forks_count":97,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-09T04:04:36.085Z","etag":null,"topics":["clang","compilation-database","emacs","irony-mode","libclang"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sarcasm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-10-12T19:07:26.000Z","updated_at":"2025-04-02T09:42:22.000Z","dependencies_parsed_at":"2022-07-20T00:02:45.876Z","dependency_job_id":"d51522d7-f9b9-47bb-a34c-a656e6b83c0d","html_url":"https://github.com/Sarcasm/irony-mode","commit_stats":{"total_commits":488,"total_committers":47,"mean_commits":"10.382978723404255","dds":0.1598360655737705,"last_synced_commit":"870d1576fb279bb93f776a71e65f45283c423a9e"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sarcasm%2Firony-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sarcasm%2Firony-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sarcasm%2Firony-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sarcasm%2Firony-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sarcasm","download_url":"https://codeload.github.com/Sarcasm/irony-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974715,"owners_count":21026742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clang","compilation-database","emacs","irony-mode","libclang"],"created_at":"2024-09-24T19:38:15.258Z","updated_at":"2025-04-09T04:04:47.908Z","avatar_url":"https://github.com/Sarcasm.png","language":"Emacs Lisp","readme":"# Irony-Mode\n\n## A C/C++ minor mode powered by [libclang][libclang-ref]\n\n`irony-mode` is an Emacs minor-mode that aims at improving the editing\nexperience for the C, C++ and Objective-C languages. It works by using a\ncombination of an Emacs package and a C++ program (`irony-server`) exposing\n[libclang][libclang-ref].\n\n**Features:**\n\n* Code completion:\n  * With Emacs' built-in `completion-at-point-functions`\n  * With [company-mode][company-ref]'s backend: [company-irony][company-irony-ref]\n\n* Syntax checking:\n  * With [flycheck][flycheck-ref]'s checker: [flycheck-irony][flycheck-irony-ref]\n\n* `eldoc` integration: [irony-eldoc][irony-eldoc-ref]\n\n* [counsel][counsel-ref] integration: https://oremacs.com/2017/03/28/emacs-cpp-ide/\n\n## Dependencies\n\n### Elisp dependencies\n\nThese dependencies will be installed automatically when using the\n[standard installation](#installation) procedure described below.\n\n| Package              | Comment                                                                          |\n| -------------------- | -------------------------------------------------------------------------------- |\n| [cl-lib][cl-lib-ref] | Built-in since Emacs 24.3                                                        |\n| [json][json-el-ref]  | Built-in since Emacs 23.1                                                        |\n| [YASnippet][yas-ref] | Optional. May be used to provide post-completion expansion of function arguments |\n\n\n### Irony-Server prerequisites\n\n`irony-server` provides the [libclang][libclang-ref] interface to `irony-mode`.\nIt uses a simple protocol based on S-expression. This server, written in C++ and\nrequires the following packages to be installed on your system:\n\n* [CMake][cmake-ref] \u003e= 2.8.3\n* [libclang][libclang-ref]\n\n\n## Installation\n\nThe recommended way to install `irony-mode` and its dependencies is to use a\npackage manager.\n\n* Using [MELPA](https://melpa.org/#/)\n\n        M-x package-install RET irony RET\n\n* Using `apt` on Debian ≥10 and derivatives\n\n        sudo apt install elpa-irony\n\nExactly one package manager should manage `irony-mode`. If using apt,\nbut the MELPA package is desired, uninstall the version managed by\napt; Likewise, installing from both MELPA and `straight.el` may result\nin a state that requires a manual workaround.\n\n#### To install the latest Debian-supported `irony-mode ` and Clang\nThe [backports](https://backports.debian.org/) mechanism is the\nrecommended and officially supported method of accessing newer\nversions than `Debian stable` provides. For example on Debian 10 (buster):\n\n        sudo apt install -t buster-backports elpa-irony\n\nIf one requires a newer version of Clang/LLVM than the one provided in\nbackports, the following repository is available: [LLVM Debian/Ubuntu\nnightly packages.](https://apt.llvm.org) This unofficial repository is\nmaintained by Sylvestre Ledru, who is responsible for the official\nDebian package.  His repository also supports Ubuntu and derivatives.\nWhen using this unofficial repository, it is recommended to use the\n_MELPA package_ of irony-mode and to uninstall `elpa-irony`. Finally,\nwhen switching from apt to MELPA, the following action is required:\n`M-x irony-install-server RET`.\n\n\n## Configuration\n\n~~~el\n(add-hook 'c++-mode-hook 'irony-mode)\n(add-hook 'c-mode-hook 'irony-mode)\n(add-hook 'objc-mode-hook 'irony-mode)\n\n(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)\n~~~\n\n\n## Windows considerations\n\n`irony-mode` should work fine on Windows but there are some things to take care\nof first.\n\n* `libclang.dll` is expected to be available in the `PATH` or in Emacs'\n  `exec-path`.\n\n* **Emacs \u003e= 24.4 is required.** A bug in previous versions makes irony\n  unuseable (Emacs bug #18420).\n\n* `w32-pipe-read-delay` default value of `50` should be changed.\n  This should not cause any issue on today's version of Windows.\n  The default value of `50` may be lowered in mainline Emacs in future versions,\n  until then, I suggest to set it to `0`.\n\n* `w32-pipe-buffer-size`, introduced by Emacs 25,\n  can be set to a larger value than the default to improve\n  `irony-server` communication performances\n  (c.f. https://github.com/Sarcasm/irony-mode/issues/321).\n  The variable to customize is `irony-server-w32-pipe-buffer-size`.\n\n\nWindows configuration tweaks to add to your Emacs configuration:\n\n```el\n;; Windows performance tweaks\n;;\n(when (boundp 'w32-pipe-read-delay)\n  (setq w32-pipe-read-delay 0))\n;; Set the buffer size to 64K on Windows (from the original 4K)\n(when (boundp 'w32-pipe-buffer-size)\n  (setq irony-server-w32-pipe-buffer-size (* 64 1024)))\n```\n\n\n## Usage\n\nOn the first run, `irony-mode` will ask you to build and install `irony-server`.\nTo do so, type `M-x irony-install-server RET`.\n\nTo tune `irony-mode`, use `customize`:\n\n\n    M-x customize-group RET irony RET\n\nIn order to provide context sensitive and accurate information, `irony-mode`\nneeds to know about the compiler flags used to parse the current buffer. The\nbest way to achieve this is to use a\n[Compilation Database](#compilation-database).\n\n\n## Compilation Database\n\nIn order to work correctly, `irony-mode` needs to know the compile flags.\n`irony-cdb` aims to provide *as automatic as possible* compile flags discovery,\nwith minimal user input.\n\nPlease refer to `irony-cdb-autosetup-compile-options` and\n`irony-cdb-compilation-databases`.\n\nRight now `irony-cdb` supports the following compilation databases:\n\n* [JSON Compilation Database][clang-compile-db-ref] - A JSON formatted file\n  generated by various build tools. The file is named `compile_commands.json`,\n  it lists the compile options associated to each file in the project.\n\n  * [CMake \u003e= 2.8.5][cmake-ref] will generate a compilation database in the\n    build directory when issuing the following command\n    `cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \u003c...\u003e`.\n\n  * [ninja \u003e= 1.2][ninja-ref] will generate a JSON Compilation Database when\n    using the `compdb` tool.\n\n  * [Bear][bear-ref] generates a JSON Compilation Database file by \"monitoring\"\n    the build of a project. The typical usage for a `make`-based project will be\n    `bear -- make -B`.\n\n* [.clang_complete][clang_complete-doc-ref] - A file at the root of your project\n  containing the compilation flags, one per line. This is compatible with the\n  with plugin [Rip-Rip/clang_complete][clang_complete-vim-ref]. If you want to\n  generate the `.clang_complete` automatically, take a look at the\n  [cc_args.py documentation][cc_args-py-doc-ref].\n\nMore detailed information on compilation database is available here:\n\n* https://sarcasm.github.io/notes/dev/compilation-database.html\n\n## FAQ\n\n__It's slow, why?__\n\nA bug in old version of Clang (at least '3.1-8') caused the completion to fail\non the standard library types. To eliminate this bug an optimisation has been\ndisabled in the parsing of a translation unit. This result in a slower parsing.\n\nThis only affect old versions of Clang (\u003c 3.2), it is suggested to update your\nlibclang installation if you want to take advantage of the optimizations.\n\n__libclang.so: cannot open shared object file...__\n\nCompiling `irony-server` succeed but you have the following message when you try\nto run the `irony-server` executable:\n\n    'irony-server: error while loading shared libraries: libclang.so: cannot open shared object file: No such file or directory\n\nWhen `libclang` is installed in a non-standard location (one that is missing\nfrom the path list of the dynamic loader, see *ld.so.conf*) you can tell CMake\nto use the [rpath][rpath-ref] when installing the target `irony-server`. To\nenable rpath in CMake use the following command:\n\n    cmake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \u003cargs...\u003e\n\nIf you're running OS X, you can also use `install_name_tool` to explicitly\ntell `irony-server` where an appropriate version of `libclang.dylib` lives.\nFor example, Homebrew (with `brew install llvm --with-clang`) will install\na `libclang.dylib` library at `/usr/local/opt/llvm/lib/libclang.dylib`;\nyou can instruct `irony-server` to use this with something like:\n\n    install_name_tool -change @rpath/libclang.dylib /usr/local/opt/llvm/lib/libclang.dylib irony-server\n\n[ac-irony-ref]: https://github.com/Sarcasm/ac-irony \"AC Irony\"\n[ac-ref]: https://github.com/auto-complete/auto-complete \"Auto Complete\"\n[bear-ref]: https://github.com/rizsotto/Bear \"Bear\"\n[cc_args-py-doc-ref]: https://github.com/Rip-Rip/clang_complete/blob/c8673142759b87316265eb0edd1f620196ec1fba/doc/clang_complete.txt#L270 \"cc_args.py documentation\"\n[cl-lib-ref]: http://elpa.gnu.org/packages/cl-lib.html \"cl-lib\"\n[clang-compile-db-ref]: http://clang.llvm.org/docs/JSONCompilationDatabase.html \"Clang: JSONCompilationDatabase\"\n[clang_complete-doc-ref]: https://github.com/Rip-Rip/clang_complete/blob/c8673142759b87316265eb0edd1f620196ec1fba/doc/clang_complete.txt#L55 \".clang_complete\"\n[clang_complete-vim-ref]: https://github.com/Rip-Rip/clang_complete \"clang_complete Vim plugin\"\n[cmake-ref]: http://www.cmake.org \"CMake\"\n[counsel-ref]: https://github.com/abo-abo/swiper#counsel \"Counsel on Github\"\n[company-irony-ref]: https://github.com/Sarcasm/company-irony \"Company Irony\"\n[company-ref]: https://github.com/company-mode/company-mode \"Company-Mode\"\n[flycheck-irony-ref]: https://github.com/Sarcasm/flycheck-irony \"Flycheck Irony\"\n[flycheck-ref]: http://www.flycheck.org \"Flycheck -- Modern Emacs syntax checking\"\n[irony-eldoc-ref]: https://github.com/ikirill/irony-eldoc \"irony-eldoc -- irony-mode support for eldoc-mode\"\n[json-el-ref]: http://edward.oconnor.cx/2006/03/json.el \"Introducing json.el\"\n[libclang-ref]: http://clang.llvm.org/doxygen/group__CINDEX.html \"libclang: C Interface to Clang\"\n[ninja-ref]: https://ninja-build.org \"Ninja\"\n[rpath-ref]: http://en.wikipedia.org/wiki/Rpath \"rpath Wikipedia article\"\n[yas-ref]: https://github.com/capitaomorte/yasnippet \"YASnippet\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarcasm%2Firony-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsarcasm%2Firony-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsarcasm%2Firony-mode/lists"}