#+TITLE: Contribution guidelines Spacemacs is a volunteer effort. We encourage you to pitch in. The community makes Spacemacs what it is. We have a few guidelines, which we ask all contributors to follow. You can only consider reading the sections relevant to what you are going to do or just watch this video [[https://www.youtube.com/watch?v=OMS-3Jl05mE&feature=youtu.be&list=PLpr9V-R8ZxiCHMl2_dn1Fovcd34Oz45sua][here]]: - [[#asking-for-help][Asking for help]] if you are about to open an issue to ask a question. - [[#reporting-issues][Reporting issues]] if you are about to open a new issue. - [[#contributing-code][Contributing code]] if you are about to send a PR. - [[https://github.com/syl20bnr/spacemacs/blob/develop/CONTRIBUTING.org#reviewing-pull-requests][Reviewing Pull Requests]] if you are about to review a PR. Thanks! :heart: :heart: :heart: * Table of Contents :TOC_5_gh:noexport: - [[#asking-for-help][Asking for help]] - [[#reporting-issues][Reporting issues]] - [[#contributing-code][Contributing code]] - [[#general-contribution-guidelines][General contribution guidelines]] - [[#license][License]] - [[#conventions][Conventions]] - [[#changelog-entry][Changelog entry]] - [[#pull-request][Pull Request]] - [[#ideally-for-simple-prs-most-of-them][Ideally for /simple/ PRs (most of them):]] - [[#for-complex-prs-big-refactoring-etc][For complex PRs (big refactoring, etc):]] - [[#commit-messages][Commit messages]] - [[#contributing-a-layer][Contributing a layer]] - [[#file-header][File header]] - [[#author-of-a-new-layer][Author of a new layer]] - [[#readmeorg-tags][README.org tags]] - [[#contributor-to-an-existing-layer][Contributor to an existing layer]] - [[#contributing-a-key-binding][Contributing a key binding]] - [[#contributing-a-banner][Contributing a banner]] - [[#reviewing-pull-requests][Reviewing Pull Requests]] - [[#using-magit-to-quickly-test-prs][Using Magit to quickly test PRs]] - [[#additional-information][Additional information]] - [[#testing][Testing]] - [[#credits][Credits]] * Asking for help If you want to ask an usage question, be sure to look first into some places as it may hold the answer: - [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/FAQ.org][The FAQ]]. Some of the most frequently asked questions are answered there. - [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/DOCUMENTATION.org][The documentation]]. It's the general documentation of Spacemacs. - You may also read the =README.org= of the [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/LAYERS.org][relevant layer(s)]]. If your question is not answered there, then please come into our [[https://gitter.im/syl20bnr/spacemacs][gitter chat]] to discuss it with us :relaxed:. We will direct you to a solution, or ask you to open an issue if it is needed. * Reporting issues Issues have to be reported on our [[https://github.com/syl20bnr/spacemacs/issues][issues tracker]]. Please: - Check that the issue has not already been reported. - This can be achieved by searching keywords on the [[https://github.com/syl20bnr/spacemacs/issues][issues tracker]]. - Check that the issue has not been fixed in the =develop= version of Spacemacs. - This can be achieved by running Spacemacs on the =develop= branch and trying to reproduce the bug here. You can also check at the [[https://github.com/syl20bnr/spacemacs/tree/develop][source code]] to see if it has been changed/corrected. - Try to use a clear title, and describe your problem with complete sentences. See also [[https://github.com/syl20bnr/spacemacs/wiki/Debugging#how-to-make-a-great-bug-report][How to make a great bug report]] in the wiki. - Include the following information in your issue: - The output of =SPC h d s= (=M-m h d s= in Emacs style), which gives the versions information about your installation. - If relevant, include the mode in which the problem arise (e.g. javascript files, =org-mode=, etc…). - If possible, try to include details on how to reproduce it, like a step by step guide. * Contributing code Code contributions are welcome. Please read the following sections carefully. In any case, feel free to join us on the [[https://gitter.im/syl20bnr/spacemacs][gitter chat]] to ask questions about contributing! ** General contribution guidelines *** License The license is =GPLv3= for all parts specific to Spacemacs, this includes: - The initialization and core files - All the layer files. For files not belonging to Spacemacs like local packages and libraries, refer to the header file. Those files should not have an empty header, we may not accept code without a proper header file. *** Conventions Spacemacs is based on conventions, mainly for naming functions, keybindings definition and writing documentation. Please read the [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/CONVENTIONS.org][CONVENTIONS.org]] file before your first contribution to get to know them. *** Changelog entry Add a short entry describing your proposed change under a suitable subheading in [[https://github.com/syl20bnr/spacemacs/blob/develop/CHANGELOG.develop][CHANGELOG.develop]]. Use the previous entries and [[https://github.com/syl20bnr/spacemacs/blob/develop/CONTRIBUTING.org#commit-messages][commit messages instructions]] as guidelines. You can add your name or github username in parentheses at the end of the entry if you want to. If an entry already exists describing your PR (small documentation improvements etc.), you can omit the changelog entry or add your name at the end of the pre-existing one. *** Pull Request Submit your contribution against the =develop= branch. You should not use your =master= branch to modify Spacemacs, this branch is considered to be read-only. You may want to [[https://github.com/syl20bnr/spacemacs/wiki/Beginner%27s-Guide-to-Contributing-a-Pull-Request-to-Spacemacs][read our beginner's guide for Pull Requests]]. /PR = Pull Request/ **** Ideally for /simple/ PRs (most of them): - Branch from =develop= - One topic per PR - One commit per PR - If you have several commits on different topics, close the PR and create one PR per topic - If you still have several commits, squash them into only one commit ([[https://github.com/syl20bnr/spacemacs/pull/13381#pullrequestreview-380313280][here's a guide]]) - Rebase your PR branch on top of upstream =develop= before submitting the PR Those PRs are usually /cherry-picked/. **** For complex PRs (big refactoring, etc): - Squash only the commits with uninteresting changes like typos, syntax fixes, etc... and keep the important and /isolated/ steps in different commits. Those PRs are /merged/ and explicitly /not fast-forwarded/. *** Commit messages Write commit messages according to adapted [[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html][Tim Pope's guidelines]]: - Use present tense and write in the imperative: "Fix bug", not "fixed bug" or "fixes bug". - Start with a capitalized, short (72 characters or less) summary, followed by a blank line. - If necessary, add one or more paragraphs with details, wrapped at 72 characters. - Separate paragraphs by blank lines. This is a model commit message: #+BEGIN_EXAMPLE Capitalized, short (72 chars or less) summary More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as the subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you omit the body entirely); tools like rebase can get confused if you run the two together. Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert. Further paragraphs come after blank lines. - Bullet points are okay, too - Typically a hyphen or asterisk is used for the bullet, followed by a single space, with blank lines in between, but conventions vary here - Use a hanging indent #+END_EXAMPLE [[https://github.com/magit/magit/][Git Commit]] and [[https://github.com/magit/magit/][Magit]] provide Emacs mode for Git commit messages, which helps you to comply to these guidelines. ** Contributing a layer Please read the [[https://github.com/syl20bnr/spacemacs/blob/develop/doc/LAYERS.org][layers documentation]] first. It is recommended to use the =configuration-layer/create-layer= command in order to create a layer, as it will take care of using the files templates and will also create the file headers correctly. Contributed configuration layers are stored in the =layers/= folder. The =layers/= folder also contains categories prefixed with =+= to put your layers in. For example a layer for a language would go in the =layers/+lang/= folder. Layer with no associated configuration will be rejected. For instance a layer with just a package and a hook can be easily replaced by the usage of the variable =dotspacemacs-additional-packages=. *** File header The file header for =elisp= files should look like the following template: #+BEGIN_EXAMPLE ;;; FILENAME --- NAME Layer File for Spacemacs ;; ;; Copyright (c) 2012- Sylvain Benner & Contributors ;; ;; Author: YOUR_NAME ;; URL: https://github.com/syl20bnr/spacemacs ;; ;; This file is not part of GNU Emacs. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . #+END_EXAMPLE You should replace =FILENAME= by the name of the file (e.g. =packages.el=), and =NAME= by the name of the layer you are creating. =TYPE= should match the =FILENAME= (e.g. =funcs= for =funcs.el=). Don't forget to replace =YEAR=, =YOUR_NAME=, and =YOUR_EMAIL= also. Some files already have a template inside =core/templates/=, so look in there first. Note that if you use =configuration-layer/create-layer=, Spacemacs will prepare files and headers for you, and for free :smile: ! *** Author of a new layer In the files header, change the default author name (=Sylvain Benner=) to your name. **** README.org tags Every README.org file of a layer should have =#+TAGS:= line: #+BEGIN_EXAMPLE #+TITLE: My layer #+TAGS: layer|web service * Table of Contents :TOC_5_gh:noexport: ... #+END_EXAMPLE Individual tags are separated with "|" character. Example above has 2 tags: "layer" and "web service". Tags are listed in [[https://github.com/syl20bnr/spacemacs/blob/develop/.ci/spacedoc-cfg.edn][/.ci/spacedoc-cfg.edn]] configuration file. #+BEGIN_SRC clojure :spacetools.spacedoc.config/valid-tags {"chat" "Chats" ...