{"id":13621316,"url":"https://github.com/ethereum/emacs-solidity","last_synced_at":"2025-08-20T14:04:24.341Z","repository":{"id":24631267,"uuid":"28040436","full_name":"ethereum/emacs-solidity","owner":"ethereum","description":"The official solidity-mode for EMACS","archived":false,"fork":false,"pushed_at":"2023-06-28T16:37:20.000Z","size":166,"stargazers_count":208,"open_issues_count":14,"forks_count":67,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-06-04T17:13:25.069Z","etag":null,"topics":["emacs","emacs-lisp","emacs-mode","ethereum","solidity"],"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/ethereum.png","metadata":{"files":{"readme":"README.org","changelog":"changelog.MD","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-15T14:37:03.000Z","updated_at":"2025-05-15T11:27:18.000Z","dependencies_parsed_at":"2024-08-01T21:54:10.757Z","dependency_job_id":null,"html_url":"https://github.com/ethereum/emacs-solidity","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ethereum/emacs-solidity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Femacs-solidity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Femacs-solidity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Femacs-solidity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Femacs-solidity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethereum","download_url":"https://codeload.github.com/ethereum/emacs-solidity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethereum%2Femacs-solidity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271330292,"owners_count":24740815,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["emacs","emacs-lisp","emacs-mode","ethereum","solidity"],"created_at":"2024-08-01T21:01:04.631Z","updated_at":"2025-08-20T14:04:24.320Z","avatar_url":"https://github.com/ethereum.png","language":"Emacs Lisp","funding_links":[],"categories":["Editor Plugins","Emacs Lisp"],"sub_categories":[],"readme":"#+TITLE: Emacs Solidity Mode\n#+AUTHOR: Lefteris Karapetsas\n\n[[LICENSE][file:https://img.shields.io/badge/License-GPL%20v3-blue.svg]] [[http://melpa.org/#/solidity-mode][file:http://melpa.org/packages/solidity-mode-badge.svg]]\n\nA simple language mode for the Solidity language. It is a constant work in progress as the\n language itself also progresses. For information about Solidity check the [[https://github.com/ethereum/wiki/wiki/Solidity-Tutorial][Tutorial]] and the [[https://github.com/ethereum/wiki/wiki/Solidity-Features][Features]] \nwiki pages.\n\n\n* Installation\nYou can simply load the file in your emacs but the recommended way to install it is either via el-get or MELPA.\n\n** El-get\nIf you don't know how to use el-get you can find more information on its [[https://github.com/dimitri/el-get][webpage]]. First [[https://github.com/dimitri/el-get#basic-setup][install el-get]] and then (in emacs), press =Alt+x= (this is in emacs notation written as =M-x= ) and then type =el-get-install=. This will prompt you for a package, type =solidity-mode= and hit enter, this should install all you need.\n\n** Melpa\nYou can also obtain solidity-mode from [[http://melpa.org/#/][Melpa]] as can be seen [[http://melpa.org/#/solidity-mode][here]].\n\n1. Install melpa and make sure emacs is started with it.\n2. Press =Alt+x= (this is in emacs notation written as =M-x= ) and then type =package-refresh-contents=.\n3. Press =Alt+x= and then type =package-install=. This will prompt you for a package.\n3. type =solidity-mode= and hit enter, this should install all you need.\n\n* Configuration\nBy default solidity-mode associates itself with any files ending in =.sol=.\n\nIf using =el-get= then you should have a specific package initializing lisp file. If not then you can put these\nanywhere in your =init.el=.\n\n** Generic configuration\nRegardless of where you installed solidity mode from, you need to require the package:\n#+BEGIN_SRC lisp\n(require 'solidity-mode)\n#+END_SRC\n(append that line to your =~/.emacs= file)\n\nYou can also set the way the comments are inserted by emacs with commands like =comment-region=. The default is \n=/* .. */= and you can turn it to using =//= instead by putting the following into your emacs config:\n\n#+BEGIN_SRC lisp\n(setq solidity-comment-style 'slash)\n;; or\n(setq solidity-comment-style 'star) ;; this is the default\n#+END_SRC\n\n** Keymap\nYou can modify the default keybindings of the solidity mode keymap by adding\na new key combination for each command you want to change. For example\n\n#+BEGIN_SRC lisp\n(define-key solidity-mode-map (kbd \"C-c C-g\") 'solidity-estimate-gas-at-point)\n#+END_SRC\n\n** Interface with linters\n*** Provide path to solc binary\nThe =solc= binary is assumed to be part of the PATH. Wherever that is not the case you would have to manually\nset the location of the binary like below:\n#+BEGIN_SRC emacs-lisp\n(setq solidity-solc-path \"/home/lefteris/ew/cpp-ethereum/build/solc/solc\")\n#+END_SRC\n\nNote: This better be set before requiring solidity mode.\n\n*** Provide path to solium binary\nThe =solium= binary is assumed to be part of the user's =PATH=. If this is not the case\nthen set its location like below:\n#+BEGIN_SRC emacs-lisp\n(setq solidity-solium-path \"/home/lefteris/.npm-global/bin/solium\")\n#+END_SRC\n\n\n** [Optional] Flycheck interface\nSolidity mode can also interface with [[https://github.com/flycheck/flycheck][flycheck]] if you have it. Make sure to\ndownload and install the flycheck package. Then configure it to either work on\nall modes or enable it only for solidity mode.\n\nFlycheck can interface with solc and/or with [[http://solium.readthedocs.io/en/latest/][solium]]. We only support integration\nwith solium \u003e= =v0.2.0=\n\nYou have to specifically set the path\nto both executables and activate the checker integration by setting the following:\n\nTo activate flycheck you need the =solidity-flycheck= package and to add this in your\nemacs file:\n\n#+BEGIN_SRC emacs-lisp\n(require 'solidity-flycheck)\n#+END_SRC\n\nTo activate =solc= checker\n#+BEGIN_SRC emacs-lisp\n(setq solidity-flycheck-solc-checker-active t)\n#+END_SRC\n\nTo activate =solium= checker\n#+BEGIN_SRC emacs-lisp\n(setq solidity-flycheck-solium-checker-active t)\n#+END_SRC\n\n\nKeep in mind that you need to provide the path to either solc or solium unless\nemacs can already find it in your environment's =PATH=. Even if you can call it\nfrom the command line it does not mean that EMACS can see it as emacs may be started\nby systemd at which point =PATH= is not fully populated.\n\n*** Configuring solc checker\n\nYou can configure flycheck's solc invocation with the following arguments\n\n**** std contracts\nBy default this is false. If you want to include the standard contracts just add the following to your emacs init file\n\n#+BEGIN_SRC emacs-lisp\n(setq flycheck-solidity-solc-addstd-contracts t)\n#+END_SRC\n\n*** Configuring solium checker\nYou can configure flycheck's solium incocation with the following arguments\n\n**** solium RC file\nBy default solium looks at the current directory of the file you are editing in order to find =.soliumrc.json=. Having this\nfile is required. But you can point to an external configuration file by putting the following anywhere in your emacs init file.\n\n#+BEGIN_SRC emacs-lisp\n(setq flycheck-solidity-solium-soliumrcfile \"/home/path/to/common/.soliumrc.json\")\n#+END_SRC\n\n*** Chaining both checkers\nIf you enable both checkers then their results are chained. The variable =solidity-flycheck-chaining-error-level= controls\nhow they are chained. Its value can be either =t=, =error=, =warning= or =info= and that controls the maximum error level\nof the solc checker after which solium will not run. If =t= is given solium will always run. The default is =warning=, so\nif anything over than a warning is found in solc solium will not run.\n\n** [Optional] Autocompletion\nTo achieve solidity autcompletion you will need the  =company-solidity= package, a simple [[http://company-mode.github.io/][company-mode]] back-end for Solidity.\nTo use it make sure that company-mode is installed and then:\n\n#+BEGIN_SRC emacs-lisp\n(require 'company-solidity)\n#+END_SRC\n\n*** What it does\nGive completion suggestions for Solidity keywords, global variables, and address methods.\n\n*** What it isn't\nSmart. The completion suggestions are *not context dependent*.\n\n*** Something to watch out for\n=company-mode= treats =.= as the end of a word, and will cut off compeletion suggestions when you type a =.=. So, when you've typed =msg= you will get =msg.sender=, =msg.value= etc. as completion suggestions. However, as soon as you type =msg.=, the suggestions will disappear.\n\n*** Local Variables\nIf you want autocomplete suggestions to include local variables, in addition to Solidity keywords, add the following to your =init.el=:\n\n#+BEGIN_SRC emacs-lisp\n(add-hook 'solidity-mode-hook\n\t(lambda ()\n\t(set (make-local-variable 'company-backends)\n\t\t(append '((company-solidity company-capf company-dabbrev-code))\n\t\t\tcompany-backends))))\n#+END_SRC\n\n* Commands\n\n** Gas estimate of function under point\nYou can get an estimate of the function under the cursor, by placing the curson\non top of the function name and typing =C-c C-g=.\n\nThis will call =solidity-estimate-gas-at-point= and provide a max gas estimate,\nif possible, for the function.\n* Features\n+ Syntax highlighting\n+ Autocompletion\n+ Indentation\n+ On the fly syntax checking with flycheck\n+ Gas estimation for function under point\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Femacs-solidity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethereum%2Femacs-solidity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethereum%2Femacs-solidity/lists"}