emacs.rst (4559B)
1 Emacs 2 ===== 3 4 ESLint 5 ------ 6 7 See `the devtools documentation <https://wiki.mozilla.org/DevTools/CodingStandards#Running_ESLint_in_Emacs>`__ 8 that describes how to integrate ESLint into Emacs. 9 10 C/C++ Development Packages 11 -------------------------- 12 13 General Guidelines to Emacs C++ Programming 14 ------------------------------------------- 15 16 The following guides give an overview of the C++ editing capabilities of emacs. 17 18 It is worth reading through these guides to see what features are available. 19 The rest of this section is dedicated to Mozilla/Gecko specific setup for 20 packages. 21 22 23 * `C/C++ Development Environment for Emacs <https://tuhdo.github.io/c-ide.html>`__ 24 * `Emacs as C++ IDE <https://syamajala.github.io/c-ide.html>`__ 25 26 rtags (LLVM/Clang-based Code Indexing) 27 -------------------------------------- 28 29 Instructions for the installation of rtags are available at the 30 `rtags github repo <https://github.com/Andersbakken/rtags>`__. 31 32 rtags requires a :ref:`compilation database <CompileDB back-end-compileflags>`. 33 34 In order for rtags to index correctly, included files need to be copied and 35 unified compilation files need to be created. Either run a full build of the 36 tree, or if you only want indexes to be generated for the moment, run the 37 following commands (assuming you're in the gecko repo root): 38 39 .. code:: 40 41 cd gecko_build_directory 42 make export 43 ./config.status 44 45 To increase indexing speed, it's best to remove unified build files and test 46 files from database updates. This can be done by creating a :code:`~/.rdmrc` 47 file with the following contents, with :code:`[src_dir]` replaced with either 48 the repo or build directory for your checkout: 49 50 .. code:: 51 52 -X */[src_dir]/*Unified*;*/[src_dir]/*/test/*;*/[src_dir]/*/tests/* 53 54 Once the rdm daemon is running, the compilation database can be added to rtags 55 like so: 56 57 .. code:: 58 59 rc -J [gecko_build_directory]/compile_commands.json 60 61 Note that this process will take a while initially. However, once the database 62 is built, it will only require incremental updates. As long as the rdm daemon 63 is running in the background, the database will be updated based on changes to 64 files. 65 66 irony (LLVM/Clang-based Code Completion) 67 ---------------------------------------- 68 69 Instructions on the installation of irony-mode are available at the 70 `irony-mode github repo <https://github.com/Sarcasm/irony-mode>`__. 71 72 irony-mode requires a :ref:`compilation database <CompileDB back-end-compileflags>`. 73 74 Note that irony-mode, by default, uses elisp to parse the 75 :code:`compile_commands.json` file. As gecko is a very large codebase, this 76 file can easily be multiple megabytes, which can make irony-mode take multiple 77 seconds to load on a gecko file. 78 79 It is recommended to use `this fork of irony-mode <https://github.com/Hylen/irony-mode/tree/compilation-database-guessing-4-pull-request>`__, 80 which requires the boost System and Filesystem libraries. 81 82 `Checking the bug to get this patch into the mainline of irony-mode <https://github.com/Sarcasm/irony-mode/issues/176>`__ 83 is recommended, to see if the fork can be used or if the mainline repo can be 84 used. Using the Boost version of the irony-mode server brings file load times 85 to under 1s. 86 87 Projectile (Project Management) 88 ------------------------------- 89 90 Instructions on the installation of projectile are available at the 91 `projectile github repo <https://github.com/bbatsov/projectile>`__. 92 93 Projectile comes preconfigured for many project types. Since, gecko uses its 94 own special build system (mach), a new project type needs to be added. This can 95 be done via adding the following elisp configuration command to your emacs 96 configuration file. 97 98 .. code:: 99 100 (projectile-register-project-type 'gecko 101 '("mach" "moz.build") 102 "python mach --log-no-times build" 103 "python mach mochitest" 104 "python mach run") 105 106 Assuming projectile-global-mode is on, this will allow projectile to run the 107 correct commands whenever it is working in a gecko repo. 108 109 gdb 110 ^^^ 111 112 Emacs comes with great integration with gdb, especially when using 113 `gdb-many-windows <https://www.gnu.org/software/emacs/manual/html_node/emacs/GDB-User-Interface-Layout.html>`__. 114 115 However, when gdb is invoked via mach, some special arguments 116 need to be passed in order to make sure the correct display mode is used. To 117 use M-x gdb with mach on firefox, use the following command: 118 119 .. code:: 120 121 gecko_repo_directory/mach run --debug --debugparams=-i=mi