{"id":21326677,"url":"https://github.com/jaypmorgan/cern-root-mode","last_synced_at":"2025-07-12T07:30:52.763Z","repository":{"id":39580378,"uuid":"479423547","full_name":"jaypmorgan/cern-root-mode","owner":"jaypmorgan","description":"Major-mode for ROOT and the Cling REPL in Emacs","archived":false,"fork":false,"pushed_at":"2024-04-11T13:55:26.000Z","size":622,"stargazers_count":11,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-11T15:09:38.091Z","etag":null,"topics":["cern-root","cpp","emacs","emacs-mode","repl","root-cern","terminal"],"latest_commit_sha":null,"homepage":"https://jaypmorgan.github.io/cern-root-mode/","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/jaypmorgan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-08T14:30:51.000Z","updated_at":"2023-12-06T12:55:17.000Z","dependencies_parsed_at":"2022-09-04T09:42:13.960Z","dependency_job_id":null,"html_url":"https://github.com/jaypmorgan/cern-root-mode","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaypmorgan%2Fcern-root-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaypmorgan%2Fcern-root-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaypmorgan%2Fcern-root-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaypmorgan%2Fcern-root-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaypmorgan","download_url":"https://codeload.github.com/jaypmorgan/cern-root-mode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225802630,"owners_count":17526452,"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":["cern-root","cpp","emacs","emacs-mode","repl","root-cern","terminal"],"created_at":"2024-11-21T21:10:39.542Z","updated_at":"2025-07-12T07:30:52.754Z","avatar_url":"https://github.com/jaypmorgan.png","language":"Emacs Lisp","readme":"# CERN-ROOT-mode\n\n[![MELPA](https://melpa.org/packages/cern-root-mode-badge.svg)](https://melpa.org/#/cern-root-mode)\n\nCERN-ROOT-mode is an Emacs major-mode for interacting with ROOT\n(https://root.cern/). Specifically, this package provides the\nfacilities to run the ROOT command line interface/REPL.\n\n![Example demonstration](./docs/images/brief-example.gif)\n\n## Installation \u0026 Configuration\n\nYou can install the package from\n[melpa](https://melpa.org/#/cern-root-mode), or use straight.el and\ndownload the package directly from this github repository. Here is one\nexample of installing/configuring the package with straight.el:\n\n```lisp\n(use-package cern-root-mode\n  :bind (:map c++-mode-map\n\t     ((\"C-c C-c\" . cern-root-eval-defun)\n\t      (\"C-c C-b\" . cern-root-eval-buffer)\n\t      (\"C-c C-l\" . cern-root-eval-file)\n\t      (\"C-c C-r\" . cern-root-eval-region)))\n  :straight (cern-root-mode :type git :host github :repo \"jaypmorgan/cern-root-mode\")\n  :config\n  (setq cern-root-filepath \"/path/to/root\"))\n```\n\nThere are only a few variables provided by the package:\n\n| Variable                     | Type   | Default value       | Description                                                                                                                                                             |\n|------------------------------|--------|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `cern-root-filepath`         | string | `\"root\"`            | This is the absolute/relative path to the root executable. This could be left as the default \"root\" value if ROOT is available on your $PATH.                           |\n| `cern-root-command-option`   | string | `\"\"`                | These are the command line options used when starting ROOT. By default there are no options.                                                                            |\n| `cern-root-prompt-regex`     | string | `\"^\\\\[[0-9;^k]+m?\"` | This is the regular expression used to find the input prompt of the ROOT REPL. If there is a customised prompt, this will need to be updated to suit the customisation. |\n| `cern-root-buffer-name`      | string | `\"*ROOT*\"`          | What to call the ROOT repl buffer when it starts. This could be left as the default `*ROOT*`, but its there for you to modify as you please.                            |\n| `cern-root-terminal-backend` | symbol | `'terminal`         | The terminal emulator to run the ROOT instance in. There are only two current defined [`vterm`, `inferior`]. By default, the terminal.                                   |\n  \n## Using the package\n\nBelow is listed the various commands provided by the package.\n\n| Command                         | Description                                                                                                        |\n|:--------------------------------|:-------------------------------------------------------------------------------------------------------------------|\n| `cern-root-run`                      | Start the ROOT REPL in the same window.                                                                            |\n| `cern-root-run-other-window`         | Start the ROOT REPL in a different window.                                                                         |\n| `cern-root-switch-to-repl`           | Move the cursor to the ROOT REPL.                                                                                  |\n| `cern-root-eval-region`              | Evaluate a marked region in ROOT.                                                                                  |\n| `cern-root-eval-line`                | Evaluate this line in the REPL.                                                                                    |\n| `cern-root-eval-string`              | (non-interactive function) Evaluate a string in the REPL.                                                          |\n| `cern-root-eval-defun`               | Evaluate the current function in ROOT (current as defined by cursor position).                                     |\n| `cern-root-eval-defun-maybe`         | If the cursor is within a function declaration, then evaluate this function, else we'll evaluate this single line. |\n| `cern-root-eval-buffer`              | Evaluate the current buffer in ROOT.                                                                               |\n| `cern-root-eval-file`                | Evaluate a file (using the '.L' syntax), prompt for a file.                                                        |\n| `cern-root-change-working-directory` | Change the working directory of the root session, prompt for a directory.                                          |\n| `cern-root-list-input-history`       | List the previously input statements and for selection.                                                            |\n\n## Org-mode\n\nCERN-ROOT-mode provides the functionality to execute C++ source code blocks\nusing the ROOT REPL instead of the default C++ executable. This can\nmake the process of writing C++ in org-mode more fluid.\n\n![Example demonstration of evaluating in org-mode](./docs/images/org-mode-example.gif)\n\nTo write C++ code blocks that then are executed using ROOT, specify\n`cern-root` as the language in the `begin_src` header. For example:\n\n```\n#+begin_src cern-root\n// write your code here.\n#+end_src\n```\n\nUpon executing this code block (such as with `C-c C-c`), this code\nwill be executed in the ROOT REPL instead.\n\nCode can be written and re-used over multiple code blocks with the use\nof the `:session` argument (with an optional name). By providing this\nargument, a ROOT REPL instance will be created that can be used within\nthe context of many source blocks. For example, let's create another\ncode block with this session argument:\n\n```\n#+begin_src cern-root :session *my-root-session*\nvoid test() {\n\t// print something\n\tprintf(\"This is something\");\n}\n#+end_src\n```\n\nWhen we first run this code block, CERN-ROOT-mode will create a new\ninstance of the ROOT REPL in the buffer named '*my-root-session*' (you\ncan switch to this buffer if you want to interact directly outside of\nthe code blocks!). This means that, by specifying the same argument to\na different code block, we can call this `test` function.\n\n```\n#+begin_src cern-root :session *my-root-session*\ntest();  // call the test function\n#+end_src\n```\n\nThis gets us a long way to achieving the same functionality as `root\n--notebook`, but in Emacs.\n\n## Running tests\n\nTo test the functionality of the package, some unit tests have been\nstored in the `tests/` directory. To run these unit tests, you can\neither evaluate the specific buffer in Emacs and run `ert` (see\n\u003chttps://www.gnu.org/software/emacs/manual/html_node/ert/Running-Tests-Interactively.html\u003e\nfor more information), or you can them all from the command line\nusing the Makefile:\n\n```bash\nmake test\n```\n\n## Comparison with other tools\n\n- **inferior-cling**: https://github.com/brianqq/inferior-cling. This\n  package hasn't been updated in quite a while, and is light on\n  functionality.  CERN-ROOT-mode attempts to go beyond this to make the\n  process of interacting with the REPL more seamless.  There are also\n  other ongoing issues such as duplicated input\n  (https://root-forum.cern.ch/t/interactive-input-in-emacs-is-echoed-progressively/24113)\n  in dumb terminals (https://github.com/root-project/cling/pull/99)\n  which have yet to be merged in cling. CERN-ROOT-mode solves these\n  problems while we're waiting for the pull-request to be\n  accepted. CERN-ROOT-mode also aims to support org-babel to allow one to\n  execute C++ source code blocks from within an org-mode document.\n","funding_links":[],"categories":["Editor Plugins"],"sub_categories":["Emacs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaypmorgan%2Fcern-root-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaypmorgan%2Fcern-root-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaypmorgan%2Fcern-root-mode/lists"}