git-subtree-dir: emacs.d
git-subtree-split: 664ba6ab2c
master
| @ -0,0 +1,4 @@ | |||||
| If you are posting about a *bug* please close this issue and open a new one | |||||
| using [SPC h I] or [M-m h I] (I = capital i) from within Spacemacs. If the | |||||
| bug makes Spacemacs unusable, you can find the bug report template [here](https://github.com/syl20bnr/spacemacs/blob/develop/core/templates/REPORTING.template) | |||||
| You can delete this message to start typing. | |||||
| @ -0,0 +1,7 @@ | |||||
| Thank you for contributing to Spacemacs! | |||||
| Before you submit this pull request, please ensure it is against the develop branch and not master. | |||||
| This message should be replaced with a description of your change. | |||||
| Thank you <3 | |||||
| @ -0,0 +1,53 @@ | |||||
| auto-save-list/ | |||||
| elpa/ | |||||
| export/ | |||||
| ac-comphist.dat | |||||
| eproject.lst | |||||
| .smex-items | |||||
| \#* | |||||
| .places | |||||
| .cache | |||||
| /eww-bookmarks | |||||
| eshell/history | |||||
| .emacs.desktop | |||||
| .emacs.desktop.lock | |||||
| eshell/alias | |||||
| eshell/lastdir | |||||
| /url/cookies | |||||
| my-org/ | |||||
| org-files/ | |||||
| semanticdb/ | |||||
| edts/ | |||||
| .recentf | |||||
| .recentf~ | |||||
| projectile.cache | |||||
| projectile-bookmarks.eld | |||||
| tramp | |||||
| elnode/ | |||||
| var/ | |||||
| crown/ | |||||
| *.stackdump | |||||
| bookmarks | |||||
| /.my-keybindings.el.swp | |||||
| .DS_Store | |||||
| tmp/ | |||||
| /history | |||||
| .python-environments/ | |||||
| server/ | |||||
| /network-security.data | |||||
| *.elc | |||||
| *.pyc | |||||
| /*.zip | |||||
| *.db | |||||
| python-*-docs-html | |||||
| /.cask/ | |||||
| /session.* | |||||
| /srecode-map.el | |||||
| /recentf | |||||
| # Private directory | |||||
| private/ | |||||
| !private/README.md | |||||
| !private/snippets/README.md | |||||
| !private/local/README.md | |||||
| /games/ | |||||
| @ -0,0 +1,10 @@ | |||||
| -/semanticdb | |||||
| -/url | |||||
| -/edts | |||||
| -/elpa | |||||
| -/.cache | |||||
| -ac-comphist.dat | |||||
| -.emacs.desktop | |||||
| -.emacs.desktop.lock | |||||
| -.smex-items | |||||
| -*.elc | |||||
| @ -0,0 +1,51 @@ | |||||
| #!/usr/bin/env bash | |||||
| ## run_build.sh --- Travis CI File for Spacemacs | |||||
| ## | |||||
| ## Copyright (c) 2012-2014 Sylvain Benner | |||||
| ## Copyright (c) 2014-2015 Sylvain Benner & Contributors | |||||
| ## | |||||
| ## Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ## URL: https://github.com/syl20bnr/spacemacs | |||||
| ## | |||||
| ## This file is not part of GNU Emacs. | |||||
| ## | |||||
| ## License: GPLv3 | |||||
| tests=("core") | |||||
| if [ $USER != "travis" ]; then | |||||
| echo "This script is not designed to run locally." | |||||
| echo "Instead, navigate to the appropriate test folder and run make there instead." | |||||
| exit 1 | |||||
| fi | |||||
| if [ $TRAVIS_SECURE_ENV_VARS = false ] && | |||||
| [ $TRAVIS_PULL_REQUEST != false ] && | |||||
| [ $TRAVIS_BRANCH = "master" ]; then | |||||
| printf '=%.0s' {1..70} | |||||
| printf "\n し(*・∀・)/ Thanks for the contribution! \(・∀・*)ノ\n" | |||||
| printf '=%.0s' {1..70} | |||||
| printf "\n( ^◡^)っ Please submit your pull request against the develop branch.\n" | |||||
| echo "You can read the contribution guidelines at:" | |||||
| echo "https://github.com/syl20bnr/spacemacs/blob/develop/CONTRIBUTING.org" | |||||
| exit 1 | |||||
| fi | |||||
| echo "Pwd $(pwd)" | |||||
| rm -rf ~/.emacs.d | |||||
| ln -sf `pwd` ~/.emacs.d | |||||
| for test in "${tests[@]}"; do | |||||
| rm -rf ~/.emacs.d/elpa | |||||
| rm -rf ~/.emacs.d/.cache | |||||
| rm -f ~/.spacemacs | |||||
| testdir=~/.emacs.d/tests/$test | |||||
| echo "Running '$test' in '$testdir' folder" | |||||
| if [ -f $testdir/dotspacemacs.el ]; then | |||||
| cp $testdir/dotspacemacs.el ~/.spacemacs | |||||
| fi | |||||
| cd $testdir && echo "Now in $(pwd)" | |||||
| make test || exit 2 | |||||
| done | |||||
| @ -0,0 +1,25 @@ | |||||
| language: generic | |||||
| sudo: false | |||||
| branches: | |||||
| only: | |||||
| - master | |||||
| - develop | |||||
| before_install: | |||||
| - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh | |||||
| - evm install $EVM_EMACS --use --skip | |||||
| env: | |||||
| - EVM_EMACS=emacs-24.4-travis | |||||
| - EVM_EMACS=emacs-24.5-travis | |||||
| - EVM_EMACS=emacs-git-snapshot-travis | |||||
| matrix: | |||||
| fast_finish: true | |||||
| allow_failures: | |||||
| env: | |||||
| - EVM_EMACS=emacs-git-snapshot-travis | |||||
| script: | |||||
| - ./.travis-build.sh | |||||
| @ -0,0 +1,111 @@ | |||||
| #+TITLE: Spacemacs Community | |||||
| * Spacemacs Community :TOC_4_gh:noexport: | |||||
| - [[#philosophy][Philosophy]] | |||||
| - [[#for-contributors][For Contributors]] | |||||
| - [[#for-users][For Users]] | |||||
| - [[#moderation][Moderation]] | |||||
| - [[#guidelines][Guidelines]] | |||||
| - [[#people][People]] | |||||
| - [[#issues][Issues]] | |||||
| - [[#pull-requests-and-commmits][Pull requests and Commmits]] | |||||
| - [[#messages][Messages]] | |||||
| - [[#interpretation][Interpretation]] | |||||
| - [[#collaborators-privacy][Collaborators privacy]] | |||||
| - [[#maintainer][Maintainer]] | |||||
| - [[#log][Log]] | |||||
| * Philosophy | |||||
| ** For Contributors | |||||
| - This community is a community of hackers based on meritocracy and | |||||
| volunteering. Hackers strive for excellence to make the world a better place, | |||||
| so does the Spacemacs community. | |||||
| - Be good in what you bring to the project be it code, documentation, typo | |||||
| fixes, art, humor, ideas, project management, web design, assurance quality, | |||||
| mentorship, you name it! We like to award achievements to people making a | |||||
| difference in a wide variety of domains and occasions, [[file:./doc/DOCUMENTATION.org#specials][see it for yourself]]. | |||||
| Why not you? Make it happen, make history! | |||||
| - Think you are not good enough? Find support and mentors by chatting on Gitter | |||||
| with fellow Spacemacs users or just open an issue on GitHub, you will find | |||||
| help to fulfil your desire of contribution. We welcome anyone with good | |||||
| intentions. | |||||
| - In a nutshell: Be good, positive and/or with good intentions and focused on | |||||
| the project. | |||||
| ** For Users | |||||
| - Any question related to the project is welcomed and encouraged, the worst | |||||
| thing that can happen is that we redirect you to the documentation. | |||||
| - The majority of the interactions with the community happens on GitHub via | |||||
| issues and on Gitter via the official Spacemacs channel. There is also an | |||||
| active official twitter account =spacemacs=. | |||||
| - Any opinion on the project is valorized given it is constructive. | |||||
| * Moderation | |||||
| We want the community to be judged based on its moderation actions instead of | |||||
| telling people how to behave. The golden rules of the community are to have good | |||||
| intentions and stay focused on the project, for anything else that requires | |||||
| moderation any future user or contributor can refer to this section to know | |||||
| about our past moderation actions. So readers won't find any example or | |||||
| definition of what collaborators judge offending or outrageous, instead they | |||||
| will find at the end of this section a log of all major moderation actions taken | |||||
| by the collaborators since the beginning of the project which started officially | |||||
| in August 2014. It should allow you to decide whether or not you want to be part | |||||
| of this community. If you are not convinced then be assured that the only evil | |||||
| part in Spacemacs is the evil mode :-) | |||||
| ** Guidelines | |||||
| These guidelines apply to all collaborators of the project, namely @syl20bnr, | |||||
| @TheBB, @d12frosted and @bmag. | |||||
| *** People | |||||
| - Collaborators cannot ban any GitHub user from the repository but they can ban | |||||
| users from the official Gitter channel. | |||||
| - A user can be banned if and only if all the collaborators agree to do so. | |||||
| - The reasons of the ban are mentioned in the moderation actions log (see | |||||
| below). | |||||
| *** Issues | |||||
| - Issues can be locked if their contents are judged _inappropriate_, _offending_ | |||||
| or if they deviate _dangerously_ from the project. | |||||
| *** Pull requests and Commmits | |||||
| - Collaborators can push to the repository without making a PR. | |||||
| - PR can be rejected. Rejected PR always go with a reason explicitly written | |||||
| when closing the PR. | |||||
| - Commits can be reverted if they compromise the stability of the project. The | |||||
| reason is contained in the commit comments. | |||||
| - Pull request are also issues, thus issue guidelines also apply to pull | |||||
| requests. | |||||
| *** Messages | |||||
| - Only the form of a message can be edited, not its meaning, except if this | |||||
| meaning is _outrageous_. | |||||
| - Moderators can add information to a message to improve its accuracy without | |||||
| altering its meaning, | |||||
| - Any edition of a message is logged in the =edits log= located at the end of | |||||
| the edited message with the following format: | |||||
| #+BEGIN_EXAMPLE | |||||
| EDIT: [@moderator] action (reason: xxx) | |||||
| #+END_EXAMPLE | |||||
| - The reason is added only when needed (for instance we won't add a reason for | |||||
| formatting edits) | |||||
| ** Interpretation | |||||
| Words used in these guidelines like _good_, _inappropriate_, _offending_, | |||||
| _dangerously_ and _outrageous_ are used without any explanation, their meanings | |||||
| and interpretations are left solely to the discretion of the collaborators who | |||||
| are educated persons working in the interest of the community. | |||||
| ** Collaborators privacy | |||||
| Life and actions of collaborators outside of the project (i.e. outside of the | |||||
| Spacemacs GitHub repository, official Spacemacs Gitter channels and Twitter | |||||
| official Spacemacs account timeline) are completely detached from their | |||||
| activities and roles in the project. They are free to express any opinion on the | |||||
| project or any other subjects and those opinions cannot be used to compromise | |||||
| their roles in the project as long as they follow the moderation guidelines with | |||||
| good intentions. | |||||
| ** Maintainer | |||||
| - The maintainer @syl20bnr as a BDFL is free to demote a collaborator in extreme | |||||
| situations. | |||||
| - When there is no consensus on a subject, the BDFL can decide to impose his | |||||
| view on the subject. | |||||
| ** Log | |||||
| For transparency and future reference any major moderation actions are recorded | |||||
| here. As of Sunday, April 10th 2016, 7200 issues have been opened and 2 major | |||||
| moderation actions have been taken: | |||||
| | Date | Moderator | Action | Issue | Reason | | |||||
| |------------+-----------+--------+-------+-----------------------------------------------------------------| | |||||
| | 2016/01/27 | syl20bnr | lock | #3484 | comments judged to be offending towards the Spacemacs community | | |||||
| | 2016/01/27 | syl20bnr | unlock | #3484 | let's make it happen, i.e. this document | | |||||
| @ -0,0 +1,256 @@ | |||||
| #+TITLE: Contribution guidelines | |||||
| #+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" /> | |||||
| 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: | |||||
| - [[#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 Pull-Request. | |||||
| Thanks! :heart: :heart: :heart: | |||||
| * Content :TOC@2:noexport: | |||||
| - [[#asking-for-help][Asking for help]] | |||||
| - [[#reporting-issues][Reporting issues]] | |||||
| - [[#contributing-code][Contributing code]] | |||||
| - [[#general-contribution-guidelines][General contribution guidelines]] | |||||
| - [[#contributing-a-layer][Contributing a layer]] | |||||
| - [[#contributing-a-keybinding][Contributing a keybinding]] | |||||
| - [[#contributing-a-banner][Contributing a banner]] | |||||
| - [[#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: | |||||
| - [[doc/FAQ.org][The FAQ]]. Some of the most frequently asked questions are answered there. | |||||
| - [[doc/DOCUMENTATION.org][The documentation]]. It's the general documentation of Spacemacs. | |||||
| - You may also read the =README.org= of the [[layers/][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 [[file:doc/CONVENTIONS.org][CONVENTIONS.org]] file | |||||
| before your first contribution to get to know them. | |||||
| *** 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 | |||||
| - 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 [[file: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 packages File for Spacemacs | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: YOUR_NAME <YOUR_EMAIL> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| #+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, don't forget to replace | |||||
| =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. | |||||
| *** Contributor to an existing layer | |||||
| If you are contributing to an already existing layer, you should not modify any | |||||
| header file. | |||||
| ** Contributing a keybinding | |||||
| Keybindings are an important part of spacemacs. | |||||
| First if you want to have some personal keybindings, you can freely bind them | |||||
| inside the ~SPC o~ and ~SPC m o~ prefixes which are reserved for the user. This | |||||
| can be done from the =dotspacemacs/user-config= function of your =.spacemacs= | |||||
| file and don't require any contribution to Spacemacs. | |||||
| If you think it worth contributing a new key bindings then be sure to read | |||||
| the [[doc/CONVENTIONS.org][CONVENTIONS.org]] file to find the best key bindings, then create a | |||||
| Pull-Request with your changes. | |||||
| *ALWAYS* document your new keybindings or keybindings changes inside the | |||||
| relevant documentation file. It should be the layer's =README.org= file for | |||||
| layer's keybindings, or =DOCUMENTATION.org= for general Spacemacs key | |||||
| bindings. | |||||
| ** Contributing a banner | |||||
| The startup banner is by default the Spacemacs logo but there are also ASCII | |||||
| banners available in the directory =core/banners/=. | |||||
| If you have some ASCII skills you can submit your artwork! | |||||
| You are free to choose a reasonable height size but the width size should be | |||||
| around 75 characters. | |||||
| * Additional information | |||||
| ** Testing | |||||
| Tests live in the =tests/= folder, with a folder structure corresponding to the | |||||
| rest of the repository. | |||||
| To run tests locally, navigate to the relevant subfolder and run =make=. | |||||
| Spacemacs uses Travis CI to perform more comprehensive testing, where each | |||||
| testable layer is enabled in turn. | |||||
| To add tests for a layer, do the following: | |||||
| 1. Create a subfolder of =tests/= corresponding to the layer you want to test. | |||||
| 2. Write a file called =dotspacemacs.el= in that folder. It should be a minimal | |||||
| dotfile that enables the layer in question (and other layers it may depend | |||||
| on). | |||||
| 3. Write a number of files with tests. Please try to separate unit and | |||||
| functional tests. Look at existing tests for clues. | |||||
| 4. Write a =Makefile= in that folder. It should define three variables. | |||||
| - =LOAD_FILES= :: a list of additional files to load before testing (relative | |||||
| to the root Spacemacs folder). This should typically be =init.el=. | |||||
| - =UNIT_TEST_FILES= :: a list of unit test files in the current folder. | |||||
| - =FUNC_TEST_FILES= :: a list of functional test files in the current folder. | |||||
| See existing tests for examples. | |||||
| #+begin_src makefile | |||||
| TEST_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | |||||
| LOAD_FILES = ... | |||||
| UNIT_TEST_FILES = ... | |||||
| FUNC_TEST_FILES = ... | |||||
| include ../../spacemacs.mk | |||||
| #+end_src | |||||
| 5. Add the new test to list of tests in =travis/run_build.sh=. | |||||
| * Credits | |||||
| This =CONTRIBUTING.org= file is partially based on the [[https://github.com/rails/rails/blob/master/CONTRIBUTING.md][Rails Contribution | |||||
| guidelines]] and [[https://github.com/flycheck/flycheck/blob/master/CONTRIBUTING.md][Flycheck Contribution guidelines]]. | |||||
| @ -0,0 +1,455 @@ | |||||
| <a name="top"></a> | |||||
| <a href="http://spacemacs.org"><img src="https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg" alt="Made with Spacemacs"></a><a href="http://www.twitter.com/spacemacs"><img src="http://i.imgur.com/tXSoThF.png" alt="Twitter" align="right"></a><br> | |||||
| *** | |||||
| <p align="center"><img src="/doc/img/title2.png" alt="Spacemacs"/></p> | |||||
| <p align="center"> | |||||
| <b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline5">philosophy</a></b> | |||||
| | | |||||
| <b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline8">for whom?</a></b> | |||||
| | | |||||
| <b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline7">screenshots</a></b> | |||||
| | | |||||
| <b><a href="http://spacemacs.org/doc/DOCUMENTATION.html">documentation</a></b> | |||||
| | | |||||
| <b><a href="CONTRIBUTING.org">contribute</a></b> | |||||
| | | |||||
| <b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline187">achievements</a></b> | |||||
| | | |||||
| <b><a href="http://spacemacs.org/doc/FAQ">FAQ</a></b> | |||||
| </p> | |||||
| *** | |||||
| <p align="center"> | |||||
| <a href="https://gitter.im/syl20bnr/spacemacs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/Join Chat.svg" alt="Gitter"></a> | |||||
| <a href="https://travis-ci.org/syl20bnr/spacemacs"><img src="https://travis-ci.org/syl20bnr/spacemacs.svg" alt="Build Status"></a> | |||||
| <a href="https://waffle.io/syl20bnr/spacemacs"><img src="https://badge.waffle.io/syl20bnr/spacemacs.png?label=Merging...&title=Merging" alt="PR being merged"></a> | |||||
| <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ESFVNPKP4Y742"><img src="https://img.shields.io/badge/Paypal-Donate-blue.svg" alt="Donate"></a> | |||||
| <a href="https://shop.spreadshirt.com/spacemacs-shop"><img src="https://img.shields.io/badge/Shop-T--Shirts-blue.svg" alt="Donate"></a> | |||||
| <a href="http://www.slant.co/topics/12/~what-are-the-best-programming-text-editors"><img src="https://img.shields.io/badge/Slant-Recommend-ff69b4.svg" alt="Recommend it"></a> | |||||
| </p> | |||||
| *** | |||||
| **Quick Install:** | |||||
| git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d | |||||
| <!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-generate-toc again --> | |||||
| **Table of Contents** | |||||
| - [Introduction](#introduction) | |||||
| - [Features](#features) | |||||
| - [Documentation](#documentation) | |||||
| - [Getting Help](#getting-help) | |||||
| - [Prerequisites](#prerequisites) | |||||
| - [Emacs](#emacs) | |||||
| - [Linux distros](#linux-distros) | |||||
| - [macOS](#macos) | |||||
| - [Windows](#windows) | |||||
| - [Install](#install) | |||||
| - [Default installation](#default-installation) | |||||
| - [Alternate installations](#alternate-installations) | |||||
| - [Modify HOME environment variable](#modify-home-environment-variable) | |||||
| - [Modify spacemacs-start-directory variable](#modify-spacemacs-start-directory-variable) | |||||
| - [Spacemacs logo](#spacemacs-logo) | |||||
| - [Update](#update) | |||||
| - [Automatic update (on master branch)](#automatic-update-on-master-branch) | |||||
| - [Manual update (on master branch)](#manual-update-on-master-branch) | |||||
| - [On develop branch](#on-develop-branch) | |||||
| - [Revert to a specific version](#revert-to-a-specific-version) | |||||
| - [Quotes](#quotes) | |||||
| - [Contributions](#contributions) | |||||
| - [Communities](#communities) | |||||
| - [License](#license) | |||||
| - [Supporting Spacemacs](#supporting-spacemacs) | |||||
| <!-- markdown-toc end --> | |||||
| # Introduction | |||||
| Spacemacs is a new way to experience Emacs -- a sophisticated and | |||||
| polished set-up focused on ergonomics, mnemonics and consistency. | |||||
| Just clone it, launch it, then press the space bar to explore the | |||||
| interactive list of carefully-chosen key bindings. You can also press | |||||
| the home buffer's `[?]` button for some great first key bindings to | |||||
| try. | |||||
| Spacemacs can be used naturally by both Emacs and Vim users -- you can | |||||
| even mix the two editing styles. Switching easily between input styles | |||||
| makes Spacemacs a great tool for pair-programming. | |||||
| Spacemacs is currently in beta, and contributions are very welcome. | |||||
|  | |||||
| # Features | |||||
| - **Great documentation:** access documentation in Emacs with | |||||
| <kbd>SPC h SPC</kbd>. | |||||
| - **Beautiful GUI:** you'll love the distraction free UI and its functional | |||||
| mode-line. | |||||
| - **Excellent ergonomics:** all the key bindings are accessible by pressing | |||||
| the <kbd>space bar</kbd> or <kbd>alt-m</kbd>. | |||||
| - **Mnemonic key bindings:** commands have mnemonic prefixes like | |||||
| <kbd>SPC b</kbd> for all the buffer commands or <kbd>SPC p</kbd> for the | |||||
| project commands. | |||||
| - **Batteries included:** discover hundreds of ready-to-use packages nicely | |||||
| organised in configuration layers following a set of | |||||
| [conventions][CONVENTIONS.org]. | |||||
| # Documentation | |||||
| Comprehensive documentation is available for each layer by pressing | |||||
| <kbd>SPC h SPC</kbd>. | |||||
| You can also check the [general documentation][DOCUMENTATION.org], | |||||
| [quick start guide][QUICK_START.org] and the [FAQ][FAQ.org]. | |||||
| # Getting Help | |||||
| If you need help, ask your question in the [Gitter Chat][] and a member of the | |||||
| community will help you out. | |||||
| If you prefer IRC, connect to the [Gitter Chat IRC server][] and join the | |||||
| `#syl20bnr/spacemacs` channel. | |||||
| # Prerequisites | |||||
| ## Emacs | |||||
| Spacemacs requires Emacs 24.4 or above. The development version of Emacs (at the | |||||
| time of writing, this is 25.2) is not *officially* supported, but should | |||||
| nevertheless be expected to work. | |||||
| Some modes require third-party tools that you'll have to install via your | |||||
| favorite package manager. | |||||
| ### Linux distros | |||||
| Install Emacs from the package manager of your Linux distribution. | |||||
| You should install the "emacs" package, not the "xemacs" package. | |||||
| XEmacs is an old fork of Emacs. The X in its name is unrelated to X11. | |||||
| Both Emacs and XEmacs have graphical support. | |||||
| **Note:** Ubuntu LTS 12.04 and 14.04 repositories have only Emacs 24.3 | |||||
| available. You have to [build from source][build_source] Emacs 24.4 or greater, | |||||
| as Spacemacs won't work with 24.3. The same may be true for other distributions | |||||
| as well. | |||||
| ### macOS | |||||
| The recommended way of installing Emacs on macOS is using [homebrew][]: | |||||
| ```sh | |||||
| $ brew tap d12frosted/emacs-plus | |||||
| $ brew install emacs-plus | |||||
| $ brew linkapps emacs-plus | |||||
| ``` | |||||
| *Note:* these homebrew commands will install GNU Emacs, and link it to your | |||||
| `/Applications` directory. You still need to run the `git clone` mentioned at | |||||
| the start of this file. That will populate your `~/.emacs.d` directory, which is | |||||
| what transforms a regular GNU Emacs into Spacemacs. | |||||
| *Note:* the proposed `emacs-plus` tap is identical to the `emacs` formulae, it | |||||
| just builds GNU Emacs with support of several features by default along with | |||||
| providing Spacemacs icon. | |||||
| See [emacs-plus](https://github.com/d12frosted/homebrew-emacs-plus) for more | |||||
| information. | |||||
| *Note:* after you have completed the [install process](#install) below, it is | |||||
| also recommended to add the [osx layer][] to your [dotfile][]. Install | |||||
| instructions are available in the [osx layer][] documentation. | |||||
| *Note:* if the powerline separators on the spaceline are a different (less | |||||
| saturated) color than the rest of the line, you can add following snippet to | |||||
| `dotspacemacs/user-config` in your `.spacemacs` file. | |||||
| ```elisp | |||||
| (setq ns-use-srgb-colorspace nil) | |||||
| ``` | |||||
| Keep in mind that this is not ideal solution as it affects all colours in Emacs. | |||||
| Another option is to use different powerline separator. For example, `alternate` | |||||
| and `bar` diminishes the difference. And using `utf-8` separator makes it go | |||||
| away completely without the need to change colour space. In order to change | |||||
| powerline separator put following snippet in `dotspacemacs/user-config`. | |||||
| ```eslip | |||||
| (setq powerline-default-separator 'utf-8) | |||||
| ``` | |||||
| For more information about powerline separators, please refer to appropriate | |||||
| section in [Documentation][DOCUMENTATION.org]. | |||||
| ### Windows | |||||
| You can download good quality builds from the [emacs-w64 project][emacs-for-windows]. | |||||
| It is recommended to install the most recent [stable build][emacs-for-windows-stable]. | |||||
| Be sure to declare a environment variable named `HOME` pointing to your user | |||||
| directory `C:\Users\<username>`. Then you can clone Spacemacs in this directory. | |||||
| Sometimes you'll get the following error when you first start Emacs: | |||||
| ``` | |||||
| The directory ~/.emacs.d/server is unsafe | |||||
| ``` | |||||
| To fix it change the owner of the directory `~/.emacs.d/server`: | |||||
| - from Properties select the Tab “Security”, | |||||
| - select the button “Advanced”, | |||||
| - select the Tab “Owner” | |||||
| - change the owner to your account name | |||||
| Source: [Stack Overflow][so-server-unsafe] | |||||
| For efficient searches we recommend to install `pt` ([the platinum searcher][]). | |||||
| `pt` version 1.7.7 or higher is required. | |||||
| # Install | |||||
| ## Default installation | |||||
| 1. If you have an existing Emacs configuration, back it up first: | |||||
| ```sh | |||||
| cd ~ | |||||
| mv .emacs.d .emacs.d.bak | |||||
| mv .emacs .emacs.bak | |||||
| ``` | |||||
| Don't forget to backup and *remove* `~/.emacs` file otherwise Spacemacs | |||||
| **WILL NOT** load since that file prevents Emacs from loading the proper | |||||
| initialization file. | |||||
| 2. Clone the repository: | |||||
| ```sh | |||||
| git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d | |||||
| ``` | |||||
| `master` is the stable branch and it is _immutable_, **DO NOT** make any | |||||
| modification to it or you will break the update mechanism. If you want to | |||||
| fork Spacemacs safely use the `develop` branch where you handle the update | |||||
| manually. | |||||
| 3. (Optional) Install the [Source Code Pro][] font. | |||||
| If you are running in terminal you'll also need to change font settings of | |||||
| your terminal. | |||||
| 4. Launch Emacs. Spacemacs will automatically install the packages it requires. | |||||
| If you get an error regarding package downloads then you may try to disable | |||||
| the HTTPS protocol by starting Emacs with | |||||
| ```sh | |||||
| emacs --insecure | |||||
| ``` | |||||
| Or you can set the `dotspacemacs-elpa-https` to `nil` in your dotfile to | |||||
| remove the need to start Emacs with `--insecure` argument. You may wish to | |||||
| clear out your `.emacs.d/elpa` directory before doing this, so that any | |||||
| corrupted packages you may have downloaded will be re-installed. | |||||
| 5. Restart Emacs to complete the installation. | |||||
| If the mode-line turns red then be sure to consult the [FAQ][FAQ.org]. | |||||
| ## Alternate installations | |||||
| It may be useful to clone Spacemacs outside Emacs dotdirectory `~/.emacs.d` so | |||||
| you can try Spacemacs without replacing completely our own configuration. | |||||
| There is currently two possibilities to support alternative location for | |||||
| Spacemacs configuration. | |||||
| ### Modify HOME environment variable | |||||
| This solution is ideal to quickly try Spacemacs without compromising your | |||||
| existing configuration. | |||||
| ```sh | |||||
| mkdir ~/spacemacs | |||||
| git clone https://github.com/syl20bnr/spacemacs.git ~/spacemacs/.emacs.d | |||||
| HOME=~/spacemacs emacs | |||||
| ``` | |||||
| Note: If you're on Fish shell, you will need to modify the last command to: `env | |||||
| HOME=$HOME/spacemacs emacs` | |||||
| ### Modify spacemacs-start-directory variable | |||||
| This solution is better suited to "embed" Spacemacs into your own configuration. | |||||
| Say you cloned Spacemacs in `~/.emacs.d/spacemacs/` then drop these lines in | |||||
| `~/.emacs.d/init.el`: | |||||
| ```elisp | |||||
| (setq spacemacs-start-directory "~/.emacs.d/spacemacs/") | |||||
| (load-file (concat spacemacs-start-directory "init.el")) | |||||
| ``` | |||||
| ## Spacemacs logo | |||||
| For Ubuntu users, follow this guide to | |||||
| [change the logo in Unity][cpaulik-unity-icon]. | |||||
| For Mac users, you need to [download the .icns version of the logo][icon-repository], | |||||
| then [change the logo on Dock][icon-mac-instructions]. | |||||
| # Update | |||||
| Spacemacs has a built-in notification of a new version when you are on the | |||||
| `master` branch. If you are on the `develop` branch then you'll have to | |||||
| update Spacemacs manually by updating your repository. | |||||
| ## Automatic update (on master branch) | |||||
| When a new version is available a little arrow appears in the mode-line. | |||||
| Its color depends on the number of versions available since your last update. | |||||
| Green means that your current version is recent, orange and red mean that your | |||||
| current version is older. | |||||
|  | |||||
| Click on the arrow to update Spacemacs to the last version. | |||||
| ## Manual update (on master branch) | |||||
| (Remove the angle brackets when typing the lines below into your shell.) | |||||
| ```sh | |||||
| git fetch | |||||
| git reset --hard <tag version which you are updating to> | |||||
| ``` | |||||
| ## On develop branch | |||||
| 1. Update Emacs packages by clicking (press `RET`) on the `[Update Packages]` link of | |||||
| the starting page. | |||||
| 2. Close Emacs and update the git repository: | |||||
| ```sh | |||||
| git pull --rebase | |||||
| ``` | |||||
| 3. Restart Emacs to complete the upgrade. | |||||
| ## Revert to a specific version | |||||
| To revert to a specific version you just have to checkout the corresponding | |||||
| branch, for instance to revert to the last `0.103`: | |||||
| ```sh | |||||
| git checkout origin/release-0.103 | |||||
| ``` | |||||
| **After you update, either manually, or automatically, you are advised to update | |||||
| your packages by clicking the `[Update Packages]` button on the Spacemacs Home | |||||
| Buffer.** | |||||
| # Quotes | |||||
| [Quote][quote01] by [ashnur](https://github.com/ashnur): | |||||
| «I feel that spacemacs is an aircraft carrier and I am playing table tennis on the deck as a freerider.» | |||||
| [Quote][quote02] by [deuill](https://github.com/deuill): | |||||
| «I LOVE SPACEMACS AND MAGIT | |||||
| That is all» | |||||
| # Contributions | |||||
| Spacemacs is a community-driven project, it needs _you_ to keep it up to | |||||
| date and propose great and useful configuration for all the things! | |||||
| Before contributing be sure to consult the | |||||
| [contribution guidelines][CONTRIBUTING.org] and [conventions][CONVENTIONS.org]. | |||||
| Here is a throughput graph of the repository for the last few weeks: | |||||
| [](https://waffle.io/syl20bnr/spacemacs/metrics) | |||||
| # Communities | |||||
| - [Gitter Chat] | |||||
| - [Stack Exchange] | |||||
| - [Reddit] | |||||
| # License | |||||
| The license is GPLv3 for all parts specific to Spacemacs, this includes: | |||||
| - the initialization and core files | |||||
| - all the layer files | |||||
| - the documentation | |||||
| For the packages shipped in this repository you can refer to the files header. | |||||
| [Spacemacs logo][] by [Nasser Alshammari][] released under a [Creative Commons Attribution-ShareAlike 4.0 International License.](http://creativecommons.org/licenses/by-sa/4.0/) | |||||
| # Supporting Spacemacs | |||||
| The best way to support Spacemacs is to contribute to it either by reporting | |||||
| bugs, helping the community on the [Gitter Chat][] or sending pull requests. | |||||
| You can show your love for the project by getting cool Spacemacs t-shirts, mugs | |||||
| and more in the [Spacemacs Shop][]. | |||||
| If you want to show your support financially you can contribute to [Bountysource][] or buy a drink for the | |||||
| maintainer by clicking on the [Paypal badge](#top). | |||||
| If you used spacemacs in a project and you want to show that fact, you can use | |||||
| the spacemacs badge: [](http://spacemacs.org) | |||||
| - For Markdown: | |||||
| ``` | |||||
| [](http://spacemacs.org) | |||||
| ``` | |||||
| - For HTML: | |||||
| ``` | |||||
| <a href="http://spacemacs.org"><img src="https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg" /></a> | |||||
| ``` | |||||
| - For Org-mode: | |||||
| ``` | |||||
| [[http://spacemacs.org][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] | |||||
| ``` | |||||
| Thank you! | |||||
| [Twitter]: http://i.imgur.com/tXSoThF.png | |||||
| [CONTRIBUTING.org]: CONTRIBUTING.org | |||||
| [CONVENTIONS.org]: http://spacemacs.org/doc/CONVENTIONS | |||||
| [DOCUMENTATION.org]: http://spacemacs.org/doc/DOCUMENTATION | |||||
| [QUICK_START.org]: http://spacemacs.org/doc/QUICK_START | |||||
| [FAQ.org]: http://spacemacs.org/doc/FAQ | |||||
| [VIMUSERS.org]: http://spacemacs.org/doc/VIMUSERS | |||||
| [dotfile]: http://spacemacs.org/doc/DOCUMENTATION#orgheadline45 | |||||
| [osx layer]: http://spacemacs.org/layers/+os/osx/README.html | |||||
| [Gitter Chat]: https://gitter.im/syl20bnr/spacemacs | |||||
| [Gitter Chat IRC server]: https://irc.gitter.im/ | |||||
| [homebrew]: http://brew.sh | |||||
| [emacs-for-windows]: http://emacsbinw64.sourceforge.net/ | |||||
| [emacs-for-windows-stable]: https://sourceforge.net/projects/emacsbinw64/files/release/ | |||||
| [the platinum searcher]: https://github.com/monochromegane/the_platinum_searcher | |||||
| [so-server-unsafe]: http://stackoverflow.com/questions/885793/emacs-error-when-calling-server-start | |||||
| [Spacemacs logo]: https://github.com/nashamri/spacemacs-logo | |||||
| [Nasser Alshammari]: https://github.com/nashamri | |||||
| [cpaulik-unity-icon]: http://splendidabacus.com/posts/2015/03/spacemacs-unity-icon/ | |||||
| [icon-mac-instructions]: http://www.idownloadblog.com/2014/07/16/how-to-change-app-icon-mac/ | |||||
| [icon-repository]: https://github.com/nashamri/spacemacs-logo | |||||
| [Stack Exchange]: http://emacs.stackexchange.com/questions/tagged/spacemacs | |||||
| [Reddit]: https://www.reddit.com/r/spacemacs | |||||
| [quote01]: https://gitter.im/syl20bnr/spacemacs?at=568e627a0cdaaa62045a7df6 | |||||
| [quote02]: https://gitter.im/syl20bnr/spacemacs?at=5768456c6577f032450cfedb | |||||
| [build_source]: https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html | |||||
| [Bountysource]: https://salt.bountysource.com/teams/spacemacs | |||||
| [Source Code Pro]: https://github.com/adobe-fonts/source-code-pro | |||||
| [Spacemacs Shop]: https://shop.spreadshirt.com/spacemacs-shop | |||||
| @ -0,0 +1,166 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <svg | |||||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
| xmlns:cc="http://creativecommons.org/ns#" | |||||
| xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
| xmlns:svg="http://www.w3.org/2000/svg" | |||||
| xmlns="http://www.w3.org/2000/svg" | |||||
| xmlns:xlink="http://www.w3.org/1999/xlink" | |||||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
| width="153" | |||||
| height="20" | |||||
| id="svg2" | |||||
| version="1.1" | |||||
| inkscape:version="0.91 r13725" | |||||
| sodipodi:docname="built with-Spacemacs-532c67.svg" | |||||
| inkscape:export-filename="/home/nasser/bp.png" | |||||
| inkscape:export-xdpi="96" | |||||
| inkscape:export-ydpi="96"> | |||||
| <metadata | |||||
| id="metadata36"> | |||||
| <rdf:RDF> | |||||
| <cc:Work | |||||
| rdf:about=""> | |||||
| <dc:format>image/svg+xml</dc:format> | |||||
| <dc:type | |||||
| rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||||
| </cc:Work> | |||||
| </rdf:RDF> | |||||
| </metadata> | |||||
| <defs | |||||
| id="defs34"> | |||||
| <linearGradient | |||||
| inkscape:collect="always" | |||||
| xlink:href="#linearGradient4275" | |||||
| id="linearGradient4281-3" | |||||
| x1="-284.07013" | |||||
| y1="1007.8895" | |||||
| x2="-339.81476" | |||||
| y2="951.63043" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| gradientTransform="matrix(0.14240629,-0.04958232,0.04958232,0.14240629,24.557055,883.06921)" /> | |||||
| <linearGradient | |||||
| inkscape:collect="always" | |||||
| id="linearGradient4275"> | |||||
| <stop | |||||
| style="stop-color:#e3dde5;stop-opacity:1" | |||||
| offset="0" | |||||
| id="stop4277" /> | |||||
| <stop | |||||
| style="stop-color:#ffffff;stop-opacity:1" | |||||
| offset="1" | |||||
| id="stop4279" /> | |||||
| </linearGradient> | |||||
| </defs> | |||||
| <sodipodi:namedview | |||||
| pagecolor="#ffffff" | |||||
| bordercolor="#666666" | |||||
| borderopacity="1" | |||||
| objecttolerance="10" | |||||
| gridtolerance="10" | |||||
| guidetolerance="10" | |||||
| inkscape:pageopacity="0" | |||||
| inkscape:pageshadow="2" | |||||
| inkscape:window-width="1366" | |||||
| inkscape:window-height="704" | |||||
| id="namedview32" | |||||
| showgrid="false" | |||||
| inkscape:zoom="2.8284271" | |||||
| inkscape:cx="72.897267" | |||||
| inkscape:cy="8.9744457" | |||||
| inkscape:window-x="0" | |||||
| inkscape:window-y="27" | |||||
| inkscape:window-maximized="1" | |||||
| inkscape:current-layer="g12" /> | |||||
| <linearGradient | |||||
| id="b" | |||||
| x2="0" | |||||
| y2="55.317267" | |||||
| gradientTransform="scale(2.7658633,0.36155076)" | |||||
| x1="0" | |||||
| y1="0" | |||||
| gradientUnits="userSpaceOnUse"> | |||||
| <stop | |||||
| offset="0" | |||||
| stop-color="#bbb" | |||||
| stop-opacity=".1" | |||||
| id="stop5" /> | |||||
| <stop | |||||
| offset="1" | |||||
| stop-opacity=".1" | |||||
| id="stop7" /> | |||||
| </linearGradient> | |||||
| <mask | |||||
| id="a"> | |||||
| <rect | |||||
| width="153" | |||||
| height="20" | |||||
| rx="3" | |||||
| fill="#fff" | |||||
| id="rect10" /> | |||||
| </mask> | |||||
| <g | |||||
| mask="url(#a)" | |||||
| id="g12"> | |||||
| <path | |||||
| d="m 0,0 61.127081,0 0,20 L 0,20 Z" | |||||
| id="path14" | |||||
| inkscape:connector-curvature="0" | |||||
| style="fill:#555555;fill-opacity:1" /> | |||||
| <path | |||||
| d="M 61.107742,0 153,0 l 0,20 -91.892258,0 z" | |||||
| id="path16" | |||||
| inkscape:connector-curvature="0" | |||||
| style="fill:#937bbf;fill-opacity:1" /> | |||||
| <path | |||||
| d="M 0,0 153,0 153,20 0,20 Z" | |||||
| id="path18" | |||||
| style="fill:url(#b)" | |||||
| inkscape:connector-curvature="0" /> | |||||
| </g> | |||||
| <g | |||||
| font-size="11" | |||||
| id="g20" | |||||
| transform="translate(1.8096428,20)" | |||||
| style="font-size:11px;font-family:'DejaVu Sans', Verdana, Geneva, sans-serif;text-anchor:middle;fill:#ffffff"> | |||||
| <text | |||||
| x="29.644875" | |||||
| y="-5" | |||||
| id="text24" | |||||
| style="fill:#010101;fill-opacity:0.3">built with</text> | |||||
| <text | |||||
| x="29.644875" | |||||
| y="-6" | |||||
| id="text26">built with</text> | |||||
| <text | |||||
| x="114.5" | |||||
| y="-5" | |||||
| id="text28" | |||||
| style="fill:#010101;fill-opacity:0.3">Spacemacs</text> | |||||
| <text | |||||
| x="114.5" | |||||
| y="-6" | |||||
| id="text30">Spacemacs</text> | |||||
| <g | |||||
| style="font-size:11px;font-family:'DejaVu Sans', Verdana, Geneva, sans-serif;text-anchor:middle;display:inline;fill:#010101;fill-opacity:0.30196078" | |||||
| id="g4277-7" | |||||
| transform="matrix(1.9720218,0.6866088,-0.6866088,1.9720218,725.42264,-2077.8363)"> | |||||
| <path | |||||
| id="path4186-2-6-7" | |||||
| d="m 28.770097,1035.4159 a 3.4892756,3.4892756 0 0 0 -1.258938,0.7743 c 1.192923,0.2085 2.449137,0.8823 3.241687,1.4094 l -2.1e-5,0 c 0.160372,0.1088 0.3031,0.2042 0.433225,0.2906 -1.96e-4,0 -4.04e-4,0 -5.86e-4,-0.01 -0.05302,-0.5168 -0.587049,-1.4093 -1.118114,-1.8685 -0.05154,-0.044 -0.09159,-0.085 -0.08895,-0.09 l 0.0019,10e-5 -1.9e-5,0 c 0.02923,0 0.378468,0.1748 0.514216,0.2623 0.237973,0.1534 0.344459,0.2537 0.532304,0.5013 0.488741,0.6445 0.850198,1.1826 1.21536,1.8094 0.183203,0.3144 0.516053,0.8854 0.572345,0.997 0.0073,0.015 0.0098,0.036 0.01099,0.04 -0.0073,0 -0.02592,-0.013 -0.104883,-0.044 -0.23152,-0.094 -0.664106,-0.2052 -1.076409,-0.2763 -0.514469,-0.089 -1.010761,-0.1453 -2.108512,-0.2397 -1.002022,-0.086 -1.465685,-0.1321 -1.834082,-0.181 l -0.330114,-0.043 c 0.06191,0.072 0.12806,0.1477 0.205773,0.2377 0,0 0.63415,0.1119 0.731936,0.1789 0,0 1.055519,0.9773 1.586279,1.5898 0.39705,0.4621 0.856592,1.015 1.06092,1.1411 0.0085,0.01 0.01623,0.01 0.02304,0.013 -0.305878,0.029 -1.826506,-0.1642 -1.826506,-0.1642 -0.563091,-1.1588 -1.459768,-2.4514 -2.487664,-3.735 -0.03452,-0.035 -0.05978,-0.061 -0.06019,-0.062 -0.0013,0 0.05018,0.02 0.114399,0.053 0.717131,0.3777 2.007861,0.498 3.266709,0.3044 0.358931,-0.055 0.758905,-0.1803 0.991679,-0.2764 -0.121787,-0.078 -0.254309,-0.1643 -0.401513,-0.261 -1.364927,-0.8969 -2.465764,-1.0897 -3.400638,-1.1163 -0.02433,0 -0.04822,0 -0.07186,0 a 3.4892756,3.4892756 0 0 0 -0.481644,3.2045 3.4892756,3.4892756 0 0 0 4.442571,2.1479 3.4892756,3.4892756 0 0 0 2.147925,-4.4426 3.4892756,3.4892756 0 0 0 -4.442571,-2.1479 z m 2.269005,1.0919 c 2.63e-4,0 2.42e-4,0 2.02e-4,0 0,0 2.1e-5,0 2.1e-5,0 -7.7e-5,0 -1.81e-4,0 -1.66e-4,0 0.194717,0.09 0.521579,0.2813 0.838804,0.343 0.311414,0.1965 0.521787,0.423 0.731581,0.5549 -0.07803,-0.031 -0.398278,-0.1607 -0.398278,-0.1607 0,0 -0.503244,-0.2266 -0.794002,-0.3866 -0.11175,-0.062 -0.124147,-0.073 -0.191399,-0.1267 -0.02626,-0.021 -0.154284,-0.2003 -0.186544,-0.223 3.9e-5,0 -3.6e-5,0 -2.1e-5,0 -4.6e-5,0 -1.21e-4,-1e-4 -1.66e-4,0 l -4.5e-5,0 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#010101;fill-opacity:0.30196078;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" /> | |||||
| </g> | |||||
| <g | |||||
| style="display:inline" | |||||
| id="g4277" | |||||
| transform="matrix(1.9720218,0.6866088,-0.6866088,1.9720218,725.42264,-2078.8487)"> | |||||
| <path | |||||
| id="path4186-2-6" | |||||
| d="m 28.770097,1035.4159 a 3.4892756,3.4892756 0 0 0 -1.258938,0.7743 c 1.192923,0.2085 2.449137,0.8823 3.241687,1.4094 l -2.1e-5,0 c 0.160372,0.1088 0.3031,0.2042 0.433225,0.2906 -1.96e-4,0 -4.04e-4,0 -5.86e-4,-0.01 -0.05302,-0.5168 -0.587049,-1.4093 -1.118114,-1.8685 -0.05154,-0.044 -0.09159,-0.085 -0.08895,-0.09 l 0.0019,10e-5 -1.9e-5,0 c 0.02923,0 0.378468,0.1748 0.514216,0.2623 0.237973,0.1534 0.344459,0.2537 0.532304,0.5013 0.488741,0.6445 0.850198,1.1826 1.21536,1.8094 0.183203,0.3144 0.516053,0.8854 0.572345,0.997 0.0073,0.015 0.0098,0.036 0.01099,0.04 -0.0073,0 -0.02592,-0.013 -0.104883,-0.044 -0.23152,-0.094 -0.664106,-0.2052 -1.076409,-0.2763 -0.514469,-0.089 -1.010761,-0.1453 -2.108512,-0.2397 -1.002022,-0.086 -1.465685,-0.1321 -1.834082,-0.181 l -0.330114,-0.043 c 0.06191,0.072 0.12806,0.1477 0.205773,0.2377 0,0 0.63415,0.1119 0.731936,0.1789 0,0 1.055519,0.9773 1.586279,1.5898 0.39705,0.4621 0.856592,1.015 1.06092,1.1411 0.0085,0.01 0.01623,0.01 0.02304,0.013 -0.305878,0.029 -1.826506,-0.1642 -1.826506,-0.1642 -0.563091,-1.1588 -1.459768,-2.4514 -2.487664,-3.735 -0.03452,-0.035 -0.05978,-0.061 -0.06019,-0.062 -0.0013,0 0.05018,0.02 0.114399,0.053 0.717131,0.3777 2.007861,0.498 3.266709,0.3044 0.358931,-0.055 0.758905,-0.1803 0.991679,-0.2764 -0.121787,-0.078 -0.254309,-0.1643 -0.401513,-0.261 -1.364927,-0.8969 -2.465764,-1.0897 -3.400638,-1.1163 -0.02433,0 -0.04822,0 -0.07186,0 a 3.4892756,3.4892756 0 0 0 -0.481644,3.2045 3.4892756,3.4892756 0 0 0 4.442571,2.1479 3.4892756,3.4892756 0 0 0 2.147925,-4.4426 3.4892756,3.4892756 0 0 0 -4.442571,-2.1479 z m 2.269005,1.0919 c 2.63e-4,0 2.42e-4,0 2.02e-4,0 0,0 2.1e-5,0 2.1e-5,0 -7.7e-5,0 -1.81e-4,0 -1.66e-4,0 0.194717,0.09 0.521579,0.2813 0.838804,0.343 0.311414,0.1965 0.521787,0.423 0.731581,0.5549 -0.07803,-0.031 -0.398278,-0.1607 -0.398278,-0.1607 0,0 -0.503244,-0.2266 -0.794002,-0.3866 -0.11175,-0.062 -0.124147,-0.073 -0.191399,-0.1267 -0.02626,-0.021 -0.154284,-0.2003 -0.186544,-0.223 3.9e-5,0 -3.6e-5,0 -2.1e-5,0 -4.6e-5,0 -1.21e-4,-1e-4 -1.66e-4,0 l -4.5e-5,0 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4281-3);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" /> | |||||
| </g> | |||||
| </g> | |||||
| </svg> | |||||
| @ -0,0 +1,405 @@ | |||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
| <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||||
| <svg | |||||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
| xmlns:cc="http://creativecommons.org/ns#" | |||||
| xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
| xmlns:svg="http://www.w3.org/2000/svg" | |||||
| xmlns="http://www.w3.org/2000/svg" | |||||
| xmlns:xlink="http://www.w3.org/1999/xlink" | |||||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
| width="666" | |||||
| height="666" | |||||
| viewBox="0 0 666.00001 666.00001" | |||||
| id="svg4774" | |||||
| version="1.1" | |||||
| inkscape:version="0.91 r13725" | |||||
| sodipodi:docname="spacemacs-logo.svg"> | |||||
| <defs | |||||
| id="defs4776"> | |||||
| <radialGradient | |||||
| inkscape:collect="always" | |||||
| xlink:href="#linearGradient4221" | |||||
| id="radialGradient4194" | |||||
| cx="-177.23108" | |||||
| cy="928.25415" | |||||
| fx="-177.23108" | |||||
| fy="928.25415" | |||||
| r="28.529215" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| gradientTransform="matrix(0.78891466,0.78891466,-0.76542395,0.76542395,536.60019,408.54464)" /> | |||||
| <linearGradient | |||||
| id="linearGradient4221"> | |||||
| <stop | |||||
| style="stop-color:#c0c0dc;stop-opacity:1" | |||||
| offset="0" | |||||
| id="stop4223" /> | |||||
| <stop | |||||
| id="stop4225" | |||||
| offset="0.11419532" | |||||
| style="stop-color:#c0c0dd;stop-opacity:1" /> | |||||
| <stop | |||||
| style="stop-color:#a191bf;stop-opacity:1" | |||||
| offset="0.47871608" | |||||
| id="stop4227" /> | |||||
| <stop | |||||
| style="stop-color:#625681;stop-opacity:1" | |||||
| offset="1" | |||||
| id="stop4229" /> | |||||
| </linearGradient> | |||||
| <linearGradient | |||||
| gradientUnits="userSpaceOnUse" | |||||
| y2="951.89844" | |||||
| x2="46.893108" | |||||
| y1="934.5658" | |||||
| x1="-0.65353984" | |||||
| id="linearGradient7595" | |||||
| xlink:href="#linearGradient4274" | |||||
| gradientTransform="matrix(0.4887125,0,0,0.4887125,7.5674041,560.78197)" /> | |||||
| <linearGradient | |||||
| id="linearGradient4274"> | |||||
| <stop | |||||
| style="stop-color:#eeeeec;stop-opacity:1" | |||||
| offset="0" | |||||
| id="stop4276" /> | |||||
| <stop | |||||
| id="stop4181" | |||||
| offset="0.0837483" | |||||
| style="stop-color:#eeeeec;stop-opacity:1" /> | |||||
| <stop | |||||
| style="stop-color:#eeeeec;stop-opacity:1" | |||||
| offset="0.3513594" | |||||
| id="stop4280" /> | |||||
| <stop | |||||
| style="stop-color:#e0d5d5;stop-opacity:1" | |||||
| offset="1" | |||||
| id="stop4282" /> | |||||
| </linearGradient> | |||||
| <linearGradient | |||||
| gradientTransform="matrix(0.19229712,0.06206447,-0.10031905,0.17023858,27.947597,914.55215)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| y2="672.25775" | |||||
| x2="396.9097" | |||||
| y1="608.87836" | |||||
| x1="303.64438" | |||||
| id="linearGradient4317" | |||||
| xlink:href="#linearGradient7589" /> | |||||
| <linearGradient | |||||
| id="linearGradient7589"> | |||||
| <stop | |||||
| style="stop-color:#351347;stop-opacity:1" | |||||
| offset="0" | |||||
| id="stop7591" /> | |||||
| <stop | |||||
| style="stop-color:#5c3566;stop-opacity:0;" | |||||
| offset="1" | |||||
| id="stop7593" /> | |||||
| </linearGradient> | |||||
| <linearGradient | |||||
| gradientTransform="matrix(0.07485012,0.08932098,-0.08626544,0.06221301,53.22269,961.64413)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| y2="364.66345" | |||||
| x2="377.03168" | |||||
| y1="425.15848" | |||||
| x1="306.88434" | |||||
| id="linearGradient4301" | |||||
| xlink:href="#linearGradient4311" /> | |||||
| <linearGradient | |||||
| id="linearGradient4311"> | |||||
| <stop | |||||
| id="stop4313" | |||||
| offset="0" | |||||
| style="stop-color:#351e47;stop-opacity:1" /> | |||||
| <stop | |||||
| id="stop4315" | |||||
| offset="1" | |||||
| style="stop-color:#5c3566;stop-opacity:0;" /> | |||||
| </linearGradient> | |||||
| <linearGradient | |||||
| gradientTransform="matrix(0.15153279,0.0143268,-0.0143268,0.15153279,-12.641966,950.28506)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| y2="429.49622" | |||||
| x2="329.16669" | |||||
| y1="527.33502" | |||||
| x1="267.65439" | |||||
| id="linearGradient4230" | |||||
| xlink:href="#linearGradient4274" /> | |||||
| <linearGradient | |||||
| gradientTransform="matrix(-0.13467,0.03941451,0.04093431,0.13986281,58.64004,937.70038)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| y2="465.96136" | |||||
| x2="190.84904" | |||||
| y1="511.44083" | |||||
| x1="308.41003" | |||||
| id="linearGradient5577" | |||||
| xlink:href="#linearGradient4196" /> | |||||
| <linearGradient | |||||
| id="linearGradient4196"> | |||||
| <stop | |||||
| id="stop4198" | |||||
| offset="0" | |||||
| style="stop-color:#ffffff;stop-opacity:1" /> | |||||
| <stop | |||||
| style="stop-color:#fffff2;stop-opacity:1" | |||||
| offset="0.11419532" | |||||
| id="stop4200" /> | |||||
| <stop | |||||
| id="stop4202" | |||||
| offset="0.47871608" | |||||
| style="stop-color:#d2acd2;stop-opacity:1" /> | |||||
| <stop | |||||
| id="stop4204" | |||||
| offset="1" | |||||
| style="stop-color:#123069;stop-opacity:1" /> | |||||
| </linearGradient> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.3389967,0.21474015,-0.19688621,0.26982602,-1209.2255,-630.6322)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-65" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <linearGradient | |||||
| id="linearGradient6003"> | |||||
| <stop | |||||
| style="stop-color:#c2c6db;stop-opacity:1" | |||||
| offset="0" | |||||
| id="stop6005" /> | |||||
| <stop | |||||
| id="stop6007" | |||||
| offset="0.33969504" | |||||
| style="stop-color:#bab1e0;stop-opacity:1" /> | |||||
| <stop | |||||
| id="stop6009" | |||||
| offset="0.44414869" | |||||
| style="stop-color:#8d77a3;stop-opacity:1" /> | |||||
| <stop | |||||
| style="stop-color:#675a84;stop-opacity:1" | |||||
| offset="0.55217898" | |||||
| id="stop6011" /> | |||||
| <stop | |||||
| style="stop-color:#050846;stop-opacity:1" | |||||
| offset="1" | |||||
| id="stop6013" /> | |||||
| </linearGradient> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.19025707,0.10471339,-0.11049955,0.13157478,-966.76195,-798.66855)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-3-1" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.1361054,0.07855904,-0.0790488,0.09871133,-780.58233,-1164.6467)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-8-8" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.18445402,0.09675949,-0.10712923,0.12158052,-859.37376,-1098.3051)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-6" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.33582312,0.20512484,-0.19504306,0.25774431,-945.14244,-758.65362)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-2" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.35330232,0.22380216,-0.20519478,0.28121264,-702.27629,-398.30317)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-65-3" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.19828589,0.10913228,-0.11516262,0.13712722,-658.03031,-481.71303)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-3-1-9" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.14184903,0.08187422,-0.08238465,0.10287694,-643.98232,-766.01725)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-8-8-5" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.34999481,0.21378108,-0.20327385,0.26862109,-680.60673,-453.66251)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-2-1" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| <radialGradient | |||||
| gradientTransform="matrix(0.19223796,0.10084273,-0.11165007,0.1267112,-724.74062,-701.33347)" | |||||
| gradientUnits="userSpaceOnUse" | |||||
| r="169" | |||||
| fy="472.51749" | |||||
| fx="322.17105" | |||||
| cy="472.51749" | |||||
| cx="322.17105" | |||||
| id="radialGradient5136-0-6-6-8-6-9" | |||||
| xlink:href="#linearGradient6003" /> | |||||
| </defs> | |||||
| <sodipodi:namedview | |||||
| id="base" | |||||
| pagecolor="#ffffff" | |||||
| bordercolor="#666666" | |||||
| borderopacity="1.0" | |||||
| inkscape:pageopacity="0.0" | |||||
| inkscape:pageshadow="2" | |||||
| inkscape:zoom="0.7" | |||||
| inkscape:cx="395.86046" | |||||
| inkscape:cy="245.84063" | |||||
| inkscape:document-units="px" | |||||
| inkscape:current-layer="layer1" | |||||
| showgrid="false" | |||||
| units="px" | |||||
| inkscape:window-width="1920" | |||||
| inkscape:window-height="1055" | |||||
| inkscape:window-x="1366" | |||||
| inkscape:window-y="25" | |||||
| inkscape:window-maximized="1" /> | |||||
| <metadata | |||||
| id="metadata4779"> | |||||
| <rdf:RDF> | |||||
| <cc:Work | |||||
| rdf:about=""> | |||||
| <dc:format>image/svg+xml</dc:format> | |||||
| <dc:type | |||||
| rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |||||
| <dc:title /> | |||||
| </cc:Work> | |||||
| </rdf:RDF> | |||||
| </metadata> | |||||
| <g | |||||
| inkscape:label="spacemacs" | |||||
| inkscape:groupmode="layer" | |||||
| id="layer1" | |||||
| transform="translate(0,-386.36216)" | |||||
| style="display:inline"> | |||||
| <g | |||||
| style="display:inline" | |||||
| transform="matrix(12.9592,4.5120702,-4.5120702,12.9592,4535.5464,-12837.419)" | |||||
| id="g5039"> | |||||
| <circle | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient4194);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path4186" | |||||
| cx="-306.25821" | |||||
| cy="988.6507" | |||||
| r="23.139797" | |||||
| transform="matrix(0.9443945,-0.32881459,0.32881459,0.9443945,0,0)" /> | |||||
| <path | |||||
| id="path5256-9" | |||||
| d="m 41.74716,1025.8039 c 14.519162,9.8452 9.408594,4.9185 10.261109,11.0962 -0.08117,0.1465 -0.169388,0.2875 -0.264301,0.4231 -0.01249,-0.014 -0.02419,-0.026 -0.03724,-0.04 -0.01001,-0.012 -0.02174,-0.019 -0.03214,-0.029 0.0196,-0.032 0.04012,-0.064 0.05853,-0.097 -1.225557,-5.0729 2.687143,-1.119 -11.156663,-10.2157 -9.051772,-5.9479 -16.352144,-7.226 -22.551938,-7.4019 -3.488421,-0.099 -5.913923,0.8728 -6.987909,2.7989 -1.3411642,2.4179 -0.912655,3.8155 1.994536,8.2521 -0.0911,0.3259 -0.03315,0.4943 -0.142124,0.8727 -3.8516196,-5.3869 -5.0172816,-9.7976 -3.4468002,-12.6716 0.9933212,-1.8068 2.7093882,-2.6025 5.6926712,-2.7563 9.218032,-0.2063 20.202074,5.5056 26.612289,9.7685 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient7595);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.37715784;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" | |||||
| sodipodi:nodetypes="ccccccsccccccc" /> | |||||
| <path | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.8;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4317);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| d="m 14.9959,1029.2143 c -0.236814,-0.2856 -0.559796,-0.7803 -0.485872,-0.7807 0.200566,-9e-4 9.60872,5.7454 9.929692,5.9329 4.225002,4.0646 7.676291,7.8951 11.373035,12.2304 2.765649,3.2702 7.591378,9.0843 9.008973,9.9815 0.05917,0.037 0.112444,0.068 0.159687,0.093 -2.111114,0.1893 -14.247147,-3.1483 -14.247147,-3.1483 -3.97823,-8.2435 -8.504661,-15.1572 -15.738368,-24.3079 z" | |||||
| id="path4234" | |||||
| inkscape:connector-curvature="0" | |||||
| sodipodi:nodetypes="cccccccc" /> | |||||
| <path | |||||
| id="path6025-8" | |||||
| d="m 39.507014,1015.4943 c 0.260338,0.1601 1.278904,1.4959 1.492115,1.6461 0.54521,0.3837 0.645075,0.4736 1.558512,0.91 2.376613,1.136 6.504302,2.7191 6.504302,2.7191 0,0 2.630753,0.9003 3.272047,1.1112 -1.710157,-0.9453 -3.398419,-2.6104 -5.93676,-4.0182 -2.624957,-0.3799 -5.293181,-1.7482 -6.889784,-2.3741 -5.36e-4,0 0.0042,0.023 -5.36e-4,0 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.8;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4301);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" /> | |||||
| <path | |||||
| id="path6023" | |||||
| d="m 36.623604,1014.7016 c 0.193864,-0.019 2.509837,1.1588 3.410083,1.7391 1.57816,1.0174 2.284312,1.6826 3.530043,3.325 3.241178,4.2734 5.638326,7.8421 8.059968,11.9988 1.214933,2.0854 3.422302,5.8712 3.79561,6.6117 0.04828,0.1012 0.06496,0.2398 0.07289,0.2669 -0.04815,-0.025 -0.17197,-0.083 -0.695631,-0.2973 -1.535379,-0.6247 -4.40422,-1.3616 -7.138474,-1.8334 -3.411804,-0.5887 -6.703011,-0.9628 -13.982957,-1.5894 -6.645099,-0.572 -9.719985,-0.8756 -12.163077,-1.2004 l -2.240265,-0.286 -2.354121,-2.612 c -1.46418,-1.4526 -2.668967,-2.6643 -2.677396,-2.6931 -0.0084,-0.028 0.332869,0.131 0.758726,0.3553 4.75579,2.5049 13.315388,3.3027 21.66368,2.0192 2.970312,-0.4566 6.368994,-1.6365 7.501263,-2.2622 0.21761,-0.12 0.380508,-0.2142 0.464537,-0.2839 0.0016,-2e-4 0.005,9e-4 0.0069,9e-4 0.0013,-0.093 -0.01124,-0.1899 -0.01912,-0.267 -0.351615,-3.4272 -3.893164,-9.3454 -7.415017,-12.3909 -0.341761,-0.2955 -0.607302,-0.5635 -0.589853,-0.5953 0.0016,0 0.0061,0 0.01225,0 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4230);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" /> | |||||
| <path | |||||
| id="path6025" | |||||
| d="m 36.461108,1014.6646 c 0.191656,-0.016 3.77684,0.9616 4.167363,1.319 0.998651,0.9137 1.69043,1.7046 2.940028,3.3953 4.362718,5.9461 8.135752,12.2745 11.646698,18.748 -2.436785,-3.3659 -6.107216,-6.7129 -10.58113,-10.1675 -7.7e-5,-0.021 10e-4,-0.075 -0.0016,-0.1149 -0.383095,-3.505 -3.995976,-9.3221 -7.512388,-12.4697 -0.341235,-0.3054 -0.687815,-0.6718 -0.670879,-0.7042 0.0015,0 0.0059,0 0.012,0 z" | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient5577);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| inkscape:connector-curvature="0" /> | |||||
| </g> | |||||
| </g> | |||||
| <g | |||||
| inkscape:groupmode="layer" | |||||
| id="layer9" | |||||
| inkscape:label="craters" | |||||
| style="display:inline;opacity:0.48800001" | |||||
| sodipodi:insensitive="true"> | |||||
| <ellipse | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.24500002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient5136-0-6-65-3);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path5113-4-3" | |||||
| cx="-674.75861" | |||||
| cy="-183.95151" | |||||
| rx="33.302528" | |||||
| ry="31.029184" | |||||
| transform="matrix(-0.46577522,-0.88490307,0.94940297,0.3140605,0,0)" /> | |||||
| <ellipse | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.24500002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient5136-0-6-6-2-1);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path5113-4-3-7" | |||||
| cx="-653.35913" | |||||
| cy="-248.91931" | |||||
| rx="32.990776" | |||||
| ry="29.639826" | |||||
| transform="matrix(-0.79746875,-0.60336025,0.73432765,-0.67879518,0,0)" /> | |||||
| <ellipse | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.24500002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient5136-0-6-6-8-6-9);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path5113-4-3-7-3" | |||||
| cx="-709.77368" | |||||
| cy="-604.74725" | |||||
| rx="18.120491" | |||||
| ry="13.981397" | |||||
| transform="matrix(-0.99991572,0.01298277,0.35376623,-0.93533387,0,0)" /> | |||||
| <ellipse | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.24500002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient5136-0-6-6-8-3-1-9);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path5113-4-3-7-3-1" | |||||
| cx="-642.59436" | |||||
| cy="-377.19153" | |||||
| rx="18.690575" | |||||
| ry="15.130705" | |||||
| transform="matrix(-0.82870289,-0.55968877,0.78595684,-0.61828136,0,0)" /> | |||||
| <ellipse | |||||
| style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.24500002;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#radialGradient5136-0-6-6-8-8-8-5);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.21200001;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" | |||||
| id="path5113-4-3-7-3-0" | |||||
| cx="-632.93744" | |||||
| cy="-687.5965" | |||||
| rx="13.370796" | |||||
| ry="11.351508" | |||||
| transform="matrix(-0.99900978,0.04449109,0.3468689,-0.93791362,0,0)" /> | |||||
| </g> | |||||
| </svg> | |||||
| @ -0,0 +1,119 @@ | |||||
| ;;; zemacs.el --- Spacemacs 2016 April Fools File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (setq spacemacs-buffer-name "*zemacs*") | |||||
| (setq spacemacs-buffer-logo-title "[Z E M A C S]") | |||||
| (setq spacemacs-buffer-version-info "af-1.01") | |||||
| (define-minor-mode zemacs-buffer-mode | |||||
| "Zemacs major mode for startup screen." | |||||
| :lighter "ToTheMAX" | |||||
| (if zemacs-buffer-mode | |||||
| (progn | |||||
| (spacemacs/set-leader-keys-for-major-mode 'spacemacs-buffer-mode | |||||
| (kbd "aprilfool") 'next-next-NEXT-millennium) | |||||
| (zemacs//insert-links)) | |||||
| ;; restore the true one | |||||
| (ad-disable-advice 'configuration-layer/initialize | |||||
| 'before 'zemacs/initialize) | |||||
| (ad-activate 'configuration-layer/initialize) | |||||
| (ad-disable-advice 'spacemacs-buffer//inject-version | |||||
| 'around 'zemacs/inject-version) | |||||
| (ad-activate 'spacemacs-buffer//inject-version) | |||||
| (ad-disable-advice 'spacemacs-buffer/insert-banner-and-buttons | |||||
| 'after 'zemacs/insert-banner-and-buttons) | |||||
| (ad-activate 'spacemacs-buffer/insert-banner-and-buttons) | |||||
| (load-file (concat spacemacs-start-directory "core/core-spacemacs-buffer.el")) | |||||
| (setq dotspacemacs-startup-banner 'official) | |||||
| (kill-buffer) | |||||
| (insert " | |||||
| ───█──█─█▀▀█─█▀▀█─█▀▀█─█──█─── | |||||
| ───█▀▀█─█▄▄█─█▀▀▀─█▀▀▀─▀▀▀█─── | |||||
| ───█──█─█──█─█────█────█▄▄█─── | |||||
| ────────────────────────────── | |||||
| ───█▀▀█─█▀▀█─█▀▀█─▀▀█▀▀─█───── | |||||
| ───█▄▄█─█▀▀▀─█▀▀▄───█───█───── | |||||
| ───█──█─█────█──█─▄▄█▄▄─█▄▄─── | |||||
| ────────────────────────────── | |||||
| ──█▀▀▀─▄▀▀▀▄─▄▀▀▀▄─█────▄▀▀▀── | |||||
| ──█▀▀▀─█───█─█───█─█────▀▀▀▄── | |||||
| ──█────▀▄▄▄▀─▀▄▄▄▀─█▄▄▄─▄▄▄▀── | |||||
| ────────────────────────────── | |||||
| ──────────▄▄███████▄▄───────── | |||||
| ───────▄███████████████▄────── | |||||
| ────▄██████▀────────▀█████▄─── | |||||
| ──▄█████▀──────────────▀████▄─ | |||||
| ▄████▀────▄██▄────▄██▄───▀████ | |||||
| ██▀───────████────████─────▀██ | |||||
| ██────────████────████──────██ | |||||
| ██────────▀██▀────▀██▀──────██ | |||||
| ██──────────────────────────██ | |||||
| ██──█▄──────────────────▄█──██ | |||||
| ██──█▀██▄──────────────▄██──██ | |||||
| ██──█──▀██▄──────────▄▄█─█──██ | |||||
| ██──█────▀████████████▀──█──██ | |||||
| ██──█─────█────█────█────█──██ | |||||
| ██──█─────█────█────█────█──██ | |||||
| ██──██▄───█────█────█──▄██──██ | |||||
| ██──██████████████████████──██ | |||||
| ██──█─────█────█────█────█──██ | |||||
| ██──█─────█────█────█────█──██ | |||||
| ██──██────█────█────█───█▀──██ | |||||
| ██───▀██████████████████▀───██ | |||||
| ██▄───────────────────────▄███ | |||||
| █████▄──────────────────▄█████ | |||||
| ─▀███████▄───────────▄██████▀─ | |||||
| ────▀█████████████████████▀─── ") | |||||
| (spacemacs-buffer/goto-buffer) | |||||
| (spacemacs-buffer//remove-existing-widget-if-exist))) | |||||
| (defun next-next-NEXT-millennium () | |||||
| "Time to rock on!" | |||||
| (interactive) | |||||
| (zemacs-buffer-mode -1)) | |||||
| (defvar zemacs--links '(("this one" "http://neovim.io") | |||||
| ("link" "http://cdn.meme.am/instances/500x/67641307.jpg") | |||||
| ("Atom" "http://atom.io/") | |||||
| ("implementation tricks" "http://emacshorrors.com/"))) | |||||
| (defun zemacs//insert-links () | |||||
| "Replace bracketed texts by their link counterparts." | |||||
| (with-current-buffer spacemacs-buffer-name | |||||
| (save-excursion | |||||
| (dolist (l zemacs--links) | |||||
| (re-search-backward (format "\\(\\[%s\\]\\)" (car l)) nil t) | |||||
| (make-text-button | |||||
| (match-beginning 1) | |||||
| (match-end 1) | |||||
| 'type 'help-url | |||||
| 'help-args (cdr l)))))) | |||||
| (defadvice configuration-layer/initialize (before zemacs/initialize activate) | |||||
| (setq dotspacemacs-startup-banner "~/.emacs.d/core/banners/img/zemacs.png")) | |||||
| (defadvice spacemacs-buffer//inject-version | |||||
| (around zemacs/inject-version activate) | |||||
| (let ((emacs-version "99.9999999") | |||||
| (dotspacemacs-distribution "zemacs") | |||||
| (spacemacs-version "af-1.01")) | |||||
| ad-do-it)) | |||||
| (defadvice spacemacs-buffer/insert-banner-and-buttons | |||||
| (after zemacs/insert-banner-and-buttons activate) | |||||
| ;; always display the release note | |||||
| (spacemacs-buffer//insert-release-note-widget | |||||
| (concat spacemacs-release-notes-directory | |||||
| spacemacs-buffer-version-info ".txt"))) | |||||
| (add-hook 'emacs-startup-hook 'zemacs-buffer-mode t) | |||||
| (provide 'zemacs) | |||||
| @ -0,0 +1,8 @@ | |||||
| Welcome to | |||||
| ███████╗██████╗**█████╗**██████╗███████╗███╗***███╗*█████╗**██████╗███████╗ B | |||||
| ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗*████║██╔══██╗██╔════╝██╔════╝ E | |||||
| ███████╗██████╔╝███████║██║*****█████╗**██╔████╔██║███████║██║*****███████╗ T | |||||
| ╚════██║██╔═══╝*██╔══██║██║*****██╔══╝**██║╚██╔╝██║██╔══██║██║*****╚════██║ A | |||||
| ███████║██║*****██║**██║╚██████╗███████╗██║*╚═╝*██║██║**██║╚██████╗███████║ | |||||
| ╚══════╝╚═╝*****╚═╝**╚═╝*╚═════╝╚══════╝╚═╝*****╚═╝╚═╝**╚═╝*╚═════╝╚══════╝ | |||||
| @ -0,0 +1,9 @@ | |||||
| ┏━━━┓ | |||||
| ┃┏━┓┃ Welcome to | |||||
| ┃┗━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏┓┏┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓ b | |||||
| ┗━━┓┃┏━━┓┃┏┓┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃┃━┫┏━━┓┃┗┛┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃━━┫ e | |||||
| ┃┗━┛┃┗━━┛┃┗┛┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┃┃━┫┗━━┛┃┃┃┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┣━━┃ t | |||||
| ┗━━━┛╋╋╋╋┃┏━┛╋╋╋╋┗┛┗┛╋╋╋╋┗━━┛╋╋╋╋┗━━┛╋╋╋╋┗┻┻┛╋╋╋╋┗┛┗┛╋╋╋╋┗━━┛╋╋╋╋┗━━┛ a | |||||
| ╋╋╋╋╋╋╋╋╋┃┃[The best editor is neither Emacs nor Vim, it's Emacs+Vim] | |||||
| ╋╋╋╋╋╋╋╋╋┗┛ | |||||
| @ -0,0 +1,9 @@ | |||||
| ╭─┏━━━┓───────────────────────────────────────────────────────────────────╮ | |||||
| │ ┃┏━┓┃ Welcome to │ | |||||
| │ ┃┗━━┓ ┏━━┓ ┏━━┓ ┏━━┓ ┏━━┓ ┏┓┏┓ ┏━━┓ ┏━━┓ ┏━━┓ b │ | |||||
| │ ┗━━┓┃┏━━┓┃┏┓┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃┃━┫┏━━┓┃┗┛┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃━━┫ e │ | |||||
| │ ┃┗━┛┃┗━━┛┃┗┛┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┃┃━┫┗━━┛┃┃┃┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┣━━┃ t │ | |||||
| │ ┗━━━┛ ┃┏━┛ ┗┛┗┛ ┗━━┛ ┗━━┛ ┗┻┻┛ ┗┛┗┛ ┗━━┛ ┗━━┛ a │ | |||||
| │ ┃┃[The best editor is neither Emacs nor Vim, it's Emacs+Vim] │ | |||||
| ╰──────────┗┛─────────────────────────────────────────────────────────────╯ | |||||
| @ -0,0 +1,17 @@ | |||||
| ⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| ⠀⣠⣾⣿⣿⣿⣷⣶⣤⣀⡤⣤⡒⢖⠖⢖⢒⠢⠤⢄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| ⠠⣿⠛⠉⠁⢉⣹⢿⣿⣿⣿⣷⣼⢸⢸⢨⠢⡡⢑⡠⠀⠑⠢⢄⠀⠀⠀⠀⠀⠀ | |||||
| ⠨⡃⠀⢀⡴⡣⣗⢵⣣⢟⣟⣿⣿⣿⣎⡎⡎⡜⡐⢽⣾⡄⠀⠈⠑⢄⠀⠀⠀⠀ | |||||
| ⠀⢇⣠⢯⡪⣯⣺⢽⢾⣽⡽⣾⣺⣝⢿⣿⣼⢨⠢⡑⢿⣷⠀⠀⠀⠀⠳⡀⠀⠀ | |||||
| ⠀⡸⡪⡪⣿⣾⣺⡽⣿⣳⢯⡿⣵⢷⣝⢼⢻⣯⣎⠢⢹⣿⣇⠀⠀⠀⠀⠱⡀⠀ | |||||
| ⢰⡫⢪⢪⡘⠿⣿⣿⣿⣾⣯⣿⢽⡳⣕⢇⢗⢜⢻⣧⡡⣿⣿⡄⠀⠀⠀⠀⢣⠀ Welcome to | |||||
| ⣞⢨⢊⢎⢆⠀⠀⠉⢿⣿⣿⣿⣿⣿⣷⣯⣮⣮⣦⣽⣿⣿⣿⣇⠀⠀⠀⠀⠈⡆ | |||||
| ⡧⢑⠔⡡⢣⠂⠀⠀⠀⢓⢝⢟⡻⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⡇ [ S p a c e m a c s ] | |||||
| ⡏⠄⠡⢊⢂⢅⠀⠀⠀⠀⠇⡇⠎⢎⠢⡩⠛⠻⢿⣿⣿⣿⣿⣿⡆⠀⠀⠀⢀⠇ | |||||
| ⢸⡀⡁⢁⠂⡂⠀⠀⠀⠀⠈⠔⡑⠡⢊⠐⡈⠌⢀⠀⠙⠻⢿⣿⣷⠀⠀⠀⡸⠀ | |||||
| ⠀⢣⠀⠀⠠⠈⠀⠀⠀⠀⠀⠀⠂⠌⠐⠠⠀⠀⠀⠀⠀⠀⠀⠈⠙⠀⠀⢠⠃⠀ | |||||
| ⠀⠀⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠃⠀⠀ | |||||
| ⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀ | |||||
| ⠀⠀⠀⠀⠀⠙⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠁⠀⠀⠀⠀⠀ | |||||
| ⠀⠀⠀⠀⠀⠀⠀⠙⠒⠤⠤⣀⣀⣀⣀⣀⡠⠤⠔⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| @ -0,0 +1,17 @@ | |||||
| ⠀⠀⠀⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| ⠀⢀⠎⠁⠀⠀⠈⠉⠒⠦⢀⡀⡄⡤⡤⡤⡤⡤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| ⠀⡎⡠⠒⠉⠉⢑⢲⢀⠀⠀⠈⠪⢣⢫⡺⣹⡹⣝⠾⣻⣶⣤⡀⠀⠀⠀⠀⠀⠀ | |||||
| ⠀⢿⡅⠀⠠⡰⡊⡎⡪⢊⠢⡠⢀⠀⠘⠜⣜⢎⡯⣳⠀⠳⣻⣿⣷⡄⠀⠀⠀⠀ | |||||
| ⠀⢹⣇⡠⠫⡪⡊⡢⢊⠨⠨⡂⢕⢐⠄⡀⠈⢺⢸⣝⡆⠀⢻⣷⣿⣿⣦⡀⠀⠀ | |||||
| ⠀⠈⣟⢪⢇⠀⠑⠌⠢⠡⡃⠢⡑⡐⢅⢇⢆⠀⠑⢕⣯⡀⠀⢿⣿⣿⣿⣷⡀⠀ | |||||
| ⠀⣐⢵⢣⢻⣦⣀⠀⠀⠁⠈⠌⠢⡊⡜⡔⡕⡭⢆⠈⠺⡄⠀⠸⣿⣿⣿⣿⣧⠀ Welcome to | |||||
| ⠀⣵⡫⡮⡣⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠈⠘⠘⠙⠑⠀⠀⠀⠀⢿⣿⣿⣿⣿⡀ | |||||
| ⠀⣗⡯⣞⢵⢽⣿⣿⣿⣟⡕⡕⡤⡠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⡆ [ S p a c e m a c s ] | |||||
| ⠀⣯⢿⣺⣝⢮⣿⣿⣿⣿⣿⡪⡮⣳⢝⡽⣲⢤⣄⡀⠀⠀⠀⠀⠈⣿⣿⣿⣿⠂ | |||||
| ⠀⢸⣿⡽⣾⣳⣻⣿⣿⣿⣿⣾⡽⣺⢵⡯⣯⣿⣳⡿⣷⣦⣄⠀⠀⢿⣿⣿⡟⠀ | |||||
| ⠀⠀⢺⣿⣯⣿⣽⣿⣿⣿⣿⣿⣿⣽⣯⣟⣿⣾⣿⣿⣿⣿⣿⣿⣶⣼⣿⡿⠁⠀ | |||||
| ⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠀⠀ | |||||
| ⠀⠀⠀⠀⠘⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀ | |||||
| ⠀⠀⠀⠀⠀⠀⠉⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠀⠀⠀⠀⠀⠀ | |||||
| ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠻⠻⠿⠿⠿⠛⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ | |||||
| @ -0,0 +1,27 @@ | |||||
| ▄▄▄▄ ▄ | |||||
| ▌▄ █▄ ▄▀▄▀▄ | |||||
| ▌███ ▌ ▄▄▄▄▄▄ ▐ ███ ▌ | |||||
| ▄▄▀ ░░ ▐░░▐░░░▐ ▀▄ ░░░ ▌▄ | |||||
| ▄▀ ░░░░ ▐░░ ▌░▌░░ ▐ ░░░░░ ▀▄ | |||||
| ▐ ░░░░░ ▐░░░▐▌░░░▐ ░░░░░░░░ ▌ | |||||
| ▐ ░░░ ▄▀▀▄ ░░░░░░░ ▄▀▀▄ ░░░░░░ ▌ | |||||
| ▐ ░░ ▀▄▄▀ ░░░░░ ▀▄▄▀ ░░░░ ▌ | |||||
| --▐---------___▄▀▀▄__----------- ▌ | |||||
| _▐_________--—▀▄▄▀--__________ ▌ | |||||
| ▀▌ ░░░░░ ▄▄▌▐▄▄ ░░░░░░░░ ▐▀ | |||||
| ▀▌ ░░ ▐▀▀ ▀▀▌ ░░░░ ▐▀ | |||||
| ▀▌░ ░▐▀▀ | |||||
| ▀▀▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▀▀ | |||||
| ▐ ▌ | |||||
| ▄▄▌ ▐▄▄ | |||||
| ▄▄▀ ░░░ ▀▄▄ | |||||
| ▄▄▌ ░░░░░░░░ ▐▄▄ | |||||
| ▌ ░░░░░░░░░░░░░ ▐ | |||||
| ▄ ▄ | ███╗ ███╗ ██████╗ ███╗ ███╗ █████╗ ██████╗███████╗ | |||||
| ▄ ░░▄▄▀▀▄▄░░ ▄ | ████╗ ████║██╔═══██╗████╗ ████║██╔══██╗██╔════╝██╔════╝ | |||||
| ░░ ▄▀ ░░░░ ▀▄ ░░ | ██╔████╔██║██║ ██║██╔████╔██║███████║██║ ███████╗ | |||||
| ▐░░░░░░░░░░▌ | ██║╚██╔╝██║██║ ██║██║╚██╔╝██║██╔══██║██║ ╚════██║ | |||||
| ▀▄▄▄▄▄▄▄▄▀ | ██║ ╚═╝ ██║╚██████╔╝██║ ╚═╝ ██║██║ ██║╚██████╗███████║ | |||||
| | ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝ | |||||
| @ -0,0 +1,26 @@ | |||||
| ░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░ | |||||
| ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░ | |||||
| Such powerful ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░ | |||||
| ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░ | |||||
| ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░ Vim and Emacs | |||||
| ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░ So love | |||||
| ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░ Much forbidden | |||||
| ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░ | |||||
| Very modes ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░ | |||||
| ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░ | |||||
| ▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░ | |||||
| ▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌ | |||||
| ▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░ | |||||
| ░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░ | |||||
| ░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░ | |||||
| ░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░ | |||||
| ░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░ Wow. | |||||
| ░░░░░░▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀░░░░░ | |||||
| ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░ | |||||
| ██████╗ ██████╗ ██████╗ ███████╗███╗ ███╗ █████╗ ██████╗███████╗ | |||||
| ██╔══██╗██╔═══██╗██╔════╝ ██╔════╝████╗ ████║██╔══██╗██╔════╝██╔════╝ | |||||
| ██║ ██║██║ ██║██║ ███╗█████╗ ██╔████╔██║███████║██║ ███████╗ | |||||
| ██║ ██║██║ ██║██║ ██║██╔══╝ ██║╚██╔╝██║██╔══██║██║ ╚════██║ | |||||
| ██████╔╝╚██████╔╝╚██████╔╝███████╗██║ ╚═╝ ██║██║ ██║╚██████╗███████║ | |||||
| ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝ | |||||
| @ -0,0 +1,83 @@ | |||||
| ;;; core-auto-completion.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| ;; Company ------------------------------------------------------------------- | |||||
| (defvar spacemacs-default-company-backends | |||||
| '((company-dabbrev-code company-gtags company-etags company-keywords) | |||||
| company-files company-dabbrev) | |||||
| "The list of default company backends used by spacemacs. | |||||
| This variable is used to configure mode-specific company backends in spacemacs. | |||||
| Backends in this list will always be active in these modes, as well as any | |||||
| backends added by individual spacemacs layers.") | |||||
| (defmacro spacemacs|defvar-company-backends (mode) | |||||
| "Define a MODE specific company backend variable with default backends. | |||||
| The variable name format is company-backends-MODE." | |||||
| `(defvar ,(intern (format "company-backends-%S" mode)) | |||||
| ',spacemacs-default-company-backends | |||||
| ,(format "Company backend list for %S" mode))) | |||||
| (defmacro spacemacs|add-company-hook (mode) | |||||
| "Enable company for the given MODE. | |||||
| MODE must match the symbol passed in `spacemacs|defvar-company-backends'. | |||||
| The initialization function is hooked to `MODE-hook'." | |||||
| (let ((mode-hook (intern (format "%S-hook" mode))) | |||||
| (func (intern (format "spacemacs//init-company-%S" mode))) | |||||
| (backend-list (intern (format "company-backends-%S" mode)))) | |||||
| `(when (configuration-layer/package-usedp 'company) | |||||
| (defun ,func () | |||||
| ,(format "Initialize company for %S" mode) | |||||
| (when auto-completion-enable-snippets-in-popup | |||||
| (setq ,backend-list (mapcar 'spacemacs//show-snippets-in-company | |||||
| ,backend-list))) | |||||
| (set (make-variable-buffer-local 'auto-completion-front-end) | |||||
| 'company) | |||||
| (set (make-variable-buffer-local 'company-backends) | |||||
| ,backend-list)) | |||||
| (add-hook ',mode-hook ',func t) | |||||
| (add-hook ',mode-hook 'company-mode t)))) | |||||
| (defmacro spacemacs|disable-company (mode) | |||||
| "Disable company for the given MODE. | |||||
| MODE parameter must match the parameter used in the call to | |||||
| `spacemacs|add-company-hook'." | |||||
| (let ((mode-hook (intern (format "%S-hook" mode))) | |||||
| (func (intern (format "spacemacs//init-company-%S" mode)))) | |||||
| `(progn | |||||
| (remove-hook ',mode-hook ',func) | |||||
| (remove-hook ',mode-hook 'company-mode)))) | |||||
| (defun spacemacs//show-snippets-in-company (backend) | |||||
| (if (or (not auto-completion-enable-snippets-in-popup) | |||||
| (and (listp backend) (member 'company-yasnippet backend))) | |||||
| backend | |||||
| (append (if (consp backend) backend (list backend)) | |||||
| '(:with company-yasnippet)))) | |||||
| ;; Auto-complete ------------------------------------------------------------- | |||||
| (defmacro spacemacs|enable-auto-complete (mode) | |||||
| "Enable auto-complete for the given MODE. | |||||
| The initialization function is hooked to `MODE-hook'." | |||||
| (let ((mode-hook (intern (format "%S-hook" mode))) | |||||
| (func (intern (format "spacemacs//init-auto-complete-%S" mode)))) | |||||
| `(when (configuration-layer/package-usedp 'auto-complete) | |||||
| (defun ,func () | |||||
| ,(format "Initialize auto-complete for %S" mode) | |||||
| (set (make-variable-buffer-local 'auto-completion-front-end) | |||||
| 'auto-complete) | |||||
| (set (make-variable-buffer-local 'company-backends) | |||||
| ,(intern (format "company-backends-%S" mode)))) | |||||
| (add-hook ',mode-hook ',func) | |||||
| (add-hook ',mode-hook 'auto-complete-mode)))) | |||||
| (provide 'core-auto-completion) | |||||
| @ -0,0 +1,62 @@ | |||||
| ;;; core-command-line.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defvar spacemacs-force-resume-layouts nil | |||||
| "If non-nil force the current emacs instance to resume layouts | |||||
| at start time despite the value of `dotspacemacs-auto-resume-layouts'.") | |||||
| (defvar spacemacs-insecure nil | |||||
| "If non-nil force Spacemacs to operate without secured protocols.") | |||||
| (defun spacemacs//parse-command-line (args) | |||||
| "Handle Spacemacs specific command line arguments. | |||||
| The reason why we don't use the Emacs hooks for processing user defined | |||||
| arguments is that we want to process these arguments as soon as possible." | |||||
| (let ((i 0) new-args) | |||||
| (while (< i (length args)) | |||||
| (let ((arg (nth i args)) | |||||
| (next-arg-digit | |||||
| (when (< (1+ i) (length args)) | |||||
| (string-to-number (nth (1+ i) args))))) | |||||
| (when (or (null next-arg-digit) (= 0 next-arg-digit)) | |||||
| (setq next-arg-digit nil)) | |||||
| (pcase arg | |||||
| ("--profile" | |||||
| (setq spacemacs-debug-with-profile t) | |||||
| (setq spacemacs-debugp t)) | |||||
| ("--timed-requires" | |||||
| (setq spacemacs-debug-with-timed-requires t) | |||||
| (when next-arg-digit | |||||
| (setq spacemacs-debug-timer-threshold next-arg-digit | |||||
| i (1+ i))) | |||||
| (setq spacemacs-debugp t)) | |||||
| ("--adv-timers" | |||||
| (setq spacemacs-debug-with-adv-timers t) | |||||
| (when next-arg-digit | |||||
| (setq spacemacs-debug-timer-threshold next-arg-digit | |||||
| i (1+ 1))) | |||||
| (setq spacemacs-debugp t)) | |||||
| ("--insecure" | |||||
| (setq spacemacs-insecure t)) | |||||
| ("--no-layer" | |||||
| (setq configuration-layer-exclude-all-layers t)) | |||||
| ("--distribution" | |||||
| (setq configuration-layer-force-distribution (intern (nth (1+ i) args)) | |||||
| i (1+ i))) | |||||
| ("--resume-layouts" | |||||
| (setq spacemacs-force-resume-layouts t)) | |||||
| (_ (push arg new-args)))) | |||||
| (setq i (1+ i))) | |||||
| (nreverse new-args))) | |||||
| (setq command-line-args (spacemacs//parse-command-line command-line-args)) | |||||
| (provide 'core-command-line) | |||||
| @ -0,0 +1,143 @@ | |||||
| ;;; core-debug.el --- Spacemacs Core File -*- lexical-binding: t; -*- | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (require 'profiler) | |||||
| (defvar spacemacs-debug-timer-threshold 0.15 | |||||
| "Generate message if file takes longer than this number of | |||||
| seconds to load") | |||||
| (defvar spacemacs-debugp nil) | |||||
| (defvar spacemacs-debug-with-profile nil) | |||||
| (defvar spacemacs-debug-with-timed-requires nil) | |||||
| (defvar spacemacs-debug-with-adv-timers nil) | |||||
| (defun spacemacs//load-timer (origfunc &rest args) | |||||
| "Used to time invocation of `require' or `load'." | |||||
| (let ((start (current-time)) | |||||
| (required (car args)) | |||||
| delta) | |||||
| (prog1 | |||||
| (apply origfunc args) | |||||
| (setq delta (float-time (time-since start))) | |||||
| (when (> delta spacemacs-debug-timer-threshold) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "[%.3f] (%.3f) Load or require\n Feature: %s\n In file: %s\n\n" | |||||
| (float-time (time-since emacs-start-time)) | |||||
| delta required load-file-name))))))) | |||||
| (defmacro spacemacs||make-function-timer (func) | |||||
| "Used to time call to FUNC." | |||||
| `(lambda (origfunc &rest args) | |||||
| (let ((start (current-time)) | |||||
| delta) | |||||
| (prog1 | |||||
| (apply origfunc args) | |||||
| (setq delta (float-time (time-since start))) | |||||
| (when (> delta spacemacs-debug-timer-threshold) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "[%.3f] (%.3f) Function call\n Function: %s\n Args: %s\n\n" | |||||
| (float-time (time-since emacs-start-time)) | |||||
| delta ',func args)))))))) | |||||
| (defmacro spacemacs||make-function-profiler (func) | |||||
| `(lambda (origfunc &rest args) | |||||
| (if (profiler-running-p) | |||||
| (profiler-report) | |||||
| (profiler-start 'cpu)) | |||||
| (prog1 | |||||
| (apply origfunc args) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "[%.3f] Done profiling function: %s\n\n" | |||||
| (float-time (time-since emacs-start-time)) ',func))) | |||||
| (profiler-report)))) | |||||
| (defun spacemacs/init-debug () | |||||
| "Set the debug hooks." | |||||
| (when spacemacs-debug-with-profile | |||||
| (profiler-start 'cpu+mem) | |||||
| (add-hook 'after-init-hook | |||||
| (lambda () | |||||
| (run-with-idle-timer 2 nil (lambda () | |||||
| (profiler-report) | |||||
| (profiler-stop)))))) | |||||
| (when spacemacs-debug-with-timed-requires | |||||
| (with-current-buffer (get-buffer-create "*load-times*") | |||||
| (insert (format "Threshold set at %.3f seconds\n\n" | |||||
| spacemacs-debug-timer-threshold))) | |||||
| (defadvice package-initialize (around spacemacs//timed-initialize activate) | |||||
| (let ((start (current-time)) res delta) | |||||
| (setq res ad-do-it | |||||
| delta (float-time (time-since start))) | |||||
| (when (> delta spacemacs-debug-timer-threshold) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "package-initialize took %.3f sec\n" delta)))) | |||||
| res)) | |||||
| (defadvice require (around spacemacs//timed-require activate) | |||||
| (let ((start (current-time)) res delta) | |||||
| (setq res ad-do-it | |||||
| delta (float-time (time-since start))) | |||||
| (when (> delta spacemacs-debug-timer-threshold) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "File %s: Required %s: %.3f sec\n" | |||||
| load-file-name (ad-get-arg 0) delta)))) | |||||
| res)) | |||||
| (defadvice load (around spacemacs//timed-load activate) | |||||
| (let ((start (current-time)) res delta) | |||||
| (setq res ad-do-it | |||||
| delta (float-time (time-since start))) | |||||
| (when (> delta spacemacs-debug-timer-threshold) | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "File %s: Loaded %s: %.3f sec\n" | |||||
| load-file-name (ad-get-arg 0) delta)))) | |||||
| res))) | |||||
| (when spacemacs-debug-with-adv-timers | |||||
| (with-current-buffer (get-buffer-create "*load-times*") | |||||
| (insert (format "Measured times greater than %.3f sec:\n\n" | |||||
| spacemacs-debug-timer-threshold))) | |||||
| (add-hook 'after-init-hook | |||||
| (lambda () | |||||
| (with-current-buffer "*load-times*" | |||||
| (goto-char (point-max)) | |||||
| (insert (format "[%.3f] Spacemacs finished initializing\n\n" | |||||
| (float-time (time-since emacs-start-time)) ))))) | |||||
| (advice-add 'load :around #'spacemacs//load-timer) | |||||
| (advice-add 'require :around #'spacemacs//load-timer) | |||||
| (advice-add 'package-initialize | |||||
| :around | |||||
| (spacemacs||make-function-timer package-intialize)) | |||||
| (advice-add 'configuration-layer/sync | |||||
| :around | |||||
| (spacemacs||make-function-timer configuration-layer/sync)) | |||||
| ;; (advice-add 'configuration-layer/sync | |||||
| ;; :around | |||||
| ;; (spacemacs||make-function-profiler configuration-layer/sync)) | |||||
| (advice-add 'configuration-layer//configure-package | |||||
| :around | |||||
| (spacemacs||make-function-timer configuration-layer//configure-package))) | |||||
| ;; Keep debug-on-error on for stuff that is lazily loaded | |||||
| (add-hook 'after-init-hook (lambda () (setq debug-on-error t)))) | |||||
| (provide 'core-debug) | |||||
| @ -0,0 +1,46 @@ | |||||
| ;;; core-display-init.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defvar spacemacs--after-display-system-init-list '() | |||||
| "List of functions to be run after the display system is initialized.") | |||||
| (defadvice server-create-window-system-frame | |||||
| (after spacemacs-init-display activate) | |||||
| "After Emacs server creates a frame, run functions queued in | |||||
| `SPACEMACS--AFTER-DISPLAY-SYSTEM-INIT-LIST' to do any setup that needs to have | |||||
| the display system initialized." | |||||
| (progn | |||||
| (dolist (fn (reverse spacemacs--after-display-system-init-list)) | |||||
| (funcall fn)) | |||||
| (ad-disable-advice 'server-create-window-system-frame | |||||
| 'after | |||||
| 'spacemacs-init-display) | |||||
| (ad-activate 'server-create-window-system-frame))) | |||||
| (defmacro spacemacs|do-after-display-system-init (&rest body) | |||||
| "If the display-system is initialized, run `BODY', otherwise, | |||||
| add it to a queue of actions to perform after the first graphical frame is | |||||
| created." | |||||
| `(let ((init (cond ((boundp 'ns-initialized) ns-initialized) | |||||
| ;; w32-initialized gets set too early, so | |||||
| ;; if we're on Windows, check the list of fonts | |||||
| ;; instead (this is nil until the graphics system | |||||
| ;; is initialized) | |||||
| ((boundp 'w32-initialized) (font-family-list)) | |||||
| ((boundp 'x-initialized) x-initialized) | |||||
| ;; fallback to normal loading behavior only if in a GUI | |||||
| (t (display-graphic-p))))) | |||||
| (if init | |||||
| (progn | |||||
| ,@body) | |||||
| (push (lambda () ,@body) spacemacs--after-display-system-init-list)))) | |||||
| (provide 'core-display-init) | |||||
| @ -0,0 +1,250 @@ | |||||
| ;;; core-spacemacs.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (require 'org) | |||||
| (require 'ox-publish) | |||||
| (require 's) | |||||
| (require 'dash) | |||||
| (require 'f) | |||||
| (require 'toc-org) | |||||
| (require 'org-id) | |||||
| (defvar spacemacs--category-names | |||||
| '(("config-files" . "Configuration files") | |||||
| ("email" . "E-mail") | |||||
| ("intl" . "International support") | |||||
| ("lang" . "Programming and markup languages") | |||||
| ("os" . "Operating systems") | |||||
| ("spacemacs" . "Spacemacs distribution layers")) | |||||
| "Special names for categories. Used to generate the layers list.") | |||||
| (defun spacemacs//generate-layers-from-path (path level) | |||||
| "Add all layers found in PATH to the current buffer, at org level LEVEL." | |||||
| (let* ((all-subs (directory-files path t nil nil)) | |||||
| (layers (-filter (lambda (p) | |||||
| (eq 'layer (configuration-layer//directory-type p))) | |||||
| all-subs)) | |||||
| (categories (-filter (lambda (p) | |||||
| (eq 'category (configuration-layer//directory-type p))) | |||||
| all-subs))) | |||||
| (message "%S" layers) | |||||
| (dolist (l layers) | |||||
| (let ((layer-name (file-name-nondirectory l)) | |||||
| (target-path (concat (file-relative-name | |||||
| l (concat spacemacs-start-directory "layers")) | |||||
| "/README.org"))) | |||||
| (insert (format "- [[file:%s][%s]]\n" target-path layer-name)))) | |||||
| (dolist (c categories) | |||||
| (let* ((category-name (substring (file-name-nondirectory c) 1)) | |||||
| (pretty-name (or (cdr (assoc category-name spacemacs--category-names)) | |||||
| (s-capitalize (replace-regexp-in-string | |||||
| "-" " " category-name))))) | |||||
| (message "%S" category-name) | |||||
| (unless (string= "distribution" category-name) | |||||
| (insert (format "\n%s %s\n" level pretty-name)) | |||||
| (spacemacs//generate-layers-from-path c (concat level "*")) | |||||
| ))))) | |||||
| (defun spacemacs//generate-layers-file () | |||||
| "Generate the layers list file." | |||||
| (interactive) | |||||
| (with-temp-buffer | |||||
| (org-mode) | |||||
| (insert "#+TITLE: Configuration layers\n") | |||||
| (insert "#+HTML_HEAD_EXTRA: <link rel=\"stylesheet\" type=\"text/css\" href=\"../css/readtheorg.css\" />\n\n") | |||||
| (insert "* Table of Contents\n") | |||||
| (org-set-tags-to '("TOC_4_org" "noexport")) | |||||
| ;; there is no layer at the root level for now | |||||
| ;; uncomment this line if any new layer is added at the root level | |||||
| ;; (insert "* General layers\n") | |||||
| (spacemacs//generate-layers-from-path configuration-layer-directory "*") | |||||
| (write-file (concat spacemacs-start-directory "layers/LAYERS.org")))) | |||||
| (defun spacemacs//format-toc (&rest r) | |||||
| (if (not (null (car r))) | |||||
| (let* ((toc (car r)) | |||||
| (heading-pos (s-index-of "Contents</h" toc))) | |||||
| (if (not (null heading-pos)) | |||||
| (let* ((end-of-heading-pos (+ (length "Contents") heading-pos)) | |||||
| (beginning-of-heading (substring toc 0 end-of-heading-pos)) | |||||
| (rest-of-toc (substring toc end-of-heading-pos))) | |||||
| (format "%s<a href=\"#\">Close</a>%s" beginning-of-heading rest-of-toc)) | |||||
| toc)) | |||||
| (car r))) | |||||
| (defun spacemacs//format-content (&rest r) | |||||
| (let* ((content (car r)) | |||||
| (div-string "<div id=\"content\">") | |||||
| (toc-string "<div id=\"toggle-sidebar\"><a href=\"#table-of-contents\"><h2>Table of Contents</h2></a></div>") | |||||
| (has-toc (s-index-of "Table of Contents" content)) | |||||
| (beginning-of-content-div-pos (+ (length div-string) (s-index-of div-string content))) | |||||
| (beginning-of-content (substring content 0 beginning-of-content-div-pos)) | |||||
| (rest-of-content (substring content beginning-of-content-div-pos))) | |||||
| (if (not (null has-toc)) | |||||
| (format "%s\n%s%s" beginning-of-content toc-string rest-of-content) | |||||
| content))) | |||||
| (defun spacemacs//toc-org-unhrefify-toc () | |||||
| "Make TOC classical org-mode TOC." | |||||
| (let ((toc-org-hrefify-default "org")) | |||||
| (toc-org-insert-toc))) | |||||
| (defun spacemacs//org-heading-annotate-custom-id () | |||||
| "Annotate headings with the indexes that GitHub uses for linking. | |||||
| `org-html-publish-to-html' will use them instead of the default #orgheadline{N}. | |||||
| This way the GitHub links and the http://spacemacs.org/ links will be compatible." | |||||
| (progn (goto-char (point-min)) | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward "^[\\*]+\s\\(.*\\).*$" nil t) | |||||
| (let ((heading (match-string 1))) | |||||
| (progn (move-end-of-line nil) | |||||
| (open-line 1) | |||||
| (next-line 1) | |||||
| (insert (format (concat " :PROPERTIES:\n" | |||||
| " :CUSTOM_ID: %s\n" | |||||
| " :END:\n") | |||||
| (substring (toc-org-hrefify-gh | |||||
| (replace-regexp-in-string | |||||
| toc-org-tags-regexp | |||||
| "" | |||||
| heading)) | |||||
| ;; Remove # prefix added by `toc-org-hrefify-gh'. | |||||
| 1)))))))) | |||||
| (defun spacemacs//reroot-links () | |||||
| "Find the links that start with https://github.com/syl20bnr/spacemacs/blob/ | |||||
| and end with .org{#an-optional-heading-link} (i.e the links between the local org files). | |||||
| Change their root to http://spacemacs.org/ so the links will point at files located on the site. | |||||
| For the file to file links to work properly the exported org files should be processed with | |||||
| the `spacemacs//org-heading-annotate-custom-id' function." | |||||
| (let ((git-url-root-regexp | |||||
| (concat "\\[\\[[\\s]*\\(https\\:\\/\\/github\\.com\\/syl20bnr" | |||||
| "\\/spacemacs\\/blob\\/[^/]+\\/\\)[^]]+\\(\\.org\\).*$")) | |||||
| (site-url "http://spacemacs.org/") | |||||
| (site-doc-postf ".html")) | |||||
| (progn (goto-char (point-min)) | |||||
| (while (re-search-forward git-url-root-regexp nil t) | |||||
| (progn (replace-match site-url nil t nil 1) | |||||
| (replace-match site-doc-postf nil t nil 2)))))) | |||||
| (defun spacemacs//add-org-meta-readtheorg-css (filename) | |||||
| (let* ((head-css-extra-readtheorg-head (concat | |||||
| "#+HTML_HEAD_EXTRA:" | |||||
| "<link rel=\"stylesheet\" " | |||||
| "type=\"text/css\" " | |||||
| "href=\"")) | |||||
| (head-css-extra-readtheorg-tail "css/readtheorg.css\" />\n")) | |||||
| (progn (goto-char (point-min)) | |||||
| (delete-matching-lines "\\+HTML_HEAD_EXTRA\\:.*\\/css\\/readtheorg\\.css") | |||||
| (goto-char (point-min)) | |||||
| (if (search-forward "#+TITLE:" nil t nil) | |||||
| (beginning-of-line 2) | |||||
| (error (format "Can't find #+TITLE: in %s" | |||||
| (buffer-file-name)))) | |||||
| (insert (concat head-css-extra-readtheorg-head | |||||
| (f-relative spacemacs-start-directory | |||||
| (file-name-directory filename)) | |||||
| head-css-extra-readtheorg-tail))))) | |||||
| (defun spacemacs//pub-doc-html-advice (origfunc &rest args) | |||||
| "Wrapper for `org-html-publish-to-html' use it to insert | |||||
| preprocessors for the exported .org files." | |||||
| (save-current-buffer | |||||
| (save-excursion | |||||
| (let* ((filename (car (nthcdr 1 args))) | |||||
| (visitingp (find-buffer-visiting filename))) | |||||
| ;; Temporary "unvisit" the visited org files. | |||||
| (when visitingp (with-current-buffer visitingp (setq buffer-file-name nil))) | |||||
| (with-temp-buffer | |||||
| (save-match-data | |||||
| (insert-file-contents filename t) | |||||
| ;; ===========Add preprocessors here=============== | |||||
| (spacemacs//add-org-meta-readtheorg-css filename) | |||||
| (spacemacs//toc-org-unhrefify-toc) | |||||
| (spacemacs//reroot-links) | |||||
| (spacemacs//org-heading-annotate-custom-id) | |||||
| (apply origfunc args) | |||||
| (not-modified))) | |||||
| ;; Restore `buffer-file-name' for the buffers that previously visited the org files. | |||||
| (when visitingp (with-current-buffer visitingp (setq buffer-file-name filename))))))) | |||||
| (defun spacemacs/publish-doc () | |||||
| "Publish the documentation to doc/export/." | |||||
| (interactive) | |||||
| (advice-add 'org-html-toc :filter-return #'spacemacs//format-toc) | |||||
| (advice-add 'org-html-template :filter-return #'spacemacs//format-content) | |||||
| (advice-add 'org-html-publish-to-html :around #'spacemacs//pub-doc-html-advice) | |||||
| (let* ((header | |||||
| "<link rel=\"stylesheet\" type=\"text/css\" | |||||
| href=\"http://www.pirilampo.org/styles/readtheorg/css/htmlize.css\"/> | |||||
| <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"></script> | |||||
| <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js\"></script> | |||||
| <script type=\"text/javascript\" | |||||
| src=\"http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js\"></script> | |||||
| <script> | |||||
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |||||
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new | |||||
| Date();a=s.createElement(o), | |||||
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |||||
| })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |||||
| ga('create', 'UA-28326243-2', 'auto'); ga('send', 'pageview'); | |||||
| </script>") | |||||
| (publish-target (concat spacemacs-start-directory "export/")) | |||||
| (org-html-htmlize-output-type 'css) | |||||
| (org-publish-project-alist | |||||
| `(("spacemacs" | |||||
| :components ("spacemacs-news" | |||||
| "spacemacs-doc" | |||||
| "spacemacs-doc-static" | |||||
| "layers-doc" | |||||
| "layers-doc-static")) | |||||
| ("spacemacs-news" | |||||
| :base-directory ,spacemacs-news-directory | |||||
| :base-extension "org" | |||||
| :publishing-directory ,(concat publish-target "news/") | |||||
| :publishing-function org-html-publish-to-html | |||||
| :headline-levels 4 | |||||
| :html-head ,header) | |||||
| ("spacemacs-doc" | |||||
| :base-directory ,spacemacs-docs-directory | |||||
| :base-extension "org" | |||||
| :publishing-directory ,(concat publish-target "doc/") | |||||
| :publishing-function org-html-publish-to-html | |||||
| :headline-levels 4 | |||||
| :html-head ,header) | |||||
| ("layers-doc" | |||||
| :base-directory ,(concat spacemacs-start-directory "layers/") | |||||
| :base-extension "org" | |||||
| :recursive t | |||||
| :publishing-directory ,(concat publish-target "layers/") | |||||
| :publishing-function org-html-publish-to-html | |||||
| :preparation-function spacemacs//generate-layers-file | |||||
| :exclude "local" | |||||
| :html-head ,header) | |||||
| ("spacemacs-doc-static" | |||||
| :base-directory ,spacemacs-docs-directory | |||||
| :base-extension "png" | |||||
| :recursive t | |||||
| :publishing-directory ,(concat publish-target "doc/") | |||||
| :publishing-function org-publish-attachment) | |||||
| ("layers-doc-static" | |||||
| :base-directory ,(concat spacemacs-start-directory "layers/") | |||||
| :base-extension "jpg\\|png\\|gif" | |||||
| :recursive t | |||||
| :publishing-directory ,(concat publish-target "layers/") | |||||
| :publishing-function org-publish-attachment)))) | |||||
| (org-publish-project "spacemacs")) | |||||
| (advice-remove 'org-html-toc #'spacemacs//format-toc) | |||||
| (advice-remove 'org-html-template #'spacemacs//format-content) | |||||
| (advice-remove 'org-html-publish-to-html #'spacemacs//pub-doc-html-advice)) | |||||
| (provide 'core-documentation) | |||||
| @ -0,0 +1,728 @@ | |||||
| ;;; core-dotspacemacs.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defconst dotspacemacs-template-directory | |||||
| (expand-file-name (concat spacemacs-core-directory "templates/")) | |||||
| "Templates directory.") | |||||
| (defconst dotspacemacs-test-results-buffer "*dotfile-test-results*" | |||||
| "Name of the buffer to display dotfile test results.") | |||||
| (let* ((env (getenv "SPACEMACSDIR")) | |||||
| (env-dir (when env (expand-file-name (concat env "/")))) | |||||
| (env-init (and env-dir (expand-file-name "init.el" env-dir))) | |||||
| (no-env-dir-default (expand-file-name | |||||
| (concat user-home-directory | |||||
| ".spacemacs.d/"))) | |||||
| (default-init (expand-file-name ".spacemacs" user-home-directory))) | |||||
| (defconst dotspacemacs-directory | |||||
| (cond | |||||
| ((and env (file-exists-p env-dir)) | |||||
| env-dir) | |||||
| ((file-exists-p no-env-dir-default) | |||||
| no-env-dir-default) | |||||
| (t | |||||
| nil)) | |||||
| "Optional spacemacs directory, which defaults to | |||||
| ~/.spacemacs.d. This setting can be overridden using the | |||||
| SPACEMACSDIR environment variable. If neither of these | |||||
| directories exist, this variable will be nil.") | |||||
| (defvar dotspacemacs-filepath | |||||
| (let ((spacemacs-dir-init (when dotspacemacs-directory | |||||
| (concat dotspacemacs-directory | |||||
| "init.el")))) | |||||
| (cond | |||||
| (env-init) | |||||
| ((file-exists-p default-init) default-init) | |||||
| ((and dotspacemacs-directory (file-exists-p spacemacs-dir-init)) spacemacs-dir-init) | |||||
| (t default-init))) | |||||
| "Filepath to the installed dotfile. If SPACEMACSDIR is given | |||||
| then SPACEMACSDIR/init.el is used. Otherwise, if ~/.spacemacs | |||||
| exists, then this is used. If ~/.spacemacs does not exist, then | |||||
| check for init.el in dotspacemacs-directory and use this if it | |||||
| exists. Otherwise, fallback to ~/.spacemacs")) | |||||
| (defvar dotspacemacs-distribution 'spacemacs | |||||
| "Base distribution to use. This is a layer contained in the directory | |||||
| `+distributions'. For now available distributions are `spacemacs-base' | |||||
| or `spacemacs'.") | |||||
| (defvar dotspacemacs-elpa-https t | |||||
| "If non nil ELPA repositories are contacted via HTTPS whenever it's | |||||
| possible. Set it to nil if you have no way to use HTTPS in your | |||||
| environment, otherwise it is strongly recommended to let it set to t.") | |||||
| (defvar dotspacemacs-elpa-timeout 5 | |||||
| "Maximum allowed time in seconds to contact an ELPA repository.") | |||||
| (defvar dotspacemacs-elpa-subdirectory nil | |||||
| "If non-nil, a form that evaluates to a package directory. For | |||||
| example, to use different package directories for different Emacs | |||||
| versions, set this to `emacs-version'.") | |||||
| (defvar dotspacemacs-configuration-layer-path '() | |||||
| "List of additional paths where to look for configuration layers. | |||||
| Paths must have a trailing slash (ie. `~/.mycontribs/')") | |||||
| (defvar dotspacemacs-install-packages 'used-only | |||||
| "Defines the behaviour of Spacemacs when installing packages. | |||||
| Possible values are `used-only', `used-but-keep-unused' and `all'. `used-only' | |||||
| installs only explicitly used packages and uninstall any unused packages as well | |||||
| as their unused dependencies. `used-but-keep-unused' installs only the used | |||||
| packages but won't uninstall them if they become unused. `all' installs *all* | |||||
| packages supported by Spacemacs and never uninstall them.") | |||||
| (defvar dotspacemacs-enable-lazy-installation 'unused | |||||
| "Lazy installation of layers (i.e. layers are installed only when a file | |||||
| with a supported type is opened). Possible values are `all', `unused' and `nil'. | |||||
| `unused' will lazy install only unused layers (i.e. layers not listed in | |||||
| variable `dotspacemacs-configuration-layers'), `all' will lazy install any layer | |||||
| that support lazy installation even the layers listed in | |||||
| `dotspacemacs-configuration-layers'. `nil' disable the lazy installation feature | |||||
| and you have to explicitly list a layer in the variable | |||||
| `dotspacemacs-configuration-layers' to install it.") | |||||
| (defvar dotspacemacs-ask-for-lazy-installation t | |||||
| "If non-nil then Spacemacs will ask for confirmation before installing | |||||
| a layer lazily.") | |||||
| (defvar dotspacemacs-additional-packages '() | |||||
| "List of additional packages that will be installed wihout being | |||||
| wrapped in a layer. If you need some configuration for these | |||||
| packages then consider to create a layer, you can also put the | |||||
| configuration in `dotspacemacs/user-config'.") | |||||
| (defvar dotspacemacs-editing-style 'vim | |||||
| "One of `vim', `emacs' or `hybrid'. | |||||
| `hybrid' is like `vim' except that `insert state' is replaced by the | |||||
| `hybrid state' with `emacs' key bindings. The value can also be a list | |||||
| with `:variables' keyword (similar to layers). Check the editing styles | |||||
| section of the documentation for details on available variables.") | |||||
| (defvar dotspacemacs-startup-banner 'official | |||||
| "Specify the startup banner. Default value is `official', it displays | |||||
| the official spacemacs logo. An integer value is the index of text | |||||
| banner, `random' chooses a random text banner in `core/banners' | |||||
| directory. A string value must be a path to a .PNG file. | |||||
| If the value is nil then no banner is displayed.") | |||||
| (defvar dotspacemacs-scratch-mode 'text-mode | |||||
| "Default major mode of the scratch buffer.") | |||||
| (defvar dotspacemacs-check-for-update nil | |||||
| "If non nil then spacemacs will check for updates at startup | |||||
| when the current branch is not `develop'. Note that checking for | |||||
| new versions works via git commands, thus it calls GitHub services | |||||
| whenever you start Emacs.") | |||||
| (defvar dotspacemacs-configuration-layers '(emacs-lisp) | |||||
| "List of configuration layers to load.") | |||||
| (defvar dotspacemacs--configuration-layers-saved nil | |||||
| "Saved value of `dotspacemacs-configuration-layers' after sync.") | |||||
| (defvar dotspacemacs-themes '(spacemacs-dark | |||||
| spacemacs-light) | |||||
| "List of themes, the first of the list is loaded when spacemacs starts. | |||||
| Press `SPC T n' to cycle to the next theme in the list (works great | |||||
| with 2 themes variants, one dark and one light") | |||||
| (defvar dotspacemacs-colorize-cursor-according-to-state t | |||||
| "If non nil the cursor color matches the state color in GUI Emacs.") | |||||
| (defvar dotspacemacs-leader-key "SPC" | |||||
| "The leader key.") | |||||
| (defvar dotspacemacs-emacs-leader-key "M-m" | |||||
| "The leader key accessible in `emacs state' and `insert state'") | |||||
| (defvar dotspacemacs-major-mode-leader-key "," | |||||
| "Major mode leader key is a shortcut key which is the equivalent of | |||||
| pressing `<leader> m`. Set it to `nil` to disable it.") | |||||
| (defvar dotspacemacs-major-mode-emacs-leader-key "C-M-m" | |||||
| "Major mode leader key accessible in `emacs state' and `insert state'") | |||||
| (defvar dotspacemacs-ex-command-key ":" | |||||
| "The key used for Vim Ex commands.") | |||||
| (defvar dotspacemacs-command-key "SPC" | |||||
| "The key used for Emacs commands (M-x) (after pressing on the leader key).") | |||||
| (defvaralias 'dotspacemacs-emacs-command-key 'dotspacemacs-command-key | |||||
| "New official name for `dotspacemacs-command-key'") | |||||
| (defvar dotspacemacs-distinguish-gui-tab nil | |||||
| "If non nil, distinguish C-i and tab in the GUI version of | |||||
| emacs.") | |||||
| ;; (defvar dotspacemacs-distinguish-gui-ret nil | |||||
| ;; "If non nil, distinguish C-m and return in the GUI version of | |||||
| ;; emacs.") | |||||
| (defvar dotspacemacs-default-font '("Source Code Pro" | |||||
| :size 13 | |||||
| :weight normal | |||||
| :width normal | |||||
| :powerline-scale 1.1) | |||||
| "Default font, or prioritized list of fonts. `powerline-scale' | |||||
| allows to quickly tweak the mode-line size to make separators | |||||
| look not too crappy. | |||||
| Has no effect when running Emacs in terminal.") | |||||
| (defvar dotspacemacs-remap-Y-to-y$ nil | |||||
| "If non nil `Y' is remapped to `y$' in Evil states.") | |||||
| (defvar dotspacemacs-retain-visual-state-on-shift t | |||||
| "If non-nil, the shift mappings `<' and `>' retain visual state | |||||
| if used there.") | |||||
| (defvar dotspacemacs-visual-line-move-text nil | |||||
| "If non-nil, J and K move lines up and down when in visual mode.") | |||||
| (defvar dotspacemacs-ex-substitute-global nil | |||||
| "If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.") | |||||
| (defvar dotspacemacs-folding-method 'evil | |||||
| "Code folding method. Possible values are `evil' and `origami'.") | |||||
| (defvar dotspacemacs-default-layout-name "Default" | |||||
| " Name of the default layout.") | |||||
| (defvar dotspacemacs-display-default-layout nil | |||||
| "If non nil the default layout name is displayed in the mode-line.") | |||||
| (defvar dotspacemacs-auto-resume-layouts nil | |||||
| "If non nil then the last auto saved layouts are resume automatically upon | |||||
| start.") | |||||
| (defvar dotspacemacs-max-rollback-slots 5 | |||||
| "Maximum number of rollback slots to keep in the cache.") | |||||
| (defvar dotspacemacs-helm-resize nil | |||||
| "If non nil, `helm' will try to minimize the space it uses.") | |||||
| (defvar dotspacemacs-helm-no-header nil | |||||
| "if non nil, the helm header is hidden when there is only one source.") | |||||
| (defvar dotspacemacs-helm-position 'bottom | |||||
| "Position in which to show the `helm' mini-buffer.") | |||||
| (defvar dotspacemacs-helm-use-fuzzy 'always | |||||
| "Controls fuzzy matching in helm. If set to `always', force fuzzy matching | |||||
| in all non-asynchronous sources. If set to `source', preserve individual | |||||
| source settings. Else, disable fuzzy matching in all sources.") | |||||
| (defvar dotspacemacs-large-file-size 1 | |||||
| "Size (in MB) above which spacemacs will prompt to open the large file | |||||
| literally to avoid performance issues. Opening a file literally means that | |||||
| no major mode or minor modes are active.") | |||||
| (defvar dotspacemacs-auto-save-file-location 'cache | |||||
| "Location where to auto-save files. Possible values are `original' to | |||||
| auto-save the file in-place, `cache' to auto-save the file to another | |||||
| file stored in the cache directory and `nil' to disable auto-saving. | |||||
| Default value is `cache'.") | |||||
| (defvar dotspacemacs-enable-paste-transient-state t | |||||
| "If non nil the paste transient-state is enabled. While enabled pressing `p` | |||||
| several times cycle between the kill ring content.'") | |||||
| (defvaralias | |||||
| 'dotspacemacs-enable-paste-micro-state | |||||
| 'dotspacemacs-enable-paste-transient-state | |||||
| "Old name of `dotspacemacs-enable-paste-transient-state'.") | |||||
| (defvar dotspacemacs-which-key-delay 0.4 | |||||
| "Delay in seconds starting from the last keystroke after which | |||||
| the which-key buffer will be shown if you have not completed a | |||||
| key sequence. Setting this variable is equivalent to setting | |||||
| `which-key-idle-delay'.") | |||||
| (defvar dotspacemacs-which-key-position 'bottom | |||||
| "Location of the which-key popup buffer. Possible choices are bottom, | |||||
| right, and right-then-bottom. The last one will display on the | |||||
| right if possible and fallback to bottom if not.") | |||||
| (defvar dotspacemacs-loading-progress-bar t | |||||
| "If non nil a progress bar is displayed when spacemacs is loading. This | |||||
| may increase the boot time on some systems and emacs builds, set it to nil | |||||
| to boost the loading time.") | |||||
| (defvar dotspacemacs-fullscreen-at-startup nil | |||||
| "If non nil the frame is fullscreen when Emacs starts up (Emacs 24.4+ only).") | |||||
| (defvar dotspacemacs-fullscreen-use-non-native nil | |||||
| "If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. Use | |||||
| to disable fullscreen animations in OSX.") | |||||
| (defvar dotspacemacs-maximized-at-startup nil | |||||
| "If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only). | |||||
| Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.") | |||||
| (defvar dotspacemacs-active-transparency 90 | |||||
| "A value from the range (0..100), in increasing opacity, which describes the | |||||
| transparency level of a frame when it's active or selected. Transparency | |||||
| can be toggled through `toggle-transparency'.") | |||||
| (defvar dotspacemacs-inactive-transparency 90 | |||||
| "A value from the range (0..100), in increasing opacity, which describes the | |||||
| transparency level of a frame when it's inactive or deselected. Transparency | |||||
| can be toggled through `toggle-transparency'.") | |||||
| (defvar dotspacemacs-show-transient-state-title t | |||||
| "If non nil show the titles of transient states.") | |||||
| (defvar dotspacemacs-show-transient-state-color-guide t | |||||
| "If non nil show the color guide hint for transient state keys.") | |||||
| (defvar dotspacemacs-mode-line-unicode-symbols t | |||||
| "If non nil unicode symbols are displayed in the mode-line (eg. for lighters)") | |||||
| (defvar dotspacemacs-smooth-scrolling t | |||||
| "If non nil smooth scrolling (native-scrolling) is enabled. | |||||
| Smooth scrolling overrides the default behavior of Emacs which | |||||
| recenters point when it reaches the top or bottom of the | |||||
| screen.") | |||||
| (defvar dotspacemacs-line-numbers nil | |||||
| "If non nil line numbers are turned on in all `prog-mode' and `text-mode' | |||||
| derivatives. If set to `relative', also turns on relative line numbers.") | |||||
| (defvar dotspacemacs-persistent-server nil | |||||
| "If non nil advises quit functions to keep server open when quitting.") | |||||
| (defvar dotspacemacs-smartparens-strict-mode nil | |||||
| "If non-nil smartparens-strict-mode will be enabled in programming modes.") | |||||
| (defvar dotspacemacs-smart-closing-parenthesis nil | |||||
| "If non-nil pressing the closing parenthesis `)' key in insert mode passes | |||||
| over any automatically added closing parenthesis, bracket, quote, etc… | |||||
| This can be temporary disabled by pressing `C-q' before `)'. (default nil)") | |||||
| (defvar dotspacemacs-highlight-delimiters 'all | |||||
| "Select a scope to highlight delimiters. Possible values are `any', | |||||
| `current', `all' or `nil'. Default is `all' (highlight any scope and | |||||
| emphasis the current one.") | |||||
| (defvar dotspacemacs-whitespace-cleanup nil | |||||
| "delete whitespace while saving buffer. possible values are `all' | |||||
| to aggressively delete empty lines and long sequences of whitespace, `trailing' | |||||
| to delete only the whitespace at end of lines, `changed' to delete only | |||||
| whitespace for changed lines or `nil' to disable cleanup.") | |||||
| (defvar dotspacemacs-search-tools '("ag" "pt" "ack" "grep") | |||||
| "List of search tool executable names. Spacemacs uses the first installed | |||||
| tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.") | |||||
| (defvar dotspacemacs-default-package-repository 'melpa-stable | |||||
| "The default package repository used if no explicit repository has been | |||||
| specified with an installed package. | |||||
| NOT USED FOR NOW :-)") | |||||
| (defvar dotspacemacs-startup-lists '((recents . 5) | |||||
| (projects . 7)) | |||||
| "Association list of items to show in the startup buffer of the form | |||||
| `(list-type . list-size)`. If nil it is disabled. | |||||
| Possible values for list-type are: | |||||
| `recents' `bookmarks' `projects' `agenda' `todos'. | |||||
| List sizes may be nil, in which case | |||||
| `spacemacs--buffer-startup-lists-length' takes effect. | |||||
| ") | |||||
| (defvar dotspacemacs-startup-buffer-responsive t | |||||
| "True if the home buffer should respond to resize events.") | |||||
| (defvar dotspacemacs-excluded-packages '() | |||||
| "A list of packages that will not be install and loaded.") | |||||
| (defvar dotspacemacs-frozen-packages '() | |||||
| "A list of packages that cannot be updated.") | |||||
| ;; only for backward compatibility | |||||
| (defalias 'dotspacemacs-mode 'emacs-lisp-mode) | |||||
| (defmacro dotspacemacs|call-func (func &optional msg) | |||||
| "Call the function from the dotfile only if it is bound. | |||||
| If MSG is not nil then display a message in `*Messages'. Errors | |||||
| are caught and signalled to user in spacemacs buffer." | |||||
| `(progn | |||||
| (when ,msg (spacemacs-buffer/message ,msg)) | |||||
| (when (fboundp ',func) | |||||
| (condition-case-unless-debug err | |||||
| (,func) | |||||
| (error | |||||
| (configuration-layer//increment-error-count) | |||||
| (spacemacs-buffer/append (format "Error in %s: %s\n" | |||||
| ',(symbol-name func) | |||||
| (error-message-string err)) | |||||
| t)))))) | |||||
| (defun dotspacemacs//check-layers-changed () | |||||
| "Check if the value of `dotspacemacs-configuration-layers' | |||||
| changed, and issue a warning if it did." | |||||
| (unless (eq dotspacemacs-configuration-layers | |||||
| dotspacemacs--configuration-layers-saved) | |||||
| (spacemacs-buffer/warning | |||||
| "`dotspacemacs-configuration-layers' was changed outside of `dotspacemacs/layers'."))) | |||||
| (add-hook 'spacemacs-post-user-config-hook | |||||
| 'dotspacemacs//check-layers-changed) | |||||
| (defun dotspacemacs//read-editing-style-config (config) | |||||
| "Read editing style CONFIG: apply variables and return the editing style. | |||||
| CONFIG can be the symbol of an editing style or a list where the car is | |||||
| the symbol of an editing style and the cdr is a list of keyword arguments like | |||||
| `:variables'." | |||||
| (cond | |||||
| ((symbolp config) config) | |||||
| ((listp config) | |||||
| (let ((variables (spacemacs/mplist-get config :variables))) | |||||
| (while variables | |||||
| (let ((var (pop variables))) | |||||
| (if (consp variables) | |||||
| (condition-case-unless-debug err | |||||
| (set-default var (eval (pop variables))) | |||||
| ('error | |||||
| (spacemacs-buffer/append | |||||
| (format (concat "\nAn error occurred while reading the " | |||||
| "editing style variable %s " | |||||
| "(error: %s). Be sure to quote the value " | |||||
| "if needed.\n") var err)))) | |||||
| (spacemacs-buffer/warning "Missing value for variable %s !" | |||||
| var))))) | |||||
| (car config)))) | |||||
| (defun dotspacemacs/add-layer (layer-name) | |||||
| "Add LAYER_NAME to dotfile and reload the it. | |||||
| Returns non nil if the layer has been effectively inserted." | |||||
| (unless (configuration-layer/layer-usedp layer-name) | |||||
| (with-current-buffer (find-file-noselect (dotspacemacs/location)) | |||||
| (beginning-of-buffer) | |||||
| (let ((insert-point (re-search-forward | |||||
| "dotspacemacs-configuration-layers *\n?.*\\((\\)"))) | |||||
| (insert (format "\n%S" layer-name)) | |||||
| (indent-region insert-point (+ insert-point | |||||
| (length (symbol-name layer-name)))) | |||||
| (save-buffer))) | |||||
| (load-file (dotspacemacs/location)) | |||||
| t)) | |||||
| (defun dotspacemacs/sync-configuration-layers (&optional arg) | |||||
| "Synchronize declared layers in dotfile with spacemacs. | |||||
| Called with `C-u' skips `dotspacemacs/user-config'. | |||||
| Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary tests." | |||||
| (interactive "P") | |||||
| (when (file-exists-p dotspacemacs-filepath) | |||||
| (with-current-buffer (find-file-noselect dotspacemacs-filepath) | |||||
| (let ((dotspacemacs-loading-progress-bar nil)) | |||||
| (setq spacemacs-loading-string "") | |||||
| (save-buffer) | |||||
| (let ((tests-ok (or (equal arg '(16)) (dotspacemacs/test-dotfile t)))) | |||||
| (if tests-ok | |||||
| (progn | |||||
| (load-file buffer-file-name) | |||||
| (dotspacemacs|call-func dotspacemacs/init | |||||
| "Calling dotfile init...") | |||||
| (dotspacemacs|call-func dotspacemacs/user-init | |||||
| "Calling dotfile user init...") | |||||
| (setq dotspacemacs-editing-style | |||||
| (dotspacemacs//read-editing-style-config | |||||
| dotspacemacs-editing-style)) | |||||
| (configuration-layer/sync) | |||||
| (if (member arg '((4) (16))) | |||||
| (message (concat "Done (`dotspacemacs/user-config' " | |||||
| "function has been skipped).")) | |||||
| (dotspacemacs|call-func dotspacemacs/user-config | |||||
| "Calling dotfile user config...") | |||||
| (run-hooks 'spacemacs-post-user-config-hook) | |||||
| (message "Done."))) | |||||
| (switch-to-buffer-other-window dotspacemacs-test-results-buffer) | |||||
| (spacemacs-buffer/warning "Some tests failed, check `%s' buffer" | |||||
| dotspacemacs-test-results-buffer)))))) | |||||
| (when (configuration-layer/package-usedp 'spaceline) | |||||
| (spacemacs//set-powerline-for-startup-buffers))) | |||||
| (defun dotspacemacs/get-variable-string-list () | |||||
| "Return a list of all the dotspacemacs variables as strings." | |||||
| (all-completions "" obarray | |||||
| (lambda (x) | |||||
| (and (boundp x) | |||||
| (not (keywordp x)) | |||||
| (string-prefix-p "dotspacemacs" | |||||
| (symbol-name x)))))) | |||||
| (defun dotspacemacs/get-variable-list () | |||||
| "Return a list of all dotspacemacs variable symbols." | |||||
| (mapcar 'intern (dotspacemacs/get-variable-string-list))) | |||||
| (defmacro dotspacemacs|symbol-value (symbol) | |||||
| "Return the value of SYMBOL corresponding to a dotspacemacs variable. | |||||
| If SYMBOL value is `display-graphic-p' then return the result of | |||||
| `(display-graphic-p)', otherwise return the value of the symbol." | |||||
| `(if (eq 'display-graphic-p ,symbol) (display-graphic-p) ,symbol)) | |||||
| (defun dotspacemacs/location () | |||||
| "Return the absolute path to the spacemacs dotfile." | |||||
| dotspacemacs-filepath) | |||||
| (defun dotspacemacs/copy-template () | |||||
| "Copy `.spacemacs.template' in home directory. Ask for confirmation | |||||
| before copying the file if the destination already exists." | |||||
| (interactive) | |||||
| (let* ((copy? (if (file-exists-p dotspacemacs-filepath) | |||||
| (y-or-n-p | |||||
| (format "%s already exists. Do you want to overwrite it ? " | |||||
| dotspacemacs-filepath)) t))) | |||||
| (when copy? | |||||
| (copy-file (concat dotspacemacs-template-directory | |||||
| ".spacemacs.template") dotspacemacs-filepath t) | |||||
| (message "%s has been installed." dotspacemacs-filepath)))) | |||||
| (defun dotspacemacs//ido-completing-read (prompt candidates) | |||||
| "Call `ido-completing-read' with a CANDIDATES alist where the key is | |||||
| a display strng and the value is the actual value to return." | |||||
| (let ((ido-max-window-height (1+ (length candidates)))) | |||||
| (cadr (assoc (ido-completing-read prompt (mapcar 'car candidates)) | |||||
| candidates)))) | |||||
| (defun dotspacemacs/install (arg) | |||||
| "Install the dotfile, return non nil if the doftile has been installed. | |||||
| If ARG is non nil then Ask questions to the user before installing the dotfile." | |||||
| (interactive "P") | |||||
| ;; preferences is an alist where the key is the text to replace by | |||||
| ;; the value in the dotfile | |||||
| (let ((preferences | |||||
| (when arg | |||||
| ;; editing style | |||||
| `(("dotspacemacs-editing-style 'vim" | |||||
| ,(format | |||||
| "dotspacemacs-editing-style '%S" | |||||
| (dotspacemacs//ido-completing-read | |||||
| "What is your preferred editing style? " | |||||
| '(("Among the stars aboard the Evil flagship (vim)" | |||||
| vim) | |||||
| ("On the planet Emacs in the Holy control tower (emacs)" | |||||
| emacs))))) | |||||
| ("dotspacemacs-distribution 'spacemacs" | |||||
| ,(format | |||||
| "dotspacemacs-distribution '%S" | |||||
| (dotspacemacs//ido-completing-read | |||||
| "What distribution of spacemacs would you like to start with? " | |||||
| `(("The standard distribution, recommended (spacemacs)" | |||||
| spacemacs) | |||||
| (,(concat "A minimalist distribution that you can build on " | |||||
| "(spacemacs-base)") | |||||
| spacemacs-base))))) | |||||
| ("helm" | |||||
| ,(dotspacemacs//ido-completing-read | |||||
| "What type of completion framework do you want? " | |||||
| '(("A heavy one but full-featured (helm)" | |||||
| "helm") | |||||
| ("A lighter one but still very powerful (ivy)" | |||||
| "ivy") | |||||
| ;; For now, None works only if the user selected | |||||
| ;; the spacemacs-base distribution | |||||
| ("None (not recommended)" "")))))))) | |||||
| (with-current-buffer (find-file-noselect | |||||
| (concat dotspacemacs-template-directory | |||||
| ".spacemacs.template")) | |||||
| (dolist (p preferences) | |||||
| (goto-char (point-min)) | |||||
| (re-search-forward (car p)) | |||||
| (replace-match (cadr p))) | |||||
| (let ((install | |||||
| (if (file-exists-p dotspacemacs-filepath) | |||||
| (y-or-n-p | |||||
| (format "%s already exists. Do you want to overwrite it ? " | |||||
| dotspacemacs-filepath)) t))) | |||||
| (when install | |||||
| (write-file dotspacemacs-filepath) | |||||
| (message "%s has been installed." dotspacemacs-filepath) | |||||
| t)))) | |||||
| (load-file dotspacemacs-filepath)) | |||||
| (defun dotspacemacs//install-and-replace (&optional values) | |||||
| "Install the dotfile and replace its content according to VALUES. | |||||
| VALUES is an alist where the key is the text to replace and value is the new | |||||
| value." | |||||
| ) | |||||
| (defun dotspacemacs/load-file () | |||||
| "Load ~/.spacemacs if it exists." | |||||
| (let ((dotspacemacs (dotspacemacs/location))) | |||||
| (if (file-exists-p dotspacemacs) | |||||
| (unless (with-demoted-errors "Error loading .spacemacs: %S" (load dotspacemacs)) | |||||
| (dotspacemacs/safe-load))))) | |||||
| (defun dotspacemacs/safe-load () | |||||
| "Error recovery from malformed .spacemacs. | |||||
| Loads default .spacemacs template and suspends pruning of orphan packages. | |||||
| Informs users of error and prompts for default editing style for use during | |||||
| error recovery." | |||||
| (load (concat dotspacemacs-template-directory | |||||
| ".spacemacs.template")) | |||||
| (defadvice dotspacemacs/layers | |||||
| (after error-recover-preserve-packages activate) | |||||
| (progn | |||||
| (setq-default dotspacemacs-install-packages 'used-but-keep-unused) | |||||
| (ad-disable-advice 'dotspacemacs/layers 'after | |||||
| 'error-recover-preserve-packages) | |||||
| (ad-activate 'dotspacemacs/layers))) | |||||
| (defadvice dotspacemacs/init | |||||
| (after error-recover-prompt-for-style activate) | |||||
| (progn | |||||
| (setq-default dotspacemacs-editing-style | |||||
| (intern | |||||
| (ido-completing-read | |||||
| (format | |||||
| (concat | |||||
| "Spacemacs encountered an error while " | |||||
| "loading your `%s' file.\n" | |||||
| "Pick your editing style for recovery " | |||||
| "(use left and right arrows): ") | |||||
| dotspacemacs-filepath) | |||||
| '(("vim" vim) | |||||
| ("emacs" emacs) | |||||
| ("hybrid" hybrid)) | |||||
| nil t nil nil 'vim))) | |||||
| (ad-disable-advice 'dotspacemacs/init 'after | |||||
| 'error-recover-prompt-for-style) | |||||
| (ad-activate 'dotspacemacs/init)))) | |||||
| (defun dotspacemacs//test-dotspacemacs/layers () | |||||
| "Tests for `dotspacemacs/layers'" | |||||
| (insert | |||||
| (format (concat "\n* Testing settings in dotspacemacs/layers " | |||||
| "[[file:%s::dotspacemacs/layers][Show in File]]\n") | |||||
| dotspacemacs-filepath)) | |||||
| ;; protect global values of these variables | |||||
| (let (dotspacemacs-configuration-layer-path dotspacemacs-configuration-layers | |||||
| dotspacemacs-additional-packages dotspacemacs-excluded-packages | |||||
| dotspacemacs-install-packages | |||||
| (passed-tests 0) (total-tests 0)) | |||||
| (load dotspacemacs-filepath) | |||||
| (dotspacemacs/layers) | |||||
| (spacemacs//test-list | |||||
| 'stringp 'dotspacemacs-configuration-layer-path | |||||
| "is a string" "path") | |||||
| (spacemacs//test-list | |||||
| 'file-directory-p 'dotspacemacs-configuration-layer-path | |||||
| "exists in filesystem" "path") | |||||
| (setq dotspacemacs-configuration-layers | |||||
| (mapcar (lambda (l) (if (listp l) (car l) l)) | |||||
| dotspacemacs-configuration-layers)) | |||||
| (spacemacs//test-list | |||||
| 'configuration-layer/get-layer-path | |||||
| 'dotspacemacs-configuration-layers "can be found" "layer") | |||||
| (insert (format | |||||
| (concat "** RESULTS: " | |||||
| "[[file:%s::dotspacemacs/layers][dotspacemacs/layers]] " | |||||
| "passed %s out of %s tests\n") | |||||
| dotspacemacs-filepath passed-tests total-tests)) | |||||
| (equal passed-tests total-tests))) | |||||
| (defmacro dotspacemacs||let-init-test (&rest body) | |||||
| "Macro to protect dotspacemacs variables" | |||||
| `(let ((fpath dotspacemacs-filepath) | |||||
| ,@(dotspacemacs/get-variable-list) | |||||
| (passed-tests 0) (total-tests 0)) | |||||
| (setq dotspacemacs-filepath fpath) | |||||
| (load dotspacemacs-filepath) | |||||
| ,@body)) | |||||
| (defun dotspacemacs//test-dotspacemacs/init () | |||||
| "Tests for `dotspacemacs/init'" | |||||
| (insert | |||||
| (format (concat "\n* Testing settings in dotspacemacs/init " | |||||
| "[[file:%s::dotspacemacs/init][Show in File]]\n") | |||||
| dotspacemacs-filepath)) | |||||
| (dotspacemacs||let-init-test | |||||
| (dotspacemacs/init) | |||||
| (spacemacs//test-var | |||||
| (lambda (x) (or (member x '(vim emacs hybrid)) | |||||
| (and (listp x) | |||||
| (spacemacs/mplist-get x :variables)))) | |||||
| 'dotspacemacs-editing-style | |||||
| "is \'vim, \'emacs or \'hybrid or and list with `:variable' keyword") | |||||
| (spacemacs//test-var | |||||
| (lambda (x) (member x '(original cache nil))) | |||||
| 'dotspacemacs-auto-save-file-location (concat "is one of \'original, " | |||||
| "\'cache or nil")) | |||||
| (spacemacs//test-var | |||||
| (lambda (x) (member x '(all any current nil))) | |||||
| 'dotspacemacs-highlight-delimiters "is one of \'all, \'any, \'current or nil") | |||||
| (spacemacs//test-list | |||||
| (lambda (x) | |||||
| (let ((el (or (car-safe x) x)) | |||||
| (list-size (cdr-safe x))) | |||||
| (member el '(recents bookmarks projects todos agenda)))) | |||||
| 'dotspacemacs-startup-lists (concat "includes \'recents, " | |||||
| "\'bookmarks, \'todos, " | |||||
| "\'agenda or \'projects")) | |||||
| (spacemacs//test-list | |||||
| (lambda (x) | |||||
| (let ((el (or (car-safe x) x)) | |||||
| (list-size (cdr-safe x))) | |||||
| (or (null list-size)(numberp list-size)))) | |||||
| 'dotspacemacs-startup-lists (concat "list size is a number")) | |||||
| (spacemacs//test-var 'stringp 'dotspacemacs-leader-key "is a string") | |||||
| (spacemacs//test-var 'stringp 'dotspacemacs-emacs-leader-key "is a string") | |||||
| (spacemacs//test-var | |||||
| (lambda (x) (or (null x) (stringp x))) | |||||
| 'dotspacemacs-major-mode-leader-key "is a string or nil") | |||||
| (spacemacs//test-var | |||||
| (lambda (x) (or (null x) (stringp x))) | |||||
| 'dotspacemacs-major-mode-emacs-leader-key "is a string or nil") | |||||
| (spacemacs//test-var 'stringp 'dotspacemacs-emacs-command-key "is a string") | |||||
| (insert (format | |||||
| (concat "** RESULTS: " | |||||
| "[[file:%s::dotspacemacs/init][dotspacemacs/init]] " | |||||
| "passed %s out of %s tests\n") | |||||
| dotspacemacs-filepath passed-tests total-tests)) | |||||
| (equal passed-tests total-tests))) | |||||
| (defun dotspacemacs/test-dotfile (&optional hide-buffer) | |||||
| "Test settings in dotfile for correctness. | |||||
| Return non-nil if all the tests passed." | |||||
| (interactive) | |||||
| (configuration-layer/discover-layers) | |||||
| (let ((min-version "0.0")) | |||||
| ;; dotspacemacs-version not implemented yet | |||||
| ;; (if (version< dotspacemacs-version min-version) | |||||
| (if nil | |||||
| (error (format (concat "error: dotspacemacs/test-dotfile requires " | |||||
| "dotspacemacs-version %s") min-version)) | |||||
| (with-current-buffer (get-buffer-create dotspacemacs-test-results-buffer) | |||||
| (unless hide-buffer | |||||
| (switch-to-buffer-other-window dotspacemacs-test-results-buffer)) | |||||
| (org-mode) | |||||
| (org-indent-mode) | |||||
| (view-mode) | |||||
| (when (bound-and-true-p flyspell-mode) | |||||
| (flyspell-mode -1)) | |||||
| (let (buffer-read-only) | |||||
| (erase-buffer) | |||||
| (insert (format "* Running tests on [[file:%s][%s]] (v%s)\n" | |||||
| dotspacemacs-filepath dotspacemacs-filepath "0.0")) | |||||
| ;; dotspacemacs-version not implemented yet | |||||
| ;; (insert (format "* Running tests on %s (v%s)\n" dotspacemacs-filepath dotspacemacs-version)) | |||||
| (prog1 | |||||
| ;; execute all tests no matter what | |||||
| (cl-reduce (lambda (x y) | |||||
| (and (funcall y) x)) | |||||
| '(dotspacemacs//test-dotspacemacs/layers | |||||
| dotspacemacs//test-dotspacemacs/init) | |||||
| :initial-value t) | |||||
| (goto-char (point-min)))))))) | |||||
| (provide 'core-dotspacemacs) | |||||
| @ -0,0 +1,14 @@ | |||||
| ;;; core-emacs-backports.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| ;; nothing for now | |||||
| (provide 'core-emacs-backports) | |||||
| @ -0,0 +1,114 @@ | |||||
| ;;; core-fonts-support.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (require 'core-funcs) | |||||
| (require 'core-spacemacs-buffer) | |||||
| (defvar spacemacs--diminished-minor-modes nil | |||||
| "List of diminished modes to unicode or ascii values.") | |||||
| (defun spacemacs/set-default-font (plists) | |||||
| "Set the font given the passed PLISTS. | |||||
| PLISTS has either the form (\"fontname\" :prop1 val1 :prop2 val2 ...) | |||||
| or is a list of such. The first font that can be found will be used. | |||||
| The return value is nil if no font was found, truthy otherwise." | |||||
| (unless (listp (car plists)) | |||||
| (setq plists (list plists))) | |||||
| (catch 'break | |||||
| (dolist (plist plists) | |||||
| (when (find-font (font-spec :name (car plist))) | |||||
| (let* ((font (car plist)) | |||||
| (props (cdr plist)) | |||||
| (scale (plist-get props :powerline-scale)) | |||||
| (font-props (spacemacs/mplist-remove | |||||
| (spacemacs/mplist-remove props :powerline-scale) | |||||
| :powerline-offset)) | |||||
| (fontspec (apply 'font-spec :name font font-props))) | |||||
| (spacemacs-buffer/message "Setting font \"%s\"..." font) | |||||
| (set-frame-font fontspec nil t) | |||||
| (push `(font . ,(frame-parameter nil 'font)) default-frame-alist) | |||||
| (setq-default powerline-scale scale) | |||||
| (setq-default powerline-height (spacemacs/compute-powerline-height)) | |||||
| ;; fallback font for unicode characters used in spacemacs | |||||
| (pcase system-type | |||||
| (`gnu/linux | |||||
| (setq fallback-font-name "NanumGothic") | |||||
| (setq fallback-font-name2 "NanumGothic")) | |||||
| (`darwin | |||||
| (setq fallback-font-name "Arial Unicode MS") | |||||
| (setq fallback-font-name2 "Arial Unicode MS")) | |||||
| (`windows-nt | |||||
| (setq fallback-font-name "MS Gothic") | |||||
| (setq fallback-font-name2 "Lucida Sans Unicode")) | |||||
| (`cygwin | |||||
| (setq fallback-font-name "MS Gothic") | |||||
| (setq fallback-font-name2 "Lucida Sans Unicode")) | |||||
| (other | |||||
| (setq fallback-font-name nil) | |||||
| (setq fallback-font-name2 nil))) | |||||
| (when (and fallback-font-name fallback-font-name2) | |||||
| ;; remove any size or height properties in order to be able to | |||||
| ;; scale the fallback fonts with the default one (for zoom-in/out | |||||
| ;; for instance) | |||||
| (let* ((fallback-props (spacemacs/mplist-remove | |||||
| (spacemacs/mplist-remove font-props :size) | |||||
| :height)) | |||||
| (fallback-spec (apply 'font-spec | |||||
| :name fallback-font-name | |||||
| fallback-props)) | |||||
| (fallback-spec2 (apply 'font-spec | |||||
| :name fallback-font-name2 | |||||
| fallback-props))) | |||||
| ;; window numbers | |||||
| (set-fontset-font "fontset-default" | |||||
| '(#x2776 . #x2793) fallback-spec nil 'prepend) | |||||
| ;; mode-line circled letters | |||||
| (set-fontset-font "fontset-default" | |||||
| '(#x24b6 . #x24fe) fallback-spec nil 'prepend) | |||||
| ;; mode-line additional characters | |||||
| (set-fontset-font "fontset-default" | |||||
| '(#x2295 . #x22a1) fallback-spec nil 'prepend) | |||||
| ;; new version lighter | |||||
| (set-fontset-font "fontset-default" | |||||
| '(#x2190 . #x2200) fallback-spec2 nil 'prepend)))) | |||||
| (throw 'break t))) | |||||
| nil)) | |||||
| (defun spacemacs/compute-powerline-height () | |||||
| "Return an adjusted powerline height." | |||||
| (let ((scale (if (and (boundp 'powerline-scale) powerline-scale) | |||||
| powerline-scale 1))) | |||||
| (truncate (* scale (frame-char-height))))) | |||||
| (defun spacemacs/set-font (&rest args) | |||||
| "Deprecated function, display a warning message." | |||||
| (spacemacs-buffer/warning (concat "spacemacs/set-font is deprecated. " | |||||
| "Use the variable `dotspacemacs-default-font' " | |||||
| "instead (see Font section in " | |||||
| "~/.emacs.d/doc/DOCUMENTATION.org for more " | |||||
| "info)."))) | |||||
| (defmacro spacemacs|diminish (mode &optional unicode ascii) | |||||
| "Diminish MODE name in mode line to UNICODE or ASCII depending on the value | |||||
| `dotspacemacs-mode-line-unicode-symbols'. | |||||
| If ASCII is not provided then UNICODE is used instead. If neither are provided, | |||||
| the mode will not show in the mode line." | |||||
| `(let ((cell (assq ',mode spacemacs--diminished-minor-modes))) | |||||
| (if cell | |||||
| (setcdr cell '(,unicode ,ascii)) | |||||
| (push '(,mode ,unicode ,ascii) spacemacs--diminished-minor-modes)))) | |||||
| (defmacro spacemacs|hide-lighter (mode) | |||||
| "Diminish MODE name in mode line to LIGHTER." | |||||
| `(eval-after-load 'diminish '(diminish ',mode))) | |||||
| (provide 'core-fonts-support) | |||||
| @ -0,0 +1,385 @@ | |||||
| ;;; core-funcs.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defvar configuration-layer--protected-packages) | |||||
| (defvar dotspacemacs-filepath) | |||||
| (defvar spacemacs-repl-list '() | |||||
| "List of all registered REPLs.") | |||||
| (defun spacemacs/system-is-mac () | |||||
| (eq system-type 'darwin)) | |||||
| (defun spacemacs/system-is-linux () | |||||
| (eq system-type 'gnu/linux)) | |||||
| (defun spacemacs/system-is-mswindows () | |||||
| (eq system-type 'windows-nt)) | |||||
| (defun spacemacs/window-system-is-mac () | |||||
| ;; ns is returned instead of mac on Emacs 25+ | |||||
| (memq (window-system) '(mac ns))) | |||||
| (defun spacemacs/run-prog-mode-hooks () | |||||
| "Runs `prog-mode-hook'. Useful for modes that don't derive from | |||||
| `prog-mode' but should." | |||||
| (run-hooks 'prog-mode-hook)) | |||||
| (defun spacemacs/run-text-mode-hooks () | |||||
| "Runs `text-mode-hook'. Useful for modes that don't derive from | |||||
| `text-mode' but should." | |||||
| (run-hooks 'text-mode-hook)) | |||||
| (defun spacemacs//get-package-directory (pkg) | |||||
| "Return the directory of PKG. Return nil if not found." | |||||
| (let ((elpa-dir (file-name-as-directory package-user-dir))) | |||||
| (when (file-exists-p elpa-dir) | |||||
| (let* ((pkg-match (concat "\\`" (symbol-name pkg) "-[0-9]+")) | |||||
| (dir (car (directory-files elpa-dir 'full pkg-match)))) | |||||
| (when dir (file-name-as-directory dir)))))) | |||||
| (defun spacemacs/mplist-get (plist prop) | |||||
| "Get the values associated to PROP in PLIST, a modified plist. | |||||
| A modified plist is one where keys are keywords and values are | |||||
| all non-keywords elements that follow it. | |||||
| If there are multiple properties with the same keyword, only the first property | |||||
| and its values is returned. | |||||
| Currently this function infloops when the list is circular." | |||||
| (let ((tail plist) | |||||
| result) | |||||
| (while (and (consp tail) (not (eq prop (car tail)))) | |||||
| (pop tail)) | |||||
| ;; pop the found keyword | |||||
| (pop tail) | |||||
| (while (and (consp tail) (not (keywordp (car tail)))) | |||||
| (push (pop tail) result)) | |||||
| (nreverse result))) | |||||
| (defun spacemacs/mplist-remove (plist prop) | |||||
| "Return a copy of a modified PLIST without PROP and its values. | |||||
| If there are multiple properties with the same keyword, only the first property | |||||
| and its values are removed." | |||||
| (let ((tail plist) | |||||
| result) | |||||
| (while (and (consp tail) (not (eq prop (car tail)))) | |||||
| (push (pop tail) result)) | |||||
| (when (eq prop (car tail)) | |||||
| (pop tail) | |||||
| (while (and (consp tail) (not (keywordp (car tail)))) | |||||
| (pop tail))) | |||||
| (while (consp tail) | |||||
| (push (pop tail) result)) | |||||
| (nreverse result))) | |||||
| ;; Originally based on http://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file | |||||
| (defun spacemacs/dump-vars-to-file (varlist filename) | |||||
| "simplistic dumping of variables in VARLIST to a file FILENAME" | |||||
| (with-temp-file filename | |||||
| (spacemacs/dump varlist (current-buffer)) | |||||
| (make-directory (file-name-directory filename) t))) | |||||
| ;; From http://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file | |||||
| (defun spacemacs/dump (varlist buffer) | |||||
| "insert into buffer the setq statement to recreate the variables in VARLIST" | |||||
| (cl-loop for var in varlist do | |||||
| (print (list 'setq var (list 'quote (symbol-value var))) | |||||
| buffer))) | |||||
| (defvar spacemacs--init-redisplay-count 0 | |||||
| "The number of calls to `redisplay'") | |||||
| (defun spacemacs//redisplay () | |||||
| "`redisplay' wrapper." | |||||
| (setq spacemacs--init-redisplay-count (1+ spacemacs--init-redisplay-count)) | |||||
| (redisplay)) | |||||
| (defun spacemacs//create-key-binding-form (props func) | |||||
| "Helper which returns a from to bind FUNC to a key according to PROPS. | |||||
| Supported properties: | |||||
| `:evil-leader STRING' | |||||
| One or several key sequence strings to be set with `spacemacs/set-leader-keys . | |||||
| `:evil-leader-for-mode CONS CELL' | |||||
| One or several cons cells (MODE . KEY) where MODE is a major-mode symbol | |||||
| and KEY is a key sequence string to be set with | |||||
| `spacemacs/set-leader-keys-for-major-mode'. | |||||
| `:global-key STRING' | |||||
| One or several key sequence strings to be set with `global-set-key'. | |||||
| `:define-key CONS CELL' | |||||
| One or several cons cells (MAP . KEY) where MAP is a mode map and KEY is a | |||||
| key sequence string to be set with `define-key'. " | |||||
| (let ((evil-leader (spacemacs/mplist-get props :evil-leader)) | |||||
| (evil-leader-for-mode (spacemacs/mplist-get props :evil-leader-for-mode)) | |||||
| (global-key (spacemacs/mplist-get props :global-key)) | |||||
| (def-key (spacemacs/mplist-get props :define-key))) | |||||
| (append | |||||
| (when evil-leader | |||||
| `((dolist (key ',evil-leader) | |||||
| (spacemacs/set-leader-keys key ',func)))) | |||||
| (when evil-leader-for-mode | |||||
| `((dolist (val ',evil-leader-for-mode) | |||||
| (spacemacs/set-leader-keys-for-major-mode | |||||
| (car val) (cdr val) ',func)))) | |||||
| (when global-key | |||||
| `((dolist (key ',global-key) | |||||
| (global-set-key (kbd key) ',func)))) | |||||
| (when def-key | |||||
| `((dolist (val ',def-key) | |||||
| (define-key (eval (car val)) (kbd (cdr val)) ',func))))))) | |||||
| (defun spacemacs/prettify-org-buffer () | |||||
| "Apply visual enchantments to the current buffer. | |||||
| The buffer's major mode should be `org-mode'." | |||||
| (interactive) | |||||
| (unless (derived-mode-p 'org-mode) | |||||
| (user-error "org-mode should be enabled in the current buffer.")) | |||||
| ;; Make ~SPC ,~ work, reference: | |||||
| ;; http://stackoverflow.com/questions/24169333/how-can-i-emphasize-or-verbatim-quote-a-comma-in-org-mode | |||||
| (setcar (nthcdr 2 org-emphasis-regexp-components) " \t\n") | |||||
| (org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components) | |||||
| (setq-local org-emphasis-alist '(("*" bold) | |||||
| ("/" italic) | |||||
| ("_" underline) | |||||
| ("=" org-verbatim verbatim) | |||||
| ("~" org-kbd) | |||||
| ("+" | |||||
| (:strike-through t)))) | |||||
| (when (require 'space-doc nil t) | |||||
| (space-doc-mode))) | |||||
| (defun spacemacs/view-org-file (file &optional anchor-text expand-scope) | |||||
| "Open org file and apply visual enchantments. | |||||
| FILE is the org file to be opened. | |||||
| If ANCHOR-TEXT is `nil' then run `re-search-forward' with ^ (beginning-of-line). | |||||
| If ANCHOR-TEXT is a GitHub style anchor then find a corresponding header. | |||||
| If ANCHOR-TEXT isn't a GitHub style anchor then run `re-search-forward' with | |||||
| ANCHOR-TEXT. | |||||
| If EXPAND-SCOPE is `subtree' then run `outline-show-subtree' at the matched line. | |||||
| If EXPAND-SCOPE is `all' then run `outline-show-all' at the matched line." | |||||
| (interactive) | |||||
| (find-file file) | |||||
| (spacemacs/prettify-org-buffer) | |||||
| (goto-char (point-min)) | |||||
| (when anchor-text | |||||
| ;; If `anchor-text' is GitHub style link. | |||||
| (if (string-prefix-p "#" anchor-text) | |||||
| ;; If the toc-org package is loaded. | |||||
| (if (configuration-layer/package-usedp 'toc-org) | |||||
| ;; For each heading. Search the heading that corresponds | |||||
| ;; to `anchor-text'. | |||||
| (while (and (re-search-forward "^[\\*]+\s\\(.*\\).*$" nil t) | |||||
| (not (string= (toc-org-hrefify-gh (match-string 1)) | |||||
| anchor-text)))) | |||||
| ;; This is not a problem because without the space-doc package | |||||
| ;; those links will be opened in the browser. | |||||
| (message (format (concat "Can't follow the GitHub style anchor: '%s' " | |||||
| "without the org layer.") anchor-text))) | |||||
| (re-search-forward anchor-text))) | |||||
| (beginning-of-line) | |||||
| (cond | |||||
| ((eq expand-scope 'subtree) | |||||
| (outline-show-subtree)) | |||||
| ((eq expand-scope 'all) | |||||
| (outline-show-all)) | |||||
| (t nil))) | |||||
| (defun spacemacs//test-var (pred var test-desc) | |||||
| "Test PRED against VAR and print test result, incrementing | |||||
| passed-tests and total-tests." | |||||
| (let ((var-name (symbol-name var)) | |||||
| (var-val (symbol-value var))) | |||||
| (when (boundp 'total-tests) (setq total-tests (1+ total-tests))) | |||||
| (insert (format "** TEST: [[file:%s::%s][%s]] %s\n" | |||||
| dotspacemacs-filepath var-name var-name test-desc)) | |||||
| (if (funcall pred var-val) | |||||
| (progn | |||||
| (when (boundp 'passed-tests) (setq passed-tests (1+ passed-tests))) | |||||
| (insert (format "*** PASS: %s\n" var-val))) | |||||
| (insert (propertize (format "*** FAIL: %s\n" var-val) | |||||
| 'font-lock-face 'font-lock-warning-face))))) | |||||
| (defun spacemacs//test-list (pred varlist test-desc &optional element-desc) | |||||
| "Test PRED against each element of VARLIST and print test | |||||
| result, incrementing passed-tests and total-tests." | |||||
| (let ((varlist-name (symbol-name varlist)) | |||||
| (varlist-val (symbol-value varlist))) | |||||
| (if element-desc | |||||
| (insert (format "** TEST: Each %s in [[file:%s::%s][%s]] %s\n" | |||||
| element-desc dotspacemacs-filepath varlist-name | |||||
| varlist-name test-desc)) | |||||
| (insert (format "** TEST: Each element of [[file:%s::%s][%s]] %s\n" | |||||
| dotspacemacs-filepath varlist-name varlist-name | |||||
| test-desc))) | |||||
| (dolist (var varlist-val) | |||||
| (when (boundp 'total-tests) (setq total-tests (1+ total-tests))) | |||||
| (if (funcall pred var) | |||||
| (progn | |||||
| (when (boundp 'passed-tests) (setq passed-tests (1+ passed-tests))) | |||||
| (insert (format "*** PASS: %s\n" var))) | |||||
| (insert (propertize (format "*** FAIL: %s\n" var) 'font-lock-face 'font-lock-warning-face)))))) | |||||
| ;; hide mode line | |||||
| ;; from http://bzg.fr/emacs-hide-mode-line.html | |||||
| (defvar-local hidden-mode-line-mode nil) | |||||
| (defvar-local hide-mode-line nil) | |||||
| (define-minor-mode hidden-mode-line-mode | |||||
| "Minor mode to hide the mode-line in the current buffer." | |||||
| :init-value nil | |||||
| :global t | |||||
| :variable hidden-mode-line-mode | |||||
| :group 'editing-basics | |||||
| (if hidden-mode-line-mode | |||||
| (setq hide-mode-line mode-line-format | |||||
| mode-line-format nil) | |||||
| (setq mode-line-format hide-mode-line | |||||
| hide-mode-line nil)) | |||||
| (force-mode-line-update) | |||||
| ;; Apparently force-mode-line-update is not always enough to | |||||
| ;; redisplay the mode-line | |||||
| (redraw-display) | |||||
| (when (and (called-interactively-p 'interactive) | |||||
| hidden-mode-line-mode) | |||||
| (run-with-idle-timer | |||||
| 0 nil 'message | |||||
| (concat "Hidden Mode Line Mode enabled. " | |||||
| "Use M-x hidden-mode-line-mode to make the mode-line appear.")))) | |||||
| (defun spacemacs/recompile-elpa () | |||||
| "Recompile packages in elpa directory. Useful if you switch | |||||
| Emacs versions." | |||||
| (interactive) | |||||
| (byte-recompile-directory package-user-dir nil t)) | |||||
| (defun spacemacs/register-repl (feature repl-func &optional tag) | |||||
| "Register REPL-FUNC to the global list of REPLs SPACEMACS-REPL-LIST. | |||||
| FEATURE will be loaded before running the REPL, in case it is not already | |||||
| loaded. If TAG is non-nil, it will be used as the string to show in the helm | |||||
| buffer." | |||||
| (push `(,(or tag (symbol-name repl-func)) | |||||
| . (,feature . ,repl-func)) | |||||
| spacemacs-repl-list)) | |||||
| ;; http://stackoverflow.com/questions/11847547/emacs-regexp-count-occurrences | |||||
| (defun spacemacs/how-many-str (regexp str) | |||||
| (loop with start = 0 | |||||
| for count from 0 | |||||
| while (string-match regexp str start) | |||||
| do (setq start (match-end 0)) | |||||
| finally return count)) | |||||
| ;; from https://github.com/cofi/dotfiles/blob/master/emacs.d/config/cofi-util.el#L38 | |||||
| (defun spacemacs/add-to-hooks (fun hooks) | |||||
| "Add function to hooks" | |||||
| (dolist (hook hooks) | |||||
| (add-hook hook fun))) | |||||
| (defun spacemacs/add-all-to-hook (hook &rest funs) | |||||
| "Add functions to hook." | |||||
| (spacemacs/add-to-hook hook funs)) | |||||
| (defun spacemacs/add-to-hook (hook funs) | |||||
| "Add list of functions to hook." | |||||
| (dolist (fun funs) | |||||
| (add-hook hook fun))) | |||||
| (defun spacemacs/echo (msg &rest args) | |||||
| "Display MSG in echo-area without logging it in *Messages* buffer." | |||||
| (interactive) | |||||
| (let ((message-log-max nil)) | |||||
| (apply 'message msg args))) | |||||
| (defun spacemacs/alternate-buffer (&optional window) | |||||
| "Switch back and forth between current and last buffer in the | |||||
| current window." | |||||
| (interactive) | |||||
| (let ((current-buffer (window-buffer window)) | |||||
| (buffer-predicate | |||||
| (frame-parameter (window-frame window) 'buffer-predicate))) | |||||
| ;; switch to first buffer previously shown in this window that matches | |||||
| ;; frame-parameter `buffer-predicate' | |||||
| (switch-to-buffer | |||||
| (or (cl-find-if (lambda (buffer) | |||||
| (and (not (eq buffer current-buffer)) | |||||
| (or (null buffer-predicate) | |||||
| (funcall buffer-predicate buffer)))) | |||||
| (mapcar #'car (window-prev-buffers window))) | |||||
| ;; `other-buffer' honors `buffer-predicate' so no need to filter | |||||
| (other-buffer current-buffer t))))) | |||||
| (defun spacemacs/comint-clear-buffer () | |||||
| (interactive) | |||||
| (let ((comint-buffer-maximum-size 0)) | |||||
| (comint-truncate-buffer))) | |||||
| ;; Generalized next-error system ("gne") | |||||
| (defun spacemacs/error-delegate () | |||||
| "Decide which error API to delegate to. | |||||
| Delegates to flycheck if it is enabled and the next-error buffer | |||||
| is not visible. Otherwise delegates to regular Emacs next-error." | |||||
| (if (and (bound-and-true-p flycheck-mode) | |||||
| (let ((buf (ignore-errors (next-error-find-buffer)))) | |||||
| (not (and buf (get-buffer-window buf))))) | |||||
| 'flycheck | |||||
| 'emacs)) | |||||
| (defun spacemacs/next-error (&optional n reset) | |||||
| "Dispatch to flycheck or standard emacs error." | |||||
| (interactive "P") | |||||
| (let ((sys (spacemacs/error-delegate))) | |||||
| (cond | |||||
| ((eq 'flycheck sys) (call-interactively 'flycheck-next-error)) | |||||
| ((eq 'emacs sys) (call-interactively 'next-error))))) | |||||
| (defun spacemacs/previous-error (&optional n reset) | |||||
| "Dispatch to flycheck or standard emacs error." | |||||
| (interactive "P") | |||||
| (let ((sys (spacemacs/error-delegate))) | |||||
| (cond | |||||
| ((eq 'flycheck sys) (call-interactively 'flycheck-previous-error)) | |||||
| ((eq 'emacs sys) (call-interactively 'previous-error))))) | |||||
| (defvar-local spacemacs--gne-min-line nil | |||||
| "The first line in the buffer that is a valid result.") | |||||
| (defvar-local spacemacs--gne-max-line nil | |||||
| "The last line in the buffer that is a valid result.") | |||||
| (defvar-local spacemacs--gne-cur-line 0 | |||||
| "The current line in the buffer. (It is problematic to use | |||||
| point for this.)") | |||||
| (defvar-local spacemacs--gne-line-func nil | |||||
| "The function to call to visit the result on a line.") | |||||
| (defun spacemacs/gne-next (num reset) | |||||
| "A generalized next-error function. This function can be used | |||||
| as `next-error-function' in any buffer that conforms to the | |||||
| Spacemacs generalized next-error API. | |||||
| The variables `spacemacs--gne-min-line', | |||||
| `spacemacs--gne-max-line', and `spacemacs--line-func' must be | |||||
| set." | |||||
| (when reset (setq spacemacs--gne-cur-line | |||||
| spacemacs--gne-min-line)) | |||||
| (setq spacemacs--gne-cur-line | |||||
| (min spacemacs--gne-max-line | |||||
| (max spacemacs--gne-min-line | |||||
| (+ num spacemacs--gne-cur-line)))) | |||||
| (goto-line spacemacs--gne-cur-line) | |||||
| (funcall spacemacs--gne-line-func | |||||
| (buffer-substring (point-at-bol) (point-at-eol)))) | |||||
| (provide 'core-funcs) | |||||
| @ -0,0 +1,66 @@ | |||||
| ;;; core-jump.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defvar spacemacs-default-jump-handlers '() | |||||
| "List of jump handlers available in every mode.") | |||||
| (defvar-local spacemacs-jump-handlers '() | |||||
| "List of jump handlers local to this buffer.") | |||||
| (defmacro spacemacs|define-jump-handlers (mode &rest handlers) | |||||
| "Defines jump handlers for the given MODE. | |||||
| This defines a variable `spacemacs-jump-handlers-MODE' to which | |||||
| handlers can be added, and a function added to MODE-hook which | |||||
| sets `spacemacs-jump-handlers' in buffers of that mode." | |||||
| (let ((mode-hook (intern (format "%S-hook" mode))) | |||||
| (func (intern (format "spacemacs//init-jump-handlers-%S" mode))) | |||||
| (handlers-list (intern (format "spacemacs-jump-handlers-%S" mode)))) | |||||
| `(progn | |||||
| (defvar ,handlers-list ',handlers | |||||
| ,(format (concat "List of mode-specific jump handlers for %S. " | |||||
| "These take priority over those in " | |||||
| "`spacemacs-default-jump-handlers'.") | |||||
| mode)) | |||||
| (defun ,func () | |||||
| (setq spacemacs-jump-handlers | |||||
| (append ,handlers-list | |||||
| spacemacs-default-jump-handlers))) | |||||
| (add-hook ',mode-hook ',func) | |||||
| (with-eval-after-load 'bind-map | |||||
| (spacemacs/set-leader-keys-for-major-mode ',mode | |||||
| "gg" 'spacemacs/jump-to-definition))))) | |||||
| (defun spacemacs/jump-to-definition () | |||||
| (interactive) | |||||
| (catch 'done | |||||
| (let ((old-buffer (current-buffer)) | |||||
| (old-point (point))) | |||||
| (dolist (-handler spacemacs-jump-handlers) | |||||
| (let ((handler (if (listp -handler) (car -handler) -handler)) | |||||
| (async (when (listp -handler) | |||||
| (plist-get (cdr -handler) :async)))) | |||||
| (ignore-errors | |||||
| (call-interactively handler)) | |||||
| (when (or async | |||||
| (not (eq old-point (point))) | |||||
| (not (equal old-buffer (current-buffer)))) | |||||
| (throw 'done t))))) | |||||
| (message "No jump handler was able to find this symbol."))) | |||||
| ;; Set the `:jump' property manually instead of just using `evil-define-motion' | |||||
| ;; in an `eval-after-load' macro invocation because doing that prevents | |||||
| ;; `describe-function' from correctly finding the source. | |||||
| ;; | |||||
| ;; See discussion on https://github.com/syl20bnr/spacemacs/pull/6771 | |||||
| (with-eval-after-load 'evil | |||||
| (evil-set-command-property 'spacemacs/jump-to-definition :jump t)) | |||||
| (provide 'core-jump) | |||||
| @ -0,0 +1,177 @@ | |||||
| ;;; core-keybindings.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (require 'core-funcs) | |||||
| (defvar spacemacs/prefix-titles nil | |||||
| "alist for mapping command prefixes to long names.") | |||||
| (defvar spacemacs-default-map (make-sparse-keymap) | |||||
| "Base keymap for all spacemacs leader key commands.") | |||||
| (defun spacemacs/translate-C-i (_) | |||||
| "If `dotspacemacs-distinguish-gui-tab' is non nil, the raw key | |||||
| sequence does not include <tab> or <kp-tab>, and we are in the | |||||
| gui, translate to [C-i]. Otherwise, [9] (TAB)." | |||||
| (interactive) | |||||
| (if (and (not (cl-position 'tab (this-single-command-raw-keys))) | |||||
| (not (cl-position 'kp-tab (this-single-command-raw-keys))) | |||||
| dotspacemacs-distinguish-gui-tab | |||||
| (display-graphic-p)) | |||||
| [C-i] [?\C-i])) | |||||
| (define-key key-translation-map [?\C-i] 'spacemacs/translate-C-i) | |||||
| ;; (defun spacemacs/translate-C-m (_) | |||||
| ;; "If `dotspacemacs-distinguish-gui-ret' is non nil, the raw key | |||||
| ;; sequence does not include <ret>, and we are in the gui, translate | |||||
| ;; to [C-m]. Otherwise, [9] (TAB)." | |||||
| ;; (interactive) | |||||
| ;; (if (and | |||||
| ;; (not (cl-position 'return (this-single-command-raw-keys))) | |||||
| ;; (not (cl-position 'kp-enter (this-single-command-raw-keys))) | |||||
| ;; dotspacemacs-distinguish-gui-ret | |||||
| ;; (display-graphic-p)) | |||||
| ;; [C-m] [?\C-m])) | |||||
| ;; (define-key key-translation-map [?\C-m] 'spacemacs/translate-C-m) | |||||
| (defun spacemacs/declare-prefix (prefix name &optional long-name) | |||||
| "Declare a prefix PREFIX. PREFIX is a string describing a key | |||||
| sequence. NAME is a string used as the prefix command. | |||||
| LONG-NAME if given is stored in `spacemacs/prefix-titles'." | |||||
| (let* ((command name) | |||||
| (full-prefix (concat dotspacemacs-leader-key " " prefix)) | |||||
| (full-prefix-emacs (concat dotspacemacs-emacs-leader-key " " prefix)) | |||||
| (full-prefix-lst (listify-key-sequence (kbd full-prefix))) | |||||
| (full-prefix-emacs-lst (listify-key-sequence | |||||
| (kbd full-prefix-emacs)))) | |||||
| ;; define the prefix command only if it does not already exist | |||||
| (unless long-name (setq long-name name)) | |||||
| (which-key-declare-prefixes | |||||
| full-prefix-emacs (cons name long-name) | |||||
| full-prefix (cons name long-name)))) | |||||
| (defun spacemacs/declare-prefix-for-mode (mode prefix name &optional long-name) | |||||
| "Declare a prefix PREFIX. MODE is the mode in which this prefix command should | |||||
| be added. PREFIX is a string describing a key sequence. NAME is a symbol name | |||||
| used as the prefix command." | |||||
| (let ((command (intern (concat (symbol-name mode) name))) | |||||
| (full-prefix (concat dotspacemacs-leader-key " " prefix)) | |||||
| (full-prefix-emacs (concat dotspacemacs-emacs-leader-key " " prefix)) | |||||
| (is-major-mode-prefix (string-prefix-p "m" prefix)) | |||||
| (major-mode-prefix (concat dotspacemacs-major-mode-leader-key | |||||
| " " (substring prefix 1))) | |||||
| (major-mode-prefix-emacs | |||||
| (concat dotspacemacs-major-mode-emacs-leader-key | |||||
| " " (substring prefix 1)))) | |||||
| (unless long-name (setq long-name name)) | |||||
| (let ((prefix-name (cons name long-name))) | |||||
| (which-key-declare-prefixes-for-mode mode | |||||
| full-prefix-emacs prefix-name | |||||
| full-prefix prefix-name) | |||||
| (when (and is-major-mode-prefix dotspacemacs-major-mode-leader-key) | |||||
| (which-key-declare-prefixes-for-mode mode major-mode-prefix prefix-name)) | |||||
| (when (and is-major-mode-prefix dotspacemacs-major-mode-emacs-leader-key) | |||||
| (which-key-declare-prefixes-for-mode | |||||
| mode major-mode-prefix-emacs prefix-name))))) | |||||
| (defun spacemacs/set-leader-keys (key def &rest bindings) | |||||
| "Add KEY and DEF as key bindings under | |||||
| `dotspacemacs-leader-key' and `dotspacemacs-emacs-leader-key'. | |||||
| KEY should be a string suitable for passing to `kbd', and it | |||||
| should not include the leaders. DEF is most likely a quoted | |||||
| command. See `define-key' for more information about the possible | |||||
| choices for DEF. This function simply uses `define-key' to add | |||||
| the bindings. | |||||
| For convenience, this function will accept additional KEY DEF | |||||
| pairs. For example, | |||||
| \(spacemacs/set-leader-keys | |||||
| \"a\" 'command1 | |||||
| \"C-c\" 'command2 | |||||
| \"bb\" 'command3\)" | |||||
| (while key | |||||
| (define-key spacemacs-default-map (kbd key) def) | |||||
| (setq key (pop bindings) def (pop bindings)))) | |||||
| (put 'spacemacs/set-leader-keys 'lisp-indent-function 'defun) | |||||
| (defalias 'evil-leader/set-key 'spacemacs/set-leader-keys) | |||||
| (defun spacemacs//acceptable-leader-p (key) | |||||
| "Return t if key is a string and non-empty." | |||||
| (and (stringp key) (not (string= key "")))) | |||||
| (defun spacemacs//init-leader-mode-map (mode map &optional minor) | |||||
| "Check for MAP-prefix. If it doesn't exist yet, use `bind-map' | |||||
| to create it and bind it to `dotspacemacs-major-mode-leader-key' | |||||
| and `dotspacemacs-major-mode-emacs-leader-key'. If MODE is a | |||||
| minor-mode, the third argument should be non nil." | |||||
| (let* ((prefix (intern (format "%s-prefix" map))) | |||||
| (leader1 (when (spacemacs//acceptable-leader-p | |||||
| dotspacemacs-major-mode-leader-key) | |||||
| dotspacemacs-major-mode-leader-key)) | |||||
| (leader2 (when (spacemacs//acceptable-leader-p | |||||
| dotspacemacs-leader-key) | |||||
| (concat dotspacemacs-leader-key | |||||
| (unless minor " m")))) | |||||
| (emacs-leader1 (when (spacemacs//acceptable-leader-p | |||||
| dotspacemacs-major-mode-emacs-leader-key) | |||||
| dotspacemacs-major-mode-emacs-leader-key)) | |||||
| (emacs-leader2 (when (spacemacs//acceptable-leader-p | |||||
| dotspacemacs-emacs-leader-key) | |||||
| (concat dotspacemacs-emacs-leader-key | |||||
| (unless minor " m")))) | |||||
| (leaders (delq nil (list leader1 leader2))) | |||||
| (emacs-leaders (delq nil (list emacs-leader1 emacs-leader2)))) | |||||
| (or (boundp prefix) | |||||
| (progn | |||||
| (eval | |||||
| `(bind-map ,map | |||||
| :prefix-cmd ,prefix | |||||
| ,(if minor :minor-modes :major-modes) (,mode) | |||||
| :keys ,emacs-leaders | |||||
| :evil-keys ,leaders | |||||
| :evil-states (normal motion visual evilified))) | |||||
| (boundp prefix))))) | |||||
| (defun spacemacs/set-leader-keys-for-major-mode (mode key def &rest bindings) | |||||
| "Add KEY and DEF as key bindings under | |||||
| `dotspacemacs-major-mode-leader-key' and | |||||
| `dotspacemacs-major-mode-emacs-leader-key' for the major-mode | |||||
| MODE. MODE should be a quoted symbol corresponding to a valid | |||||
| major mode. The rest of the arguments are treated exactly like | |||||
| they are in `spacemacs/set-leader-keys'." | |||||
| (let* ((map (intern (format "spacemacs-%s-map" mode)))) | |||||
| (when (spacemacs//init-leader-mode-map mode map) | |||||
| (while key | |||||
| (define-key (symbol-value map) (kbd key) def) | |||||
| (setq key (pop bindings) def (pop bindings)))))) | |||||
| (put 'spacemacs/set-leader-keys-for-major-mode 'lisp-indent-function 'defun) | |||||
| (defalias | |||||
| 'evil-leader/set-key-for-mode | |||||
| 'spacemacs/set-leader-keys-for-major-mode) | |||||
| (defun spacemacs/set-leader-keys-for-minor-mode (mode key def &rest bindings) | |||||
| "Add KEY and DEF as key bindings under | |||||
| `dotspacemacs-major-mode-leader-key' and | |||||
| `dotspacemacs-major-mode-emacs-leader-key' for the minor-mode | |||||
| MODE. MODE should be a quoted symbol corresponding to a valid | |||||
| minor mode. The rest of the arguments are treated exactly like | |||||
| they are in `spacemacs/set-leader-keys'." | |||||
| (let* ((map (intern (format "spacemacs-%s-map" mode)))) | |||||
| (when (spacemacs//init-leader-mode-map mode map t) | |||||
| (while key | |||||
| (define-key (symbol-value map) (kbd key) def) | |||||
| (setq key (pop bindings) def (pop bindings)))))) | |||||
| (put 'spacemacs/set-leader-keys-for-minor-mode 'lisp-indent-function 'defun) | |||||
| (provide 'core-keybindings) | |||||
| @ -0,0 +1,77 @@ | |||||
| ;;; core-load-paths.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defun add-to-load-path (dir) (add-to-list 'load-path dir)) | |||||
| (defun add-to-load-path-if-exists (dir) | |||||
| "If DIR exists in the file system, add it to `load-path'." | |||||
| (when (file-exists-p dir) | |||||
| (add-to-load-path dir))) | |||||
| ;; paths | |||||
| (defvar spacemacs-start-directory | |||||
| user-emacs-directory | |||||
| "Spacemacs start directory.") | |||||
| (defconst spacemacs-core-directory | |||||
| (expand-file-name (concat spacemacs-start-directory "core/")) | |||||
| "Spacemacs core directory.") | |||||
| (defconst spacemacs-info-directory | |||||
| (expand-file-name (concat spacemacs-core-directory "info/")) | |||||
| "Spacemacs info files directory") | |||||
| (defconst spacemacs-release-notes-directory | |||||
| (expand-file-name (concat spacemacs-info-directory "release-notes/")) | |||||
| "Spacemacs release notes directory") | |||||
| (defconst spacemacs-banner-directory | |||||
| (expand-file-name (concat spacemacs-core-directory "banners/")) | |||||
| "Spacemacs banners directory.") | |||||
| (defconst spacemacs-banner-official-png | |||||
| (expand-file-name (concat spacemacs-banner-directory "img/spacemacs.png")) | |||||
| "Spacemacs official banner image.") | |||||
| (defconst spacemacs-badge-official-png | |||||
| (expand-file-name (concat spacemacs-banner-directory | |||||
| "img/spacemacs-badge.png")) | |||||
| "Spacemacs official badge image.") | |||||
| (defconst spacemacs-purple-heart-png | |||||
| (expand-file-name (concat spacemacs-banner-directory "img/heart.png")) | |||||
| "Purple heart emoji.") | |||||
| (defconst spacemacs-cache-directory | |||||
| (expand-file-name (concat user-emacs-directory ".cache/")) | |||||
| "Spacemacs storage area for persistent files") | |||||
| (defconst spacemacs-auto-save-directory | |||||
| (expand-file-name (concat spacemacs-cache-directory "auto-save/")) | |||||
| "Spacemacs auto-save directory") | |||||
| (defconst spacemacs-docs-directory | |||||
| (expand-file-name (concat spacemacs-start-directory "doc/")) | |||||
| "Spacemacs documentation directory.") | |||||
| (defconst spacemacs-news-directory | |||||
| (expand-file-name (concat spacemacs-start-directory "news/")) | |||||
| "Spacemacs News directory.") | |||||
| (defconst spacemacs-assets-directory | |||||
| (expand-file-name (concat spacemacs-start-directory "assets/")) | |||||
| "Spacemacs assets directory.") | |||||
| (defconst spacemacs-test-directory | |||||
| (expand-file-name (concat spacemacs-start-directory "tests/")) | |||||
| "Spacemacs tests directory.") | |||||
| (defconst user-home-directory | |||||
| (expand-file-name "~/") | |||||
| "User home directory (~/).") | |||||
| (defconst pcache-directory | |||||
| (concat spacemacs-cache-directory "pcache/")) | |||||
| (unless (file-exists-p spacemacs-cache-directory) | |||||
| (make-directory spacemacs-cache-directory)) | |||||
| ;; load paths | |||||
| (mapc 'add-to-load-path | |||||
| `( | |||||
| ,spacemacs-core-directory | |||||
| ,(concat spacemacs-core-directory "libs/") | |||||
| ,(concat spacemacs-core-directory "aprilfool/") | |||||
| )) | |||||
| @ -0,0 +1,272 @@ | |||||
| ;;; -*- lexical-binding: t -*- | |||||
| ;;; core-micro-state.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defun spacemacs/defface-micro-state-faces () | |||||
| "Define faces for micro-states." | |||||
| (let* ((hname 'spacemacs-micro-state-header-face) | |||||
| (bname 'spacemacs-micro-state-binding-face) | |||||
| (box '(:line-width -1 :color (plist-get (face-attribute | |||||
| 'mode-line :box) :color))) | |||||
| (err (face-attribute 'error :foreground))) | |||||
| (eval `(defface ,hname '((t ())) | |||||
| "Face for micro-state header in echo area. | |||||
| The header is the name of the micro-state." | |||||
| :group 'spacemacs)) | |||||
| (set-face-attribute hname nil | |||||
| :background "DarkGoldenrod2" | |||||
| :foreground "black" | |||||
| :bold t | |||||
| :box box) | |||||
| (eval `(defface ,bname '((t ())) | |||||
| "Face for micro-state key binding in echo area. | |||||
| Characters enclosed in `[]' will have this face applied to them." | |||||
| :group 'spacemacs)) | |||||
| (set-face-attribute bname nil | |||||
| :foreground err | |||||
| :bold t))) | |||||
| (spacemacs/defface-micro-state-faces) | |||||
| (add-hook 'spacemacs-post-theme-change-hook | |||||
| 'spacemacs/defface-micro-state-faces) | |||||
| (defun spacemacs//micro-state-set-minibuffer-height (str) | |||||
| "Set the max mini windows size given a string STR." | |||||
| (let ((line-count (1+ (spacemacs/how-many-str "\n" str)))) | |||||
| (when (and (> line-count max-mini-window-height) | |||||
| (> line-count 10)) | |||||
| (setq max-mini-window-height line-count)))) | |||||
| (defmacro spacemacs|define-micro-state (name &rest props) | |||||
| "Define a micro-state called NAME. | |||||
| NAME is a symbol. | |||||
| Available PROPS: | |||||
| `:on-enter SEXP' | |||||
| Evaluate SEXP when the micro-state is switched on. | |||||
| `:on-exit SEXP' | |||||
| Evaluate SEXP when leaving the micro-state. | |||||
| `:doc STRING or SEXP' | |||||
| A STRING or a SEXP that evaluates to a string. | |||||
| `:use-minibuffer BOOLEAN' | |||||
| If non nil then the minibuffer is used to display the documenation | |||||
| strings. Default is nil. | |||||
| `:disable-evil-leader BOOLEAN' | |||||
| If non nil then the evil leader has no effect when the micro state | |||||
| is active. Default to nil. | |||||
| `:persistent BOOLEAN' | |||||
| If BOOLEAN is non nil then the micro-state never exits. A binding | |||||
| with an explicitly set `exit t' property is required. Default is nil. | |||||
| `:execute-binding-on-enter BOOLEAN' | |||||
| If BOOLEAN is non nil then execute the micro-state command bound to | |||||
| to the pressed key that started the micro-state. | |||||
| `:bindings EXPRESSIONS' | |||||
| One or several EXPRESSIONS with the form | |||||
| (STRING1 SYMBOL1 :doc STRING | |||||
| :pre SEXP | |||||
| :post SEXP | |||||
| :exit SYMBOL) | |||||
| where: | |||||
| - STRING1 is a key to be bound to the function or key map SYMBOL1. | |||||
| - :doc STRING or SEXP is a STRING or an SEXP that evalutes | |||||
| to a string | |||||
| - :pre is an SEXP evaluated before the bound action | |||||
| - :post is an SEXP evaluated after the bound action | |||||
| - :exit SYMBOL or SEXP, if non nil then pressing this key will | |||||
| leave the micro-state (default is nil). | |||||
| Important note: due to inner working of transient-maps in Emacs | |||||
| the `:exit' keyword is evaluate *before* the actual execution | |||||
| of the bound command. | |||||
| All properties supported by `spacemacs//create-key-binding-form' can be | |||||
| used." | |||||
| (declare (indent 1)) | |||||
| (let* ((func (spacemacs//micro-state-func-name name)) | |||||
| (doc (spacemacs/mplist-get props :doc)) | |||||
| (persistent (plist-get props :persistent)) | |||||
| (disable-leader (plist-get props :disable-evil-leader)) | |||||
| (msg-func (if (plist-get props :use-minibuffer) | |||||
| 'message | |||||
| 'lv-message)) | |||||
| (exec-binding (plist-get props :execute-binding-on-enter)) | |||||
| (on-enter (spacemacs/mplist-get props :on-enter)) | |||||
| (on-exit (spacemacs/mplist-get props :on-exit)) | |||||
| (bindings (spacemacs/mplist-get props :bindings)) | |||||
| (wrappers (spacemacs//micro-state-create-wrappers | |||||
| name doc msg-func disable-leader bindings)) | |||||
| (keymap-body (spacemacs//micro-state-fill-map-sexps wrappers)) | |||||
| (bindkeys (spacemacs//create-key-binding-form props func))) | |||||
| `(progn (defun ,func () | |||||
| ,(format "%S micro-state." name) | |||||
| (interactive) | |||||
| ,@on-enter | |||||
| ,(when exec-binding | |||||
| (spacemacs//micro-state-auto-execute bindings)) | |||||
| (let ((doc ,@doc)) | |||||
| (when doc | |||||
| (spacemacs//micro-state-set-minibuffer-height doc) | |||||
| (apply ',msg-func (list (spacemacs//micro-state-propertize-doc | |||||
| (format "%S: %s" ',name doc)))))) | |||||
| (,(if (version< emacs-version "24.4") | |||||
| 'set-temporary-overlay-map | |||||
| 'set-transient-map) | |||||
| (let ((map (make-sparse-keymap))) | |||||
| ,@keymap-body map) ',(spacemacs//micro-state-create-exit-func | |||||
| name wrappers persistent on-exit))) | |||||
| ,@bindkeys))) | |||||
| (defun spacemacs//micro-state-func-name (name) | |||||
| "Return the name of the micro-state function." | |||||
| (intern (format "spacemacs/%S-micro-state" name))) | |||||
| (defun spacemacs//micro-state-auto-execute (bindings) | |||||
| "Auto execute the binding corresponding to `this-command-keys'." | |||||
| `(let* ((key (substring (this-command-keys) | |||||
| (1- (length (this-command-keys))))) | |||||
| (binding (assoc key ',bindings))) | |||||
| (when binding | |||||
| (call-interactively (cadr binding))))) | |||||
| (defun spacemacs//micro-state-create-wrappers | |||||
| (name doc msg-func disable-leader bindings) | |||||
| "Return an alist (key wrapper) for each binding in BINDINGS." | |||||
| (mapcar (lambda (x) (spacemacs//micro-state-create-wrapper | |||||
| name doc msg-func x)) | |||||
| (append bindings | |||||
| ;; force SPC to quit the micro-state to avoid a edge case | |||||
| ;; with evil-leader | |||||
| (list `(,dotspacemacs-leader-key | |||||
| ,(unless disable-leader 'spacemacs-default-map) | |||||
| :exit t))))) | |||||
| (defun spacemacs//micro-state-create-wrapper (name default-doc msg-func binding) | |||||
| "Create a wrapper of FUNC and return a tuple (key wrapper BINDING)." | |||||
| (let* ((key (car binding)) | |||||
| (wrapped (cadr binding)) | |||||
| (binding-doc (spacemacs/mplist-get binding :doc)) | |||||
| (binding-pre (spacemacs/mplist-get binding :pre)) | |||||
| (binding-post (spacemacs/mplist-get binding :post)) | |||||
| (wrapper-name (intern (format "spacemacs//%S-%S-%s" name wrapped key))) | |||||
| (doc-body | |||||
| `((let ((bdoc ,@binding-doc) | |||||
| (defdoc ,@default-doc)) | |||||
| (cond | |||||
| (bdoc | |||||
| (apply ',msg-func | |||||
| (list (spacemacs//micro-state-propertize-doc | |||||
| (format "%S: %s" ',name bdoc)))) | |||||
| bdoc) | |||||
| ((and defdoc | |||||
| ',wrapped | |||||
| (not (plist-get ',binding :exit))) | |||||
| (spacemacs//micro-state-set-minibuffer-height defdoc) | |||||
| (apply ',msg-func | |||||
| (list (spacemacs//micro-state-propertize-doc | |||||
| (format "%S: %s" ',name defdoc)))) | |||||
| defdoc))))) | |||||
| (wrapper-func | |||||
| (if (and (boundp wrapped) | |||||
| (eval `(keymapp ,wrapped))) | |||||
| wrapped | |||||
| `(defun ,wrapper-name () | |||||
| "Auto-generated function" | |||||
| (interactive) | |||||
| ,@binding-pre | |||||
| (let ((throwp t)) | |||||
| (catch 'exit | |||||
| (when (fboundp ',wrapped) | |||||
| (setq this-command ',wrapped) | |||||
| (call-interactively ',wrapped) | |||||
| (setq last-command ',wrapped)) | |||||
| (setq throwp nil)) | |||||
| ,@binding-post | |||||
| (when throwp (throw 'exit nil))) | |||||
| (when ,@doc-body | |||||
| (spacemacs//micro-state-set-minibuffer-height ,@doc-body) | |||||
| ,@doc-body))))) | |||||
| (append (list (car binding) (eval wrapper-func)) binding))) | |||||
| (defun spacemacs//micro-state-fill-map-sexps (wrappers) | |||||
| "Return a list of `define-key' sexp to fill the micro-state temporary map." | |||||
| (mapcar (lambda (x) `(define-key map ,(kbd (car x)) ',(cadr x))) | |||||
| wrappers)) | |||||
| (defun spacemacs//micro-state-create-exit-func | |||||
| (name wrappers persistent on-exit) | |||||
| "Return a function to execute when leaving the micro-state. | |||||
| The returned function returns nil if the executed command exits the | |||||
| micro-state." | |||||
| (let ((func (intern (format "spacemacs//%s-on-exit" name)))) | |||||
| (eval `(defun ,func () | |||||
| "Function executed after each micro-state command." | |||||
| (let* ((cur-wrapper (spacemacs//get-current-wrapper | |||||
| ',name ',wrappers)) | |||||
| (exitp (if cur-wrapper (plist-get cur-wrapper :exit) | |||||
| ,(not persistent)))) | |||||
| (when (listp exitp) (setq exitp (eval exitp))) | |||||
| (when exitp ,@on-exit (spacemacs//micro-state-close-window)) | |||||
| (not exitp)))))) | |||||
| (defun spacemacs//get-current-wrapper (name wrappers) | |||||
| "Return the wrapper being executed. | |||||
| Return nil if no wrapper is being executed (i.e. an unbound key has been | |||||
| pressed)." | |||||
| (let ((micro-state-fun (spacemacs//micro-state-func-name name))) | |||||
| (catch 'found | |||||
| (dolist (wrapper wrappers) | |||||
| (let ((key (car wrapper)) | |||||
| (func (cadr wrapper))) | |||||
| (if (and (or (eq this-command micro-state-fun) | |||||
| (eq this-command func)) | |||||
| (equal (this-command-keys) (kbd key))) | |||||
| (throw 'found wrapper)))) | |||||
| nil))) | |||||
| (defun spacemacs//micro-state-propertize-doc (doc) | |||||
| "Return a propertized doc string from DOC." | |||||
| (when (string-match "^\\(.+?\\):\\([[:ascii:]]*\\)$" doc) | |||||
| (let* ((header (match-string 1 doc)) | |||||
| (pheader (when header | |||||
| (propertize (concat " " header " ") | |||||
| 'face 'spacemacs-micro-state-header-face))) | |||||
| (tail (spacemacs//micro-state-propertize-doc-rec | |||||
| (match-string 2 doc)))) | |||||
| (concat pheader tail)))) | |||||
| (defun spacemacs//micro-state-propertize-doc-rec (doc) | |||||
| "Recursively propertize keys" | |||||
| (if (string-match "^\\([[:ascii:]]*?\\)\\(\\[.+?\\]\\)\\([[:ascii:]]*\\)$" doc) | |||||
| (let* ((head (match-string 1 doc)) | |||||
| (key (match-string 2 doc)) | |||||
| (pkey (when key | |||||
| (propertize key 'face 'spacemacs-micro-state-binding-face))) | |||||
| (tail (spacemacs//micro-state-propertize-doc-rec | |||||
| (match-string 3 doc)))) | |||||
| (concat head pkey tail)) | |||||
| doc)) | |||||
| (defun spacemacs//micro-state-close-window () | |||||
| "Close micro-state help window." | |||||
| (when (window-live-p lv-wnd) | |||||
| (let ((buf (window-buffer lv-wnd))) | |||||
| (delete-window lv-wnd) | |||||
| (kill-buffer buf)))) | |||||
| (provide 'core-micro-state) | |||||
| @ -0,0 +1,343 @@ | |||||
| ;;; core-spacemacs.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defconst spacemacs-repository "spacemacs" | |||||
| "Name of the Spacemacs remote repository.") | |||||
| (defconst spacemacs-repository-owner "syl20bnr" | |||||
| "Name of the Spacemacs remote repository owner.") | |||||
| (defconst spacemacs-checkversion-remote "checkversion" | |||||
| "Name of the remote repository used to check for new version.") | |||||
| (defconst spacemacs-checkversion-branch "master" | |||||
| "Name of the branch used to check for new version.") | |||||
| (defvar dotspacemacs-check-for-update) | |||||
| (defvar spacemacs-version) | |||||
| ;; new version variables | |||||
| (defvar spacemacs-new-version nil | |||||
| "If non-nil a new Spacemacs version is available.") | |||||
| ;; used to be "6 hours" but we now check for new versions only at startup | |||||
| (defvar spacemacs-version-check-interval nil | |||||
| "Time between two version checks.") | |||||
| (defvar spacemacs-version-check-lighter "[+]" | |||||
| "Text displayed in the mode-line when a new version is available.") | |||||
| (defvar spacemacs-version--check-timer nil | |||||
| "The current timer for new version check.") | |||||
| (defvar spacemacs-version--last-startup-check-file | |||||
| (expand-file-name (concat spacemacs-cache-directory "last-version-check")) | |||||
| "File where the last startup version check time is stored.") | |||||
| (defvar spacemacs-version--last-startup-check-time nil | |||||
| "Time of last version check.") | |||||
| (defvar spacemacs-version--startup-check-interval (* 3600 24) | |||||
| "Minimum number of seconds between two version checks at startup.") | |||||
| (defun spacemacs/switch-to-version (&optional version) | |||||
| "Switch spacemacs to VERSION. | |||||
| VERSION is a string with the format `x.x.x'. | |||||
| IMPORTANT: The switch is performed by hard resetting the current branch. | |||||
| If VERSION is nil then a prompt will ask for a version number. | |||||
| If the current version is not `master' and not `develop' then | |||||
| a prompt will ask for confirmation before actually switching to the | |||||
| specified version. | |||||
| It is not possible to switch version when you are on `develop' branch, | |||||
| users on `develop' branch must manually pull last commits instead." | |||||
| (interactive) | |||||
| (let ((branch (spacemacs//git-get-current-branch)) | |||||
| (dirty (spacemacs//git-working-directory-dirty))) | |||||
| (unless version | |||||
| (message "Getting version information...") | |||||
| (let ((last-version (spacemacs/get-last-version))) | |||||
| (setq version (read-string | |||||
| (format "Version (default %s [latest]): " last-version) | |||||
| nil nil last-version)))) | |||||
| (cond ((string-equal "develop" branch) | |||||
| (message (concat "Cannot switch version because you are on " | |||||
| "develop.\n" | |||||
| "You have to manually `pull --rebase' the latest " | |||||
| "commits."))) | |||||
| (dirty | |||||
| (message (concat "Your Emacs directory is not clean.\n" | |||||
| "git status:\n%s") dirty)) | |||||
| ((string-equal version spacemacs-version) | |||||
| (message "You are already on the latest version.")) | |||||
| ((or (string-equal "master" branch) | |||||
| (yes-or-no-p | |||||
| (format (concat "You are not on master. " | |||||
| "This command will switch branches.\n" | |||||
| "Are you sure that you want to switch " | |||||
| "to version %s ? ") | |||||
| version))) | |||||
| (let ((tag (concat "v" version))) | |||||
| (if (spacemacs//git-hard-reset-to-tag tag) | |||||
| (progn | |||||
| (setq spacemacs-version version) | |||||
| (message "Successfully switched to version %s" version)) | |||||
| (message "An error occurred while switching to version %s" | |||||
| version)))) | |||||
| (t (message "Update aborted."))))) | |||||
| (defun spacemacs/check-for-new-version (force &optional interval) | |||||
| "Periodicly check for new for new Spacemacs version. | |||||
| Update `spacemacs-new-version' variable if any new version has been | |||||
| found." | |||||
| (interactive "P") | |||||
| (cond | |||||
| ((and (not force) | |||||
| (not dotspacemacs-check-for-update)) | |||||
| (message "Skipping check for new version (reason: dotfile)")) | |||||
| ((and (not force) | |||||
| (string-equal "develop" (spacemacs//git-get-current-branch))) | |||||
| (message "Skipping check for new version (reason: develop branch)")) | |||||
| ((and (not force) | |||||
| (not (spacemacs//can-check-for-new-version-at-startup))) | |||||
| (message (concat "Skipping check for new version " | |||||
| "(reason: last check is too recent)"))) | |||||
| ((require 'async nil t) | |||||
| (message "Start checking for new version...") | |||||
| (async-start | |||||
| `(lambda () | |||||
| ,(async-inject-variables "\\`spacemacs-start-directory\\'") | |||||
| (load-file (concat spacemacs-start-directory | |||||
| "core/core-load-paths.el")) | |||||
| (require 'core-spacemacs) | |||||
| (spacemacs/get-last-version)) | |||||
| (lambda (result) | |||||
| (if result | |||||
| (if (or (version< result spacemacs-version) | |||||
| (string= result spacemacs-version) | |||||
| (if spacemacs-new-version | |||||
| (string= result spacemacs-new-version))) | |||||
| (message "Spacemacs is up to date.") | |||||
| (message "New version of Spacemacs available: %s" result) | |||||
| (setq spacemacs-new-version result)) | |||||
| (message "Unable to check for new version.")))) | |||||
| (when interval | |||||
| (setq spacemacs-version--check-timer | |||||
| (run-at-time t (timer-duration interval) | |||||
| 'spacemacs/check-for-new-version)))) | |||||
| (t (message "Skipping check for new version (reason: async not loaded)")))) | |||||
| (defun spacemacs/git-get-current-branch-rev () | |||||
| "Returns the hash of the head commit on the current branch. | |||||
| Returns nil if an error occurred." | |||||
| (let ((proc-buffer "git-get-current-branch-head-hash") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (when (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "rev-parse" "--short" "HEAD")) | |||||
| (with-current-buffer proc-buffer | |||||
| (prog1 | |||||
| (when (buffer-string) | |||||
| (goto-char (point-min)) | |||||
| (replace-regexp-in-string | |||||
| "\n$" "" | |||||
| (buffer-substring (line-beginning-position) | |||||
| (line-end-position)))) | |||||
| (kill-buffer proc-buffer)))))) | |||||
| (defun spacemacs/get-new-version-lighter-face (current new) | |||||
| "Return the new version lighter face given the difference between the CURRENT | |||||
| version and the NEW version." | |||||
| (let* ((lcur (version-to-list current)) | |||||
| (lnew (version-to-list new)) | |||||
| (scur (spacemacs//compute-version-score lcur)) | |||||
| (snew (spacemacs//compute-version-score lnew)) | |||||
| (diff (- snew scur))) | |||||
| (cond | |||||
| ((< diff 3000) 'spacemacs-mode-line-new-version-lighter-success-face) | |||||
| ((< diff 5000) 'spacemacs-mode-line-new-version-lighter-warning-face) | |||||
| (t 'spacemacs-mode-line-new-version-lighter-error-face)))) | |||||
| (defun spacemacs/get-last-version () | |||||
| "Return the last tagged version." | |||||
| (interactive) | |||||
| (spacemacs//get-last-version spacemacs-repository | |||||
| spacemacs-repository-owner | |||||
| spacemacs-checkversion-remote | |||||
| spacemacs-checkversion-branch)) | |||||
| (defun spacemacs//can-check-for-new-version-at-startup () | |||||
| "Return non-nil if the version check at startup can be performed." | |||||
| (when (file-exists-p spacemacs-version--last-startup-check-file) | |||||
| (load spacemacs-version--last-startup-check-file)) | |||||
| (let ((result | |||||
| (or (null spacemacs-version--last-startup-check-time) | |||||
| (> (- (float-time) spacemacs-version--last-startup-check-time) | |||||
| spacemacs-version--startup-check-interval)))) | |||||
| (when result | |||||
| (setq spacemacs-version--last-startup-check-time (float-time)) | |||||
| (spacemacs/dump-vars-to-file '(spacemacs-version--last-startup-check-time) | |||||
| spacemacs-version--last-startup-check-file)) | |||||
| result)) | |||||
| (defun spacemacs//get-last-version (repo owner remote branch) | |||||
| "Return the last tagged version of BRANCH on REMOTE repository from | |||||
| OWNER REPO." | |||||
| (let ((url (format "https://github.com/%s/%s" owner repo))) | |||||
| (spacemacs//git-remove-remote remote) | |||||
| (spacemacs//git-add-remote remote url) | |||||
| ;; removing this call according to issue #6692 proposal | |||||
| ;; (spacemacs//git-fetch-remote remote) | |||||
| (spacemacs//git-fetch-tags remote branch)) | |||||
| (let ((version (spacemacs//git-latest-tag remote branch))) | |||||
| (when version | |||||
| (save-match-data | |||||
| (string-match "^.*\\([0-9]+\\.[0-9]+\\.[0-9]+\\)$" version) | |||||
| (match-string 1 version))))) | |||||
| (defun spacemacs//git-has-remote (remote) | |||||
| "Return non nil if REMOTE is declared." | |||||
| (let ((proc-buffer "git-has-remote") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (when (eq 0 (process-file "git" nil proc-buffer nil "remote")) | |||||
| (with-current-buffer proc-buffer | |||||
| (prog2 | |||||
| (goto-char (point-min)) | |||||
| (re-search-forward (format "^%s$" remote) nil 'noerror) | |||||
| (kill-buffer proc-buffer)))))) | |||||
| (defun spacemacs//git-add-remote (remote url) | |||||
| "Add a REMOTE with URL, return t if no error." | |||||
| (let ((proc-buffer "git-add-remote") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "remote" "add" remote url)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-remove-remote (remote) | |||||
| "Remove a REMOTE, return t if no error." | |||||
| (let ((proc-buffer "git-remove-remote") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "remote" "remove" remote)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-fetch-remote (remote) | |||||
| "Fetch last commits from REMOTE, return t if no error." | |||||
| (let ((proc-buffer "git-fetch-remote") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "fetch" remote)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-fetch-tags (remote branch) | |||||
| "Fetch the tags for BRANCH in REMOTE repository." | |||||
| (let ((proc-buffer "git-fetch-tags") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| ;;;; original comment: seems necessary to fetch first | |||||
| ;; but we remove this according to issue #6692 proposal | |||||
| ;; (eq 0 (process-file "git" nil proc-buffer nil | |||||
| ;; "fetch" remote branch)) | |||||
| ;; explicitly fetch the new tags | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "fetch" "--tags" remote branch)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-hard-reset-to-tag (tag) | |||||
| "Hard reset the current branch to specifed TAG." | |||||
| (let ((proc-buffer "git-hard-reset") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "reset" "--hard" tag)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-latest-tag (remote branch) | |||||
| "Returns the latest tag on REMOTE/BRANCH." | |||||
| (let ((proc-buffer "git-latest-tag") | |||||
| (default-directory (file-truename spacemacs-start-directory)) | |||||
| (where (format "%s/%s" remote branch))) | |||||
| (when (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "describe" "--tags" "--abbrev=0" | |||||
| "--match=v*" where "FETCH_HEAD")) | |||||
| (with-current-buffer proc-buffer | |||||
| (prog1 | |||||
| (when (buffer-string) | |||||
| (goto-char (point-max)) | |||||
| (forward-line -1) | |||||
| (replace-regexp-in-string | |||||
| "\n$" "" | |||||
| (buffer-substring (line-beginning-position) | |||||
| (line-end-position)))) | |||||
| (kill-buffer proc-buffer)))))) | |||||
| (defun spacemacs//git-checkout (branch) | |||||
| "Checkout the given BRANCH. Return t if there is no error." | |||||
| (let ((proc-buffer "git-checkout") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (prog1 | |||||
| (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "checkout" branch)) | |||||
| (kill-buffer proc-buffer)))) | |||||
| (defun spacemacs//git-get-current-branch () | |||||
| "Return the current branch. Return nil if an error occurred." | |||||
| (let ((proc-buffer "git-get-current-branch") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (when (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "symbolic-ref" "--short" "-q" "HEAD")) | |||||
| (with-current-buffer proc-buffer | |||||
| (prog1 | |||||
| (when (buffer-string) | |||||
| (goto-char (point-min)) | |||||
| (replace-regexp-in-string | |||||
| "\n$" "" | |||||
| (buffer-substring (line-beginning-position) | |||||
| (line-end-position)))) | |||||
| (kill-buffer proc-buffer)))))) | |||||
| (defun spacemacs//git-working-directory-dirty () | |||||
| "Non-nil if the user's emacs directory is not clean. | |||||
| Returns the output of git status --porcelain." | |||||
| (let ((proc-buffer "git-working-directory-dirty") | |||||
| (default-directory (file-truename spacemacs-start-directory))) | |||||
| (when (eq 0 (process-file "git" nil proc-buffer nil | |||||
| "status" "--porcelain")) | |||||
| (with-current-buffer proc-buffer | |||||
| (prog1 | |||||
| (when (and (buffer-string) | |||||
| ;;simplecheckforanytext | |||||
| (string-match-p "[^ \t\n]" (buffer-string))) | |||||
| (replace-regexp-in-string "\n\\'" "" (buffer-string))) | |||||
| (kill-buffer proc-buffer)))))) | |||||
| (defun spacemacs//deffaces-new-version-lighter (state) | |||||
| "Define a new version lighter face for the given STATE." | |||||
| (let* ((fname (intern | |||||
| (format "spacemacs-mode-line-new-version-lighter-%s-face" | |||||
| (symbol-name state)))) | |||||
| (foreground (face-foreground state))) | |||||
| (eval `(defface ,fname '((t ())) | |||||
| ,(format "Color for new version lighter in mode line (%s)." | |||||
| (symbol-name state)) | |||||
| :group 'spacemacs)) | |||||
| (set-face-attribute fname nil | |||||
| :foreground foreground | |||||
| :box (face-attribute 'mode-line :box)))) | |||||
| (defun spacemacs//compute-version-score (version) | |||||
| "Returns an integer from the version list. | |||||
| Example: (1 42 3) = 1 042 003" | |||||
| (let ((i -1)) | |||||
| (cl-reduce '+ (mapcar (lambda (n) (setq i (1+ i)) (* n (expt 10 (* i 3)))) | |||||
| (reverse version))))) | |||||
| (defun spacemacs/set-new-version-lighter-mode-line-faces () | |||||
| "Define or set the new version lighter mode-line faces." | |||||
| (mapcar 'spacemacs//deffaces-new-version-lighter | |||||
| '(error warning success))) | |||||
| (spacemacs/set-new-version-lighter-mode-line-faces) | |||||
| (add-hook 'spacemacs-post-theme-change-hook | |||||
| 'spacemacs/set-new-version-lighter-mode-line-faces) | |||||
| (provide 'core-release-management) | |||||
| @ -0,0 +1,341 @@ | |||||
| ;;; core-spacemacs.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (setq message-log-max 16384) | |||||
| (defconst emacs-start-time (current-time)) | |||||
| (require 'subr-x nil 'noerror) | |||||
| (require 'page-break-lines) | |||||
| (require 'core-debug) | |||||
| (require 'core-command-line) | |||||
| (require 'core-dotspacemacs) | |||||
| (require 'core-release-management) | |||||
| (require 'core-auto-completion) | |||||
| (require 'core-jump) | |||||
| (require 'core-display-init) | |||||
| (require 'core-themes-support) | |||||
| (require 'core-fonts-support) | |||||
| (require 'core-spacemacs-buffer) | |||||
| (require 'core-keybindings) | |||||
| (require 'core-toggle) | |||||
| (require 'core-funcs) | |||||
| (require 'core-micro-state) | |||||
| (require 'core-transient-state) | |||||
| (require 'core-use-package-ext) | |||||
| (defgroup spacemacs nil | |||||
| "Spacemacs customizations." | |||||
| :group 'starter-kit | |||||
| :prefix 'spacemacs-) | |||||
| ;; loading progress bar variables | |||||
| (defvar spacemacs-loading-char ?█) | |||||
| (defvar spacemacs-loading-string "") | |||||
| (defvar spacemacs-loading-counter 0) | |||||
| (defvar spacemacs-loading-value 0) | |||||
| ;; (defvar spacemacs-loading-text "Loading") | |||||
| ;; (defvar spacemacs-loading-done-text "Ready!") | |||||
| (defvar spacemacs-loading-dots-chunk-count 3) | |||||
| (defvar spacemacs-loading-dots-count (window-total-size nil 'width)) | |||||
| (defvar spacemacs-loading-dots-chunk-size | |||||
| (/ spacemacs-loading-dots-count spacemacs-loading-dots-chunk-count)) | |||||
| (defvar spacemacs-loading-dots-chunk-threshold 0) | |||||
| (defvar spacemacs-post-user-config-hook nil | |||||
| "Hook run after dotspacemacs/user-config") | |||||
| (defvar spacemacs-post-user-config-hook-run nil | |||||
| "Whether `spacemacs-post-user-config-hook' has been run") | |||||
| (defvar spacemacs--default-mode-line mode-line-format | |||||
| "Backup of default mode line format.") | |||||
| (defvar spacemacs-initialized nil | |||||
| "Whether or not spacemacs has finished initializing by completing | |||||
| the final step of executing code in `emacs-startup-hook'.") | |||||
| (defun spacemacs/init () | |||||
| "Perform startup initialization." | |||||
| (when spacemacs-debugp (spacemacs/init-debug)) | |||||
| ;; silence ad-handle-definition about advised functions getting redefined | |||||
| (setq ad-redefinition-action 'accept) | |||||
| ;; this is for a smoother UX at startup (i.e. less graphical glitches) | |||||
| (hidden-mode-line-mode) | |||||
| (spacemacs//removes-gui-elements) | |||||
| ;; explicitly set the prefered coding systems to avoid annoying prompt | |||||
| ;; from emacs (especially on Microsoft Windows) | |||||
| (prefer-coding-system 'utf-8) | |||||
| ;; TODO move these variables when evil is removed from the bootstrapped | |||||
| ;; packages. | |||||
| (setq-default evil-want-C-u-scroll t | |||||
| ;; `evil-want-C-i-jump' is set to nil to avoid `TAB' being | |||||
| ;; overlapped in terminal mode. The GUI specific `<C-i>' is used | |||||
| ;; instead. | |||||
| evil-want-C-i-jump nil) | |||||
| (dotspacemacs/load-file) | |||||
| (require 'core-configuration-layer) | |||||
| (dotspacemacs|call-func dotspacemacs/init "Calling dotfile init...") | |||||
| (dotspacemacs|call-func dotspacemacs/user-init "Calling dotfile user init...") | |||||
| (setq dotspacemacs-editing-style (dotspacemacs//read-editing-style-config | |||||
| dotspacemacs-editing-style)) | |||||
| (configuration-layer/initialize) | |||||
| ;; default theme | |||||
| (let ((default-theme (car dotspacemacs-themes))) | |||||
| (spacemacs/load-theme default-theme) | |||||
| ;; protect used themes from deletion as orphans | |||||
| (setq configuration-layer--protected-packages | |||||
| (append | |||||
| (delq nil (mapcar 'spacemacs//get-theme-package | |||||
| dotspacemacs-themes)) | |||||
| configuration-layer--protected-packages)) | |||||
| (setq-default spacemacs--cur-theme default-theme) | |||||
| (setq-default spacemacs--cycle-themes (cdr dotspacemacs-themes))) | |||||
| ;; font | |||||
| (spacemacs|do-after-display-system-init | |||||
| ;; If you are thinking to remove this call to `message', think twice. You'll | |||||
| ;; break the life of several Spacemacser using Emacs in daemon mode. Without | |||||
| ;; this, their chosen font will not be set on the *first* instance of | |||||
| ;; emacsclient, at least if different than their system font. You don't | |||||
| ;; believe me? Go ahead, try it. After you'll have notice that this was true, | |||||
| ;; increase the counter bellow so next people will give it more confidence. | |||||
| ;; Counter = 1 | |||||
| (message "Setting the font...") | |||||
| (unless (spacemacs/set-default-font dotspacemacs-default-font) | |||||
| (spacemacs-buffer/warning | |||||
| "Cannot find any of the specified fonts (%s)! Font settings may not be correct." | |||||
| (if (listp (car dotspacemacs-default-font)) | |||||
| (mapconcat 'car dotspacemacs-default-font ", ") | |||||
| (car dotspacemacs-default-font))))) | |||||
| ;; spacemacs init | |||||
| (setq inhibit-startup-screen t) | |||||
| (spacemacs-buffer/goto-buffer) | |||||
| (unless (display-graphic-p) | |||||
| ;; explicitly recreate the home buffer for the first GUI client | |||||
| ;; in order to correctly display the logo | |||||
| (spacemacs|do-after-display-system-init | |||||
| (kill-buffer (get-buffer spacemacs-buffer-name)) | |||||
| (spacemacs-buffer/goto-buffer))) | |||||
| ;; This is set to nil during startup to allow Spacemacs to show buffers opened | |||||
| ;; as command line arguments. | |||||
| (setq initial-buffer-choice nil) | |||||
| (setq inhibit-startup-screen t) | |||||
| (require 'core-keybindings) | |||||
| ;; for convenience and user support | |||||
| (unless (fboundp 'tool-bar-mode) | |||||
| (spacemacs-buffer/message (concat "No graphical support detected, " | |||||
| "you won't be able to launch a " | |||||
| "graphical instance of Emacs" | |||||
| "with this build."))) | |||||
| ;; check for new version | |||||
| (if dotspacemacs-mode-line-unicode-symbols | |||||
| (setq-default spacemacs-version-check-lighter "[⇪]"))) | |||||
| (defun spacemacs//removes-gui-elements () | |||||
| "Remove the menu bar, tool bar and scroll bars." | |||||
| ;; removes the GUI elements | |||||
| (unless (spacemacs/window-system-is-mac) | |||||
| (when (and (fboundp 'menu-bar-mode) (not (eq menu-bar-mode -1))) | |||||
| (menu-bar-mode -1))) | |||||
| (when (and (fboundp 'scroll-bar-mode) (not (eq scroll-bar-mode -1))) | |||||
| (scroll-bar-mode -1)) | |||||
| (when (and (fboundp 'tool-bar-mode) (not (eq tool-bar-mode -1))) | |||||
| (tool-bar-mode -1)) | |||||
| ;; tooltips in echo-aera | |||||
| (when (and (fboundp 'tooltip-mode) (not (eq tooltip-mode -1))) | |||||
| (tooltip-mode -1))) | |||||
| (defun spacemacs/maybe-install-dotfile () | |||||
| "Install the dotfile if it does not exist." | |||||
| (unless (file-exists-p dotspacemacs-filepath) | |||||
| (spacemacs-buffer/set-mode-line "Dotfile wizard installer") | |||||
| (spacemacs//redisplay) | |||||
| (when (dotspacemacs/install 'with-wizard) | |||||
| (configuration-layer/sync)))) | |||||
| (defun spacemacs/display-and-copy-version () | |||||
| "Echo the current spacemacs version and copy it." | |||||
| (interactive) | |||||
| (let ((msg (format "Spacemacs v.%s" spacemacs-version))) | |||||
| (message msg) (kill-new msg))) | |||||
| (defun display-startup-echo-area-message () | |||||
| "Change the default welcome message of minibuffer to another one." | |||||
| (message "Spacemacs is ready.")) | |||||
| (defun spacemacs/defer-until-after-user-config (func) | |||||
| "Call FUNC if dotspacemacs/user-config has been called. Otherwise, | |||||
| defer call using `spacemacs-post-user-config-hook'." | |||||
| (if spacemacs-post-user-config-hook-run | |||||
| (funcall func) | |||||
| (add-hook 'spacemacs-post-user-config-hook func))) | |||||
| (defun spacemacs/setup-startup-hook () | |||||
| "Add post init processing." | |||||
| (add-hook | |||||
| 'emacs-startup-hook | |||||
| (lambda () | |||||
| ;; This is set here so that emacsclient will show the startup buffer (and | |||||
| ;; so that it can be changed in user-config if necessary). It was set to | |||||
| ;; nil earlier in the startup process to properly handle command line | |||||
| ;; arguments. | |||||
| (setq initial-buffer-choice (lambda () (get-buffer spacemacs-buffer-name))) | |||||
| ;; Ultimate configuration decisions are given to the user who can defined | |||||
| ;; them in his/her ~/.spacemacs file | |||||
| (dotspacemacs|call-func dotspacemacs/user-config | |||||
| "Calling dotfile user config...") | |||||
| (run-hooks 'spacemacs-post-user-config-hook) | |||||
| (setq spacemacs-post-user-config-hook-run t) | |||||
| (when (fboundp dotspacemacs-scratch-mode) | |||||
| (with-current-buffer "*scratch*" | |||||
| (funcall dotspacemacs-scratch-mode))) | |||||
| (configuration-layer/display-summary emacs-start-time) | |||||
| (spacemacs/check-for-new-version nil spacemacs-version-check-interval) | |||||
| (setq spacemacs-initialized t)))) | |||||
| (defun spacemacs//describe-system-info-string () | |||||
| "Gathers info about your Spacemacs setup and returns it as a string." | |||||
| (format | |||||
| (concat "#### System Info :computer:\n" | |||||
| "- OS: %s\n" | |||||
| "- Emacs: %s\n" | |||||
| "- Spacemacs: %s\n" | |||||
| "- Spacemacs branch: %s (rev. %s)\n" | |||||
| "- Graphic display: %s\n" | |||||
| "- Distribution: %s\n" | |||||
| "- Editing style: %s\n" | |||||
| "- Completion: %s\n" | |||||
| "- Layers:\n```elisp\n%s```\n" | |||||
| (when (version<= "25.1" emacs-version) | |||||
| "- System configuration features: %s\n")) | |||||
| system-type | |||||
| emacs-version | |||||
| spacemacs-version | |||||
| (spacemacs//git-get-current-branch) | |||||
| (spacemacs/git-get-current-branch-rev) | |||||
| (display-graphic-p) | |||||
| dotspacemacs-distribution | |||||
| dotspacemacs-editing-style | |||||
| (cond ((configuration-layer/layer-usedp 'helm) | |||||
| 'helm) | |||||
| ((configuration-layer/layer-usedp 'ivy) | |||||
| 'ivy) | |||||
| (t 'helm)) | |||||
| (pp-to-string dotspacemacs--configuration-layers-saved) | |||||
| (bound-and-true-p system-configuration-features))) | |||||
| (defun spacemacs/describe-system-info () | |||||
| "Gathers info about your Spacemacs setup and copies to clipboard." | |||||
| (interactive) | |||||
| (let ((sysinfo (spacemacs//describe-system-info-string))) | |||||
| (kill-new sysinfo) | |||||
| (message sysinfo) | |||||
| (message (concat "Information has been copied to clipboard.\n" | |||||
| "You can paste it in the gitter chat.\n" | |||||
| "Check the *Messages* buffer if you need to review it")))) | |||||
| (defun spacemacs//describe-last-keys-string () | |||||
| "Gathers info about your Emacs last keys and returns it as a string." | |||||
| (loop | |||||
| for key | |||||
| across (recent-keys) | |||||
| collect (if (or (integerp key) (symbolp key) (listp key)) | |||||
| (single-key-description key) | |||||
| (prin1-to-string key)) | |||||
| into keys | |||||
| finally (return | |||||
| (with-temp-buffer | |||||
| (set-fill-column 60) | |||||
| (insert (mapconcat 'identity keys " ")) | |||||
| (fill-region (point-min) (point-max)) | |||||
| (format "#### Emacs last keys :musical_keyboard: \n```text\n%s\n```\n" (buffer-string)))))) | |||||
| (defun spacemacs/describe-last-keys () | |||||
| "Gathers info about your Emacs last keys and copies to clipboard." | |||||
| (interactive) | |||||
| (let ((lossage (spacemacs//describe-last-keys-string))) | |||||
| (kill-new lossage) | |||||
| (message lossage) | |||||
| (message (concat "Information has been copied to clipboard.\n" | |||||
| (propertize | |||||
| "PLEASE REVIEW THE DATA BEFORE GOING FURTHER AS IT CAN CONTAIN SENSITIVE DATA (PASSWORD, ...)\n" | |||||
| 'face 'font-lock-warning-face) | |||||
| "You can paste it in the gitter chat.\n" | |||||
| "Check the *Messages* buffer if you need to review it")))) | |||||
| (defun spacemacs/report-issue (arg) | |||||
| "Open a spacemacs/report-issue-mode buffer prepopulated with | |||||
| issue report template and system information. | |||||
| With prefix arg,include the last keys pressed." | |||||
| (interactive "P") | |||||
| (let ((buf | |||||
| (generate-new-buffer "REPORT_SPACEMACS_ISSUE")) | |||||
| (system-info | |||||
| (spacemacs//describe-system-info-string)) | |||||
| (backtrace | |||||
| (if (get-buffer "*Backtrace*") | |||||
| (with-current-buffer "*Backtrace*" | |||||
| (buffer-substring-no-properties | |||||
| (point-min) | |||||
| (min (point-max) 1000))) | |||||
| "<<BACKTRACE IF RELEVANT>>")) | |||||
| (last-keys | |||||
| (if (and arg (y-or-n-p (concat "Do you really want to " | |||||
| "include your last pressed keys? It " | |||||
| "may include some sensitive data."))) | |||||
| (concat (spacemacs//describe-last-keys-string) "\n") | |||||
| ""))) | |||||
| (switch-to-buffer buf) | |||||
| (insert-file-contents-literally | |||||
| (concat configuration-layer-template-directory "REPORTING.template")) | |||||
| (loop | |||||
| for (placeholder replacement) | |||||
| in '(("%SYSTEM_INFO%" system-info) | |||||
| ("%BACKTRACE%" backtrace) | |||||
| ("(%LAST_KEYS%)\n" last-keys)) | |||||
| do (save-excursion | |||||
| (goto-char (point-min)) | |||||
| (search-forward placeholder) | |||||
| (replace-match (symbol-value replacement) [keep-case] [literal]))) | |||||
| (spacemacs/report-issue-mode))) | |||||
| (define-derived-mode spacemacs/report-issue-mode markdown-mode "Report-Issue" | |||||
| "Major mode for reporting issues with Spacemacs. | |||||
| When done editing, you can type \\[spacemacs//report-issue-done] to create the | |||||
| issue on Github. You must be logged in already for this to work. After you see | |||||
| that the issue has been created successfully, you can close this buffer. | |||||
| Markdown syntax is supported in this buffer. | |||||
| \\{spacemacs/report-issue-mode-map} | |||||
| " | |||||
| (font-lock-add-keywords 'spacemacs/report-issue-mode | |||||
| '(("\\(<<.*?>>\\)" . 'font-lock-comment-face)))) | |||||
| (define-key spacemacs/report-issue-mode-map | |||||
| (kbd "C-c C-c") 'spacemacs//report-issue-done) | |||||
| (define-key spacemacs/report-issue-mode-map | |||||
| (kbd "C-c C-k") 'kill-buffer) | |||||
| (with-eval-after-load 'bind-map | |||||
| (spacemacs/set-leader-keys-for-major-mode 'spacemacs/report-issue-mode | |||||
| "," 'spacemacs//report-issue-done | |||||
| "c" 'spacemacs//report-issue-done | |||||
| "a" 'kill-buffer | |||||
| "k" 'kill-buffer)) | |||||
| (defun spacemacs//report-issue-done () | |||||
| (interactive) | |||||
| (let ((url "http://github.com/syl20bnr/spacemacs/issues/new?body=")) | |||||
| (setq url (url-encode-url (concat url (buffer-string)))) | |||||
| ;; HACK: Needed because the first `#' is not encoded | |||||
| (setq url (replace-regexp-in-string "#" "%23" url)) | |||||
| (browse-url url))) | |||||
| (provide 'core-spacemacs) | |||||
| @ -0,0 +1,230 @@ | |||||
| ;;; core-themes-support.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defconst emacs-built-in-themes (cons 'default (custom-available-themes)) | |||||
| "List of emacs built-in themes") | |||||
| (defface org-kbd | |||||
| '((t (:background "LemonChiffon1" :foreground "black" :box | |||||
| (:line-width 2 :color nil :style released-button)))) | |||||
| "Face for displaying key bindings in Spacemacs documents." | |||||
| :group 'org-faces) | |||||
| (defconst spacemacs-theme-name-to-package | |||||
| '( | |||||
| (alect-black-alt . alect-themes) | |||||
| (alect-black . alect-themes) | |||||
| (alect-dark-alt . alect-themes) | |||||
| (alect-dark . alect-themes) | |||||
| (alect-light-alt . alect-themes) | |||||
| (alect-light . alect-themes) | |||||
| (ample-light . ample-theme) | |||||
| (ample-flat . ample-theme) | |||||
| (apropospriate-light . apropospriate-theme) | |||||
| (apropospriate-dark . apropospriate-theme) | |||||
| (base16-3024 . base16-theme) | |||||
| (base16-apathy . base16-theme) | |||||
| (base16-ashes . base16-theme) | |||||
| (base16-atelier-cave . base16-theme) | |||||
| (base16-atelier-dune . base16-theme) | |||||
| (base16-atelier-estuary . base16-theme) | |||||
| (base16-atelier-forest . base16-theme) | |||||
| (base16-atelier-heath . base16-theme) | |||||
| (base16-atelier-lakeside . base16-theme) | |||||
| (base16-atelier-plateau . base16-theme) | |||||
| (base16-atelier-savanna . base16-theme) | |||||
| (base16-atelier-seaside . base16-theme) | |||||
| (base16-atelier-sulphurpool . base16-theme) | |||||
| (base16-bespin . base16-theme) | |||||
| (base16-brewer . base16-theme) | |||||
| (base16-bright . base16-theme) | |||||
| (base16-chalk . base16-theme) | |||||
| (base16-codeschool . base16-theme) | |||||
| (base16-darktooth . base16-theme) | |||||
| (base16-default-dark . base16-theme) | |||||
| (base16-default-light . base16-theme) | |||||
| (base16-eighties . base16-theme) | |||||
| (base16-embers . base16-theme) | |||||
| (base16-flat . base16-theme) | |||||
| (base16-github . base16-theme) | |||||
| (base16-google-dark . base16-theme) | |||||
| (base16-google-light . base16-theme) | |||||
| (base16-grayscale-dark . base16-theme) | |||||
| (base16-grayscale-light . base16-theme) | |||||
| (base16-green-screen . base16-theme) | |||||
| (base16-harmonic16-dark . base16-theme) | |||||
| (base16-harmonic16-light . base16-theme) | |||||
| (base16-hopscotch . base16-theme) | |||||
| (base16-ir-black . base16-theme) | |||||
| (base16-isotope . base16-theme) | |||||
| (base16-london-tube . base16-theme) | |||||
| (base16-macintosh . base16-theme) | |||||
| (base16-marrakesh . base16-theme) | |||||
| (base16-mocha . base16-theme) | |||||
| (base16-monokai . base16-theme) | |||||
| (base16-ocean . base16-theme) | |||||
| (base16-oceanicnext . base16-theme) | |||||
| (base16-paraiso . base16-theme) | |||||
| (base16-phd . base16-theme) | |||||
| (base16-pico . base16-theme) | |||||
| (base16-pop . base16-theme) | |||||
| (base16-railscasts . base16-theme) | |||||
| (base16-seti-ui . base16-theme) | |||||
| (base16-shapeshifter . base16-theme) | |||||
| (base16-solar-flare . base16-theme) | |||||
| (base16-solarized-dark . base16-theme) | |||||
| (base16-solarized-light . base16-theme) | |||||
| (base16-summerfruit-dark . base16-theme) | |||||
| (base16-summerfruit-light . base16-theme) | |||||
| (base16-tomorrow-night . base16-theme) | |||||
| (base16-tomorrow . base16-theme) | |||||
| (base16-twilight . base16-theme) | |||||
| (base16-unikitty-dark . base16-theme) | |||||
| (base16-unikitty-light . base16-theme) | |||||
| (sanityinc-solarized-dark . color-theme-sanityinc-solarized) | |||||
| (sanityinc-solarized-light . color-theme-sanityinc-solarized) | |||||
| (sanityinc-tomorrow-blue . color-theme-sanityinc-tomorrow) | |||||
| (sanityinc-tomorrow-bright . color-theme-sanityinc-tomorrow) | |||||
| (sanityinc-tomorrow-day . color-theme-sanityinc-tomorrow) | |||||
| (sanityinc-tomorrow-eighties . color-theme-sanityinc-tomorrow) | |||||
| (sanityinc-tomorrow-night . color-theme-sanityinc-tomorrow) | |||||
| (doom-one . doom-themes) | |||||
| (doom-molokai . doom-themes) | |||||
| (solarized-light . solarized-theme) | |||||
| (solarized-dark . solarized-theme) | |||||
| (spacemacs-light . spacemacs-theme) | |||||
| (spacemacs-dark . spacemacs-theme) | |||||
| (colorsarenice-dark . colorsarenice-theme) | |||||
| (colorsarenice-light . colorsarenice-theme) | |||||
| (hemisu-dark . hemisu-theme) | |||||
| (hemisu-light . hemisu-theme) | |||||
| (majapahit-dark . majapahit-theme) | |||||
| (majapahit-light . majapahit-theme) | |||||
| (material-light . material-theme) | |||||
| (minimal-light . minimal-theme) | |||||
| (moe-dark . moe-theme) | |||||
| (moe-light . moe-theme) | |||||
| (stekene-dark . stekene-theme) | |||||
| (stekene-light . stekene-theme) | |||||
| (brin . sublime-themes) | |||||
| (dorsey . sublime-themes) | |||||
| (fogus . sublime-themes) | |||||
| (graham . sublime-themes) | |||||
| (granger . sublime-themes) | |||||
| (hickey . sublime-themes) | |||||
| (junio . sublime-themes) | |||||
| (mccarthy . sublime-themes) | |||||
| (odersky . sublime-themes) | |||||
| (omtose-darker . omtose-phellack-theme) | |||||
| (omtose-softer . omtose-phellack-theme) | |||||
| (ritchie . sublime-themes) | |||||
| (spolsky . sublime-themes) | |||||
| (wilson . sublime-themes) | |||||
| (zonokai-blue . zonokai-theme) | |||||
| (zonokai-red . zonokai-theme) | |||||
| (tao-yin . tao-theme) | |||||
| (tao-yang . tao-theme) | |||||
| (farmhouse-light . farmhouse-theme) | |||||
| (farmhouse-dark . farmhouse-theme) | |||||
| ) | |||||
| "alist matching a theme name with its package name, required when | |||||
| package name does not match theme name + `-theme' suffix.") | |||||
| (defvar spacemacs-post-theme-change-hook nil | |||||
| "Hook run after theme has changed.") | |||||
| (defun spacemacs//get-theme-package (theme) | |||||
| "Returns the package theme for the given THEME name." | |||||
| (cond | |||||
| ;; built-in | |||||
| ((memq theme emacs-built-in-themes) nil) | |||||
| ;; from explicit alist | |||||
| ((assq theme spacemacs-theme-name-to-package) | |||||
| (cdr (assq theme spacemacs-theme-name-to-package))) | |||||
| ;; fallback to <name>-theme | |||||
| (t (intern (format "%S-theme" theme))))) | |||||
| (defun spacemacs/load-theme (theme) | |||||
| "Load THEME." | |||||
| ;; Required dependencies for some themes | |||||
| (condition-case-unless-debug err | |||||
| (progn | |||||
| (when (or (eq 'zonokai-blue theme) | |||||
| (eq 'zonokai-red theme) | |||||
| (eq 'solarized-light theme) | |||||
| (eq 'solarized-dark theme)) | |||||
| (configuration-layer/load-or-install-package 'dash)) | |||||
| ;; Unless Emacs stock themes | |||||
| (unless (or (memq theme (custom-available-themes)) | |||||
| (eq 'default theme)) | |||||
| (cond | |||||
| ;; themes with explicitly declared package names | |||||
| ((assq theme spacemacs-theme-name-to-package) | |||||
| (let* ((pkg (spacemacs//get-theme-package theme)) | |||||
| (pkg-dir (configuration-layer/load-or-install-package pkg))) | |||||
| (when (or (eq 'moe-light theme) | |||||
| (eq 'moe-dark theme)) | |||||
| (load-file (concat pkg-dir "moe-light-theme.el")) | |||||
| (load-file (concat pkg-dir "moe-dark-theme.el"))) | |||||
| (add-to-list 'custom-theme-load-path pkg-dir))) | |||||
| (t | |||||
| ;; other themes | |||||
| ;; we assume that the package name is suffixed with `-theme' | |||||
| ;; if not we will handle the special themes as we get issues | |||||
| ;; in the tracker. | |||||
| (let ((pkg (spacemacs//get-theme-package theme))) | |||||
| (configuration-layer/load-or-install-package pkg)))))) | |||||
| ('error | |||||
| (setq theme 'default) | |||||
| (display-warning 'spacemacs | |||||
| (format (concat "An error occurred while retrieving the " | |||||
| "theme, using default theme. (error: %s)") | |||||
| err) | |||||
| :warning))) | |||||
| (mapc 'disable-theme custom-enabled-themes) | |||||
| (if (eq 'default theme) | |||||
| (progn | |||||
| (setq spacemacs--cur-theme 'default) | |||||
| (spacemacs/post-theme-init 'default)) | |||||
| (load-theme theme t) | |||||
| ;; explicitly reload the theme for the first GUI client | |||||
| (eval `(spacemacs|do-after-display-system-init | |||||
| (load-theme ',theme t))))) | |||||
| (defun spacemacs/cycle-spacemacs-theme () | |||||
| "Cycle through themes defined in `dotspacemacs-themes.'" | |||||
| (interactive) | |||||
| (when spacemacs--cur-theme | |||||
| (disable-theme spacemacs--cur-theme) | |||||
| ;; if current theme isn't in cycleable themes, start over | |||||
| (setq spacemacs--cycle-themes | |||||
| (or (cdr (memq spacemacs--cur-theme dotspacemacs-themes)) | |||||
| dotspacemacs-themes))) | |||||
| (setq spacemacs--cur-theme (pop spacemacs--cycle-themes)) | |||||
| (message "Loading theme %s..." spacemacs--cur-theme) | |||||
| (spacemacs/load-theme spacemacs--cur-theme)) | |||||
| (defadvice load-theme (after spacemacs/load-theme-adv activate) | |||||
| "Perform post load processing." | |||||
| (let ((theme (ad-get-arg 0))) | |||||
| ;; Without this a popup is raised every time emacs25 starts up for | |||||
| ;; assignment to a free variable | |||||
| (with-no-warnings | |||||
| (setq spacemacs--cur-theme theme)) | |||||
| (spacemacs/post-theme-init theme))) | |||||
| (defun spacemacs/post-theme-init (theme) | |||||
| "Some processing that needs to be done when the current theme | |||||
| has been changed to THEME." | |||||
| (interactive) | |||||
| (run-hooks 'spacemacs-post-theme-change-hook)) | |||||
| (provide 'core-themes-support) | |||||
| @ -0,0 +1,113 @@ | |||||
| ;;; core-toggle.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (require 'core-funcs) | |||||
| (defvar spacemacs-toggles '() | |||||
| "List of all declared toggles. The structure of an element is a | |||||
| property list (name :func FUNCTION :doc STRING :key STRING).") | |||||
| (defmacro spacemacs|add-toggle (name &rest props) | |||||
| "Add a toggle with NAME symbol. | |||||
| This macro creates the following functions: | |||||
| - spacemacs/toggle-NAME switches on or off depending on the current state | |||||
| - spacemacs/toggle-NAME-on only switches on if currently disabled | |||||
| - spacemacs/toggle-NAME-off only switches off if currently enabled | |||||
| Avaiblabe PROPS: | |||||
| `:status EXPRESSION' | |||||
| The EXPRESSION to evaluate to get the current status of the toggle. | |||||
| `:if EXPRESSION' | |||||
| If this EXPRESSION evaluate to nil then no attempt to update the toggle | |||||
| status will be performed. | |||||
| `:on BODY' | |||||
| Evaluate BODY when the toggle is switched on. | |||||
| `:off BODY' | |||||
| Evaluate BODY when the toggle is switched off. | |||||
| `:documentation STRING' | |||||
| STRING describes what the toggle does. | |||||
| `:prefix SYMBOL' | |||||
| SYMBOL is bound to the raw value of prefix-arg (same as calling | |||||
| (interactive \"P\")) in the wrapper function. | |||||
| `:on-message EXPRESSION' | |||||
| EXPRESSION is evaluated and displayed when the \"on\" toggle is activated. | |||||
| `:mode SYMBOL' | |||||
| If given, must be a minor mode. This overrides `:on', `:off' and `:status'. | |||||
| All properties supported by `spacemacs//create-key-binding-form' can be | |||||
| used." | |||||
| (declare (indent 1)) | |||||
| (let* ((wrapper-func (intern (format "spacemacs/toggle-%s" | |||||
| (symbol-name name)))) | |||||
| (wrapper-func-status (intern (format "%s-p" wrapper-func))) | |||||
| (wrapper-func-on (intern (format "%s-on" wrapper-func))) | |||||
| (wrapper-func-off (intern (format "%s-off" wrapper-func))) | |||||
| (mode (plist-get props :mode)) | |||||
| (status (or mode (plist-get props :status))) | |||||
| (condition (plist-get props :if)) | |||||
| (doc (plist-get props :documentation)) | |||||
| (on-body (if mode `((,mode)) (spacemacs/mplist-get props :on))) | |||||
| (off-body (if mode `((,mode -1)) (spacemacs/mplist-get props :off))) | |||||
| (prefix-arg-var (plist-get props :prefix)) | |||||
| (on-message (plist-get props :on-message)) | |||||
| (bindkeys (spacemacs//create-key-binding-form props wrapper-func)) | |||||
| ;; we evaluate condition and status only if they are a list or | |||||
| ;; a bound symbol | |||||
| (status-eval `(and (or (and (symbolp ',status) (boundp ',status)) | |||||
| (listp ',status)) | |||||
| ,status))) | |||||
| `(progn | |||||
| (push (append '(,name) '(:function ,wrapper-func | |||||
| :predicate ,wrapper-func-status) ',props) | |||||
| spacemacs-toggles) | |||||
| ;; toggle function | |||||
| (defun ,wrapper-func ,(if prefix-arg-var (list prefix-arg-var) ()) | |||||
| ,(format "Toggle %s on and off." (symbol-name name)) | |||||
| ,(if prefix-arg-var '(interactive "P") '(interactive)) | |||||
| (if (or (null ',condition) | |||||
| (and (or (and (symbolp ',condition) (boundp ',condition)) | |||||
| (listp ',condition)) | |||||
| ,condition)) | |||||
| (if (,wrapper-func-status) | |||||
| (progn ,@off-body | |||||
| (when (called-interactively-p 'any) | |||||
| (message ,(format "%s disabled." name)))) | |||||
| ,@on-body | |||||
| (when (called-interactively-p 'any) | |||||
| (message ,(or on-message (format "%s enabled." name))))) | |||||
| (message "This toggle is not supported."))) | |||||
| ;; predicate function | |||||
| (defun ,wrapper-func-status () | |||||
| ,(format "Check if %s is on." (symbol-name name)) | |||||
| ,status-eval) | |||||
| ;; Only define on- or off-functions when status is available | |||||
| ,@(when status | |||||
| ;; on-function | |||||
| `((defun ,wrapper-func-on () | |||||
| ,(format "Toggle %s on." (symbol-name name)) | |||||
| (interactive) | |||||
| (unless (,wrapper-func-status) (,wrapper-func))) | |||||
| ;; off-function | |||||
| (defun ,wrapper-func-off () | |||||
| ,(format "Toggle %s off." (symbol-name name)) | |||||
| (interactive) | |||||
| (when (,wrapper-func-status) (,wrapper-func))))) | |||||
| ,@bindkeys))) | |||||
| (provide 'core-toggle) | |||||
| @ -0,0 +1,193 @@ | |||||
| ;;; -*- lexical-binding: t -*- | |||||
| ;;; core-transient-state.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Justin Burkett <justin@burkett.cc> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defun spacemacs//transient-state-func-name (name) | |||||
| "Return the name of the transient state function." | |||||
| (intern (format "spacemacs/%S-transient-state" name))) | |||||
| (defun spacemacs//transient-state-props-var-name (name) | |||||
| "Return the name of the variable use to store the transient state properties." | |||||
| (intern (format "spacemacs--%S-transient-state-props" name))) | |||||
| (defun spacemacs//transient-state-body-func-name (name) | |||||
| "Return the name of the transient state function." | |||||
| (intern (format "spacemacs/%S-transient-state/body" name))) | |||||
| (defun spacemacs//transient-state-heads-name (name) | |||||
| "Return the name of the transient state heads variable which | |||||
| holds the key bindings." | |||||
| (intern (format "spacemacs/%S-transient-state/heads" name))) | |||||
| (defun spacemacs//transient-state-adjust-bindings (bindings to-remove to-add) | |||||
| (append | |||||
| (cl-remove-if | |||||
| (lambda (bnd) | |||||
| (and (boundp to-remove) | |||||
| (listp (symbol-value to-remove)) | |||||
| (member (car bnd) (symbol-value to-remove)))) | |||||
| bindings) | |||||
| (when (and (boundp to-add) | |||||
| (listp (symbol-value to-add))) | |||||
| (symbol-value to-add)))) | |||||
| (defun spacemacs//transient-state-make-doc | |||||
| (transient-state docstring &optional body) | |||||
| "Use `hydra' internal function to format and apply DOCSTRING." | |||||
| (let ((heads (spacemacs//transient-state-heads-name transient-state))) | |||||
| (setq body (if body body '(nil nil :hint nil :foreign-keys nil))) | |||||
| (eval | |||||
| (hydra--format nil body docstring (symbol-value heads))))) | |||||
| (defmacro spacemacs|transient-state-format-hint (name var hint) | |||||
| "Format HINT and store the result in VAR for transient state NAME." | |||||
| (declare (indent 1)) | |||||
| `(add-hook 'spacemacs-post-user-config-hook | |||||
| (lambda () | |||||
| (let* ((props-var ,(spacemacs//transient-state-props-var-name | |||||
| name)) | |||||
| (prop-hint (cadr (assq 'hint props-var))) | |||||
| (prop-columns (cadr (assq 'columns props-var))) | |||||
| (prop-foreign-keys (cadr (assq 'foreign-keys props-var))) | |||||
| (prop-entry-sexp (cadr (assq 'entry-sexp props-var))) | |||||
| (prop-exit-sexp (cadr (assq 'exit-sexp props-var)))) | |||||
| (setq ,var (spacemacs//transient-state-make-doc | |||||
| ',name | |||||
| ,hint | |||||
| `(nil | |||||
| nil | |||||
| :hint ,prop-hint | |||||
| :columns ,prop-columns | |||||
| :foreign-keys ,prop-foreign-keys | |||||
| :body-pre ,prop-entry-sexp | |||||
| :before-exit ,prop-exit-sexp))) | |||||
| 'append)))) | |||||
| (defface spacemacs-transient-state-title-face | |||||
| `((t :inherit mode-line)) | |||||
| "Face for title of transient states.") | |||||
| (defmacro spacemacs|define-transient-state (name &rest props) | |||||
| "Define a transient state called NAME. | |||||
| NAME is a symbol. | |||||
| Available PROPS: | |||||
| `:on-enter SEXP' | |||||
| Evaluate SEXP when the transient state is switched on. | |||||
| `:on-exit SEXP' | |||||
| Evaluate SEXP when leaving the transient state. | |||||
| `:doc STRING or SEXP' | |||||
| A docstring supported by `defhydra'. | |||||
| `:additional-docs cons cells (VARIABLE . STRING)' | |||||
| Additional docstrings to format and store in the corresponding VARIABLE. | |||||
| This can be used to dynamically change the docstring. | |||||
| `:title STRING' | |||||
| Provide a title in the header of the transient state | |||||
| `:columns INTEGER' | |||||
| Automatically generate :doc with this many number of columns. | |||||
| `:hint BOOLEAN' | |||||
| Whether to display hints. Default is nil. | |||||
| `:hint-is-doc BOOLEAN' | |||||
| Whether the hints act as a documentation, the only effect of this value is | |||||
| to change where the hints are displayed. If non-nil the hints are displayed | |||||
| on the same line as the `:title', otherwise they are displayed below it. | |||||
| Default is nil. | |||||
| `:dynamic-hint SEXP' | |||||
| An sexp evaluating to a string for dynamic hinting. | |||||
| When provided `:hint' has no effect. Default is nil. | |||||
| `:foreign-keys SYMBOL' | |||||
| What to do when keys not bound in the transient state are entered. This | |||||
| can be nil (default), which means to exit the transient state, warn, | |||||
| which means to not exit but warn the user that the key is not part | |||||
| of the transient state, or run, which means to try to run the key binding | |||||
| without exiting. | |||||
| `:bindings EXPRESSIONS' | |||||
| One or several EXPRESSIONS with the form | |||||
| (STRING1 SYMBOL1 DOCSTRING | |||||
| :exit SYMBOL) | |||||
| where: | |||||
| - STRING1 is a key to be bound to the function or key map SYMBOL1. | |||||
| - DOCSTRING is a STRING or an SEXP that evaluates to a string | |||||
| - :exit SYMBOL or SEXP, if non nil then pressing this key will | |||||
| leave the transient state (default is nil). | |||||
| Important note: due to inner working of transient-maps in Emacs | |||||
| the `:exit' keyword is evaluate *before* the actual execution | |||||
| of the bound command. | |||||
| All properties supported by `spacemacs//create-key-binding-form' can be | |||||
| used." | |||||
| (declare (indent 1)) | |||||
| (let* ((func (spacemacs//transient-state-func-name name)) | |||||
| (props-var (spacemacs//transient-state-props-var-name name)) | |||||
| (body-func (spacemacs//transient-state-body-func-name name)) | |||||
| (add-bindings | |||||
| (intern (format "spacemacs-%s-transient-state-add-bindings" name))) | |||||
| (remove-bindings | |||||
| (intern (format "spacemacs-%s-transient-state-remove-bindings" name))) | |||||
| (bindings (spacemacs/mplist-get props :bindings)) | |||||
| (doc (or (plist-get props :doc) "\n")) | |||||
| (title (plist-get props :title)) | |||||
| (hint-var (intern (format "%s/hint" func))) | |||||
| (columns (plist-get props :columns)) | |||||
| (entry-sexp (plist-get props :on-enter)) | |||||
| (exit-sexp (plist-get props :on-exit)) | |||||
| (hint (plist-get props :hint)) | |||||
| (hint-doc-p (plist-get props :hint-is-doc)) | |||||
| (dyn-hint (plist-get props :dynamic-hint)) | |||||
| (additional-docs (spacemacs/mplist-get props :additional-docs)) | |||||
| (foreign-keys (plist-get props :foreign-keys)) | |||||
| (bindkeys (spacemacs//create-key-binding-form props body-func))) | |||||
| `(progn | |||||
| (defvar ,props-var nil | |||||
| ,(format (concat "Association list containing a copy of some " | |||||
| "properties of the transient state %S. Those " | |||||
| "properties are used in macro " | |||||
| "`spacemacs|transient-state-format-hint'.") name)) | |||||
| (add-to-list ',props-var '(hint ,hint)) | |||||
| (add-to-list ',props-var '(columns ,columns)) | |||||
| (add-to-list ',props-var '(foreign-keys ,foreign-keys)) | |||||
| (add-to-list ',props-var '(entry-sexp ,entry-sexp)) | |||||
| (add-to-list ',props-var '(exit-sexp ,exit-sexp)) | |||||
| (spacemacs/defer-until-after-user-config | |||||
| '(lambda () | |||||
| (eval | |||||
| (append | |||||
| '(defhydra ,func | |||||
| (nil nil | |||||
| :hint ,hint | |||||
| :columns ,columns | |||||
| :foreign-keys ,foreign-keys | |||||
| :body-pre ,entry-sexp | |||||
| :before-exit ,exit-sexp) | |||||
| ,doc) | |||||
| (spacemacs//transient-state-adjust-bindings | |||||
| ',bindings ',remove-bindings ',add-bindings))) | |||||
| (when ,title | |||||
| (let ((guide (concat "[" (propertize "KEY" 'face 'hydra-face-blue) | |||||
| "] exits state [" | |||||
| (if ',foreign-keys | |||||
| (propertize "KEY" 'face 'hydra-face-pink) | |||||
| (propertize "KEY" 'face 'hydra-face-red)) | |||||
| "] will not exit"))) | |||||
| ;; (add-face-text-property 0 (length guide) '(:height 0.9) t guide) | |||||
| (add-face-text-property 0 (length guide) 'italic t guide) | |||||
| (setq ,hint-var | |||||
| (list 'concat | |||||
| (when dotspacemacs-show-transient-state-title | |||||
| (concat | |||||
| (propertize | |||||
| ,title | |||||
| 'face 'spacemacs-transient-state-title-face) | |||||
| (if ,hint-doc-p " " "\n"))) ,hint-var | |||||
| ',dyn-hint | |||||
| (when dotspacemacs-show-transient-state-color-guide | |||||
| (concat "\n" guide)))))) | |||||
| ,@bindkeys))))) | |||||
| (provide 'core-transient-state) | |||||
| @ -0,0 +1,50 @@ | |||||
| ;;; core-use-package-ext.el --- Spacemacs Core File | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (defconst spacemacs--use-package-add-hook-keywords '(:pre-init | |||||
| :post-init | |||||
| :pre-config | |||||
| :post-config)) | |||||
| (defmacro spacemacs|use-package-add-hook (name &rest plist) | |||||
| "Add post hooks to `:init' or `:config' arguments of an existing | |||||
| configuration. | |||||
| In order to use this macro the variable `use-package-inject-hooks' | |||||
| must be non-nil. | |||||
| This is useful in the dotfile to override the default configuration | |||||
| of a package. | |||||
| Usage: | |||||
| (spacemacs|use-package-add-hook package-name | |||||
| [:keyword [option]]...) | |||||
| :pre-init Code to run before the default `:init' configuration. | |||||
| :post-init Code to run after the default `:init' configuration. | |||||
| :pre-config Code to run before the default `:config' configuration. | |||||
| :post-config Code to run after the default `:config' configuration. | |||||
| In practice the most useful hook is the `:post-config' where you can | |||||
| override lazy-loaded settings." | |||||
| (declare (indent 1)) | |||||
| (let ((name-symbol (if (stringp name) (intern name) name)) | |||||
| (expanded-forms '())) | |||||
| (dolist (keyword spacemacs--use-package-add-hook-keywords) | |||||
| (let ((body (spacemacs/mplist-get plist keyword))) | |||||
| (when body | |||||
| (let ((hook (intern (format "use-package--%S--%s-hook" | |||||
| name-symbol | |||||
| (substring (format "%s" keyword) 1))))) | |||||
| (push `(add-hook ',hook (lambda nil ,@body)) expanded-forms))))) | |||||
| `(progn ,@expanded-forms))) | |||||
| (provide 'core-use-package-ext) | |||||
| @ -0,0 +1,28 @@ | |||||
| Press [TAB] or [J] to move to next button. | |||||
| Press [Shift-TAB] or [K] to move to previous button. | |||||
| Press [r] to jump to recent file list if it is enabled. | |||||
| Press [p] to jump to project list if it is enabled. | |||||
| Press [b] to jump to bookmark list if it is enabled. | |||||
| Press [o] to jump to any link or button. | |||||
| Press [m] to jump to the top menu. | |||||
| Press [SPC] (in Vim editing style) or [Alt-m] (in Emacs editing style) to access | |||||
| Spacemacs commands (will list only the Vim style ones for the rest of this | |||||
| help). | |||||
| Press [SPC f e d] (or [Alt-m f e d] in Emacs style) to access .spacemacs file. | |||||
| Press [SPC h SPC] to access a list of documentation and supported layers. You | |||||
| can type anything to narrow to a specific feature i.e. "python" for Python | |||||
| layer. There are multiple lists and you can press [Ctrl-o] to switch between | |||||
| them. | |||||
| When reading a document, you can use [SPC s j] to jump to a heading. | |||||
| Please consult Spacemacs documentation from [SPC h SPC] for more details. | |||||
| @ -0,0 +1,10 @@ | |||||
| New layers: | |||||
| company-mode layer has been replaced by the new layer auto-completion. | |||||
| Org packages have been moved to the new layer org. | |||||
| Flycheck has been moved to the new layer syntax-checking. | |||||
| Be sure to update your dotfile to add these layers. | |||||
| Init functions: | |||||
| The init function <layer>/init-<package> is now mandatory. Any package | |||||
| without an explicit init function will be ignored and uninstalled by | |||||
| Spacemacs. | |||||
| @ -0,0 +1,34 @@ | |||||
| 1. Dotfile | |||||
| It is now possible to reload the dotfile and layers anywhere with `SPC f e | |||||
| R`. This key binding *replaces* the old `C-c C-c` and `SPC m c c` only | |||||
| available in the dotfile. | |||||
| *Important* You should replace your `(defvar <layer>-packages ...)`, | |||||
| `(defvar <layer>-pre-extensions ...)`, `(defvar <layer>-post-extensions ...)` | |||||
| and `(defvar <layer>-excluded-packages ...)` by `(setq ...)`. This will | |||||
| allow to install newly added packages to a layer without restarting spacemacs | |||||
| by pressing `SPC f e R`. Be sure to remove the docstring when replacing the | |||||
| `defvar` since `setq` does not take a third argument. | |||||
| `:variables` keyword now behaves like a regular `setq` so you'll have to | |||||
| quote any value appropriately. | |||||
| 2. Emacs lisp and Shell config are now in their own layers | |||||
| Be sure to add the new layers `emacs-lisp` and `shell` to your dotfile to | |||||
| continue to enjoy the emacs-lisp and shell configurations of Spacemacs. | |||||
| Also be sure to check the key binding `SPC '` to open a shell buffer. | |||||
| 3. Key bindings | |||||
| `SPC b s` to switch buffer is now on `SPC b b`. | |||||
| `SPC f f` uses helm instead of ido, set the new variable. | |||||
| `dotspacemacs-use-ido` to t to get back the old ido behavior. | |||||
| `TAB` and `C-z` in helm buffers have been *swapped*. | |||||
| 4. Sentence delimiter | |||||
| Sentence delimiter is now a *single space* as opposed to Emacs default | |||||
| which is double spaces. | |||||
| @ -0,0 +1,36 @@ | |||||
| 1. Magit 2.1 | |||||
| Spacemacs is now compatible only with Magit 2.1 and later, be | |||||
| sure to *update your packages* (at least Magit). | |||||
| 2. Helm | |||||
| Helm input pattern is now displayed in its header instead of the | |||||
| minibuffer. | |||||
| 3. Git layer | |||||
| The `git` layer has been split into two layers: `git` and `github` so | |||||
| the layer variable `git-enabled-github-support` is deprecated, you | |||||
| have to *add the layer `github` in your dotfile*. | |||||
| The `git-gutter` has been replaced by `diff-hl`. This package is in | |||||
| the new layer `version-control`, be sure to *add this new layer to | |||||
| your dotfile*. | |||||
| 4. Auctex layer | |||||
| The `auctex` layer has been renamed `latex`, be sure to *update your | |||||
| dotfile* if you use this layer. | |||||
| 5. Erlang/Elixir layer | |||||
| The erlang/elixir layer has been split into two layers `erlang` and | |||||
| `elixir`, be sure to *update your dotfile* if you use these layers. | |||||
| 6. Key bindings changes | |||||
| Projectile key bindings changes: | |||||
| ~SPC p e~ is now ~SPC p r~ (recent files), | |||||
| ~SPC p R~ is now ~SPC p G~ (regenerate tags), | |||||
| ~SPC p r~ is now ~SPC p R~ (replace). | |||||
| @ -0,0 +1,44 @@ | |||||
| 1. Org | |||||
| `org-plus-contrib` is now installed from org ELPA repository, you may | |||||
| encounter strange behaviours from Org. In this case delete the `org` | |||||
| directory in the `elpa` directory and restart Emacs. | |||||
| 2. Helm | |||||
| `Helm` key bindings have been slightly adjusted: | |||||
| - in `helm-find-files` (`SPC f f`): now `C-h` move up a directory | |||||
| and `C-l` enter the selected directory. `describe-key` command is | |||||
| available on `C-S-h` | |||||
| - in other `helm` buffers ~C-h~ is used to go to the next source | |||||
| and `C-l` is the same as `RET`. `describe-key` command is also | |||||
| available on `C-S-h`. | |||||
| 3. Vim keys | |||||
| `Y` has been remapped to `y$`, if you don't like this behavior you can | |||||
| set the variable `dotspacemacs-remap-Y-to-y$` to nil in your dotfile. | |||||
| 4. Guide-key | |||||
| `guide-key` has been replaced by `which-key`, you may encounter issues | |||||
| if you have some `guide-key` custom configuration, remove any `guide-key` | |||||
| configuration and check the options offered by `which-key`. | |||||
| 5. Bookmarks | |||||
| The `bookmark` save file has been moved to the `.cache` directory, if | |||||
| you have a bookmark file `~/.emacs.d/bookmarks` then you'll have to move | |||||
| it to file `~/.emacs.d/.cache/bookmarks` | |||||
| 6. Ruby on Rails | |||||
| Ruby on Rails framework has now its own layer called `ruby-on-rails`, | |||||
| be sure to add this layer to your dotfile if you use it. | |||||
| 7. Django | |||||
| Django framework has now its own layer called `django`, | |||||
| be sure to add this layer to your dotfile if you use it. | |||||
| @ -0,0 +1,32 @@ | |||||
| 1. Key binding changes | |||||
| - `SPC l` for `avy-goto-line` is now under `SPC y`. `SPC l` is now for | |||||
| spacemacs layouts. | |||||
| - `SPC a p` is now for `list-processes` and `SPC a P` for `proced`, | |||||
| `paradox` to list ELPA packages is now on `SPC a k`. | |||||
| - `SPC s l` is now used to bring back last search buffer and `SPC s j` | |||||
| is for jumping into a file using `imenu` (was `SPC s l`). | |||||
| - In home buffer, jumping to bookmark list is now on ~b~. | |||||
| 2. Magit | |||||
| Magit key bindings have been revamped thanks to the official `evil-magit` | |||||
| package. `evil-magit` provides a faithful port of Magit UX using Vim key | |||||
| bindings. If you want to continue to use the old evilified bindings add | |||||
| `evil-magit` package to the `dotspacemacs-excluded-packages` variable | |||||
| of your dotfile. | |||||
| 3. Projectile | |||||
| Caching is now disabled by default, while it should not break anything, | |||||
| if you have some functions relying on caching being enabled be sure to | |||||
| activate it explicitly with `(setq projectile-enable-caching t)`. | |||||
| 4. Ruby | |||||
| The default major mode is now the Emacs built-in `ruby-mode`. If you want | |||||
| to continue to use `enh-ruby-mode` set the layer variable | |||||
| `ruby-enable-enh-ruby-mode` to `t`. | |||||
| @ -0,0 +1,16 @@ | |||||
| The Autumnal Cleanup 2016 is complete! Thank you to everyone | |||||
| who helped keep the issue tracker clean. In particular | |||||
| 1. gilbertw1 (230 issues, 27.09%) | |||||
| 2. NJBS (98 issues, 11.54%) | |||||
| 3. mahinshaw (90 issues, 10.60%) | |||||
| 4. smile13241324 (75 issues, 8.83%) | |||||
| 5. deb0ch (66 issues, 7.77%) | |||||
| as well as bleggett, jredville, lazywithclass, rgrinberg, | |||||
| kdelwat, cmr, bmag, ksjogo, ekmecic, cro, inirudebwoy, | |||||
| mwillsey, robbyoconnor and alimoeeny. And of course, last but | |||||
| not least, the hard working organizer d12frosted! | |||||
| For more info on release 0.200.x see the newsletter #01 at | |||||
| [[http://spacemacs.org/news/news01.html]] | |||||
| @ -0,0 +1,38 @@ | |||||
| The new version of Spacemacs has arrived! | |||||
| This version brings Emacs to a whole new level by embedding Zerovim technologies | |||||
| through a state of the art message passing interface, this is Emacs for the next | |||||
| next NEXT century. | |||||
| This is so powerful that we decided to rename Spacemacs! | |||||
| Zemacs: Emacs to THE MAX! | |||||
| - Zerovim ambitious refactor of the (-1)Vim code base directly improves the code | |||||
| quality of Emacs while still retaining its important [implementation tricks]. | |||||
| - Elisp can now be transpiled to Vimscript which can be transpiled to Lua which | |||||
| can be used to code plugins for Zerovim, so now Emacs can have true native Vim | |||||
| plugins in Lua code coded in Elisp. | |||||
| Note: For performance reasons native plugins are transpiled to Elisp before | |||||
| being executed. | |||||
| - You can now type in [Atom] in Emacs by sharing a Zerovim session. Zemacs is | |||||
| shipped with a groundbreaking new UI using the new VR headsets capabilities: | |||||
| by projecting the Atom web-based interface on the left eye and the Emacs | |||||
| text-based interface on the right eye (also available the `swap-the-eyes' major | |||||
| mode tailored for colour-blind people) we can create the perfect blend of Emacs | |||||
| and Atom, instantaneous context switching with the blink of an eye. Welcome | |||||
| to the definitive GUI: | |||||
| Zemacstom, the editor for the next next NEXT millennium. | |||||
| ------------------------------------------- | |||||
| This text is a parody of Neovim whose only purpose is to be funny (the text, not | |||||
| Neovim!). Neovim is a popular fork of Vim, you can try it and contribute to it | |||||
| by visiting this [link] or maybe [this one]. | |||||
| This prank will self-destruct the 2nd April 2016. | |||||
| Type ~SPC m aprilfool~ to start working :-) | |||||
| @ -0,0 +1,280 @@ | |||||
| ;;; ht.el --- The missing hash table library for Emacs | |||||
| ;; Copyright (C) 2013 Wilfred Hughes | |||||
| ;; Author: Wilfred Hughes <me@wilfred.me.uk> | |||||
| ;; Version: 2.0 | |||||
| ;; Keywords: hash table, hash map, hash | |||||
| ;; 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 <http://www.gnu.org/licenses/>. | |||||
| ;;; Commentary: | |||||
| ;; The missing hash table utility library for Emacs. | |||||
| ;; | |||||
| ;; See documentation on https://github.com/Wilfred/ht.el | |||||
| ;;; Code: | |||||
| (eval-when-compile (require 'cl)) ;; dolist | |||||
| (defmacro ht (&rest pairs) | |||||
| "Create a hash table with the key-value pairs given. | |||||
| Keys are compared with `equal'. | |||||
| \(fn (KEY-1 VALUE-1) (KEY-2 VALUE-2) ...)" | |||||
| (let* ((table-symbol (make-symbol "ht-temp")) | |||||
| (assignments | |||||
| (mapcar | |||||
| (lambda (pair) `(ht-set! ,table-symbol ,@pair)) | |||||
| pairs))) | |||||
| `(let ((,table-symbol (ht-create))) | |||||
| ,@assignments | |||||
| ,table-symbol))) | |||||
| (defun ht-create (&optional test) | |||||
| "Create an empty hash table. | |||||
| TEST indicates the function used to compare the hash | |||||
| keys. Default is `equal'. It can be `eq', `eql', `equal' or a | |||||
| user-supplied test created via `define-hash-table-test'." | |||||
| (make-hash-table :test (or test 'equal))) | |||||
| (defun ht<-alist (alist) | |||||
| "Create a hash table with initial values according to ALIST." | |||||
| (let ((h (ht-create))) | |||||
| ;; the first key-value pair in an alist gets precedence, so we | |||||
| ;; start from the end of the list: | |||||
| (dolist (pair (reverse alist) h) | |||||
| (let ((key (car pair)) | |||||
| (value (cdr pair))) | |||||
| (ht-set! h key value))))) | |||||
| (defalias 'ht-from-alist 'ht<-alist) | |||||
| ;; based on the excellent -partition from dash.el, but we aim to be self-contained | |||||
| (defun ht/group-pairs (list) | |||||
| "Return a new list with the items in LIST grouped into pairs. | |||||
| Errors if LIST doesn't contain an even number of elements." | |||||
| (let ((result) | |||||
| (sublist) | |||||
| (len 0)) | |||||
| (while list | |||||
| ;; take the head of LIST and push onto SUBLIST | |||||
| (setq sublist (cons (car list) sublist)) | |||||
| (setq list (cdr list)) | |||||
| (setq len (1+ len)) | |||||
| (when (= len 2) | |||||
| ;; push this two-item list onto RESULT | |||||
| (setq result (cons (nreverse sublist) result)) | |||||
| (setq sublist nil) | |||||
| (setq len 0))) | |||||
| (when sublist (error "Expected an even number of elements")) | |||||
| (nreverse result))) | |||||
| (defun ht<-plist (plist) | |||||
| "Create a hash table with initial values according to PLIST." | |||||
| (let ((h (ht-create))) | |||||
| (dolist (pair (ht/group-pairs plist) h) | |||||
| (let ((key (car pair)) | |||||
| (value (cadr pair))) | |||||
| (ht-set! h key value))))) | |||||
| (defalias 'ht-from-plist 'ht<-plist) | |||||
| (defun ht-get (table key &optional default) | |||||
| "Look up KEY in TABLE, and return the matching value. | |||||
| If KEY isn't present, return DEFAULT (nil if not specified)." | |||||
| (gethash key table default)) | |||||
| (defun ht-set! (table key value) | |||||
| "Associate KEY in TABLE with VALUE." | |||||
| (puthash key value table) | |||||
| nil) | |||||
| (defalias 'ht-set 'ht-set!) | |||||
| (defun ht-update! (table from-table) | |||||
| "Update TABLE according to every key-value pair in FROM-TABLE." | |||||
| (maphash | |||||
| (lambda (key value) (puthash key value table)) | |||||
| from-table) | |||||
| nil) | |||||
| (defalias 'ht-update 'ht-update!) | |||||
| (defun ht-merge (&rest tables) | |||||
| "Crete a new tables that includes all the key-value pairs from TABLES. | |||||
| If multiple have tables have the same key, the value in the last | |||||
| table is used." | |||||
| (let ((merged (ht-create))) | |||||
| (mapc (lambda (table) (ht-update! merged table)) tables) | |||||
| merged)) | |||||
| (defun ht-remove! (table key) | |||||
| "Remove KEY from TABLE." | |||||
| (remhash key table)) | |||||
| (defalias 'ht-remove 'ht-remove!) | |||||
| (defun ht-clear! (table) | |||||
| "Remove all keys from TABLE." | |||||
| (clrhash table) | |||||
| nil) | |||||
| (defalias 'ht-clear 'ht-clear!) | |||||
| (defun ht-map (function table) | |||||
| "Apply FUNCTION to each key-value pair of TABLE, and make a list of the results. | |||||
| FUNCTION is called with two arguments, KEY and VALUE." | |||||
| (let (results) | |||||
| (maphash | |||||
| (lambda (key value) | |||||
| (push (funcall function key value) results)) | |||||
| table) | |||||
| results)) | |||||
| (defmacro ht-amap (form table) | |||||
| "Anaphoric version of `ht-map'. | |||||
| For every key-value pair in TABLE, evaluate FORM with the | |||||
| variables KEY and VALUE bound." | |||||
| `(ht-map (lambda (key value) ,form) ,table)) | |||||
| (defun ht-keys (table) | |||||
| "Return a list of all the keys in TABLE." | |||||
| (ht-amap key table)) | |||||
| (defun ht-values (table) | |||||
| "Return a list of all the values in TABLE." | |||||
| (ht-amap value table)) | |||||
| (defun ht-items (table) | |||||
| "Return a list of two-element lists '(key value) from TABLE." | |||||
| (ht-amap (list key value) table)) | |||||
| (defalias 'ht-each 'maphash | |||||
| "Apply FUNCTION to each key-value pair of TABLE. | |||||
| Returns nil, used for side-effects only.") | |||||
| (defmacro ht-aeach (form table) | |||||
| "Anaphoric version of `ht-each'. | |||||
| For every key-value pair in TABLE, evaluate FORM with the | |||||
| variables key and value bound." | |||||
| `(ht-each (lambda (key value) ,form) ,table)) | |||||
| (defun ht->plist (table) | |||||
| "Return a flat list '(key1 value1 key2 value2...) from TABLE. | |||||
| Note that hash tables are unordered, so this cannot be an exact | |||||
| inverse of `ht<-plist'. The following is not guaranteed: | |||||
| \(let ((data '(a b c d))) | |||||
| (equalp data | |||||
| (ht->plist (ht<-plist data))))" | |||||
| (apply 'append (ht-items table))) | |||||
| (defalias 'ht-to-plist 'ht->plist) | |||||
| (defun ht-copy (table) | |||||
| "Return a shallow copy of TABLE (keys and values are shared)." | |||||
| (copy-hash-table table)) | |||||
| (defun ht->alist (table) | |||||
| "Return a list of two-element lists '(key . value) from TABLE. | |||||
| Note that hash tables are unordered, so this cannot be an exact | |||||
| inverse of `ht<-alist'. The following is not guaranteed: | |||||
| \(let ((data '((a . b) (c . d)))) | |||||
| (equalp data | |||||
| (ht->alist (ht<-alist data))))" | |||||
| (ht-amap (cons key value) table)) | |||||
| (defalias 'ht-to-alist 'ht->alist) | |||||
| (defalias 'ht? 'hash-table-p) | |||||
| (defalias 'ht-p 'hash-table-p) | |||||
| (defun ht-contains? (table key) | |||||
| "Return 't if TABLE contains KEY." | |||||
| (not (eq (ht-get table key 'ht--not-found) 'ht--not-found))) | |||||
| (defalias 'ht-contains-p 'ht-contains?) | |||||
| (defun ht-size (table) | |||||
| "Return the actual number of entries in TABLE." | |||||
| (hash-table-count table)) | |||||
| (defun ht-empty? (table) | |||||
| "Return true if the actual number of entries in TABLE is zero." | |||||
| (zerop (ht-size table))) | |||||
| (defun ht-select (function table) | |||||
| "Return a hash table containing all entries in TABLE for which | |||||
| FUNCTION returns a truthy value. | |||||
| FUNCTION is called with two arguments, KEY and VALUE." | |||||
| (let ((results (ht-create))) | |||||
| (ht-each | |||||
| (lambda (key value) | |||||
| (when (funcall function key value) | |||||
| (ht-set! results key value))) | |||||
| table) | |||||
| results)) | |||||
| (defun ht-reject (function table) | |||||
| "Return a hash table containing all entries in TABLE for which | |||||
| FUNCTION returns a falsy value. | |||||
| FUNCTION is called with two arguments, KEY and VALUE." | |||||
| (let ((results (ht-create))) | |||||
| (ht-each | |||||
| (lambda (key value) | |||||
| (unless (funcall function key value) | |||||
| (ht-set! results key value))) | |||||
| table) | |||||
| results)) | |||||
| (defun ht-reject! (function table) | |||||
| "Delete entries from TABLE for which FUNCTION returns a falsy value. | |||||
| FUNCTION is called with two arguments, KEY and VALUE." | |||||
| (ht-each | |||||
| (lambda (key value) | |||||
| (when (funcall function key value) | |||||
| (remhash key table))) | |||||
| table) | |||||
| nil) | |||||
| (defalias 'ht-delete-if 'ht-reject!) | |||||
| (defun ht-find (function table) | |||||
| "Return (key, value) from TABLE for which FUNCTION returns a truthy value. | |||||
| Return nil otherwise. | |||||
| FUNCTION is called with two arguments, KEY and VALUE." | |||||
| (catch 'break | |||||
| (ht-each | |||||
| (lambda (key value) | |||||
| (when (funcall function key value) | |||||
| (throw 'break (list key value)))) | |||||
| table))) | |||||
| (provide 'ht) | |||||
| ;;; ht.el ends here | |||||
| @ -0,0 +1,368 @@ | |||||
| ;;; mocker.el --- mocking framework for emacs | |||||
| ;; Copyright (C) 2011 Yann Hodique. | |||||
| ;; Author: Yann Hodique <yann.hodique@gmail.com> | |||||
| ;; Keywords: lisp, testing | |||||
| ;; Version: 0.3.0 | |||||
| ;; Package-Requires: ((eieio "1.3") (el-x "0.2.4")) | |||||
| ;; This file 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 2, or (at your option) | |||||
| ;; any later version. | |||||
| ;; This file 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 GNU Emacs; see the file COPYING. If not, write to | |||||
| ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |||||
| ;; Boston, MA 02111-1307, USA. | |||||
| ;;; Commentary: | |||||
| ;; | |||||
| ;;; Code: | |||||
| (eval-when-compile | |||||
| (require 'cl)) | |||||
| (require 'eieio) | |||||
| (eval-and-compile | |||||
| ;; use dflet from el-x if available | |||||
| (if (require 'dflet nil t) | |||||
| (defalias 'mocker-flet 'dflet) | |||||
| ;; fallback to regular flet, hoping it's still there | |||||
| (defalias 'mocker-flet 'flet))) | |||||
| (defvar mocker-mock-default-record-cls 'mocker-record) | |||||
| (put 'mocker-mock-error 'error-conditions '(mocker-mock-error error)) | |||||
| (put 'mocker-mock-error 'error-message "Mocker mock error") | |||||
| (put 'mocker-record-error 'error-conditions '(mocker-record-error error)) | |||||
| (put 'mocker-record-error 'error-message "Mocker record error") | |||||
| (defun mocker--plist-remove (plist key) | |||||
| ;; courtesy of pjb | |||||
| (if (eq (car plist) key) (cdr (cdr plist)) | |||||
| (cons (car plist) | |||||
| (cons (cadr plist) | |||||
| (mocker--plist-remove (cddr plist) key))))) | |||||
| ;;; Mock object | |||||
| (defclass mocker-mock () | |||||
| ((function :initarg :function :type symbol) | |||||
| (orig-def :initarg :orig-def :initform nil) | |||||
| (argspec :initarg :argspec :initform nil :type list) | |||||
| (ordered :initarg :ordered :initform t) | |||||
| (records :initarg :records :initform nil :type list))) | |||||
| (defmethod constructor :static ((mock mocker-mock) newname &rest args) | |||||
| (let* ((obj (call-next-method)) | |||||
| (recs (oref obj :records)) | |||||
| (func (oref obj :function))) | |||||
| (oset obj :orig-def (when (fboundp func) (symbol-function func))) | |||||
| (oset obj :records nil) | |||||
| (mapc #'(lambda (r) | |||||
| (apply 'mocker-add-record obj r)) | |||||
| recs) | |||||
| obj)) | |||||
| (defmethod mocker-add-record ((mock mocker-mock) &rest args) | |||||
| (object-add-to-list mock :records | |||||
| (let ((cls mocker-mock-default-record-cls) | |||||
| (tmp (plist-get args :record-cls))) | |||||
| (when tmp | |||||
| (setq cls tmp | |||||
| args (mocker-read-record cls | |||||
| (mocker--plist-remove | |||||
| args :record-cls)))) | |||||
| (apply 'make-instance cls :-mock mock | |||||
| :-sym (make-symbol "unique") args)) | |||||
| t)) | |||||
| (defmethod mocker-fail-mock ((mock mocker-mock) args) | |||||
| (signal 'mocker-mock-error | |||||
| (list (format (concat "Unexpected call to mock `%s'" | |||||
| " with input `%s'") | |||||
| (oref mock :function) args)))) | |||||
| (defvar mocker-inhibit nil) | |||||
| (defmethod mocker-run ((mock mocker-mock) &rest args) | |||||
| (if (not mocker-inhibit) | |||||
| (let* ((mocker-inhibit t) | |||||
| (rec (mocker-find-active-record mock args)) | |||||
| (ordered (oref mock :ordered))) | |||||
| (cond ((null rec) | |||||
| (mocker-fail-mock mock args)) | |||||
| ((or (not ordered) (mocker-test-record rec args)) | |||||
| (mocker-run-record rec args)) | |||||
| (t | |||||
| (mocker-fail-record rec args)))) | |||||
| (apply (oref mock :orig-def) args))) | |||||
| (defmethod mocker-find-active-record ((mock mocker-mock) args) | |||||
| (let ((first-match (lambda (pred seq) | |||||
| (let ((x nil)) | |||||
| (while (and seq | |||||
| (not (setq x (funcall pred (pop seq)))))) | |||||
| x)))) | |||||
| (let* ((ordered (oref mock :ordered)) | |||||
| rec) | |||||
| (if ordered | |||||
| (setq rec (funcall | |||||
| first-match | |||||
| #'(lambda (r) | |||||
| (when (oref r :-active) | |||||
| (if (mocker-test-record r args) | |||||
| (progn | |||||
| (mocker-use-record r) | |||||
| r) | |||||
| (mocker-skip-record r args)))) | |||||
| (oref mock :records))) | |||||
| (setq rec (funcall | |||||
| first-match | |||||
| #'(lambda (r) | |||||
| (and | |||||
| (oref r :-active) | |||||
| (mocker-test-record r args) | |||||
| (progn | |||||
| (mocker-use-record r) | |||||
| r))) | |||||
| (oref mock :records)))) | |||||
| rec))) | |||||
| (defmethod mocker-verify ((mock mocker-mock)) | |||||
| (mapc #'(lambda (r) (when (and (oref r :-active) | |||||
| (< (oref r :-occurrences) | |||||
| (oref r :min-occur))) | |||||
| (signal 'mocker-record-error | |||||
| (list (format | |||||
| (concat "Expected call to mock `%s'," | |||||
| " with input like %s," | |||||
| " was not run.") | |||||
| (oref mock :function) | |||||
| (mocker-get-record-expectations r)))))) | |||||
| (oref mock :records))) | |||||
| ;;; Mock record base object | |||||
| (defclass mocker-record-base () | |||||
| ((min-occur :initarg :min-occur :initform 1 :type number) | |||||
| (max-occur :initarg :max-occur :initform nil :type (or null number)) | |||||
| (-occur :initarg :occur :initform nil :type (or null number)) | |||||
| (-occurrences :initarg :-occurrences :initform 0 :type number | |||||
| :protection :protected) | |||||
| (-mock :initarg :-mock) | |||||
| (-active :initarg :-active :initform t :protection :protected) | |||||
| (-sym :initarg :-sym))) | |||||
| (defmethod constructor :static ((rec mocker-record-base) newname &rest args) | |||||
| (let* ((obj (call-next-method)) | |||||
| (occur (oref obj :occur))) | |||||
| (when occur | |||||
| (oset obj :min-occur (max (oref obj :min-occur) | |||||
| occur)) | |||||
| (oset obj :max-occur (if (oref obj :max-occur) | |||||
| (min (oref obj :max-occur) occur) | |||||
| occur))) | |||||
| obj)) | |||||
| (defmethod mocker-read-record :static ((rec mocker-record-base) spec) | |||||
| spec) | |||||
| (defmethod mocker-use-record ((rec mocker-record-base)) | |||||
| (let ((max (oref rec :max-occur)) | |||||
| (n (1+ (oref rec :-occurrences)))) | |||||
| (oset rec :-occurrences n) | |||||
| (when (and (not (null max)) | |||||
| (= n max)) | |||||
| (oset rec :-active nil)))) | |||||
| (defmethod mocker-skip-record ((rec mocker-record-base) args) | |||||
| (if (>= (oref rec :-occurrences) | |||||
| (oref rec :min-occur)) | |||||
| (oset rec :-active nil) | |||||
| (mocker-fail-record rec args))) | |||||
| (defmethod mocker-test-record ((rec mocker-record-base) args) | |||||
| (error "not implemented in base class")) | |||||
| (defmethod mocker-run-record ((rec mocker-record-base) args) | |||||
| (error "not implemented in base class")) | |||||
| (defmethod mocker-get-record-expectations ((rec mocker-record-base))) | |||||
| (defmethod mocker-fail-record ((rec mocker-record-base) args) | |||||
| (signal 'mocker-record-error | |||||
| (list (format (concat "Violated record while mocking `%s'." | |||||
| " Expected input like: %s, got: `%s' instead") | |||||
| (oref (oref rec :-mock) :function) | |||||
| (mocker-get-record-expectations rec) | |||||
| args)))) | |||||
| ;;; Mock input recognizer | |||||
| (defclass mocker-input-record (mocker-record-base) | |||||
| ((input :initarg :input :initform nil :type list) | |||||
| (input-matcher :initarg :input-matcher :initform nil))) | |||||
| (defmethod constructor :static ((rec mocker-input-record) newname &rest args) | |||||
| (let* ((obj (call-next-method))) | |||||
| (when (or (not (slot-boundp obj :max-occur)) | |||||
| (and (oref obj :max-occur) | |||||
| (< (oref obj :max-occur) | |||||
| (oref obj :min-occur)))) | |||||
| (oset obj :max-occur (oref obj :min-occur))) | |||||
| obj)) | |||||
| (defmethod mocker-test-record ((rec mocker-input-record) args) | |||||
| (let ((matcher (oref rec :input-matcher)) | |||||
| (input (oref rec :input))) | |||||
| (cond (matcher | |||||
| (apply matcher args)) | |||||
| (t | |||||
| (equal input args))))) | |||||
| (defmethod mocker-get-record-expectations ((rec mocker-input-record)) | |||||
| (format "`%s'" (or (oref rec :input-matcher) (oref rec :input)))) | |||||
| ;;; Mock record default object | |||||
| (defclass mocker-record (mocker-input-record) | |||||
| ((output :initarg :output :initform nil) | |||||
| (output-generator :initarg :output-generator :initform nil))) | |||||
| (defmethod mocker-run-record ((rec mocker-record) args) | |||||
| (let ((generator (oref rec :output-generator)) | |||||
| (output (oref rec :output))) | |||||
| (cond (generator | |||||
| (apply generator args)) | |||||
| (t | |||||
| output)))) | |||||
| ;;; Mock simple stub object | |||||
| (defclass mocker-stub-record (mocker-record-base) | |||||
| ((output :initarg :output :initform nil))) | |||||
| (defmethod constructor :static ((rec mocker-stub-record) newname &rest args) | |||||
| (let* ((obj (call-next-method))) | |||||
| (unless (slot-boundp obj :min-occur) | |||||
| (oset obj :min-occur 0)) | |||||
| (unless (slot-boundp obj :max-occur) | |||||
| (oset obj :max-occur nil)) | |||||
| obj)) | |||||
| (defmethod mocker-test-record ((rec mocker-stub-record) args) | |||||
| t) | |||||
| (defmethod mocker-run-record ((rec mocker-stub-record) args) | |||||
| (oref rec :output)) | |||||
| (defmethod mocker-get-record-expectations ((rec mocker-stub-record)) | |||||
| "anything") | |||||
| ;;; Mock passthrough record | |||||
| (defclass mocker-passthrough-record (mocker-input-record) | |||||
| ()) | |||||
| (defmethod mocker-run-record ((rec mocker-passthrough-record) args) | |||||
| (let* ((mock (oref rec :-mock)) | |||||
| (def (oref mock :orig-def))) | |||||
| (when def | |||||
| (apply def args)))) | |||||
| ;;; Helpers | |||||
| (defun mocker-gen-mocks (mockspecs) | |||||
| "helper to generate mocks from the input of `mocker-let'" | |||||
| (mapcar #'(lambda (m) | |||||
| (let* ((func (car m)) | |||||
| (argspec (cadr m)) | |||||
| (rest (cddr m)) | |||||
| (sym (make-symbol (concat (symbol-name func) "--mock")))) | |||||
| (list sym | |||||
| (apply 'make-instance 'mocker-mock | |||||
| :function func | |||||
| :argspec argspec | |||||
| (let* ((order (if (plist-member rest :ordered) | |||||
| (prog1 | |||||
| (plist-get rest :ordered) | |||||
| (setq rest | |||||
| (mocker--plist-remove | |||||
| rest :ordered))) | |||||
| (oref-default 'mocker-mock | |||||
| :ordered)))) | |||||
| (list :ordered order))) | |||||
| (if (plist-member rest :records) | |||||
| (plist-get rest :records) | |||||
| (car rest))))) | |||||
| mockspecs)) | |||||
| ;;;###autoload | |||||
| (defmacro mocker-let (mockspecs &rest body) | |||||
| "Generate temporary bindings according to MOCKSPECS then eval | |||||
| BODY. The value of the last form in BODY is returned. | |||||
| Each element of MOCKSPECS is a list (FUNC ARGS [OPTIONS] | |||||
| RECORDS). | |||||
| FUNC is the name of the function to bind, whose original | |||||
| definition must accept arguments compatible with ARGS. | |||||
| OPTIONS can be :ordered nil if the records can be executed out of | |||||
| order (by default, order is enforced). | |||||
| RECORDS is a list ([:record-cls CLASS] ARG1 ARG2...). | |||||
| Each element of RECORDS will generate a record for the | |||||
| corresponding mock. By default, records are objects of the | |||||
| `mocker-record' class, but CLASS is used instead if specified. | |||||
| The rest of the arguments are used to construct the record | |||||
| object. They will be passed to method `mocker-read-record' for | |||||
| the used CLASS. This method must return a valid list of | |||||
| parameters for the CLASS constructor. This allows to implement | |||||
| specialized mini-languages for specific record classes. | |||||
| " | |||||
| (declare (indent 1) (debug t)) | |||||
| (let* ((mocks (mocker-gen-mocks mockspecs)) | |||||
| (vars (mapcar #'(lambda (m) | |||||
| `(,(car m) ,(cadr m))) | |||||
| mocks)) | |||||
| (specs (mapcar | |||||
| #'(lambda (m) | |||||
| (let* ((mock-sym (car m)) | |||||
| (mock (cadr m)) | |||||
| (func (oref mock :function)) | |||||
| (spec (oref mock :argspec)) | |||||
| (call (or (and (member '&rest spec) 'apply) | |||||
| 'funcall)) | |||||
| (args (loop for el in spec | |||||
| if (or (not (symbolp el)) | |||||
| (not (equal | |||||
| (elt (symbol-name el) 0) | |||||
| ?&))) | |||||
| collect el))) | |||||
| (list func | |||||
| spec | |||||
| `(,call #'mocker-run ,mock-sym ,@args)))) | |||||
| mocks)) | |||||
| (inits (mapcar #'(lambda (m) | |||||
| (cons 'progn | |||||
| (mapcar #'(lambda (rec) | |||||
| `(mocker-add-record ,(car m) | |||||
| ,@rec)) | |||||
| (nth 2 m)))) | |||||
| mocks)) | |||||
| (verifs (mapcar #'(lambda (m) | |||||
| `(mocker-verify ,(car m))) | |||||
| mocks))) | |||||
| `(let (,@vars) | |||||
| ,@inits | |||||
| (prog1 | |||||
| ,(macroexpand `(mocker-flet (,@specs) | |||||
| ,@body)) | |||||
| ,@verifs)))) | |||||
| (provide 'mocker) | |||||
| ;;; mocker.el ends here | |||||
| @ -0,0 +1,165 @@ | |||||
| ;;; page-break-lines.el --- Display ugly ^L page breaks as tidy horizontal lines | |||||
| ;; Copyright (C) 2012-2015 Steve Purcell | |||||
| ;; Author: Steve Purcell <steve@sanityinc.com> | |||||
| ;; URL: https://github.com/purcell/page-break-lines | |||||
| ;; Package-Version: 20160109.1813 | |||||
| ;; Package-X-Original-Version: DEV | |||||
| ;; Keywords: convenience, faces | |||||
| ;; 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 <http://www.gnu.org/licenses/>. | |||||
| ;;; Commentary: | |||||
| ;; This library provides a global mode which displays form feed | |||||
| ;; characters as horizontal rules. | |||||
| ;; Install from Melpa or Marmalade, or add to `load-path' and use | |||||
| ;; (require 'page-break-lines). | |||||
| ;; Use `page-break-lines-mode' to enable the mode in specific buffers, | |||||
| ;; or customize `page-break-lines-modes' and enable the mode globally with | |||||
| ;; `global-page-break-lines-mode'. | |||||
| ;; Issues and limitations: | |||||
| ;; If `page-break-lines-char' is displayed at a different width to | |||||
| ;; regular characters, the rule may be either too short or too long: | |||||
| ;; rules may then wrap if `truncate-lines' is nil. On some systems, | |||||
| ;; Emacs may erroneously choose a different font for the page break | |||||
| ;; symbol, which choice can be overridden using code such as: | |||||
| ;; (set-fontset-font "fontset-default" | |||||
| ;; (cons page-break-lines-char page-break-lines-char) | |||||
| ;; (face-attribute 'default :family)) | |||||
| ;; Use `describe-char' on a page break char to determine whether this | |||||
| ;; is the case. | |||||
| ;; Additionally, the use of `text-scale-increase' or | |||||
| ;; `text-scale-decrease' will cause the rule width to be incorrect, | |||||
| ;; because the reported window width (in characters) will continue to | |||||
| ;; be the width in the frame's default font, not the scaled font used to | |||||
| ;; display the rule. | |||||
| ;; Adapted from code http://www.emacswiki.org/emacs/PageBreaks | |||||
| ;;; Code: | |||||
| (defgroup page-break-lines nil | |||||
| "Display ugly ^L page breaks as tidy horizontal lines." | |||||
| :prefix "page-break-lines-" | |||||
| :group 'faces) | |||||
| (defcustom page-break-lines-char ?─ | |||||
| "Character used to render page break lines." | |||||
| :type 'character | |||||
| :group 'page-break-lines) | |||||
| (defcustom page-break-lines-lighter " PgLn" | |||||
| "Mode-line indicator for `page-break-lines-mode'." | |||||
| :type '(choice (const :tag "No lighter" "") string) | |||||
| :group 'page-break-lines) | |||||
| (defcustom page-break-lines-modes | |||||
| '(emacs-lisp-mode lisp-mode scheme-mode compilation-mode outline-mode help-mode) | |||||
| "Modes in which to enable `page-break-lines-mode'." | |||||
| :type '(repeat symbol) | |||||
| :group 'page-break-lines) | |||||
| (defface page-break-lines | |||||
| '((t :inherit font-lock-comment-face :bold nil :italic nil)) | |||||
| "Face used to colorize page break lines. | |||||
| If using :bold or :italic, please ensure `page-break-lines-char' | |||||
| is available in that variant of your font, otherwise it may be | |||||
| displayed as a junk character." | |||||
| :group 'page-break-lines) | |||||
| ;;;###autoload | |||||
| (define-minor-mode page-break-lines-mode | |||||
| "Toggle Page Break Lines mode. | |||||
| In Page Break mode, page breaks (^L characters) are displayed as a | |||||
| horizontal line of `page-break-string-char' characters." | |||||
| :lighter page-break-lines-lighter | |||||
| :group 'page-break-lines | |||||
| (page-break-lines--update-display-tables)) | |||||
| ;;;###autoload | |||||
| (defun turn-on-page-break-lines-mode () | |||||
| "Enable `page-break-lines-mode' in this buffer." | |||||
| (page-break-lines-mode 1)) | |||||
| ;;;###autoload | |||||
| (defun turn-off-page-break-lines-mode () | |||||
| "Disable `page-break-lines-mode' in this buffer." | |||||
| (page-break-lines-mode -1)) | |||||
| (dolist (hook '(window-configuration-change-hook | |||||
| after-setting-font-hook)) | |||||
| (add-hook hook 'page-break-lines--update-display-tables)) | |||||
| (defun page-break-lines--update-display-table (window) | |||||
| "Modify a display-table that displays page-breaks prettily. | |||||
| If the buffer inside WINDOW has `page-break-lines-mode' enabled, | |||||
| its display table will be modified as necessary." | |||||
| (with-current-buffer (window-buffer window) | |||||
| (if page-break-lines-mode | |||||
| (progn | |||||
| (unless buffer-display-table | |||||
| (setq buffer-display-table (make-display-table))) | |||||
| (let* ((width (- (window-width window) 1)) | |||||
| (glyph (make-glyph-code page-break-lines-char 'page-break-lines)) | |||||
| (new-display-entry (vconcat (make-list width glyph)))) | |||||
| (unless (equal new-display-entry (elt buffer-display-table ?\^L)) | |||||
| (aset buffer-display-table ?\^L new-display-entry)))) | |||||
| (when buffer-display-table | |||||
| (aset buffer-display-table ?\^L nil))))) | |||||
| (defun page-break-lines--update-display-tables () | |||||
| "Function called for updating display table." | |||||
| (mapc 'page-break-lines--update-display-table (window-list nil 'no-minibuffer))) | |||||
| ;;;###autoload | |||||
| (defun page-break-lines-mode-maybe () | |||||
| "Enable `page-break-lines-mode' in the current buffer if desired. | |||||
| When `major-mode' is listed in `page-break-lines-modes', then | |||||
| `page-break-lines-mode' will be enabled." | |||||
| (if (and (not (minibufferp)) | |||||
| (apply 'derived-mode-p page-break-lines-modes)) | |||||
| (page-break-lines-mode 1))) | |||||
| ;;;###autoload | |||||
| (define-global-minor-mode global-page-break-lines-mode | |||||
| page-break-lines-mode page-break-lines-mode-maybe | |||||
| :group 'page-break-lines) | |||||
| (provide 'page-break-lines) | |||||
| ;; Local Variables: | |||||
| ;; coding: utf-8 | |||||
| ;; byte-compile-warnings: (not cl-functions) | |||||
| ;; checkdoc-minor-mode: t | |||||
| ;; End: | |||||
| ;;; page-break-lines.el ends here | |||||
| @ -0,0 +1,305 @@ | |||||
| ;; -*- mode: emacs-lisp -*- | |||||
| ;; This file is loaded by Spacemacs at startup. | |||||
| ;; It must be stored in your home directory. | |||||
| (defun dotspacemacs/layers () | |||||
| "Configuration Layers declaration. | |||||
| You should not put any user code in this function besides modifying the variable | |||||
| values." | |||||
| (setq-default | |||||
| ;; Base distribution to use. This is a layer contained in the directory | |||||
| ;; `+distribution'. For now available distributions are `spacemacs-base' | |||||
| ;; or `spacemacs'. (default 'spacemacs) | |||||
| dotspacemacs-distribution 'spacemacs | |||||
| ;; Lazy installation of layers (i.e. layers are installed only when a file | |||||
| ;; with a supported type is opened). Possible values are `all', `unused' | |||||
| ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers | |||||
| ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will | |||||
| ;; lazy install any layer that support lazy installation even the layers | |||||
| ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy | |||||
| ;; installation feature and you have to explicitly list a layer in the | |||||
| ;; variable `dotspacemacs-configuration-layers' to install it. | |||||
| ;; (default 'unused) | |||||
| dotspacemacs-enable-lazy-installation 'unused | |||||
| ;; If non-nil then Spacemacs will ask for confirmation before installing | |||||
| ;; a layer lazily. (default t) | |||||
| dotspacemacs-ask-for-lazy-installation t | |||||
| ;; If non-nil layers with lazy install support are lazy installed. | |||||
| ;; List of additional paths where to look for configuration layers. | |||||
| ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') | |||||
| dotspacemacs-configuration-layer-path '() | |||||
| ;; List of configuration layers to load. | |||||
| dotspacemacs-configuration-layers | |||||
| '( | |||||
| ;; ---------------------------------------------------------------- | |||||
| ;; Example of useful layers you may want to use right away. | |||||
| ;; Uncomment some layer names and press <SPC f e R> (Vim style) or | |||||
| ;; <M-m f e R> (Emacs style) to install them. | |||||
| ;; ---------------------------------------------------------------- | |||||
| helm | |||||
| ;; auto-completion | |||||
| ;; better-defaults | |||||
| emacs-lisp | |||||
| ;; git | |||||
| ;; markdown | |||||
| ;; org | |||||
| ;; (shell :variables | |||||
| ;; shell-default-height 30 | |||||
| ;; shell-default-position 'bottom) | |||||
| ;; spell-checking | |||||
| ;; syntax-checking | |||||
| ;; version-control | |||||
| ) | |||||
| ;; List of additional packages that will be installed without being | |||||
| ;; wrapped in a layer. If you need some configuration for these | |||||
| ;; packages, then consider creating a layer. You can also put the | |||||
| ;; configuration in `dotspacemacs/user-config'. | |||||
| dotspacemacs-additional-packages '() | |||||
| ;; A list of packages that cannot be updated. | |||||
| dotspacemacs-frozen-packages '() | |||||
| ;; A list of packages that will not be installed and loaded. | |||||
| dotspacemacs-excluded-packages '() | |||||
| ;; Defines the behaviour of Spacemacs when installing packages. | |||||
| ;; Possible values are `used-only', `used-but-keep-unused' and `all'. | |||||
| ;; `used-only' installs only explicitly used packages and uninstall any | |||||
| ;; unused packages as well as their unused dependencies. | |||||
| ;; `used-but-keep-unused' installs only the used packages but won't uninstall | |||||
| ;; them if they become unused. `all' installs *all* packages supported by | |||||
| ;; Spacemacs and never uninstall them. (default is `used-only') | |||||
| dotspacemacs-install-packages 'used-only)) | |||||
| (defun dotspacemacs/init () | |||||
| "Initialization function. | |||||
| This function is called at the very startup of Spacemacs initialization | |||||
| before layers configuration. | |||||
| You should not put any user code in there besides modifying the variable | |||||
| values." | |||||
| ;; This setq-default sexp is an exhaustive list of all the supported | |||||
| ;; spacemacs settings. | |||||
| (setq-default | |||||
| ;; If non nil ELPA repositories are contacted via HTTPS whenever it's | |||||
| ;; possible. Set it to nil if you have no way to use HTTPS in your | |||||
| ;; environment, otherwise it is strongly recommended to let it set to t. | |||||
| ;; This variable has no effect if Emacs is launched with the parameter | |||||
| ;; `--insecure' which forces the value of this variable to nil. | |||||
| ;; (default t) | |||||
| dotspacemacs-elpa-https t | |||||
| ;; Maximum allowed time in seconds to contact an ELPA repository. | |||||
| dotspacemacs-elpa-timeout 5 | |||||
| ;; If non nil then spacemacs will check for updates at startup | |||||
| ;; when the current branch is not `develop'. Note that checking for | |||||
| ;; new versions works via git commands, thus it calls GitHub services | |||||
| ;; whenever you start Emacs. (default nil) | |||||
| dotspacemacs-check-for-update nil | |||||
| ;; If non-nil, a form that evaluates to a package directory. For example, to | |||||
| ;; use different package directories for different Emacs versions, set this | |||||
| ;; to `emacs-version'. | |||||
| dotspacemacs-elpa-subdirectory nil | |||||
| ;; One of `vim', `emacs' or `hybrid'. | |||||
| ;; `hybrid' is like `vim' except that `insert state' is replaced by the | |||||
| ;; `hybrid state' with `emacs' key bindings. The value can also be a list | |||||
| ;; with `:variables' keyword (similar to layers). Check the editing styles | |||||
| ;; section of the documentation for details on available variables. | |||||
| ;; (default 'vim) | |||||
| dotspacemacs-editing-style 'vim | |||||
| ;; If non nil output loading progress in `*Messages*' buffer. (default nil) | |||||
| dotspacemacs-verbose-loading nil | |||||
| ;; Specify the startup banner. Default value is `official', it displays | |||||
| ;; the official spacemacs logo. An integer value is the index of text | |||||
| ;; banner, `random' chooses a random text banner in `core/banners' | |||||
| ;; directory. A string value must be a path to an image format supported | |||||
| ;; by your Emacs build. | |||||
| ;; If the value is nil then no banner is displayed. (default 'official) | |||||
| dotspacemacs-startup-banner 'official | |||||
| ;; List of items to show in startup buffer or an association list of | |||||
| ;; the form `(list-type . list-size)`. If nil then it is disabled. | |||||
| ;; Possible values for list-type are: | |||||
| ;; `recents' `bookmarks' `projects' `agenda' `todos'." | |||||
| ;; List sizes may be nil, in which case | |||||
| ;; `spacemacs-buffer-startup-lists-length' takes effect. | |||||
| dotspacemacs-startup-lists '((recents . 5) | |||||
| (projects . 7)) | |||||
| ;; True if the home buffer should respond to resize events. | |||||
| dotspacemacs-startup-buffer-responsive t | |||||
| ;; Default major mode of the scratch buffer (default `text-mode') | |||||
| dotspacemacs-scratch-mode 'text-mode | |||||
| ;; List of themes, the first of the list is loaded when spacemacs starts. | |||||
| ;; Press <SPC> T n to cycle to the next theme in the list (works great | |||||
| ;; with 2 themes variants, one dark and one light) | |||||
| dotspacemacs-themes '(spacemacs-dark | |||||
| spacemacs-light) | |||||
| ;; If non nil the cursor color matches the state color in GUI Emacs. | |||||
| dotspacemacs-colorize-cursor-according-to-state t | |||||
| ;; Default font, or prioritized list of fonts. `powerline-scale' allows to | |||||
| ;; quickly tweak the mode-line size to make separators look not too crappy. | |||||
| dotspacemacs-default-font '("Source Code Pro" | |||||
| :size 13 | |||||
| :weight normal | |||||
| :width normal | |||||
| :powerline-scale 1.1) | |||||
| ;; The leader key | |||||
| dotspacemacs-leader-key "SPC" | |||||
| ;; The key used for Emacs commands (M-x) (after pressing on the leader key). | |||||
| ;; (default "SPC") | |||||
| dotspacemacs-emacs-command-key "SPC" | |||||
| ;; The key used for Vim Ex commands (default ":") | |||||
| dotspacemacs-ex-command-key ":" | |||||
| ;; The leader key accessible in `emacs state' and `insert state' | |||||
| ;; (default "M-m") | |||||
| dotspacemacs-emacs-leader-key "M-m" | |||||
| ;; Major mode leader key is a shortcut key which is the equivalent of | |||||
| ;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",") | |||||
| dotspacemacs-major-mode-leader-key "," | |||||
| ;; Major mode leader key accessible in `emacs state' and `insert state'. | |||||
| ;; (default "C-M-m") | |||||
| dotspacemacs-major-mode-emacs-leader-key "C-M-m" | |||||
| ;; These variables control whether separate commands are bound in the GUI to | |||||
| ;; the key pairs C-i, TAB and C-m, RET. | |||||
| ;; Setting it to a non-nil value, allows for separate commands under <C-i> | |||||
| ;; and TAB or <C-m> and RET. | |||||
| ;; In the terminal, these pairs are generally indistinguishable, so this only | |||||
| ;; works in the GUI. (default nil) | |||||
| dotspacemacs-distinguish-gui-tab nil | |||||
| ;; If non nil `Y' is remapped to `y$' in Evil states. (default nil) | |||||
| dotspacemacs-remap-Y-to-y$ nil | |||||
| ;; If non-nil, the shift mappings `<' and `>' retain visual state if used | |||||
| ;; there. (default t) | |||||
| dotspacemacs-retain-visual-state-on-shift t | |||||
| ;; If non-nil, J and K move lines up and down when in visual mode. | |||||
| ;; (default nil) | |||||
| dotspacemacs-visual-line-move-text nil | |||||
| ;; If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command. | |||||
| ;; (default nil) | |||||
| dotspacemacs-ex-substitute-global nil | |||||
| ;; Name of the default layout (default "Default") | |||||
| dotspacemacs-default-layout-name "Default" | |||||
| ;; If non nil the default layout name is displayed in the mode-line. | |||||
| ;; (default nil) | |||||
| dotspacemacs-display-default-layout nil | |||||
| ;; If non nil then the last auto saved layouts are resume automatically upon | |||||
| ;; start. (default nil) | |||||
| dotspacemacs-auto-resume-layouts nil | |||||
| ;; Size (in MB) above which spacemacs will prompt to open the large file | |||||
| ;; literally to avoid performance issues. Opening a file literally means that | |||||
| ;; no major mode or minor modes are active. (default is 1) | |||||
| dotspacemacs-large-file-size 1 | |||||
| ;; Location where to auto-save files. Possible values are `original' to | |||||
| ;; auto-save the file in-place, `cache' to auto-save the file to another | |||||
| ;; file stored in the cache directory and `nil' to disable auto-saving. | |||||
| ;; (default 'cache) | |||||
| dotspacemacs-auto-save-file-location 'cache | |||||
| ;; Maximum number of rollback slots to keep in the cache. (default 5) | |||||
| dotspacemacs-max-rollback-slots 5 | |||||
| ;; If non nil, `helm' will try to minimize the space it uses. (default nil) | |||||
| dotspacemacs-helm-resize nil | |||||
| ;; if non nil, the helm header is hidden when there is only one source. | |||||
| ;; (default nil) | |||||
| dotspacemacs-helm-no-header nil | |||||
| ;; define the position to display `helm', options are `bottom', `top', | |||||
| ;; `left', or `right'. (default 'bottom) | |||||
| dotspacemacs-helm-position 'bottom | |||||
| ;; Controls fuzzy matching in helm. If set to `always', force fuzzy matching | |||||
| ;; in all non-asynchronous sources. If set to `source', preserve individual | |||||
| ;; source settings. Else, disable fuzzy matching in all sources. | |||||
| ;; (default 'always) | |||||
| dotspacemacs-helm-use-fuzzy 'always | |||||
| ;; If non nil the paste micro-state is enabled. When enabled pressing `p` | |||||
| ;; several times cycle between the kill ring content. (default nil) | |||||
| dotspacemacs-enable-paste-transient-state nil | |||||
| ;; Which-key delay in seconds. The which-key buffer is the popup listing | |||||
| ;; the commands bound to the current keystroke sequence. (default 0.4) | |||||
| dotspacemacs-which-key-delay 0.4 | |||||
| ;; Which-key frame position. Possible values are `right', `bottom' and | |||||
| ;; `right-then-bottom'. right-then-bottom tries to display the frame to the | |||||
| ;; right; if there is insufficient space it displays it at the bottom. | |||||
| ;; (default 'bottom) | |||||
| dotspacemacs-which-key-position 'bottom | |||||
| ;; If non nil a progress bar is displayed when spacemacs is loading. This | |||||
| ;; may increase the boot time on some systems and emacs builds, set it to | |||||
| ;; nil to boost the loading time. (default t) | |||||
| dotspacemacs-loading-progress-bar t | |||||
| ;; If non nil the frame is fullscreen when Emacs starts up. (default nil) | |||||
| ;; (Emacs 24.4+ only) | |||||
| dotspacemacs-fullscreen-at-startup nil | |||||
| ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. | |||||
| ;; Use to disable fullscreen animations in OSX. (default nil) | |||||
| dotspacemacs-fullscreen-use-non-native nil | |||||
| ;; If non nil the frame is maximized when Emacs starts up. | |||||
| ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil. | |||||
| ;; (default nil) (Emacs 24.4+ only) | |||||
| dotspacemacs-maximized-at-startup nil | |||||
| ;; A value from the range (0..100), in increasing opacity, which describes | |||||
| ;; the transparency level of a frame when it's active or selected. | |||||
| ;; Transparency can be toggled through `toggle-transparency'. (default 90) | |||||
| dotspacemacs-active-transparency 90 | |||||
| ;; A value from the range (0..100), in increasing opacity, which describes | |||||
| ;; the transparency level of a frame when it's inactive or deselected. | |||||
| ;; Transparency can be toggled through `toggle-transparency'. (default 90) | |||||
| dotspacemacs-inactive-transparency 90 | |||||
| ;; If non nil show the titles of transient states. (default t) | |||||
| dotspacemacs-show-transient-state-title t | |||||
| ;; If non nil show the color guide hint for transient state keys. (default t) | |||||
| dotspacemacs-show-transient-state-color-guide t | |||||
| ;; If non nil unicode symbols are displayed in the mode line. (default t) | |||||
| dotspacemacs-mode-line-unicode-symbols t | |||||
| ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth | |||||
| ;; scrolling overrides the default behavior of Emacs which recenters point | |||||
| ;; when it reaches the top or bottom of the screen. (default t) | |||||
| dotspacemacs-smooth-scrolling t | |||||
| ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode' | |||||
| ;; derivatives. If set to `relative', also turns on relative line numbers. | |||||
| ;; (default nil) | |||||
| dotspacemacs-line-numbers nil | |||||
| ;; Code folding method. Possible values are `evil' and `origami'. | |||||
| ;; (default 'evil) | |||||
| dotspacemacs-folding-method 'evil | |||||
| ;; If non-nil smartparens-strict-mode will be enabled in programming modes. | |||||
| ;; (default nil) | |||||
| dotspacemacs-smartparens-strict-mode nil | |||||
| ;; If non-nil pressing the closing parenthesis `)' key in insert mode passes | |||||
| ;; over any automatically added closing parenthesis, bracket, quote, etc… | |||||
| ;; This can be temporary disabled by pressing `C-q' before `)'. (default nil) | |||||
| dotspacemacs-smart-closing-parenthesis nil | |||||
| ;; Select a scope to highlight delimiters. Possible values are `any', | |||||
| ;; `current', `all' or `nil'. Default is `all' (highlight any scope and | |||||
| ;; emphasis the current one). (default 'all) | |||||
| dotspacemacs-highlight-delimiters 'all | |||||
| ;; If non nil, advise quit functions to keep server open when quitting. | |||||
| ;; (default nil) | |||||
| dotspacemacs-persistent-server nil | |||||
| ;; List of search tool executable names. Spacemacs uses the first installed | |||||
| ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'. | |||||
| ;; (default '("ag" "pt" "ack" "grep")) | |||||
| dotspacemacs-search-tools '("ag" "pt" "ack" "grep") | |||||
| ;; The default package repository used if no explicit repository has been | |||||
| ;; specified with an installed package. | |||||
| ;; Not used for now. (default nil) | |||||
| dotspacemacs-default-package-repository nil | |||||
| ;; Delete whitespace while saving buffer. Possible values are `all' | |||||
| ;; to aggressively delete empty line and long sequences of whitespace, | |||||
| ;; `trailing' to delete only the whitespace at end of lines, `changed'to | |||||
| ;; delete only whitespace for changed lines or `nil' to disable cleanup. | |||||
| ;; (default nil) | |||||
| dotspacemacs-whitespace-cleanup nil | |||||
| )) | |||||
| (defun dotspacemacs/user-init () | |||||
| "Initialization function for user code. | |||||
| It is called immediately after `dotspacemacs/init', before layer configuration | |||||
| executes. | |||||
| This function is mostly useful for variables that need to be set | |||||
| before packages are loaded. If you are unsure, you should try in setting them in | |||||
| `dotspacemacs/user-config' first." | |||||
| ) | |||||
| (defun dotspacemacs/user-config () | |||||
| "Configuration function for user code. | |||||
| This function is called at the very end of Spacemacs initialization after | |||||
| layers configuration. | |||||
| This is the place where most of your configurations should be done. Unless it is | |||||
| explicitly specified that a variable should be set before a package is loaded, | |||||
| you should place your code here." | |||||
| ) | |||||
| ;; Do not write anything past this comment. This is where Emacs will | |||||
| ;; auto-generate custom variable definitions. | |||||
| @ -0,0 +1,30 @@ | |||||
| #+TITLE: %LAYER_NAME% layer | |||||
| # The maximum height of the logo should be 200 pixels. | |||||
| [[img/%LAYER_NAME%.png]] | |||||
| # TOC links should be GitHub style anchors. | |||||
| * Table of Contents :TOC_4_gh:noexport: | |||||
| - [[#decsription][Description]] | |||||
| - [[#install][Install]] | |||||
| - [[#key-bindings][Key bindings]] | |||||
| * Description | |||||
| This layer does wonderful things: | |||||
| - thing01 | |||||
| * Install | |||||
| To use this configuration layer, add it to your =~/.spacemacs=. You will need to | |||||
| add =%LAYER_NAME%= to the existing =dotspacemacs-configuration-layers= list in this | |||||
| file. | |||||
| * Key bindings | |||||
| | Key Binding | Description | | |||||
| |-------------+----------------| | |||||
| | ~SPC x x x~ | Does thing01 | | |||||
| # Use GitHub URLs if you wish to link a Spacemacs documentation file or its heading. | |||||
| # Examples: | |||||
| # [[https://github.com/syl20bnr/spacemacs/blob/master/doc/VIMUSERS.org#sessions]] | |||||
| # [[https://github.com/syl20bnr/spacemacs/blob/master/layers/%2Bfun/emoji/README.org][Link to Emoji layer README.org]] | |||||
| # If space-doc-mode is enabled, Spacemacs will open a local copy of the linked file. | |||||
| @ -0,0 +1,21 @@ | |||||
| <<REPLACE ALL UPPERCASE EXPRESSIONS AND DELETE THIS LINE, `C-c C-c` TO SUBMIT>> | |||||
| #### Description :octocat: | |||||
| <<DESCRIPTION OF THE PROBLEM>> | |||||
| #### Reproduction guide :beetle: | |||||
| - Start Emacs | |||||
| - <<REPRODUCTION STEPS>> | |||||
| *Observed behaviour:* :eyes: :broken_heart: | |||||
| <<DESCRIPTION OF THE OBSERVED BEHAVIOUR>> | |||||
| *Expected behaviour:* :heart: :smile: | |||||
| <<DESCRIPTION OF THE EXPECTED BEHAVIOUR>> | |||||
| (%LAST_KEYS%) | |||||
| %SYSTEM_INFO% | |||||
| #### Backtrace :paw_prints: | |||||
| ``` | |||||
| %BACKTRACE% | |||||
| ``` | |||||
| @ -0,0 +1,62 @@ | |||||
| ;;; packages.el --- %LAYER_NAME% layer packages file for Spacemacs. | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: %USER_FULL_NAME% <%USER_MAIL_ADDRESS%> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| ;;; Commentary: | |||||
| ;; See the Spacemacs documentation and FAQs for instructions on how to implement | |||||
| ;; a new layer: | |||||
| ;; | |||||
| ;; SPC h SPC layers RET | |||||
| ;; | |||||
| ;; | |||||
| ;; Briefly, each package to be installed or configured by this layer should be | |||||
| ;; added to `%LAYER_NAME%-packages'. Then, for each package PACKAGE: | |||||
| ;; | |||||
| ;; - If PACKAGE is not referenced by any other Spacemacs layer, define a | |||||
| ;; function `%LAYER_NAME%/init-PACKAGE' to load and initialize the package. | |||||
| ;; - Otherwise, PACKAGE is already referenced by another Spacemacs layer, so | |||||
| ;; define the functions `%LAYER_NAME%/pre-init-PACKAGE' and/or | |||||
| ;; `%LAYER_NAME%/post-init-PACKAGE' to customize the package as it is loaded. | |||||
| ;;; Code: | |||||
| (defconst %LAYER_NAME%-packages | |||||
| '() | |||||
| "The list of Lisp packages required by the %LAYER_NAME% layer. | |||||
| Each entry is either: | |||||
| 1. A symbol, which is interpreted as a package to be installed, or | |||||
| 2. A list of the form (PACKAGE KEYS...), where PACKAGE is the | |||||
| name of the package to be installed or loaded, and KEYS are | |||||
| any number of keyword-value-pairs. | |||||
| The following keys are accepted: | |||||
| - :excluded (t or nil): Prevent the package from being loaded | |||||
| if value is non-nil | |||||
| - :location: Specify a custom installation location. | |||||
| The following values are legal: | |||||
| - The symbol `elpa' (default) means PACKAGE will be | |||||
| installed using the Emacs package manager. | |||||
| - The symbol `local' directs Spacemacs to load the file at | |||||
| `./local/PACKAGE/PACKAGE.el' | |||||
| - A list beginning with the symbol `recipe' is a melpa | |||||
| recipe. See: https://github.com/milkypostman/melpa#recipe-format") | |||||
| ;;; packages.el ends here | |||||
| @ -0,0 +1,77 @@ | |||||
| #!/bin/bash | |||||
| # ---------------------------------------------------------------------- | |||||
| # Formatting/Migration tool for Spacemacs | |||||
| # ---------------------------------------------------------------------- | |||||
| # | |||||
| # Authors: Eugene Yaremenko and Sylvain Benner | |||||
| # | |||||
| # Arguments: | |||||
| # $1: action name can be `all`, `doc`, `config` | |||||
| # `doc` formats documentation files | |||||
| # `config` format configuration files | |||||
| # `all` performs all actions | |||||
| # $2: if equal to `test` then use test files as input | |||||
| # TODO a function to add headers to config.el, packages.el etc... | |||||
| if ! [ -d "./.git" ] | |||||
| then | |||||
| echo "Should be executed from the repo root." | |||||
| exit 1 | |||||
| fi | |||||
| #Use "sed" or "gsed" if avaliable. | |||||
| seder="sed" | |||||
| if hash gsed 2>/dev/null; then | |||||
| seder="gsed" | |||||
| fi | |||||
| #Use md5 or md5sum | |||||
| mdfive="md5sum" | |||||
| if hash md5 2>/dev/null; then | |||||
| mdfive="md5" | |||||
| fi | |||||
| if [[ $2 = "test" ]] | |||||
| then | |||||
| places=("./core/tools/spacefmt/tests") | |||||
| else | |||||
| places=("./doc" "./layers") | |||||
| fi | |||||
| for place in "${places[@]}" | |||||
| do : | |||||
| before_md5="foo" | |||||
| after_md5="bar" | |||||
| while ! [ "$before_md5" = "$after_md5" ] | |||||
| do | |||||
| # Calculate md5 of the files in $place before formating | |||||
| before_md5=$(find $place -type f -exec $mdfive {} \; | sort -k 2 | $mdfive) | |||||
| if [ $1 = "all" ] || [ $1 == "doc" ] | |||||
| then | |||||
| # Remove trailing delimiters in headlines | |||||
| find $place -name "*.org" -type f -exec $seder -i 's/^\(*\+\s\+.*\)[;,.]$/\1/g' {} \; | |||||
| # Remove trailing spaces | |||||
| find $place -name "*.org" -type f -exec $seder -i 's/[ \t]*$//' {} \; | |||||
| # Remove #+HTML_HEAD_EXTRA: ... readtheorg.css" /> | |||||
| find $place -name "*.org" -type f -exec $seder -i '/#+HTML_HEAD_EXTRA.*readtheorg.css.*/d' {} \; | |||||
| # Replace multiply empty lines with a single empty line | |||||
| find $place -name "*.org" -type f -exec $seder -i '/^$/N;/^\n$/D' {} \; | |||||
| # Replace :TOC_4_org: with :TOC_4_gh: | |||||
| find $place -name "*.org" -type f -exec $seder -i 's/:TOC_4_org:/:TOC_4_gh:/' {} \; | |||||
| # apply toc-org | |||||
| find $place -name "*.org" -type f -exec emacs -batch -l ./core/tools/spacefmt/spacefmt.el '{}' -f apply-all \; | |||||
| fi | |||||
| if [ $1 = "all" ] || [ $1 == "config" ] | |||||
| then | |||||
| # migrate packages lists to config.el | |||||
| find $place -name "packages.el" -type f -exec emacs -batch -l ./core/tools/spacefmt/spacefmt.el '{}' -f move-packages-to-config \; | |||||
| fi | |||||
| # Calculate md5 of the files in $place after formating | |||||
| after_md5=$(find $place -type f -exec $mdfive {} \; | sort -k 2 | $mdfive) | |||||
| done | |||||
| done | |||||
| @ -0,0 +1,169 @@ | |||||
| ;;; fmt.el --- .org file formatter. | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; Author: Sylvain Benner <sylvain.benner@gmail.com> | |||||
| ;; URL: https://github.com/syl20bnr/spacemacs | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| (load-file "./core/tools/spacefmt/toc-org.el") | |||||
| (require 'cl) | |||||
| (require 'files) | |||||
| (require 'org) | |||||
| (require 'thingatpt) | |||||
| (defconst empty-line-regexp "^[ \t]*$") | |||||
| (defconst toc-heading-head "* Table of Contents") | |||||
| (defconst toc-heading-tail ":TOC_4_gh:noexport:") | |||||
| (defconst toc-headline (format "%-41s%s" | |||||
| toc-heading-head | |||||
| toc-heading-tail)) | |||||
| (defun apply-all () | |||||
| "Apply all filters." | |||||
| (remove-empty-lines-at-the-beginning) | |||||
| (insert-title) | |||||
| (insert-toc) | |||||
| (apply-toc) | |||||
| (remove-empty-lines-after-headlines) | |||||
| ;; Multiply empty lines are handled by | |||||
| ;; the bash script. | |||||
| (insert-empty-line-before-tables) | |||||
| (insert-empty-line-after-tables) | |||||
| (insert-empty-line-after-sections) | |||||
| (insert-empty-line-at-the-end) | |||||
| (align-tables) | |||||
| (save-buffer 0)) | |||||
| (defun remove-empty-lines-at-the-beginning () | |||||
| "Remove empty lines at the begging of the buffer." | |||||
| (goto-char (point-min)) | |||||
| (while (looking-at-p empty-line-regexp) | |||||
| (delete-blank-lines))) | |||||
| (defun insert-empty-line-at-the-end () | |||||
| "Insert an empty line at the end of the buffer." | |||||
| (goto-char (point-max)) | |||||
| (unless (looking-at-p empty-line-regexp) | |||||
| (open-line 1))) | |||||
| (defun insert-title() | |||||
| "Insert #TITLE:{DIR_NAME} if the buffer doesn't have one." | |||||
| (goto-char (point-min)) | |||||
| (unless (looking-at-p "^#\\+TITLE:.*$") | |||||
| (insert (format "#+TITLE:%s\n" | |||||
| (clj/->> (buffer-file-name) | |||||
| file-name-directory | |||||
| directory-file-name | |||||
| file-name-base))))) | |||||
| (defun insert-toc () | |||||
| "Insert toc if the buffer doesn't have one." | |||||
| (goto-char (point-min)) | |||||
| (unless (re-search-forward toc-org-toc-org-regexp nil t) | |||||
| (goto-char (point-max)) | |||||
| ;; Skip from the end of the buffer to the first headling. | |||||
| (while (re-search-backward org-heading-regexp nil t)) | |||||
| (open-line 3) | |||||
| (forward-line 1) | |||||
| (insert-string toc-headline))) | |||||
| (defun remove-empty-lines-after-headlines() | |||||
| "Remove empty liners after each headline." | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward org-heading-regexp nil t) | |||||
| (unless (= (forward-line) 0) | |||||
| (while (looking-at-p empty-line-regexp) | |||||
| (delete-blank-lines))))) | |||||
| (defun insert-empty-line-before-tables () | |||||
| "Insert an empty line before each org table." | |||||
| (goto-char (point-min)) | |||||
| (while (goto-next-table) | |||||
| (forward-line -1) | |||||
| (unless (looking-at-p empty-line-regexp) | |||||
| (end-of-line) | |||||
| (open-line 1)) | |||||
| (forward-line 1))) | |||||
| (defun insert-empty-line-after-sections () | |||||
| "Insert an empty line after each section." | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward org-heading-regexp nil t) | |||||
| (forward-line -1) | |||||
| (unless (or (looking-at-p empty-line-regexp) | |||||
| (looking-at-p org-heading-regexp)) | |||||
| (end-of-line) | |||||
| (open-line 1)) | |||||
| (forward-line 2))) | |||||
| (defun insert-empty-line-after-tables () | |||||
| "Insert an empty line after each table." | |||||
| (goto-char (point-min)) | |||||
| (while (goto-next-table) | |||||
| ;; Skip current table. | |||||
| (while (looking-at-p org-table-any-line-regexp) | |||||
| (forward-line)) | |||||
| (unless (looking-at-p empty-line-regexp) | |||||
| (beginning-of-line) | |||||
| (open-line 1) | |||||
| (forward-line)))) | |||||
| (defun align-tables () | |||||
| "Align all tables" | |||||
| (goto-char (point-min)) | |||||
| (while (goto-next-table) | |||||
| (org-table-align))) | |||||
| (defun apply-toc () | |||||
| "Apply current toc-org TAG to TOC." | |||||
| (goto-char (point-min)) | |||||
| (toc-org-insert-toc)) | |||||
| (defun goto-next-table () | |||||
| "Goto next org table. | |||||
| Returns nil if no more tables left." | |||||
| ;; Skip current table. | |||||
| (while (looking-at-p org-table-any-line-regexp) | |||||
| (forward-line)) | |||||
| ;; Skip to the next table. | |||||
| (when (re-search-forward org-table-hline-regexp nil t) | |||||
| (forward-line -1 ))) | |||||
| (defun move-packages-to-config () | |||||
| "Move xxx-packages list to config.el." | |||||
| (let ((config-file (concat default-directory "config.el"))) | |||||
| (when (or (re-search-forward "(setq.*-packages" nil t) | |||||
| (re-search-forward "(defcustom.*-packages" nil t)) | |||||
| (re-search-backward "(") | |||||
| (kill-sexp) | |||||
| (with-current-buffer (find-file-noselect config-file) | |||||
| (when (file-exists-p config-file) | |||||
| (re-search-forward ";;; License: GPLv3") | |||||
| (newline) | |||||
| (forward-line 2)) | |||||
| (yank) | |||||
| ;; config.el | |||||
| (save-buffer 0)) | |||||
| ;; packages.el | |||||
| (save-buffer 0)))) | |||||
| (defmacro clj/->> (o &rest forms) | |||||
| "Threads the expr through the forms. | |||||
| Inserts o as the last item in the first form, | |||||
| making a list of it if it is not a list already. | |||||
| If there are more forms, inserts the first form | |||||
| as the last item in second form, etc." | |||||
| (cond ((not forms) o) | |||||
| ((= 1 (length forms)) | |||||
| (let ((f (first forms))) | |||||
| (append (if (symbolp f) | |||||
| (list f) f) | |||||
| (list o)))) | |||||
| (:else `(clj/->> (clj/->> ,o ,(first forms)) ,@(rest forms))))) | |||||
| @ -0,0 +1,7 @@ | |||||
| ;;; packages.el --- test layer configuration file for Spacemacs. | |||||
| ;; | |||||
| ;; Copyright (c) 2012-2016 Sylvain Benner & Contributors | |||||
| ;; | |||||
| ;; This file is not part of GNU Emacs. | |||||
| ;; | |||||
| ;;; License: GPLv3 | |||||
| @ -0,0 +1,9 @@ | |||||
| ;; Test file for packages.el formatting and migrations | |||||
| (setq mylayer-packages | |||||
| '( | |||||
| package1 | |||||
| package2 | |||||
| package3 | |||||
| package4 | |||||
| )) | |||||
| @ -0,0 +1,28 @@ | |||||
| #+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" /> | |||||
| * Links, | |||||
| [[https://github.com/syl20bnr/spacemacs/blob/master/doc/FAQ.org#os-x][Link to FAQ "OS X" heading]] | |||||
| [[https://www.google.com][Link to www.google.com]] | |||||
| [[https://github.com/syl20bnr/spacemacs/blob/master/doc/VIMUSERS.org#sessions]] | |||||
| [[https://github.com/syl20bnr/spacemacs/blob/master/layers/%2Bfun/emoji/README.org][Link to Emoji layer README.org]] | |||||
| * FOO; | |||||
| | Key Binding | Description | | |||||
| |-------------+--------------------------------------------| | |||||
| | ~SPC m d~ | lookup thing at point in lua documentation | | |||||
| | ~SPC m s b~ | send buffer contents to REPL | | |||||
| | ~SPC m s f~ | send current function to REPL | | |||||
| | ~SPC m s l~ | send current line to REPL | | |||||
| | ~SPC m s r~ | send current region to REPL | | |||||
| =========================================================================== | |||||
| ** Org: | |||||
| Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed conseq | |||||
| * BAR | |||||
| ** SUBBAR ; , . | |||||
| Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed conseq | |||||
| * BAZ | |||||
| Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed conseq | |||||
| * FOOBAZ | |||||
| @ -0,0 +1,409 @@ | |||||
| ;;; toc-org.el --- add table of contents to org-mode files (formerly, org-toc) | |||||
| ;; Copyright (C) 2014 Sergei Nosov | |||||
| ;; Author: Sergei Nosov <sergei.nosov [at] gmail.com> | |||||
| ;; Version: 1.0 | |||||
| ;; Keywords: org-mode org-toc toc-org org toc table of contents | |||||
| ;; URL: https://github.com/snosov1/toc-org | |||||
| ;; 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 2, 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 GNU Emacs; see the file COPYING. If not, write to the | |||||
| ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |||||
| ;; Boston, MA 02111-1307, USA. | |||||
| ;;; Commentary: | |||||
| ;; toc-org helps you to have an up-to-date table of contents in org files | |||||
| ;; without exporting (useful primarily for readme files on GitHub). | |||||
| ;; NOTE: Previous name of the package is org-toc. It was changed because of a | |||||
| ;; name conflict with one of the org contrib modules. | |||||
| ;; After installation put into your .emacs file something like | |||||
| ;; (if (require 'toc-org nil t) | |||||
| ;; (add-hook 'org-mode-hook 'toc-org-enable) | |||||
| ;; (warn "toc-org not found")) | |||||
| ;; And every time you'll be saving an org file, the first headline with a :TOC: | |||||
| ;; tag will be updated with the current table of contents. | |||||
| ;; For details, see https://github.com/snosov1/toc-org | |||||
| ;;; Code: | |||||
| (require 'ert) | |||||
| (require 'org) | |||||
| (defgroup toc-org nil | |||||
| "toc-org is a utility to have an up-to-date table of contents | |||||
| in the org files without exporting (useful primarily for readme | |||||
| files on GitHub)" | |||||
| :group 'org) | |||||
| ;; just in case, simple regexp "^*.*:toc:\\($\\|[^ ]*:$\\)" | |||||
| (defconst toc-org-toc-org-regexp "^*.*:toc\\([@_][0-9]\\|\\([@_][0-9][@_][a-zA-Z]+\\)\\)?:\\($\\|[^ ]*:$\\)" | |||||
| "Regexp to find the heading with the :toc: tag") | |||||
| (defconst toc-org-tags-regexp "\s*:[[:word:]:@]*:\s*$" | |||||
| "Regexp to find tags on the line") | |||||
| (defconst toc-org-states-regexp "^*+\s+\\(TODO\s+\\|DONE\s+\\)" | |||||
| "Regexp to find states on the line") | |||||
| (defconst toc-org-links-regexp "\\[\\[\\(.*?\\)\\]\\[\\(.*?\\)\\]\\]" | |||||
| "Regexp to find states on the line") | |||||
| (defconst toc-org-special-chars-regexp "[^[:alnum:]_-]" | |||||
| "Regexp with the special characters (which are omitted in hrefs | |||||
| by GitHub)") | |||||
| (defcustom toc-org-max-depth 2 | |||||
| "Maximum depth of the headings to use in the table of | |||||
| contents. The default of 2 uses only the highest level headings | |||||
| and their subheadings (one and two stars)." | |||||
| :group 'toc-org) | |||||
| (defcustom toc-org-hrefify-default "gh" | |||||
| "Default hrefify function to use." | |||||
| :group 'toc-org) | |||||
| (defcustom toc-org-enable-links-opening t | |||||
| "With this option, org-open-at-point (C-c C-o) should work on | |||||
| the TOC links (even if the style is different from org)." | |||||
| :group 'toc-org) | |||||
| (defvar-local toc-org-hrefify-hash nil | |||||
| "Buffer local hash-table that is used to enable links | |||||
| opening. The keys are hrefified headings, the values are original | |||||
| headings.") | |||||
| (defun toc-org-raw-toc () | |||||
| "Return the \"raw\" table of contents of the current file, | |||||
| i.e. simply flush everything that's not a heading and strip | |||||
| tags." | |||||
| (let ((content (buffer-substring-no-properties | |||||
| (point-min) (point-max)))) | |||||
| (with-temp-buffer | |||||
| (insert content) | |||||
| (goto-char (point-min)) | |||||
| (keep-lines "^\*+[ ]") | |||||
| ;; don't include the TOC itself | |||||
| (goto-char (point-min)) | |||||
| (re-search-forward toc-org-toc-org-regexp nil t) | |||||
| (beginning-of-line) | |||||
| (delete-region (point) (progn (forward-line 1) (point))) | |||||
| ;; strip states | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward toc-org-states-regexp nil t) | |||||
| (replace-match "" nil nil nil 1)) | |||||
| ;; strip tags | |||||
| ;; TODO :export: and :noexport: tags semantic should be probably | |||||
| ;; implemented | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward toc-org-tags-regexp nil t) | |||||
| (replace-match "" nil nil)) | |||||
| ;; flatten links | |||||
| (goto-char (point-min)) | |||||
| (while (re-search-forward toc-org-links-regexp nil t) | |||||
| (replace-match "\\2" nil nil)) | |||||
| (buffer-substring-no-properties | |||||
| (point-min) (point-max))))) | |||||
| (ert-deftest toc-org-test-raw-toc () | |||||
| "Test the `toc-org-raw-toc' function" | |||||
| (defun toc-org-test-raw-toc-gold-test (content gold) | |||||
| (should (equal | |||||
| (with-temp-buffer | |||||
| (insert content) | |||||
| (toc-org-raw-toc)) | |||||
| gold))) | |||||
| (declare-function toc-org-test-raw-toc-gold-test "toc-org") ;; suppress compiler warning | |||||
| (let ((beg "* TODO [[http://somewhere.com][About]]\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents ") | |||||
| (gold "* About\n")) | |||||
| ;; different TOC styles | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC:" ) gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC_1:" ) gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC_1_qqq:" ) gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1:" ) gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1@cxv:" ) gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" ) gold) | |||||
| ;; trailing symbols | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\n") gold) | |||||
| (toc-org-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\nsdfd") gold)) | |||||
| ;; more complex case | |||||
| (toc-org-test-raw-toc-gold-test | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents :TOC:\n - [[#about][About]]\n - [[#use][Use]]\n - [[#different-href-styles][Different href styles]]\n - [[#example][Example]]\n\n* Installation\n** via package.el\nThis is the simplest method if you have the package.el module\n(built-in since Emacs 24.1) you can simply use =M-x package-install=\nand then put the following snippet in your ~/.emacs file\n#+BEGIN_SRC elisp\n (eval-after-load \"toc-org-autoloads\"\n '(progn\n (if (require 'toc-org nil t)\n (add-hook 'org-mode-hook 'toc-org-enable)\n (warn \"toc-org not found\"))))\n#+END_SRC\n** Manual :Hello:\n- Create folder ~/.emacs.d if you don't have it\n- Go to it and clone toc-org there\n #+BEGIN_SRC sh\n git clone https://github.com/snosov1/toc-org.git\n #+END_SRC\n- Put this in your ~/.emacs file\n #+BEGIN_SRC elisp\n (add-to-list 'load-path \"~/.emacs.d/toc-org\")\n (when (require 'toc-org nil t)\n (add-hook 'org-mode-hook 'toc-org-enable))\n #+END_SRC\n\n* Use\n\nAfter the installation, every time you'll be saving an org file, the\nfirst headline with a :TOC: tag will be updated with the current table\nof contents.\n\nTo add a TOC tag, you can use the command =org-set-tags-command=.\n\nIn addition to the simple :TOC: tag, you can also use the following\ntag formats:\n\n- :TOC@2: - sets the max depth of the headlines in the table of\n contents to 2 (the default)\n\n- :TOC@2@gh: - sets the max depth as in above and also uses the\n GitHub-style hrefs in the table of contents (the default). The other\n supported href style is 'org', which is the default org style (you\n can use C-c C-o to go to the headline at point).\n\nYou can also use =_= as separator, instead of =@=.\n\n* Different href styles\n\nCurrently, only 2 href styles are supported: =gh= and =org=. You can easily\ndefine your own styles. If you use the tag =:TOC@2@STYLE:= (=STYLE= being a\nstyle name), then the package will look for a function named\n=toc-org-hrefify-STYLE=, which accepts a heading string and returns a href\ncorresponding to that heading.\n\nE.g. for =org= style it simply returns input as is:\n\n#+BEGIN_SRC emacs-lisp\n (defun toc-org-hrefify-org (str)\n \"Given a heading, transform it into a href using the org-mode\n rules.\"\n str)\n#+END_SRC\n\n* Example\n\n#+BEGIN_SRC org\n * About\n * Table of Contents :TOC:\n - [[#about][About]]\n - [[#installation][Installation]]\n - [[#via-packageel][via package.el]]\n - [[#manual][Manual]]\n - [[#use][Use]]\n * Installation\n ** via package.el\n ** Manual\n * Use\n * Example\n#+END_SRC\n" | |||||
| "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n")) | |||||
| (defun toc-org-hrefify-gh (str) | |||||
| "Given a heading, transform it into a href using the GitHub | |||||
| rules." | |||||
| (let* ((spc-fix (replace-regexp-in-string " " "-" str)) | |||||
| (upcase-fix (replace-regexp-in-string "[A-Z]" 'downcase spc-fix t)) | |||||
| (special-chars-fix (replace-regexp-in-string toc-org-special-chars-regexp "" upcase-fix t))) | |||||
| (concat "#" special-chars-fix))) | |||||
| (ert-deftest toc-org-test-hrefify-gh () | |||||
| "Test the `toc-org-hrefify-gh' function" | |||||
| (should (equal (toc-org-hrefify-gh "About") "#about")) | |||||
| (should (equal (toc-org-hrefify-gh "!h@#$%^&*(){}|][:;\"'/?.>,<`~") "#h")) | |||||
| (should (equal (toc-org-hrefify-gh "!h@#$% ^&*(S){}|][:;\"'/?.>,<`~") "#h-s"))) | |||||
| (defun toc-org-hrefify-org (str) | |||||
| "Given a heading, transform it into a href using the org-mode | |||||
| rules." | |||||
| str) | |||||
| (defun toc-org-unhrefify (type path) | |||||
| "Looks for a value in toc-org-hrefify-hash using path as a key." | |||||
| (let ((ret-type type) | |||||
| (ret-path path) | |||||
| (original-path (and (not (eq toc-org-hrefify-hash nil)) | |||||
| (gethash | |||||
| (concat | |||||
| ;; Org 8.3 and above provides type as "custom-id" | |||||
| ;; and strips the leading hash symbol | |||||
| (if (equal type "custom-id") "#" "") | |||||
| (substring-no-properties path)) | |||||
| toc-org-hrefify-hash | |||||
| nil)))) | |||||
| (when toc-org-enable-links-opening | |||||
| (when original-path | |||||
| ;; Org 8.2 and below provides type as "thisfile" | |||||
| (when (equal type "thisfile") | |||||
| (setq ret-path original-path)) | |||||
| (when (equal type "custom-id") | |||||
| (setq ret-type "fuzzy") | |||||
| (setq ret-path original-path)))) | |||||
| (cons ret-type ret-path))) | |||||
| (defun toc-org-hrefify-toc (toc hrefify &optional hash) | |||||
| "Format the raw `toc' using the `hrefify' function to transform | |||||
| each heading into a link." | |||||
| (with-temp-buffer | |||||
| (insert toc) | |||||
| (goto-char (point-min)) | |||||
| (while | |||||
| (progn | |||||
| (when (looking-at "\\*") | |||||
| (delete-char 1) | |||||
| (while (looking-at "\\*") | |||||
| (delete-char 1) | |||||
| (insert (make-string | |||||
| (+ 2 (or (bound-and-true-p org-list-indent-offset) 0)) | |||||
| ?\s))) | |||||
| (skip-chars-forward " ") | |||||
| (insert "- ") | |||||
| (let* ((beg (point)) | |||||
| (end (line-end-position)) | |||||
| (heading (buffer-substring-no-properties | |||||
| beg end)) | |||||
| (hrefified (funcall hrefify heading))) | |||||
| (insert "[[") | |||||
| (insert hrefified) | |||||
| (insert "][") | |||||
| (end-of-line) | |||||
| (insert "]]") | |||||
| ;; maintain the hash table, if provided | |||||
| (when hash | |||||
| (puthash hrefified heading hash))) | |||||
| (= 0 (forward-line 1))))) | |||||
| (buffer-substring-no-properties | |||||
| (point-min) (point-max)))) | |||||
| (ert-deftest toc-org-test-hrefify-toc () | |||||
| (let ((hash (make-hash-table :test 'equal))) | |||||
| (should (equal (toc-org-hrefify-toc "* About\n" 'upcase hash) | |||||
| " - [[ABOUT][About]]\n")) | |||||
| (should (equal (gethash "ABOUT" hash) "About"))) | |||||
| (let ((hash (make-hash-table :test 'equal))) | |||||
| (should (equal (toc-org-hrefify-toc "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase hash) | |||||
| " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n - [[VIA PACKAGE.EL][via package.el]]\n - [[MANUAL][Manual]]\n - [[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n - [[EXAMPLE][Example]]\n")) | |||||
| (should (equal (gethash "ABOUT" hash) "About")) | |||||
| (should (equal (gethash "INSTALLATION" hash) "Installation")) | |||||
| (should (equal (gethash "VIA PACKAGE.EL" hash) "via package.el")) | |||||
| (should (equal (gethash "MANUAL" hash) "Manual")) | |||||
| (should (equal (gethash "USE" hash) "Use")) | |||||
| (should (equal (gethash "DIFFERENT HREF STYLES" hash) "Different href styles")) | |||||
| (should (equal (gethash "EXAMPLE" hash) "Example")))) | |||||
| (defun toc-org-flush-subheadings (toc max-depth) | |||||
| "Flush subheadings of the raw `toc' deeper than `max-depth'." | |||||
| (with-temp-buffer | |||||
| (insert toc) | |||||
| (goto-char (point-min)) | |||||
| (let ((re "^")) | |||||
| (dotimes (i (1+ max-depth)) | |||||
| (setq re (concat re "\\*"))) | |||||
| (flush-lines re)) | |||||
| (buffer-substring-no-properties | |||||
| (point-min) (point-max)))) | |||||
| (ert-deftest toc-org-test-flush-subheadings () | |||||
| (should (equal (toc-org-flush-subheadings "* About\n" 0) | |||||
| "")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n" 1) | |||||
| "* About\n")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n" 2) | |||||
| "* About\n")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 0) | |||||
| "")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 1) | |||||
| "* About\n* Installation\n* Use\n* Different href styles\n* Example\n")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 2) | |||||
| "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n")) | |||||
| (should (equal (toc-org-flush-subheadings "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 3) | |||||
| "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different href styles\n* Example\n"))) | |||||
| (defun toc-org-insert-toc (&optional dry-run) | |||||
| "Looks for a headline with the TOC tag and updates it with the | |||||
| current table of contents. | |||||
| If optional second argument DRY-RUN is provided, then the buffer | |||||
| is not modified at all. Only the internal hash-table is updated | |||||
| to enable `org-open-at-point' for TOC links. | |||||
| To add a TOC tag, you can use the command | |||||
| `org-set-tags-command' (C-c C-q). | |||||
| In addition to the simple :TOC: tag, you can also use the | |||||
| following tag formats: | |||||
| - :TOC_2: - sets the max depth of the headlines in the table of | |||||
| contents to 2 (the default) | |||||
| - :TOC_2_gh: - sets the max depth as in above and also uses the | |||||
| GitHub-style hrefs in the table of contents (this style is | |||||
| default). The other supported href style is 'org', which is the | |||||
| default org style." | |||||
| (interactive) | |||||
| (when (eq major-mode 'org-mode) | |||||
| (save-excursion | |||||
| (goto-char (point-min)) | |||||
| (let ((case-fold-search t)) | |||||
| ;; find the first heading with the :TOC: tag | |||||
| (when (re-search-forward toc-org-toc-org-regexp (point-max) t) | |||||
| (let* ((tag (match-string 1)) | |||||
| (depth (if tag | |||||
| (- (aref tag 1) ?0) ;; is there a better way to convert char to number? | |||||
| toc-org-max-depth)) | |||||
| (hrefify-tag (if (and tag (>= (length tag) 4)) | |||||
| (downcase (substring tag 3)) | |||||
| toc-org-hrefify-default)) | |||||
| (hrefify-string (concat "toc-org-hrefify-" hrefify-tag)) | |||||
| (hrefify (intern-soft hrefify-string))) | |||||
| (if hrefify | |||||
| (let ((new-toc | |||||
| (toc-org-hrefify-toc | |||||
| (toc-org-flush-subheadings (toc-org-raw-toc) depth) | |||||
| hrefify | |||||
| (when toc-org-hrefify-hash | |||||
| (clrhash toc-org-hrefify-hash))))) | |||||
| (unless dry-run | |||||
| (newline (forward-line 1)) | |||||
| ;; insert newline if TOC is currently empty | |||||
| (when (looking-at "^\\*") | |||||
| (open-line 1)) | |||||
| ;; find TOC boundaries | |||||
| (let ((beg (point)) | |||||
| (end | |||||
| (save-excursion | |||||
| (when (search-forward-regexp "^\\*" (point-max) t) | |||||
| (forward-line -1)) | |||||
| (end-of-line) | |||||
| (point)))) | |||||
| ;; update the TOC, but only if it's actually different | |||||
| ;; from the current one | |||||
| (unless (equal | |||||
| (buffer-substring-no-properties beg end) | |||||
| new-toc) | |||||
| (delete-region beg end) | |||||
| (insert new-toc))))) | |||||
| (message (concat "Hrefify function " hrefify-string " is not found"))))))))) | |||||
| ;;;###autoload | |||||
| (defun toc-org-enable () | |||||
| "Enable toc-org in this buffer." | |||||
| (add-hook 'before-save-hook 'toc-org-insert-toc nil t) | |||||
| ;; conservatively set org-link-translation-function | |||||
| (when (and (equal toc-org-enable-links-opening t) | |||||
| (or | |||||
| (not (fboundp org-link-translation-function)) | |||||
| (equal org-link-translation-function 'toc-org-unhrefify))) | |||||
| (setq toc-org-hrefify-hash (make-hash-table :test 'equal)) | |||||
| (setq org-link-translation-function 'toc-org-unhrefify) | |||||
| (toc-org-insert-toc t))) | |||||
| (ert-deftest toc-org-test-insert-toc () | |||||
| "Test the `toc-org-insert-toc' function" | |||||
| (defun toc-org-test-insert-toc-gold-test (content gold) | |||||
| (with-temp-buffer | |||||
| (org-mode) | |||||
| (insert content) | |||||
| (toc-org-raw-toc) | |||||
| (toc-org-insert-toc) | |||||
| (should (equal | |||||
| (buffer-substring-no-properties | |||||
| (point-min) (point-max)) | |||||
| gold)))) | |||||
| (declare-function toc-org-test-insert-toc-gold-test "toc-org") ;; suppress compiler warning | |||||
| (let ((beg "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents ")) | |||||
| (toc-org-test-insert-toc-gold-test | |||||
| (concat beg ":TOC:") | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents :TOC:\n - [[#about][About]]\n - [[#hello][Hello]]\n - [[#good-bye][Good-bye]]\n") | |||||
| (toc-org-test-insert-toc-gold-test | |||||
| (concat beg ":TOC_1:") | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents :TOC_1:\n - [[#about][About]]\n - [[#hello][Hello]]\n") | |||||
| (toc-org-test-insert-toc-gold-test | |||||
| (concat beg ":TOC_3:") | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents :TOC_3:\n - [[#about][About]]\n - [[#hello][Hello]]\n - [[#good-bye][Good-bye]]\n - [[#salut][Salut]]\n") | |||||
| (toc-org-test-insert-toc-gold-test | |||||
| (concat beg ":TOC_1_org:") | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents :TOC_1_org:\n - [[About][About]]\n - [[Hello][Hello]]\n") | |||||
| (toc-org-test-insert-toc-gold-test | |||||
| (concat beg ":TOC_3_org:") | |||||
| "* About\n:TOC:\n drawer\n:END:\n\ntoc-org is a utility to have an up-to-date table of contents in the\norg files without exporting (useful primarily for readme files on\nGitHub).\n\nIt is similar to the [[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works for org files.\n:TOC:\n drawer\n:END:\n* Hello\n** Good-bye\n*** Salut\n* Table of Contents :TOC_3_org:\n - [[About][About]]\n - [[Hello][Hello]]\n - [[Good-bye][Good-bye]]\n - [[Salut][Salut]]\n"))) | |||||
| ;; Local Variables: | |||||
| ;; compile-command: "emacs -batch -l ert -l *.el -f ert-run-tests-batch-and-exit && emacs -batch -f batch-byte-compile *.el 2>&1 | sed -n '/Warning\|Error/p' | xargs -r ls" | |||||
| ;; End: | |||||
| (provide 'toc-org) | |||||
| ;;; toc-org.el ends here | |||||
| @ -0,0 +1,376 @@ | |||||
| #+TITLE: Spacemacs Conventions | |||||
| * Spacemacs conventions :TOC_4_gh:noexport: | |||||
| - [[#code-guidelines][Code guidelines]] | |||||
| - [[#spacemacs-core-and-layer][Spacemacs core and layer]] | |||||
| - [[#all-layers][All layers]] | |||||
| - [[#use-package][Use-package]] | |||||
| - [[#key-bindings-conventions][Key bindings conventions]] | |||||
| - [[#reserved-prefix][Reserved prefix]] | |||||
| - [[#user-prefix][User prefix]] | |||||
| - [[#major-mode-prefix][Major mode prefix]] | |||||
| - [[#transient-state][Transient-state]] | |||||
| - [[#evilified-buffers][Evilified buffers]] | |||||
| - [[#navigation][Navigation]] | |||||
| - [[#n-and-n][n and N]] | |||||
| - [[#code-navigation][Code Navigation]] | |||||
| - [[#insert-state-buffers][=insert state= buffers]] | |||||
| - [[#confirm-and-abort][Confirm and Abort]] | |||||
| - [[#evaluation][Evaluation]] | |||||
| - [[#repls][REPLs]] | |||||
| - [[#send-code][Send code]] | |||||
| - [[#in-terminal][In terminal]] | |||||
| - [[#building-and-compilation][Building and Compilation]] | |||||
| - [[#debugging][Debugging]] | |||||
| - [[#plain-text-markup-languages][Plain Text Markup Languages]] | |||||
| - [[#headers][Headers]] | |||||
| - [[#insertion-of-common-elements][Insertion of common elements]] | |||||
| - [[#text-manipulation][Text manipulation]] | |||||
| - [[#movement-in-normal-mode][Movement in normal mode]] | |||||
| - [[#promotion-demotion-and-element-movement][Promotion, Demotion and element movement]] | |||||
| - [[#table-editing][Table editing]] | |||||
| - [[#tests][Tests]] | |||||
| - [[#all-languages][All languages]] | |||||
| - [[#language-specific][Language specific]] | |||||
| - [[#toggles][Toggles]] | |||||
| - [[#refactoring][Refactoring]] | |||||
| - [[#code-formatting][Code Formatting]] | |||||
| - [[#help-or-documentation][Help or Documentation]] | |||||
| - [[#writing-documentation][Writing documentation]] | |||||
| - [[#spacing-in-documentation][Spacing in documentation]] | |||||
| * Code guidelines | |||||
| ** Spacemacs core and layer | |||||
| Function names follow these conventions: | |||||
| - =spacemacs/xxx= is an interactive function called =xxx= | |||||
| - =spacemacs//xxx= is a private function called =xxx= (implementation details) | |||||
| - =spacemacs|xxx= is a /macro/ called =xxx= | |||||
| Variables follow these conventions: | |||||
| - =spacemacs-xxx= is a variable | |||||
| - =spacemacs--xxx= is a private variable (implementation details) | |||||
| ** All layers | |||||
| A package is initialized in a function with name =<layer>/init-xxx= where: | |||||
| - =<layer>= is the layer name | |||||
| - =xxx= is the package name | |||||
| ** Use-package | |||||
| - Always use =progn= when a code block requires multiple lines for =:init= or | |||||
| =:config= keywords. | |||||
| - If there is only one line of code then try to keep =:init= or =:config= | |||||
| keywords on the same line. | |||||
| - Don't nest multiple =use-package= calls unless you have a very good reason | |||||
| to do it. | |||||
| * Key bindings conventions | |||||
| ** Reserved prefix | |||||
| *** User prefix | |||||
| ~SPC o~ and ~SPC m o~ must not be used by any layer. They are reserved for the | |||||
| user. | |||||
| *** Major mode prefix | |||||
| ~SPC m~ is reserved for the current major mode. Three keys bindings are not an | |||||
| issue (ie. ~SPC m h d~) since ~SPC m~ can be accessed via ~,~. | |||||
| *** Transient-state | |||||
| Whenever possible a transient-state should be enabled with ~M-SPC~ and ~s-M-SPC~. We | |||||
| need the latter bindings on OS X since ~M-SPC~ is used by the OS for spotlight. | |||||
| For instance transient-states dedicated to special buffers like =helm= or =ido= | |||||
| buffers are good candidates to be put on ~M-SPC~ and ~s-M-SPC~. | |||||
| It is recommended to add ~q~ to leave the transient-state. | |||||
| ** Evilified buffers | |||||
| /Evilifying/ a buffer is to set the =evilified state= as the default | |||||
| state for the major mode of the buffer. | |||||
| The =evilified state= is derived from the =emacs state= and modify the | |||||
| map to: | |||||
| - add ~hjkl~ navigation | |||||
| - add scrolling feature on ~C-f~, ~C-b~, ~C-d~ and ~C-u~ | |||||
| - ~G~ and ~gg~ to go to the end and beginning of the buffer | |||||
| - add incremental search with ~/~, ~n~ and ~N~ | |||||
| - enabling =evil-ex= on ~:~ | |||||
| - add =visual state= and =visual line state= on ~v~ and ~V~ | |||||
| - add yank on ~y~ _in visual state only_ | |||||
| - activate evil-leader key on ~SPC~ | |||||
| Setting the =evilified state= to a mode is done by calling the macro | |||||
| =spacemacs|evilify-map=. | |||||
| /Evilification/ rebinds shadowed key bindings according to the following | |||||
| rules: | |||||
| - alphabetic key bindings: ~x~ -> ~X~ -> ~C-x~ -> ~C-X~ | |||||
| - ~SPC~ -> ~'~ | |||||
| - ~/~ -> ~\~ | |||||
| - ~:~ -> ~|~ | |||||
| - ~C-g~ cannot be shadowed | |||||
| If a key binding cannot be remapped then it is ignored and a warning message | |||||
| is displayed in =*Messages*=. | |||||
| ** Navigation | |||||
| *** n and N | |||||
| To be consistent with the Vim way, ~n~ and ~N~ are favored over Emacs ~n~ and | |||||
| ~p~. | |||||
| Ideally a transient-state should be provided to smooth the navigation | |||||
| experience. A transient-state allows to repeat key bindings without entering | |||||
| each time the prefix commands. More info on transient-states in the | |||||
| [[file:DOCUMENTATION.org::Transient-states][documentation]]. | |||||
| *** Code Navigation | |||||
| The prefix for going to something is ~SPC m g~. | |||||
| | Key | Description | | |||||
| |---------+-------------------------------------------------| | |||||
| | ~m g a~ | go to alternate file (i.e. =.h <--> .cpp=) | | |||||
| | ~m g b~ | go back to previous location (before last jump) | | |||||
| | ~m g g~ | go to things under point | | |||||
| | ~m g G~ | go to things under point in other window | | |||||
| | ~m g t~ | go to corresponding test file if any | | |||||
| *** =insert state= buffers | |||||
| Navigation in buffers like =Helm= and =ido= which are in =insert state= | |||||
| should be performed with ~C-j~ and ~C-k~ bindings for vertical movements. | |||||
| | Key | Description | | |||||
| |-------+-------------| | |||||
| | ~C-j~ | go down | | |||||
| | ~C-k~ | go up | | |||||
| ** Confirm and Abort | |||||
| Confirming and aborting actions which are bound to ~C-c C-c~ and ~C-c C-k~ | |||||
| in raw Emacs are mirrored in Spacemacs to: | |||||
| | Key | Description | | |||||
| |-------------------------+---------------------------| | |||||
| | ~SPC m ,~ and ~SPC m c~ | Valid/Confirm the message | | |||||
| | ~SPC m a~ and ~SPC m k~ | Abort/Discard the message | | |||||
| Some example of these modes are =magit= commit messages, =message-mode= for | |||||
| mails or =org-mode= notes. | |||||
| ** Evaluation | |||||
| Live evaluation of code is under the prefix ~SPC m e~. | |||||
| | Key | Description | | |||||
| |---------+-----------------------------------------------| | |||||
| | ~m e $~ | put point at the end of the line and evaluate | | |||||
| | ~m e b~ | evaluate buffer | | |||||
| | ~m e e~ | evaluate last expression | | |||||
| | ~m e f~ | evaluate function | | |||||
| | ~m e l~ | evaluate line | | |||||
| | ~m e r~ | evaluate region | | |||||
| ** REPLs | |||||
| *** Send code | |||||
| A lot of languages can interact with a REPL. To help keeping a | |||||
| consistent behavior between those languages the following conventions | |||||
| should be followed: | |||||
| - ~SPC m s~ is the prefix for sending code. This allows fast interaction with | |||||
| the REPL whenever it is possible | |||||
| - lower case key bindings keep the focus on the current buffer | |||||
| - upper case key bindings move the focus to the REPL buffer | |||||
| | Key | Description | | |||||
| |---------+--------------------------------------------------------------| | |||||
| | ~m s b~ | send buffer | | |||||
| | ~m s B~ | send buffer and switch to REPL | | |||||
| | ~m s d~ | first key to send buffer and switch to REPL to debug (step) | | |||||
| | ~m s D~ | second key to send buffer and switch to REPL to debug (step) | | |||||
| | ~m s f~ | send function | | |||||
| | ~m s F~ | send function and switch to REPL | | |||||
| | ~m s i~ | start/switch to REPL inferior process | | |||||
| | ~m s l~ | send line | | |||||
| | ~m s L~ | send line and switch to REPL | | |||||
| | ~m s r~ | send region | | |||||
| | ~m s R~ | send region and switch to REPL | | |||||
| Note: we don't distinguish between the file and the buffer. | |||||
| *** In terminal | |||||
| History navigation in shells or REPLs buffers should be bound as well to | |||||
| ~C-j~ and ~C-k~. | |||||
| | Key | Description | | |||||
| |-------+----------------------------| | |||||
| | ~C-j~ | next item in history | | |||||
| | ~C-k~ | previous item in history | | |||||
| | ~C-l~ | clear screen | | |||||
| | ~C-r~ | search backward in history | | |||||
| ** Building and Compilation | |||||
| The base prefix for major mode specific compilation is ~SPC m c~. | |||||
| | Key Binding | Description | | |||||
| |-------------+-------------------| | |||||
| | ~m c b~ | compile buffer | | |||||
| | ~m c c~ | compile | | |||||
| | ~m c r~ | clean and compile | | |||||
| Note: we don't distinguish between the file and the buffer. We can | |||||
| implement an auto-save of the buffer before compiling the buffer. | |||||
| ** Debugging | |||||
| The base prefix for debugging commands is ~SPC d~. | |||||
| | Key Binding | Description | | |||||
| |-------------+-------------------------| | |||||
| | ~m d a~ | abandon current process | | |||||
| | ~m d b~ | toggle a breakpoint | | |||||
| | ~m d B~ | clear all breakpoints | | |||||
| | ~m d c~ | continue | | |||||
| | ~m d d~ | start debug session | | |||||
| | ~m d i~ | inspect value at point | | |||||
| | ~m d l~ | local variables | | |||||
| | ~m d n~ | next | | |||||
| | ~m d r~ | run | | |||||
| | ~m d s~ | step | | |||||
| Notes: | |||||
| - Ideally a transient-state for breakpoint navigation should be provided. | |||||
| - If there is no toggle breakpoint function, then it should be implemented at | |||||
| the spacemacs level and ideally the function should be proposed as a patch | |||||
| upstream (major mode repository). | |||||
| ** Plain Text Markup Languages | |||||
| For layers supporting markup languages please follow the following | |||||
| keybindings whenever applicable. | |||||
| *** Headers | |||||
| All header functionality should be grouped under ~SPC m h~ | |||||
| | Key Binding | Description | | |||||
| |-------------+--------------------------------------------------| | |||||
| | ~m h i~ | Insert a header | | |||||
| | ~m h I~ | Insert a header alternative method (if existing) | | |||||
| | ~m h 1..10~ | Insert a header of level 1..10 (if possible) | | |||||
| *** Insertion of common elements | |||||
| Insertion of common elements like links or footnotes should be grouped | |||||
| under ~SPC m i~ | |||||
| | Key Binding | Description | | |||||
| |-------------+------------------| | |||||
| | ~m i f~ | Insert footnote | | |||||
| | ~m i i~ | Insert image | | |||||
| | ~m i l~ | Insert link | | |||||
| | ~m i u~ | Insert url | | |||||
| | ~m i w~ | Insert wiki-link | | |||||
| *** Text manipulation | |||||
| Manipulation of text regions should be grouped under ~SPC m x~ | |||||
| | Key Binding | Description | | |||||
| |-------------+-------------------------------| | |||||
| | ~m x b~ | Make region bold | | |||||
| | ~m x c~ | Make region code | | |||||
| | ~m x i~ | Make region italic | | |||||
| | ~m x q~ | Quote a region | | |||||
| | ~m x r~ | Remove formatting from region | | |||||
| | ~m x s~ | Make region strike-through | | |||||
| | ~m x u~ | Make region underlined | | |||||
| | ~m x v~ | Make region verbose | | |||||
| *** Movement in normal mode | |||||
| In normal mode Vim style movement should be enabled with these keybindings: | |||||
| | Key Binding | Description | | |||||
| |-------------+----------------------------------------| | |||||
| | ~g h~ | Move up one level in headings | | |||||
| | ~g j~ | Move to next heading on same level | | |||||
| | ~g k~ | Move to previous heading on same level | | |||||
| | ~g l~ | Move down one level in headings | | |||||
| *** Promotion, Demotion and element movement | |||||
| Promotion, demotion and movement of headings or list elements (whatever is | |||||
| possible) should be enabled with the following keys in any mode | |||||
| | Key Binding | Description | | |||||
| |-------------+------------------------------| | |||||
| | ~M-h~ | Promote heading by one level | | |||||
| | ~M-j~ | Move element down | | |||||
| | ~M-k~ | Move element up | | |||||
| | ~M-l~ | Demote heading by one level | | |||||
| *** Table editing | |||||
| If table specific commands are available the they are grouped under the | |||||
| ~SPC m t~ group. | |||||
| ** Tests | |||||
| A lot of languages have their own test frameworks. These frameworks | |||||
| share common actions that we can unite under the same key bindings: | |||||
| - ~SPC m t~ is the prefix for test execution. | |||||
| - ~SPC m t X~ is used to execute ~SPC m t x~ but in debug mode (if supported). | |||||
| *** All languages | |||||
| | Key | Description | | |||||
| |---------+--------------------------------------------------------------| | |||||
| | ~m t a~ | execute all the tests of the current project | | |||||
| | ~m t A~ | execute all the tests of the current project in debug | | |||||
| | ~m t b~ | execute all the tests of the current buffer | | |||||
| | ~m t B~ | execute all the tests of the current buffer in debug | | |||||
| | ~m t t~ | execute the current test (thing at point, function) | | |||||
| | ~m t T~ | execute the current test in debug (thing at point, function) | | |||||
| Note: we don't distinguish between the file and the buffer. We can | |||||
| implement an auto-save of the buffer before executing the tests of | |||||
| buffer. | |||||
| *** Language specific | |||||
| | Key | Description | | |||||
| |---------+--------------------------------------------------| | |||||
| | ~m t m~ | execute the tests of the current module | | |||||
| | ~m t M~ | execute the tests of the current module in debug | | |||||
| | ~m t s~ | execute the tests of the current suite | | |||||
| | ~m t S~ | execute the tests of the current suite in debug | | |||||
| Note that there are overlaps, depending on the language we will choose | |||||
| one or more bindings for the same thing | |||||
| ** Toggles | |||||
| - Global toggles are under ~SPC t~, ~SPC T~ and ~SPC C-t~ | |||||
| - Major mode toggles are only under ~SPC m T~ | |||||
| ** Refactoring | |||||
| Refactoring prefix is ~SPC m r~. | |||||
| ** Code Formatting | |||||
| Major-mode code formatting is under prefix ~SPC m =~. | |||||
| | Key Binding | Description | | |||||
| |-------------+--------------------------| | |||||
| | ~m = =~ | format thing under point | | |||||
| | ~m = b~ | format current buffer | | |||||
| | ~m = f~ | format current function | | |||||
| ** Help or Documentation | |||||
| The base prefix for help commands is ~SPC h~. Documentation is considered | |||||
| as an help command. | |||||
| | Key | Description | | |||||
| |---------+------------------------------------| | |||||
| | ~m h h~ | documentation of thing under point | | |||||
| | ~m h r~ | documentation of selected region | | |||||
| * Writing documentation | |||||
| Spacemacs provides an example layer =README.org= file in | |||||
| =~/.emacs.d/core/templates/README.org.template=. | |||||
| ** Spacing in documentation | |||||
| - Spacemacs tries to keep the documentation consistent between all layers by | |||||
| providing some rules for spacing: | |||||
| - After each header, you should not add an empty line | |||||
| - *Exception*: If the first item under the header is a table, add an empty | |||||
| line after it | |||||
| - At the end of each header node, there should be an empty line | |||||
| - Note: Many layer =READMEs= do not follow this convention yet. Please fix | |||||
| them if you can. | |||||
| - To keep things readable only mention the prefix ~SPC~ when documenting | |||||
| key bindings, you don't need to mention ~M-m~. | |||||
| @ -0,0 +1,582 @@ | |||||
| #+TITLE: Frequently Asked Questions | |||||
| * FAQ :TOC_4_gh:noexport: | |||||
| - [[#common][Common]] | |||||
| - [[#which-version-of-spacemacs-am-i-running][Which version of Spacemacs am I running?]] | |||||
| - [[#what-is-the-official-pronunciation-of-spacemacs][What is the official pronunciation of Spacemacs?]] | |||||
| - [[#why-do-you-call-this-a-distribution-i-dont-see-any-spacemacs-executable][Why do you call this a "distribution", I don't see any "Spacemacs" executable?]] | |||||
| - [[#why-are-packages-installed-with-package-install-automatically-deleted-by-spacemacs-when-it-boots][Why are packages installed with =package-install= automatically deleted by Spacemacs when it boots?]] | |||||
| - [[#how-to-fix-package-download-errors-when-installing-spacemacs-][How to fix package download errors when installing Spacemacs ?]] | |||||
| - [[#how-to-fix-symbols-value-as-variable-is-void-errors-on-startup][How to fix =Symbol's value as variable is void= errors on startup?]] | |||||
| - [[#how-to-fix-wrong-type-argument-arrayp-nil-errors-on-startup][How to fix =(wrong-type-argument arrayp nil)= errors on startup?]] | |||||
| - [[#the-spacemacs-banner-is-ugly-what-should-i-do][The Spacemacs banner is ugly, what should I do?]] | |||||
| - [[#the-powerline-separators-are-ugly-how-can-i-fix-them][The powerline separators are ugly, how can I fix them?]] | |||||
| - [[#the-powerline-separators-have-no-anti-aliasing-what-can-i-do][The powerline separators have no anti-aliasing, what can I do?]] | |||||
| - [[#why-is-after-init-hook-not-executed][Why is after-init-hook not executed?]] | |||||
| - [[#what-is-the-difference-between-spacemacs-base-and-spacemacs-distributions][What is the difference between =spacemacs-base= and =spacemacs= distributions?]] | |||||
| - [[#should-i-place-my-settings-in-user-init-or-user-config][Should I place my settings in =user-init= or =user-config=?]] | |||||
| - [[#why-do-some-of-my-org-related-settings-cause-problems][Why do some of my =org=-related settings cause problems?]] | |||||
| - [[#why-is-spacemacs-hanging-on-startup][Why is Spacemacs hanging on startup?]] | |||||
| - [[#why-does-helm-m-x-spc-spc-not-accept-the-prefix-argument][Why does =helm-M-x= (~SPC SPC~) not accept the prefix argument?]] | |||||
| - [[#why-does-my-color-theme-not-render-correctly-in-terminal-mode][Why does my color theme not render correctly in terminal mode?]] | |||||
| - [[#typing-quickly-fd-takes-me-out-of-insert-state-what-is-going-on][Typing quickly =fd= takes me out of =insert state=. What is going on?]] | |||||
| - [[#why-do-i-get-files-starting-with-][Why do I get files starting with .#?]] | |||||
| - [[#why-do-i-get-4m-characters-inside-ansi-term][Why do I get '4m' characters inside ansi-term?]] | |||||
| - [[#why-are-my-font-settings-not-being-respected][Why are my font settings not being respected?]] | |||||
| - [[#why-am-i-getting-a-message-about-environment-variables-on-startup][Why am I getting a message about environment variables on startup?]] | |||||
| - [[#how-do-i][How do I:]] | |||||
| - [[#install-a-package-not-provided-by-a-layer][Install a package not provided by a layer?]] | |||||
| - [[#disable-a-package-completely][Disable a package completely?]] | |||||
| - [[#disable-a-package-only-for-a-specific-major-mode][Disable a package only for a specific major-mode?]] | |||||
| - [[#disable-company-for-a-specific-major-mode][Disable company for a specific major-mode?]] | |||||
| - [[#change-special-buffer-rules][Change special buffer rules?]] | |||||
| - [[#enable-navigation-by-visual-lines][Enable navigation by visual lines?]] | |||||
| - [[#disable-evilification-of-a-mode][Disable evilification of a mode?]] | |||||
| - [[#include-underscores-in-word-motions][Include underscores in word motions?]] | |||||
| - [[#setup-path][Setup =$PATH=?]] | |||||
| - [[#change-or-define-an-alias-for-a-leader-key][Change or define an alias for a leader key?]] | |||||
| - [[#restore-the-sentence-delimiter-to-two-spaces][Restore the sentence delimiter to two spaces?]] | |||||
| - [[#prevent-the-visual-selection-overriding-my-system-clipboard][Prevent the visual selection overriding my system clipboard?]] | |||||
| - [[#make-spell-checking-support-curly-quotes-or-any-other-character][Make spell-checking support curly quotes (or any other character)?]] | |||||
| - [[#use-spacemacs-as-the-editor-for-git-commits][Use Spacemacs as the =$EDITOR= for git commits?]] | |||||
| - [[#try-spacemacs-without-modifying-my-existing-emacs-configuration][Try Spacemacs without modifying my existing Emacs configuration?]] | |||||
| - [[#make-copypaste-working-with-the-mouse-in-x11-terminals][Make copy/paste working with the mouse in X11 terminals?]] | |||||
| - [[#use-helm-ag-to-search-only-in-files-of-a-certain-type][Use =helm-ag= to search only in files of a certain type?]] | |||||
| - [[#modify-spacemacs-documentation-look-space-doc-mode][Modify spacemacs documentation look (space-doc-mode)]] | |||||
| - [[#remap-paste-key-to-be-able-to-paste-copied-text-multiple-times][Remap paste key to be able to paste copied text multiple times]] | |||||
| - [[#windows][Windows]] | |||||
| - [[#why-do-the-fonts-look-crappy-on-windows][Why do the fonts look crappy on Windows?]] | |||||
| - [[#why-is-there-no-spacemacs-logo-in-the-startup-buffer][Why is there no Spacemacs logo in the startup buffer?]] | |||||
| - [[#why-are-all-packages-unavailable][Why are all packages unavailable?]] | |||||
| - [[#the-powerline-isnt-shown-correctly-when-spacemacs-is-used-within-putty][The powerline isn't shown correctly when Spacemacs is used within =PuTTY=]] | |||||
| * Common | |||||
| ** Which version of Spacemacs am I running? | |||||
| The version is displayed on the upper right corner of the loading screen. You | |||||
| may also just type ~SPC f e v~. | |||||
| ** What is the official pronunciation of Spacemacs? | |||||
| As it is written, that is _space_ then _macs_. | |||||
| ** Why do you call this a "distribution", I don't see any "Spacemacs" executable? | |||||
| Although we could do it we don't package Emacs with Spacemacs. We allow users to | |||||
| choose whatever build of Emacs they want that works with their OS, this is more | |||||
| flexible and it saves use tons of issues. Spacemacs is more than a configuration | |||||
| of Emacs it comes with advanced feature, concepts and tooling. Roughly, think of | |||||
| it as a Linux distribution where we would ask people to install the kernel first | |||||
| and then fetch somehow the actual code to get the distribution. | |||||
| Note that some Linux distributions may start to create packages for Spacemacs, | |||||
| they are unofficial packages, we will never package Emacs with Spacemacs. | |||||
| ** Why are packages installed with =package-install= automatically deleted by Spacemacs when it boots? | |||||
| By default Spacemacs will keep only the packages that you use (i.e. the packages | |||||
| belonging to a layer explicitly listed in the variable | |||||
| =dotspacemacs-configuration-layers=). | |||||
| To install packages that does not belong to any Spacemacs layers, you can: | |||||
| - use the variable =dotspacemacs-additional-packages=. | |||||
| - or create a configuration layer configuring the package and add this layer to | |||||
| =dotspacemacs-configuration-layers= | |||||
| - or set the variable =dotspacemacs-install-packages= to =used-but-keep-unused= | |||||
| which will prevent Spacemacs from removing the packages you installed | |||||
| manually. | |||||
| To create a new configuration layer see the [[file:QUICK_START.org][quick start guide]] for more info. | |||||
| ** How to fix package download errors when installing Spacemacs ? | |||||
| Since 0.105.0 HTTPS protocol is used by default to download packages. If your | |||||
| environment does not allow HTTPS to reach ELPA repositories then you can start | |||||
| Emacs with the =--insecure= argument for force the usage of HTTP non secured | |||||
| protocol. You can set the variable =dotspacemacs-elpa-https= to =nil= in your | |||||
| dotfile to remove the need to start Emacs with =--insecure= argument. | |||||
| ** How to fix =Symbol's value as variable is void= errors on startup? | |||||
| If Emacs reports an error that the symbol =closed= or =-= is unbound as a | |||||
| variable, it is probably because you are using HTTPS to download packages, but | |||||
| you shouldn't be. Try deleting your packages (the =.emacs.d/elpa= folder), and | |||||
| restart Emacs without HTTPS to download the packages again. There are two ways | |||||
| to do this: | |||||
| - Run Emacs with the =--insecure= command line argument: =emacs --insecure=. You | |||||
| will have to do this again the next time you update your packages. | |||||
| - Set the variable =dotspacemacs-elpa-https= to =nil= in your dotfile. This has | |||||
| the same effect as =--insecure=, but is persistent. | |||||
| ** How to fix =(wrong-type-argument arrayp nil)= errors on startup? | |||||
| This is most likely caused by a corrupted package archive. Try deleting your | |||||
| =~/.emacs.d/elpa/archives/= folder and restart Emacs. | |||||
| ** The Spacemacs banner is ugly, what should I do? | |||||
| Install the default font supported by Spacemacs or choose a fixed width font. | |||||
| More information in the font section of the [[file:DOCUMENTATION.org][documentation]]. | |||||
| ** The powerline separators are ugly, how can I fix them? | |||||
| Use the property =:powerline-scale= of the variable =dotspacemacs-default-font=. | |||||
| See font section of the [[file:DOCUMENTATION.org][documentation]] for more details. | |||||
| ** The powerline separators have no anti-aliasing, what can I do? | |||||
| Emacs powerline uses XMP images to draw the separators in a graphical | |||||
| environment. You can have anti-aliasing if you use the =utf8= separator. Note | |||||
| that by default the =utf8= separator is used in a terminal. See the powerline | |||||
| section in the font section of the [[file:DOCUMENTATION.org][documentation]]. | |||||
| ** Why is after-init-hook not executed? | |||||
| Don't launch Spacemacs with =emacs -q -l init.el= command. This command will run | |||||
| the hooked functions in =after-init-hook= before the evaluation of the passed | |||||
| =-l init.el= file. | |||||
| ** What is the difference between =spacemacs-base= and =spacemacs= distributions? | |||||
| The =distribution= concept was introduced in 0.104.x. You can now choose between | |||||
| two distributions =spacemacs= or =spacemacs-base=. =spacemacs-base= contains | |||||
| only a minimal set of packages; whereas =spacemacs= is the full Spacemacs | |||||
| experience. | |||||
| Set the distribution with =dotspacemacs-distribution= variable. The default is | |||||
| =spacemacs=. For more information as to what is included, check out the | |||||
| =packages.el= file in the respective folders in the =+distributions= folder of | |||||
| the =layers/= directory. | |||||
| ** Should I place my settings in =user-init= or =user-config=? | |||||
| Any variable that layer configuration code will *read* and *act on* must be set | |||||
| in =user-init=, and any variable that Spacemacs explicitly sets but you wish to | |||||
| *override* must be set in =user-config=. | |||||
| Anything that isn't just setting a variable should 99% be in =user-config=. | |||||
| ** Why do some of my =org=-related settings cause problems? | |||||
| Since version 0.104, spacemacs uses the =org= version from the org ELPA | |||||
| repository instead of the one shipped with emacs. Then, any =org= related code | |||||
| should not be loaded before =dotspacemacs/user-config=, otherwise both versions | |||||
| will be loaded and will conflict. | |||||
| Because of autoloading, calling to =org= functions will trigger the loading up | |||||
| of the =org= shipped with emacs wich will induce conflicts. One way to avoid | |||||
| conflict is to wrap your =org= config code in a =with-eval-after-load= block | |||||
| like this: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (with-eval-after-load 'org | |||||
| ;; here goes your Org config :) | |||||
| ;; .... | |||||
| ) | |||||
| #+END_SRC | |||||
| ** Why is Spacemacs hanging on startup? | |||||
| This is probably related to Helm using Tramp which tries to figure out some | |||||
| SSH/DNS settings at startup. The root cause is probably your ISP redirecting | |||||
| non-existing addresses to their own servers. | |||||
| Try using these settings in the ~user-init~ function in your ~.spacemacs~ | |||||
| configuration: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq tramp-ssh-controlmaster-options | |||||
| "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no") | |||||
| #+END_SRC | |||||
| See [[https://github.com/syl20bnr/spacemacs/issues/3422#issuecomment-148919047][issue #3422]] and [[https://github.com/emacs-helm/helm/issues/1000#issuecomment-119487649][helm issue #1000]] for details. If for any reason this code is | |||||
| not working, you can try to put these settings directly in =~/.ssh/config=: | |||||
| #+BEGIN_SRC ssh | |||||
| Host * | |||||
| ControlMaster auto | |||||
| ControlPath ~/.ssh/master -%r@%h:%p | |||||
| ControlPersist = no | |||||
| #+END_SRC | |||||
| ** Why does =helm-M-x= (~SPC SPC~) not accept the prefix argument? | |||||
| If you try to run =helm-M-x= with the prefix argument (i.e. ~SPC u SPC SPC~) it | |||||
| will fail with this message: | |||||
| #+BEGIN_VERSE | |||||
| Error: Specifying a prefix arg before calling helm-M-x | |||||
| #+END_VERSE | |||||
| Instead, call =helm-M-x= first, select the command you want to run, and press | |||||
| ~C-u~ before pressing ~RETURN~. For instance: ~SPC SPC org-reload C-u RET~ | |||||
| ** Why does my color theme not render correctly in terminal mode? | |||||
| In the terminal version of Emacs, color themes will not render correctly as | |||||
| colors are rendered by the terminal and not by emacs. You will probably have to | |||||
| change your terminal color palette. More explanations can be found on | |||||
| [[https://github.com/sellout/emacs-color-theme-solarized#important-note-for-terminal-users][emacs-color-theme-solarized webpage]]. | |||||
| ** Typing quickly =fd= takes me out of =insert state=. What is going on? | |||||
| This is a feature of Spacemacs, enabling you to easily escape from a lot of | |||||
| situations, like escaping from =insert state= to =normal state=. | |||||
| The sequence of characters used can be customized. See the [[http://spacemacs.org/doc/DOCUMENTATION.html#orgheadline78][documentation]] for | |||||
| more information. | |||||
| If you don't like this feature, you can deactivate it by adding =evil-escape= to | |||||
| =dotspacemacs-excluded-packages= in your init file. | |||||
| ** Why do I get files starting with .#? | |||||
| These are lockfiles, created by Emacs to prevent editing conflicts which occur | |||||
| when the same file is edited simultaneously by two different programs. To | |||||
| disable this behaviour: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq create-lockfiles nil) | |||||
| #+END_SRC | |||||
| ** Why do I get '4m' characters inside ansi-term? | |||||
| Ansi-term only has a subset of capabilities supported by xterm256. Your shell | |||||
| (e.g. fish shell) might ignore =$TERMINFO= information and require you to set | |||||
| the =~/.terminfo= yourself. | |||||
| #+BEGIN_SRC fish | |||||
| tic -o ~/.terminfo $TERMINFO/e/eterm-color.ti | |||||
| #+END_SRC | |||||
| Note that =eterm-color.ti= may be at a different location, to find out the exact | |||||
| location you may try to use =locate=: | |||||
| #+BEGIN_SRC fish | |||||
| locate eterm-color.ti | |||||
| #+END_SRC | |||||
| ** Why are my font settings not being respected? | |||||
| The settings of =dotspacemacs-default-font= (such as size, weight, etc.) will | |||||
| only be applied if the name of the font exists on your system. Check to make | |||||
| sure that this is the case. If Spacemacs can't find the font, there should be a | |||||
| warning to this effect in the =*Messages*= buffer. | |||||
| ** Why am I getting a message about environment variables on startup? | |||||
| Spacemacs uses the =exec-path-from-shell= package to set the executable path | |||||
| when Emacs starts up. This is done by launching a shell and reading the values | |||||
| of variables such as =PATH= and =MANPATH= from it. If your shell configuration | |||||
| sets the values of these variables inconsistently, this could be problematic. It | |||||
| is recommended to set such variables in shell configuration files that are | |||||
| sourced unconditionally, such as =.profile=, =.bash_profile= or =.zshenv=, as | |||||
| opposed to files that are sourced only for interactive shells, such as =.bashrc= | |||||
| or =.zshrc=. If you are willing to neglect this advice, you may disable the | |||||
| warning, e.g. from =dotspacemacs/user-init=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq exec-path-from-shell-check-startup-files nil) | |||||
| #+END_SRC | |||||
| You can also disable this feature entirely by adding =exec-path-from-shell= to | |||||
| the list =dotspacemacs-excluded-packages= if you prefer setting =exec-path= | |||||
| yourself. | |||||
| * How do I: | |||||
| ** Install a package not provided by a layer? | |||||
| Spacemacs provides a variable in the =dotspacemacs/layers= function in | |||||
| =.spacemacs= called =dotspacemacs-additional-packages=. Just add a package name | |||||
| to the list and it will be installed when you reload your configuration with | |||||
| ~SPC f e R~, or at the next Spacemacs launch. | |||||
| ** Disable a package completely? | |||||
| To completely disable a package and effectively uninstalling it even if it is | |||||
| part of your used layers, look for the variable =dotspacemacs-excluded-packages= | |||||
| in your dotfile and add the package name to it: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq-default dotspacemacs-excluded-packages '(package1 package2 ...)) | |||||
| #+END_SRC | |||||
| ** Disable a package only for a specific major-mode? | |||||
| This is done by removing the hook added by Spacemacs. For example to remove | |||||
| =flycheck= support in python buffers, look for the function | |||||
| =dotspacemacs/user-config= in your dotfile and add the following code: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (remove-hook 'python-mode-hook 'flycheck-mode) | |||||
| #+END_SRC | |||||
| *Hint* to know the name of the major-mode of the current buffer press: ~SPC h d | |||||
| v major-mode RET~ | |||||
| ** Disable company for a specific major-mode? | |||||
| It may be handy to disable =company= for a given mode if you plan on configuring | |||||
| =auto-complete= instead. One easy way to do it is to use the macro | |||||
| =spacemacs|disable-company= in the function =dotspacemacs/user-config= of your | |||||
| dotfile. The following snippet disables company for =python-mode=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (spacemacs|disable-company python-mode) | |||||
| #+END_SRC | |||||
| ** Change special buffer rules? | |||||
| To change the way spacemacs marks buffers as useless, you can customize | |||||
| =spacemacs-useless-buffers-regexp= which marks buffers matching the regexp as | |||||
| useless. The variable =spacemacs-useful-buffers-regexp= marks buffers matching | |||||
| the regexp as useful buffers. Both can be customized the same way. | |||||
| Examples: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| ;; Only mark helm buffers as useless | |||||
| (setq spacemacs-useless-buffers-regexp '("\\*helm\.\+\\*")) | |||||
| ;; Marking the *Messages* buffer as useful | |||||
| (push "\\*Messages\\*" spacemacs-useful-buffers-regexp) | |||||
| #+END_SRC | |||||
| ** Enable navigation by visual lines? | |||||
| Add the following snippet to your =dotspacemacs/user-config= function: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| ;; Make evil-mode up/down operate in screen lines instead of logical lines | |||||
| (define-key evil-motion-state-map "j" 'evil-next-visual-line) | |||||
| (define-key evil-motion-state-map "k" 'evil-previous-visual-line) | |||||
| ;; Also in visual mode | |||||
| (define-key evil-visual-state-map "j" 'evil-next-visual-line) | |||||
| (define-key evil-visual-state-map "k" 'evil-previous-visual-line) | |||||
| #+END_SRC | |||||
| ** Disable evilification of a mode? | |||||
| You can ensure a mode opens in emacs state by using =evil-set-initial-state=. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (evil-set-initial-state 'magit-status-mode 'emacs) | |||||
| #+END_SRC | |||||
| You can also do this using buffer name regular expressions. E.g. for magit, | |||||
| which has a number of different major modes, you can catch them all with | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (push '("*magit" . emacs) evil-buffer-regexps) | |||||
| #+END_SRC | |||||
| This should make all original magit bindings work in the major modes in | |||||
| question. To enable the leader key in this case, you may have to define a | |||||
| binding in the mode's map, e.g. for =magit-status-mode=, | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (with-eval-after-load 'magit | |||||
| (define-key magit-status-mode-map | |||||
| (kbd dotspacemacs-leader-key) spacemacs-default-map)) | |||||
| #+END_SRC | |||||
| ** Include underscores in word motions? | |||||
| You can modify the syntax table of the mode in question. To do so you can | |||||
| include this on your =dotspacemacs/user-config=. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| ;; For python | |||||
| (add-hook 'python-mode-hook #'(lambda () (modify-syntax-entry ?_ "w"))) | |||||
| ;; For ruby | |||||
| (add-hook 'ruby-mode-hook #'(lambda () (modify-syntax-entry ?_ "w"))) | |||||
| ;; For Javascript | |||||
| (add-hook 'js2-mode-hook #'(lambda () (modify-syntax-entry ?_ "w"))) | |||||
| #+END_SRC | |||||
| ** Setup =$PATH=? | |||||
| Some layers require certain tools to be available on your =$PATH=. This means | |||||
| that your =$PATH= must contain the installation paths for those tools. For | |||||
| example, if you have installed some tools to =~/.local/bin= and want them to be | |||||
| available in Spacemacs, you need to add =~/.local/bin= to your =$PATH=. | |||||
| Users of =bash=, =zsh=, =sh= and other similar shells should add following line | |||||
| to their =.bashrc= (=.zshrc=, =.profile= or your shell's equivalent). Note that | |||||
| the =export= part is very important. | |||||
| #+BEGIN_SRC sh | |||||
| export PATH=~/.local/bin:$PATH | |||||
| #+END_SRC | |||||
| Users of =fish= should add following line to their =config.fish= file (should be | |||||
| in =$XDG_CONFIG_HOME= or its default value - =~/.config/fish=). Note that =-x= | |||||
| part is very important. | |||||
| #+BEGIN_SRC fish | |||||
| set -x PATH ~/.local/bin $PATH | |||||
| #+END_SRC | |||||
| Users of other shells should consult its documentation on how to setup =$PATH= | |||||
| variable (with export to environment). | |||||
| So now, =~/.local/bin= should be available in your =$PATH=. You can verify this | |||||
| by calling =echo $PATH=. But you also should verify that =$PATH= is set properly | |||||
| in your environment. To do so call following command in your terminal. | |||||
| #+BEGIN_SRC sh | |||||
| env | grep "PATH" | |||||
| #+END_SRC | |||||
| This is the value that will be used by Emacs. So it must contain =~/.local/bin=. | |||||
| After that you can run Spacemacs and check that it properly gets the value of | |||||
| =$PATH= by running =M-: (getenv "PATH")=. | |||||
| Note that having =~/.local/bin= in your =$PATH= also means that it's possible to | |||||
| run terminal and call tools from =~/.local/bin= without specifying their full | |||||
| path. Under certain conditions you might want to avoid modifying your =$PATH=. | |||||
| In that case you have the option of updating the value of =exec-path= in the | |||||
| =dotspacemacs/user-config= function of your =.spacemacs= file. | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (add-to-list 'exec-path "~/.local/bin/") | |||||
| #+END_SRC | |||||
| ** Change or define an alias for a leader key? | |||||
| It is possible to change a leader key by binding its keymap to another sequence. | |||||
| For instance, if you want to switch ~SPC S~ (spelling) with ~SPC d~ (used by | |||||
| dash) to make the former easier to reach, you can use: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (defun dear-leader/swap-keys (key1 key2) | |||||
| (let ((map1 (lookup-key spacemacs-default-map key1)) | |||||
| (map2 (lookup-key spacemacs-default-map key2))) | |||||
| (spacemacs/set-leader-keys key1 map2 key2 map1))) | |||||
| (dear-leader/swap-keys "S" "d") | |||||
| #+END_SRC | |||||
| If you want to define your own alias, like using ~SPC é~ (because it's a not | |||||
| used key on your keyboard-layout for instance) for accessing ~SPC w~ (windows | |||||
| management), you can use this: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (defun dear-leader/alias-of (key1 key2) | |||||
| (let ((map (lookup-key spacemacs-default-map key2))) | |||||
| (spacemacs/set-leader-keys key1 map))) | |||||
| (dear-leader/alias-of "é" "w") | |||||
| #+END_SRC | |||||
| ** Restore the sentence delimiter to two spaces? | |||||
| To restore the sentence delimiter to two spaces, add the following code to the | |||||
| =dotspacemacs/user-init= function of your =.spacemacs=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq sentence-end-double-space t) | |||||
| #+END_SRC | |||||
| ** Prevent the visual selection overriding my system clipboard? | |||||
| On some operating systems, there is only one clipboard for both *copied* and | |||||
| *selected* texts. This has the consequence that visual *selection* – which | |||||
| should normally be saved to the /PRIMARY/ clipboard – overrides the /SYSTEM/ | |||||
| clipboard, where normally goes the *copied* text. This can be corrected by | |||||
| adding the following code to the =dotspacemacs/user-config= of your | |||||
| =.spacemacs=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (fset 'evil-visual-update-x-selection 'ignore) | |||||
| #+END_SRC | |||||
| ** Make spell-checking support curly quotes (or any other character)? | |||||
| To have spell-checking support curly quotes (or any other character), you need | |||||
| to add a new entry to =ispell-local-dictionary-alist=, by adding for example the | |||||
| following code in the =dotspacemacs/user-config= of your =.spacemacs=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (add-to-list 'ispell-local-dictionary-alist | |||||
| (quote ("my_english" "[[:alpha:]]" "[^[:alpha:]]" "['’]" t ("-d" "en_US") nil utf-8))) | |||||
| #+END_SRC | |||||
| You can then add any regular expression you want in the fourth argument (i.e. | |||||
| add a symbol within =['’]=) to make it supported. Consult the help of | |||||
| =ispell-dictionary-alist= for more details about the possibilities. | |||||
| You finally have to set =my_english= as your =ispell-local-dictionary= in order | |||||
| to use the dictionary supporting your newly added characters. | |||||
| ** Use Spacemacs as the =$EDITOR= for git commits? | |||||
| Spacemacs can be used as the =$EDITOR= (or =$GIT_EDITOR=) for editing git | |||||
| commits messages. To enable this you have to add the following line to your | |||||
| =dotspacemacs/user-config=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (global-git-commit-mode t) | |||||
| #+END_SRC | |||||
| ** Try Spacemacs without modifying my existing Emacs configuration? | |||||
| Emacs' ability to use any directory as the home for launching it allows us to | |||||
| try out Spacemacs (or any other Emacs configuration we desire) without having to | |||||
| go through the trouble of backing up our =~/.emacs.d= directory and then cloning | |||||
| the new configuration. This can be achieved easily using the following steps: | |||||
| #+BEGIN_SRC sh | |||||
| mkdir ~/spacemacs | |||||
| git clone git@github.com:syl20bnr/spacemacs.git ~/spacemacs/.emacs.d | |||||
| HOME=~/spacemacs emacs | |||||
| #+END_SRC | |||||
| If you're on Fish shell, you will need to modify the last command to: | |||||
| =env HOME=$HOME/spacemacs emacs= | |||||
| ** Make copy/paste working with the mouse in X11 terminals? | |||||
| It is possible to disable the mouse support in X11 terminals in order to | |||||
| enable copying/pasting with the mouse. You need to add this line to your | |||||
| =dotspacemacs/user-config=: | |||||
| #+begin_src emacs-lisp | |||||
| (xterm-mouse-mode -1) | |||||
| #+end_src | |||||
| ** Use =helm-ag= to search only in files of a certain type? | |||||
| It is possible to restrict the scope of =helm-ag= to search only expressions in | |||||
| some specified file types. There are two ways of doing this, both by appending | |||||
| some expressions to the search input: | |||||
| - By using a regexp with =-G=, for instance =-G\.el$= will look for all files | |||||
| ending with =.el= which are emacs-lisp files. | |||||
| - By using a flag like =--python= which should be self-explaining. The list of | |||||
| available flags colud be accessed from terminal with: | |||||
| #+begin_src shell | |||||
| ag --list-file-types | |||||
| #+end_src | |||||
| This is possible because =helm-ag= is treating the search input as command-line | |||||
| arguments of the =ag= program. | |||||
| ** Modify spacemacs documentation look (space-doc-mode) | |||||
| You can modify the list of visual enhancements applied by the =space-doc-mode=: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (setq spacemacs-space-doc-modificators | |||||
| '(center-buffer-mode | |||||
| org-indent-mode | |||||
| view-mode | |||||
| hide-line-numbers | |||||
| alternative-emphasis | |||||
| alternative-tags-look | |||||
| link-protocol | |||||
| org-block-line-face-remap | |||||
| org-kbd-face-remap | |||||
| resize-inline-images)) | |||||
| #+END_SRC | |||||
| By default only =center-buffer-mode= is disabled. | |||||
| Both =space-doc-mode= and =center-buffer-mode= can be customized | |||||
| with "Easy Customization Interface". | |||||
| ** Remap paste key to be able to paste copied text multiple times | |||||
| In vim and evil, pasting over a text would cause it to be copied, hence making it impossible to paste | |||||
| the same text multiple times. | |||||
| To fix this, add the following snippet to your ~user-config~: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (defun evil-paste-after-from-0 () | |||||
| (interactive) | |||||
| (let ((evil-this-register ?0)) | |||||
| (call-interactively 'evil-paste-after))) | |||||
| (define-key evil-visual-state-map "p" 'evil-paste-after-from-0) | |||||
| #+END_SRC | |||||
| * Windows | |||||
| ** Why do the fonts look crappy on Windows? | |||||
| You can install [[https://code.google.com/archive/p/gdipp/][GDIPP]] (simplest) or [[https://code.google.com/p/mactype/][MacType]] (more complete) on Windows to get | |||||
| very nice looking fonts. It is also recommended to disable smooth scrolling on | |||||
| Windows. | |||||
| ** Why is there no Spacemacs logo in the startup buffer? | |||||
| A GUI build of emacs supporting image display is required. You can follow the | |||||
| instructions [[http://stackoverflow.com/questions/2650041/emacs-under-windows-and-png-files][here]]. Alternatively you can download binaries of emacs with image | |||||
| support included such as [[http://emacsbinw64.sourceforge.net/][this one]]. | |||||
| ** Why are all packages unavailable? | |||||
| Check if your Emacs has HTTPS capabilities by doing =M-:= and then: | |||||
| #+BEGIN_SRC emacs-lisp | |||||
| (gnutls-available-p) | |||||
| #+END_SRC | |||||
| If this returns =nil=, you need to install the GnuTLS DLL file in the same | |||||
| directory as Emacs. See [[https://www.gnu.org/software/emacs/manual/html_mono/emacs-gnutls.html#Help-For-Users][here]] for instructions. | |||||
| ** The powerline isn't shown correctly when Spacemacs is used within =PuTTY= | |||||
| You can follow [[http://mschulte.nl/posts/using-powerline-in-PuTTY.html][this explanation]] explaining how to correct this. | |||||
| @ -0,0 +1,623 @@ | |||||
| #+TITLE: Configuration layers | |||||
| * Configuration Layers :TOC_4_gh:noexport: | |||||
| - [[#introduction][Introduction]] | |||||
| - [[#nomenclature][Nomenclature]] | |||||
| - [[#the-emacs-loading-process][The Emacs loading process]] | |||||
| - [[#emacs-lisp-files][Emacs Lisp files]] | |||||
| - [[#loading-a-file][Loading a file]] | |||||
| - [[#features][Features]] | |||||
| - [[#the-load-path][The load path]] | |||||
| - [[#auto-loading][Auto-loading]] | |||||
| - [[#eval-after-load][Eval after load]] | |||||
| - [[#use-package][Use-package]] | |||||
| - [[#anatomy-of-a-layer][Anatomy of a layer]] | |||||
| - [[#layersel][layers.el]] | |||||
| - [[#packagesel][packages.el]] | |||||
| - [[#funcsel][funcs.el]] | |||||
| - [[#configel][config.el]] | |||||
| - [[#keybindingsel][keybindings.el]] | |||||
| - [[#the-spacemacs-loading-process][The Spacemacs loading process]] | |||||
| - [[#case-study-auto-completion][Case study: auto-completion]] | |||||
| - [[#layer-tips-and-tricks][Layer tips and tricks]] | |||||
| - [[#cross-dependencies][Cross-dependencies]] | |||||
| - [[#use-package-1][Use-package]] | |||||
| - [[#use-package-hooks][Use-package hooks]] | |||||
| - [[#best-practices][Best practices]] | |||||
| - [[#package-ownership][Package ownership]] | |||||
| - [[#localize-your-configuration][Localize your configuration]] | |||||
| - [[#load-ordering][Load ordering]] | |||||
| - [[#no-require][No require]] | |||||
| - [[#auto-load-everything][Auto-load everything]] | |||||
| - [[#how-do-i--idiomatically][How do I ... idiomatically?]] | |||||
| - [[#setup-auto-completion-for-a-major-mode][Setup auto-completion for a major mode]] | |||||
| * Introduction | |||||
| This document is intended as a tutorial for users who are interested in writing | |||||
| their first configuration layer, whether for private use or for contributing | |||||
| upstream. It should help clear up some confusion regarding how layers work and | |||||
| how Spacemacs (and Emacs) loads packages. | |||||
| * Nomenclature | |||||
| Layers and packages. What gives? | |||||
| - Package :: A set of Emacs Lisp files that, taken together, provide some | |||||
| feature. Packages may be available on a package repository, such as ELPA or | |||||
| MELPA or on a third-party service provider (such as github) or even | |||||
| locally on the disk. | |||||
| - Layer :: A collected unit of configuration that can be enabled (or disabled) | |||||
| in Spacemacs. A layer typically brings together one or more packages, as | |||||
| well as the glue configuration code required to make them play well with | |||||
| each other and Spacemacs in general. | |||||
| Before writing a layer, it is helpful to consider what you are trying to | |||||
| achieve. Is there a package that provides the functionality you are after, and | |||||
| you want to integrate it in Spacemacs? If yes, you should write a layer. Are you | |||||
| trying to implement a new feature that would be useful for the Emacs community | |||||
| at large? In that case, consider whether it wouldn't be more appropriate to | |||||
| write a package first, and then a layer that uses your package. | |||||
| * The Emacs loading process | |||||
| To understand how to best implement a layer, we have to investigate how Emacs | |||||
| loads code. | |||||
| ** Emacs Lisp files | |||||
| Emacs Lisp files contains code that can be evaluated. When evaluated, the | |||||
| functions, macros and modes defined in that file become available to the current | |||||
| Emacs session. Henceforth, this will be termed as /loading/ a file. | |||||
| One major problem is to ensure that all the correct files are loaded, and in the | |||||
| proper order. Another issue is to ensure that not too many files are loaded | |||||
| immediately. This causes startup to take too long. Instead, we want to make sure | |||||
| that files are loaded only as needed, and not all at once. | |||||
| How is this done in Emacs, and how is it done in Spacemacs? | |||||
| *** Loading a file | |||||
| The simplest way to load a file is to call =load-file=. | |||||
| #+begin_src emacs-lisp | |||||
| (load-file "~/elisp/foo.el") | |||||
| #+end_src | |||||
| This is as primitive as it comes. The path must be exact, and it does not have | |||||
| to be in the Emacs load path (we'll get to that later). It will not look for a | |||||
| byte-compiled =.elc= file. It will simply load exactly what you tell it to. | |||||
| ** Features | |||||
| A better way to load what you need is to use /features/. A feature is a symbol | |||||
| that typically has the same name as the file it resides in. Let us say you have | |||||
| the following contents in a file called =my-feature.el=. | |||||
| #+begin_src emacs-lisp | |||||
| ;; Your code goes here ... | |||||
| (provide 'my-feature) | |||||
| #+end_src | |||||
| To have Emacs load this file, call =require=, as such: | |||||
| #+begin_src emacs-lisp | |||||
| (require 'my-feature) | |||||
| #+end_src | |||||
| This checks whether the feature =my-feature= has already been loaded. If not, it | |||||
| looks for a file called =my-feature.el=, =my-feature.elc= or some such. If it | |||||
| finds such a file, it will load it. When the call to =provide= is evaluated, the | |||||
| feature is added to the list of loaded features, so that subsequent calls to | |||||
| =require= will do nothing. | |||||
| This will cause an error if no such file can be found. | |||||
| The file =my-feature.el= may very well contain other calls to =require=, and in | |||||
| fact this is quite a common way to ensure that dependencies are loaded before | |||||
| your code runs. | |||||
| Package authors should use this technique to make sure that dependencies are | |||||
| loaded before their code runs. | |||||
| *** The load path | |||||
| When loaded using =require=, Emacs looks for files in its /load path/. This is | |||||
| nothing more than a list of paths where elisp files can be found, and you can | |||||
| inspect it through ~SPC h d v load-path~ in Spacemacs. To add to the load path, | |||||
| simply push to this list, e.g. | |||||
| #+begin_src emacs-lisp | |||||
| (push "/some/path/" load-path) | |||||
| #+end_src | |||||
| ** Auto-loading | |||||
| Calling =require= is nothing more than a glorified way of calling =load-file=. | |||||
| It solves the problem of ensuring that files are loaded in the correct order, | |||||
| and to some degree it solved the problem of where to find the files on disk but | |||||
| a long list of calls to =require= at startup would still cause Emacs to take for | |||||
| ever to load. | |||||
| Emacs uses auto-loading to solve this problem. When a function is registered as | |||||
| auto-loading, an "empty" definition is provided. When that function is called, | |||||
| the file that provides the function is immediately loaded (along with all its | |||||
| required features). Finally, the "empty" function is substituted with the real | |||||
| one and called normally. The end user will see only a slight delay when first | |||||
| calling the function, while subsequent calls to that function (or any other | |||||
| function loaded as part of the same procedure) will be as quick as normal. | |||||
| To register a function as auto-loadable, we call =autoload=: | |||||
| #+begin_src emacs-lisp | |||||
| (autoload 'some-function "some-file") | |||||
| #+end_src | |||||
| This instructs Emacs that whenever =some-function= is called, load | |||||
| =some-file.el= first, and then proceed. | |||||
| After evaluating the above code, you can try to inspect =some-function= by doing | |||||
| ~SPC h d f some-function~. It will say it's an auto-loaded function, and that | |||||
| nothing else is known about it until it is loaded. The call to =autoload= can | |||||
| optionally include more information, such as a doc-string, whether the function | |||||
| can be called interactively, and so on. This provides more information to the | |||||
| end-user without her having to actually load the file first. | |||||
| Open your =elpa= directory, go to =helm= and look at the file | |||||
| =helm-autoloads.el=. This provides all the auto-loads for all the files in Helm. | |||||
| However, this file is not written by hand. Instead, it is automatically | |||||
| generated from "magic" comments in the source code of Helm. They look like this: | |||||
| #+begin_src emacs-lisp | |||||
| ;;;###autoload | |||||
| (defun my-function () | |||||
| ;; Source code... | |||||
| ) | |||||
| #+end_src | |||||
| The magic comment =;;;###autoload= instructs Emacs that the following definition | |||||
| should be auto-loaded. This automatically generates an appropriate call to | |||||
| =autoload=. | |||||
| Things that can be auto-loaded generally involve anything "definable", such as | |||||
| functions, macros, major or minor modes, groups, classes, and so on. | |||||
| Magic comments also work on other things, such as variable definitions | |||||
| (=defvar=), but in that case, the definition is just copied verbatim into the | |||||
| auto-loading file. For example, this code will load Helm on startup, long before | |||||
| your file is actually evaluated, probably not what was intended: | |||||
| #+begin_src emacs-lisp | |||||
| ;;;###autoload | |||||
| (require 'helm) | |||||
| #+end_src | |||||
| It is the responsibility of the package authors to ensure that their package can | |||||
| be appropriately auto-loaded, and most packages do this quite well. | |||||
| Spacemacs makes thorough use of auto-loading. Almost everything in Spacemacs is | |||||
| loaded when needed instead of right away. | |||||
| ** Eval after load | |||||
| Often, we will want to configure packages after loading them. We may want to set | |||||
| some variables or call some functions. This is trivial with =require=, because | |||||
| it loads immediately, but it can be tricky with autoloading, because the | |||||
| configuration code must also be deferred. | |||||
| Emacs offers =with-eval-after-load= for this purpose. It can be used like this: | |||||
| #+begin_src emacs-lisp | |||||
| (with-eval-after-load 'helm | |||||
| ;; Code | |||||
| ) | |||||
| #+end_src | |||||
| This arranges for the relevant code to be executed after Helm is loaded (using | |||||
| either =require= or an autoload), or if Helm is already loaded, the code is | |||||
| executed immediately. | |||||
| Since =with-eval-after-load= is a macro and not a function, its argument does | |||||
| not have to be quoted. | |||||
| ** Use-package | |||||
| For /end users/ who are trying to put together an efficient Emacs configuration, | |||||
| there is a very useful /package/ called =use-package= that provides a macro | |||||
| which is /also/ called =use-package= which does a very good job of streamlining | |||||
| the whole process of loading packages. | |||||
| The aspiring layer author is recommended to have a look at the =use-package= | |||||
| [[https://github.com/jwiegley/use-package][documentation]]. Some examples follow. | |||||
| #+begin_src emacs-lisp | |||||
| (use-package helm) | |||||
| #+end_src | |||||
| This simply loads Helm. It is essentially equivalent to =(require 'helm)=. | |||||
| #+begin_src emacs-lisp | |||||
| (use-package helm | |||||
| :defer t) | |||||
| #+end_src | |||||
| This defers the loading of Helm using the auto-load facility and the auto-load | |||||
| commands provided by the Helm source code. It is, in fact, a no-op. | |||||
| #+begin_src emacs-lisp | |||||
| (use-package helm | |||||
| :defer t | |||||
| :init | |||||
| ;; Code to execute before Helm is loaded | |||||
| :config | |||||
| ;; Code to execute after Helm is loaded | |||||
| ) | |||||
| #+end_src | |||||
| This form includes code to execute before and after Helm is loaded. The =:init= | |||||
| section can be executed immediately, but since Helm is deferred, the =:config= | |||||
| section is not executed until after loading, if ever. It is essentially | |||||
| equivalent to simply running the =:init= block, and then adding the =:config= | |||||
| block in an =with-eval-after-load=. | |||||
| #+begin_src emacs-lisp | |||||
| (use-package helm | |||||
| :commands (helm-find-files helm-M-x)) | |||||
| #+end_src | |||||
| This creates auto-load references for additional commands, if you find that the | |||||
| package author has been slacking. | |||||
| #+begin_src emacs-lisp | |||||
| (use-package ruby-mode | |||||
| :mode "\\.rb\\'") | |||||
| #+end_src | |||||
| For packages that provide major modes, you can associate file extensions to that | |||||
| mode by using the =:mode= keyword. This adds an entry to =auto-mode-alist= and | |||||
| an auto-load for =ruby-mode=. Typically this is not required, as =ruby-mode= | |||||
| should already be auto-loadable, and the package should associate Ruby files | |||||
| with itself already. | |||||
| Use-package supports heaps of useful keywords. Look at the [[https://github.com/jwiegley/use-package][documentation]] for | |||||
| more. | |||||
| * Anatomy of a layer | |||||
| A layer is simply a folder somewhere in Spacemacs' layer search path that | |||||
| usually contains these files (listed in loading order). | |||||
| - =layers.el= :: declare additional layers | |||||
| - =packages.el= :: the packages list and configuration | |||||
| - =funcs.el= :: all functions used in the layer should be declared here | |||||
| - =config.el= :: layer specific configuration | |||||
| - =keybindings.el= :: general key bindings | |||||
| Additionally, for each local package (see the next section), there should be a | |||||
| folder =<layer>/local/<package>/= containing the source code for that package. | |||||
| Before initializing that package, Spacemacs will add this folder to the load | |||||
| path for you. | |||||
| ** layers.el | |||||
| This file is the first file to be loaded and this is the place where addtional | |||||
| layers can be declared. | |||||
| For instance is layer A depends on some functionality of layer B then in the | |||||
| file =layers.el= of layer A we can add: | |||||
| #+begin_src emacs-lisp | |||||
| (configuration-layer/declare-layer 'B) | |||||
| #+end_src | |||||
| The effect is that B is considered a used layer and will be loaded as if it | |||||
| was added to =dotspacemacs-configuration-layers= variables. | |||||
| ** packages.el | |||||
| It contains this list of packages of the layer and the actual configuration for | |||||
| the packages included in the layer. | |||||
| This file is loaded after =layers.el=. | |||||
| It must define a variable called =<layer>-packages=, which should be a list of | |||||
| all the packages that this layer needs. Some valid package specifications are | |||||
| as follows: | |||||
| #+begin_src emacs-lisp | |||||
| (defconst mylayer-packages | |||||
| '( | |||||
| ;; Get the package from MELPA, ELPA, etc. | |||||
| some-package | |||||
| (some-package :location elpa) | |||||
| ;; A local package | |||||
| (some-package :location local) | |||||
| ;; A package recipe | |||||
| (some-package :location (recipe | |||||
| :fetcher github | |||||
| :repo "some/repo")) | |||||
| ;; An excluded package | |||||
| (some-package :excluded t) | |||||
| )) | |||||
| #+end_src | |||||
| The =:location= attribute specifies where the package may be found. Spacemacs | |||||
| currently supports packages on ELPA compliant repositories, local packages and | |||||
| MELPA recipes (through the Quelpa package). Local packages should reside at =<layer>/local/<package>/=. For information about recipes see the [[https://github.com/milkypostman/melpa#recipe-format][MELPA documentation]]. | |||||
| Packages may be /excluded/ by setting the =:excluded= property to true. This | |||||
| will prevent the package from being installed even if it is used by another | |||||
| layer. | |||||
| For each included package, you may define one or more of the following | |||||
| functions, which are called in order by Spacemacs to initialize the package. | |||||
| 1. =<layer>/pre-init-<package>= | |||||
| 2. =<layer>/init-<package>= | |||||
| 3. =<layer>/post-init-<package>= | |||||
| It is the responsibility of these functions to load and configure the package in | |||||
| question. Spacemacs will do nothing other than download the package and place it | |||||
| in the load path for you. | |||||
| *Note:* A package will not be installed unless at least one layer defines an | |||||
| =init= function for it. That is to say, in a certain sense, the =init= function | |||||
| does mandatory setup while the =pre-init= and =post-init= functions do optional | |||||
| setup. This can be used for managing cross-layer dependencies, which we will | |||||
| discuss later. | |||||
| ** funcs.el | |||||
| It contains all the defined functions used in the layer. | |||||
| This file is loaded after =packages.el= and before =config.el=. | |||||
| It is good practice to guard the definition of functions to make sure a package | |||||
| is actually used. For instance: | |||||
| #+begin_src emacs-lisp | |||||
| (when (configuration-layer/package-usedp 'my-package) | |||||
| (defun spacemacs/my-package-enable () ...) | |||||
| (defun spacemacs/my-package-disable () ...)) | |||||
| #+end_src | |||||
| By guarding these functions we avoid to define them in case the package | |||||
| `my-package` is not used. | |||||
| ** config.el | |||||
| This file configure the layer like declaring layer variables default values | |||||
| and setup some other variables related to the layer. | |||||
| This file is loaded after =funcs.el=. | |||||
| ** keybindings.el | |||||
| It contains general key bindings. | |||||
| This is the last file loaded. | |||||
| The word /general/ here means /independent of any package/. Since the end user | |||||
| can exclude an arbitrary set of packages, you cannot be sure that, just because | |||||
| your layer includes a package, that package will necessarily be loaded. For this | |||||
| reason, code in these files must be generally safe, regardless of which packages | |||||
| are installed. | |||||
| More on this in the next section. | |||||
| * The Spacemacs loading process | |||||
| The Spacemacs loading process can be summarized as follows: | |||||
| 1. Spacemacs goes through all the enabled layers and evaluates their files. The | |||||
| changes introduced by =config.el= are thus applied, then =funcs.el= and | |||||
| =packages.el= are loaded, but nothing happens from =packages.el=, since these | |||||
| files only define functions and variables. | |||||
| 2. Spacemacs checks which packages should be downloaded and installed. To be | |||||
| installed, a package must be | |||||
| - included by a layer that the user has enabled, | |||||
| - not be excluded by any other layer that the user has enabled, | |||||
| - not be excluded by the user herself, and | |||||
| - there must be at least one =<layer>/init-<package>= function defined for | |||||
| it. | |||||
| Alternatively, if a package is part of the end user's | |||||
| =dotspacemacs-additional-packages=, it will also be installed. | |||||
| 3. All packages which should be installed are installed in alphabetical order, | |||||
| =package.el= built-in Emacs library is in charge of implicit dependencies. | |||||
| Installed packages not following the rules of 2. are removed as well as | |||||
| their dependencies if possible. (This last behavior is optional but default.) | |||||
| 4. The =pre-init=, =init= and =post-init= functions for each installed package | |||||
| are executed in turn. | |||||
| It is step four that interests us. It is very important that a package is not | |||||
| installed if no =init= function is defined for it. | |||||
| We say that a layer *owns* a package if it defines an =init= function for it. A | |||||
| layer does *not* own a package if it only defines =pre-init= or =post-init= | |||||
| functions. | |||||
| Only one layer may own a package. Since layers are processed in order of | |||||
| specification in the user's dotfile, it is possible for layers to "seize" | |||||
| ownership of a package that was owned by a previously enabled layer. | |||||
| * Case study: auto-completion | |||||
| Spacemacs provides a layer called =auto-completion= which provides | |||||
| auto-completion features in many modes. It does this using the package | |||||
| =company=. This layer owns the =company= package, so it defines a function | |||||
| called =auto-completion/init-company=. | |||||
| When a user enables the =auto-completion= layer, Spacemacs locates it and finds | |||||
| =company= in the list of packages. Provided that =company= is not excluded, | |||||
| either by the user or another layer, Spacemacs then locates and runs the =init= | |||||
| function for =company=. This function includes a call to =use-package= that sets | |||||
| up the basic configuration. | |||||
| However, auto-completion is a two-horse game. By its very nature, it is specific | |||||
| to the major mode in question. It is pointless to expect the =auto-completion= | |||||
| layer to include configuration for each conceivable major mode, and equally | |||||
| futile to expect each programming language layer (python, ruby, etc.) to fully | |||||
| configure =company= on their own. | |||||
| This is solved using the =post-init= functions. The Python layer, for example, | |||||
| includes the =company= package and defines a function called | |||||
| =python/post-init-company=. This function is called after | |||||
| =auto-completion/init-company=, but it is not called if | |||||
| - the =auto-completion= layer is not enabled, in which case no =init= function | |||||
| for =company= will be found, or | |||||
| - the =company= package is excluded either by the user or another layer | |||||
| As such, =python/post-init-company= is the /only/ safe place to put | |||||
| configuration related to =company= in Python mode. | |||||
| If the Python layer had defined an =init= function for =company=, that package | |||||
| would have been installed even if the =auto-completion= layer had been disabled, | |||||
| which is not what we want. | |||||
| * Layer tips and tricks | |||||
| ** Cross-dependencies | |||||
| Spacemacs provides a couple of additional useful functions you can use to check | |||||
| whether other layers or packages are included. | |||||
| - =configuration-layer/layer-usedp= :: check if a layer is enabled | |||||
| - =configuration-layer/package-usedp= :: check if a package is or will be installed | |||||
| These are useful in some cases, but usually you can get the desired result just | |||||
| by using =post-init= functions. | |||||
| For layers that require another layers to be enabled, use the functions | |||||
| =configuration-layer/declare-layer= and =configuration-layer/declare-layers= to | |||||
| ensure that layers are enabled even if the user has not enabled them explicitly. | |||||
| Calls to these functions must go in the =config.el= file. | |||||
| ** Use-package | |||||
| In the vast majority of cases, a package =init= function should do nothing but | |||||
| call to =use-package=. Again, in the vast majority of cases, all the | |||||
| configuration you need to do should be doable within the =:init= or =:config= | |||||
| blocks of such a call. | |||||
| What goes where? Since =:init= is executed before load and =:config= after, | |||||
| these rules of thumb apply. | |||||
| In =:config= should be | |||||
| - Anything that requires the package to be already loaded. | |||||
| - Anything that takes a long time to run, which would ruin startup performance. | |||||
| The =:init= block should contain setup for the entry points to the package. This | |||||
| includes keybindings, if the package should be loaded manually by the user, or | |||||
| hooks, if the package should be loaded upon some event. It is not unusual to | |||||
| have both! | |||||
| ** Use-package hooks | |||||
| Spacemacs includes a macro for adding more code to the =:init= or =:config= | |||||
| blocks of a call to =use-package=, after the fact. This is useful for =pre-init= | |||||
| or =post-init= functions to "inject" code into the =use-package= call of the | |||||
| =init= function. | |||||
| #+begin_src emacs-lisp | |||||
| (spacemacs|use-package-add-hook helm | |||||
| :pre-init | |||||
| ;; Code | |||||
| :post-init | |||||
| ;; Code | |||||
| :pre-config | |||||
| ;; Code | |||||
| :post-config | |||||
| ;; Code | |||||
| ) | |||||
| #+end_src | |||||
| Since a call to =use-package= may evaluate the =:init= block immediately, any | |||||
| function that wants to inject code into this block must run =before= the call to | |||||
| =use-package=. Further, since this call to =use-package= typically takes place | |||||
| in the =init-<package>= function, calls to =spacemacs|use-package-add-hook= | |||||
| typically happen in the =pre-init-<package>= functions, and not in | |||||
| =post-init-<package>=. It is quite safe to do this in =pre-init=, so that should | |||||
| be the default choice. | |||||
| ** Best practices | |||||
| If you break any of these rules, you should know what you are doing and have a | |||||
| good reason for doing it. | |||||
| *** Package ownership | |||||
| Each package should be owned by one layer only. The layer that owns the | |||||
| package should define its =init= function. Other layers should rely on | |||||
| =pre-init= or =post-init= functions. | |||||
| *** Localize your configuration | |||||
| *Each function can only assume the existence of one package.* With some | |||||
| exceptions, the =pre-init=, =init= and =post-init= functions can /only/ | |||||
| configure exactly the package they are defined for. Since the user can exclude | |||||
| an arbitrary set of packages, there is no /a priori/ safe way to assume that | |||||
| another package is included. Use =configuration-layer/package-usedp= if you | |||||
| must. | |||||
| This can be very challenging, so please take this as a guideline and not | |||||
| something that is absolute. It is quite possible for the user to break her | |||||
| Spacemacs installation by excluding the wrong packages, and it is not our | |||||
| intention to prevent this at all costs. | |||||
| *** Load ordering | |||||
| In Spacemacs, layers are loaded in order of inclusion in the dotfile, and | |||||
| packages are loaded in alphabetical order. In the rare cases where you make use | |||||
| of this property, you should make sure to document it well. Many will assume | |||||
| that layers can be included in arbitrary order (which is true in most cases), | |||||
| and that packages can be renamed without problems (which is also in most cases). | |||||
| Preferably, write your layer so that it is independent of load ordering. The | |||||
| =pre=- and =post-init= functions are helpful, together with | |||||
| =configuration-layer/package-usedp=. | |||||
| *** No require | |||||
| Do not use require. If you find yourself using =require=, you are almost | |||||
| certainly doing something wrong. Packages in Spacemacs should be loaded through | |||||
| auto-loading, and not explicitly by you. Calls to =require= in package init | |||||
| functions will cause a package to be loaded upon startup. Code in an =:init= | |||||
| block of =use-package= should not cause anything to be loaded, either. If you | |||||
| need a =require= in a =:config= block, that is a sign that some other package is | |||||
| missing appropriate auto-loads. | |||||
| *** Auto-load everything | |||||
| Defer everything. You should have a very good reason not to defer the loading | |||||
| of a package. | |||||
| * How do I ... idiomatically? | |||||
| ** Setup auto-completion for a major mode | |||||
| In your layer's =config.el=, call =spacemacs|defvar-company-backends=. | |||||
| #+begin_src emacs-lisp | |||||
| (spacemacs|defvar-company-backends yoyo-mode) | |||||
| #+end_src | |||||
| This creates a variable called =company-backends-yoyo-mode=. In the package | |||||
| =init= functions, you should push backends to this variable. But of course, only | |||||
| if the =auto-completion= layer is enabled. | |||||
| #+begin_src emacs-lisp | |||||
| (defconst yoyo-packages '( | |||||
| ;; ... | |||||
| some-weird-package | |||||
| ;; ... | |||||
| ) | |||||
| (when (configuration-layer/package-usedp 'company) | |||||
| (defun yoyo/init-some-weird-package () | |||||
| (use-package some-weird-package | |||||
| :defer t | |||||
| ;; This has to be in init because it's a package entry point | |||||
| :init | |||||
| (push 'some-weird-backend company-backends-yoyo-mode)))) | |||||
| #+end_src | |||||
| Finally, we must make sure company is started when we enter =yoyo-mode=, but | |||||
| again only if the =auto-completion= layer is enabled. | |||||
| #+begin_src emacs-lisp | |||||
| (defconst yoyo-packages '( | |||||
| ;; ... | |||||
| yoyo-mode | |||||
| ;; ... | |||||
| )) | |||||
| (defun yoyo/init-yoyo-mode () | |||||
| (use-package yoyo-mode | |||||
| ;; Some configuration goes here, however nothing relating to company | |||||
| ;; since this function may be called even if company is not installed! | |||||
| )) | |||||
| (when (configuration-layer/package-usedp 'company) | |||||
| (defun yoyo/post-init-yoyo-mode () | |||||
| ;; This makes no reference to `some-weird-package', which may have | |||||
| ;; been excluded by the user | |||||
| (spacemacs|add-company-hook yoyo-mode))) | |||||
| #+end_src | |||||
| @ -0,0 +1,177 @@ | |||||
| #+TITLE: Quick start | |||||
| * Configuration :TOC_4_gh:noexport: | |||||
| - [[#configuration-layers][Configuration layers]] | |||||
| - [[#dotfile-spacemacs][Dotfile (.spacemacs)]] | |||||
| - [[#dotdirectory-spacemacsd][Dotdirectory (~/.spacemacs.d)]] | |||||
| - [[#learning-spacemacs][Learning Spacemacs]] | |||||
| - [[#editing-styles][Editing Styles]] | |||||
| - [[#the-leader-keys][The leader keys]] | |||||
| - [[#evil-tutor][Evil-tutor]] | |||||
| - [[#universal-argument][Universal argument]] | |||||
| - [[#configuration-layers-and-package-discovery][Configuration layers and Package discovery]] | |||||
| - [[#key-bindings-discovery][Key bindings discovery]] | |||||
| - [[#describe-functions][Describe functions]] | |||||
| - [[#how-tos][How-To's]] | |||||
| * Configuration layers | |||||
| Spacemacs divides its configuration into self-contained units called | |||||
| =configuration layers=. These layers are stacked on top of each other | |||||
| to achieve a custom configuration. | |||||
| By default Spacemacs uses a dotfile called =~/.spacemacs= to control which | |||||
| layers to load. Within this file you can also configure certain features. | |||||
| A configuration layer is a directory containing at least a =packages.el= | |||||
| file which defines and configures packages to be downloaded from Emacs | |||||
| package repositories using the =package.el= built-in feature of Emacs. | |||||
| If you already have your own =Emacs= configuration you can move it to your | |||||
| own layer. | |||||
| The following command creates a layer in the =private= directory: | |||||
| #+BEGIN_EXAMPLE | |||||
| SPC SPC configuration-layer/create-layer RET | |||||
| #+END_EXAMPLE | |||||
| Any configuration layers you create must be explicitly loaded in =~/.spacemacs=. | |||||
| Note: For your privacy, the contents of the =private= directory are not | |||||
| under source control. See the section on private configuration management in | |||||
| the [[file:DOCUMENTATION.org][documentation]]. | |||||
| * Dotfile (.spacemacs) | |||||
| As mentioned =.spacemacs= controls which configuration layers to load and | |||||
| is also a means to customizing Spacemacs. | |||||
| The following command will create a =.spacemacs= file in your home directory: | |||||
| #+BEGIN_EXAMPLE | |||||
| SPC SPC dotspacemacs/install RET | |||||
| #+END_EXAMPLE | |||||
| To open the installed dotfile: | |||||
| #+BEGIN_EXAMPLE | |||||
| SPC f e d | |||||
| #+END_EXAMPLE | |||||
| To load some configuration layers using the variable | |||||
| =dotspacemacs-configuration-layers=: | |||||
| #+BEGIN_SRC elisp | |||||
| ;; List of configuration layers to load. | |||||
| dotspacemacs-configuration-layers '(auto-completion smex) | |||||
| #+END_SRC | |||||
| Some configuration layers support configuration variables to expose granular | |||||
| control over layer-specific features, [[file:../layers/+source-control/git/README.org][git layer]] being one such example. | |||||
| Variables can be directly set within =dotspacemacs-configuration-layers= like so: | |||||
| #+BEGIN_SRC elisp | |||||
| ;; List of configuration layers to load. | |||||
| dotspacemacs-configuration-layers '(auto-completion | |||||
| (git :variables | |||||
| git-magit-status-fullscreen t) | |||||
| smex) | |||||
| #+END_SRC | |||||
| At anytime you can apply the changes made to the dotfile or layers | |||||
| _without restarting_ Spacemacs by pressing ~SPC f e R~. | |||||
| The [[file:../core/templates/.spacemacs.template][dotfile template]] contain further information about how to customize | |||||
| Spacemacs. See the dotfile configuration section of the [[file:DOCUMENTATION.org][documentation]] for | |||||
| more details. | |||||
| * Dotdirectory (~/.spacemacs.d) | |||||
| Like =Emacs=, Spacemacs initialization can also be contained in an =init.el= file | |||||
| in a special directory =~/.spacemacs.d=. The contents of the dotfile should be | |||||
| then copied in the =init.el= file. | |||||
| The Emacs dotfile or dotdirectory is not replaced but rather | |||||
| complemented by the Spacemacs dotfile or dotdirectory. During startup, | |||||
| Emacs still uses =~/.emacs.d/init.el= (or =~/.emacs=) for its | |||||
| initialization, and variable =user-emacs-directory= will still point | |||||
| to =~/.emacs.d/=, even if =~/.spacemacs.d= or =~/.spacemacs= are | |||||
| present. Only now =~/.emacs.d/init.el= is provided by Spacemacs | |||||
| (e.g. after cloning the Spacemacs git repo into an empty | |||||
| =~/.emacs.d/=), and your own personnal configurations go into | |||||
| =~/.spacemacs.d/init.el= (or =~/.spacemacs=). | |||||
| Have a look into the FAQ for an easy workaround to maintain (your | |||||
| former) vanilla Emacs and (your new) Spacemacs configurations | |||||
| side-by-side without the need to rename and backup =~/.emacs.d/=. | |||||
| * Learning Spacemacs | |||||
| ** Editing Styles | |||||
| Spacemacs can be used by Vim users or Emacs users by setting the | |||||
| =dotspacemacs-editing-style= variable to =vim=, =emacs= or even =hybrid= | |||||
| in the dotfile =~/.spacemacs=. | |||||
| ** The leader keys | |||||
| Spacemacs key bindings use a leader key which is by default bound to | |||||
| ~SPC~ (space bar) in =vim= or =hybrid= editing styles and ~M-m~ in =emacs= | |||||
| style. | |||||
| You can change it by setting the variable =dotspacemacs-leader-key= if | |||||
| you use the =vim= style or =dotspacemacs-emacs-leader-key= if you use | |||||
| the =emacs= style (these variables must be set in the file =~/.spacemacs=). | |||||
| For simplicity the documentation always refers to the leader key as | |||||
| ~SPC~. | |||||
| There is secondary leader key called the major-mode leader key which is | |||||
| set to ~,~ by default. This key is a shortcut for ~SPC m~ | |||||
| where all the major-mode specific commands are bound. | |||||
| ** Evil-tutor | |||||
| If you are willing to learn the Vim key bindings (highly recommended since | |||||
| you can benefit from them even in =emacs= style), press ~SPC h T~ | |||||
| to begin an Evil-adapted Vimtutor. | |||||
| ** Universal argument | |||||
| In =vim= editing style the universal argument defaults to ~SPC u~ | |||||
| instead of ~C-u~ because the latter is used to scroll up as in Vim. | |||||
| ** Configuration layers and Package discovery | |||||
| By using =helm-spacemacs-help= with ~SPC h SPC~ you can quickly search | |||||
| for a package and get the name of the layers using it. | |||||
| You can also easily go to the =README.org= of a layer or go to the initialization | |||||
| function of a package. | |||||
| ** Key bindings discovery | |||||
| Thanks to [[https://github.com/justbur/emacs-which-key][which-key]], whenever a prefix command is pressed (like ~SPC~) | |||||
| a buffer appears after one second listing the possible keys for this prefix. | |||||
| It is also possible to search for specific key bindings by pressing: | |||||
| #+BEGIN_EXAMPLE | |||||
| SPC ? | |||||
| #+END_EXAMPLE | |||||
| To narrow the bindings list to those prefixed with =SPC=, | |||||
| type a pattern like this regular expression: | |||||
| #+BEGIN_EXAMPLE | |||||
| SPC\ b | |||||
| #+END_EXAMPLE | |||||
| which would list all =buffer= related bindings. *Note:* You are at the | |||||
| /HELM-Descbind/ prompt, the pattern consists of 6 letters: uppercase ~SPC~, a | |||||
| backslash, an actual space and a lowercase ~b~. | |||||
| ** Describe functions | |||||
| =Describe functions= are powerful Emacs introspection commands to get information | |||||
| about functions, variables, modes etc. These commands are bound thusly: | |||||
| | Key Binding | Description | | |||||
| |-------------+-------------------| | |||||
| | ~SPC h d f~ | describe-function | | |||||
| | ~SPC h d k~ | describe-key | | |||||
| | ~SPC h d m~ | describe-mode | | |||||
| | ~SPC h d v~ | describe-variable | | |||||
| * How-To's | |||||
| Some quick =how-to's= are compiled in the [[file:FAQ.org::How%20do%20I...][FAQ.org]] file. | |||||
| @ -0,0 +1,484 @@ | |||||
| #+TITLE: Migrating from Vim | |||||
| * Migrating from vim :TOC_4_gh:noexport: | |||||
| - [[#purpose-of-this-document][Purpose of this document]] | |||||
| - [[#philosophy][Philosophy]] | |||||
| - [[#basic-orientation][Basic orientation]] | |||||
| - [[#terms][Terms]] | |||||
| - [[#modes-vs-states][Modes vs. States]] | |||||
| - [[#layers][Layers]] | |||||
| - [[#transient-states][Transient-states]] | |||||
| - [[#keybinding-conventions][Keybinding conventions]] | |||||
| - [[#running-commands][Running commands]] | |||||
| - [[#buffer-and-window-management][Buffer and window management]] | |||||
| - [[#buffers][Buffers]] | |||||
| - [[#special-buffers][Special buffers]] | |||||
| - [[#windows][Windows]] | |||||
| - [[#files][Files]] | |||||
| - [[#the-help-system][The Help System]] | |||||
| - [[#exploring][Exploring]] | |||||
| - [[#customization][Customization]] | |||||
| - [[#the-spacemacs-file][The .spacemacs file]] | |||||
| - [[#emacs-lisp][Emacs Lisp]] | |||||
| - [[#variables][Variables]] | |||||
| - [[#keybindings][Keybindings]] | |||||
| - [[#functions][Functions]] | |||||
| - [[#activating-a-layer][Activating a Layer]] | |||||
| - [[#creating-a-layer][Creating a Layer]] | |||||
| - [[#installing-a-single-package][Installing a single package]] | |||||
| - [[#loading-packages][Loading packages]] | |||||
| - [[#uninstalling-a-package][Uninstalling a package]] | |||||
| - [[#common-tweaks][Common tweaks]] | |||||
| - [[#changing-the-escape-key][Changing the escape key]] | |||||
| - [[#changing-the-colorscheme][Changing the colorscheme]] | |||||
| - [[#nohlsearch][Nohlsearch]] | |||||
| - [[#sessions][Sessions]] | |||||
| - [[#navigating-using-visual-lines][Navigating using visual lines]] | |||||
| - [[#other-useful-links][Other useful links]] | |||||
| * Purpose of this document | |||||
| This document is intended to supplement the Spacemacs documentation by bridging | |||||
| the gap between vim and Spacemacs. While some information may be duplicated, | |||||
| this does not replace the Spacemacs documentation. It is recommended that you | |||||
| read both files to fully understand Spacemacs. | |||||
| [[file:DOCUMENTATION.org][Spacemacs Documentation]] | |||||
| * Philosophy | |||||
| One misconception many vim users have is that Spacemacs is an Emacs /clone/ of | |||||
| vim. Spacemacs does not seek to completely mimic the behavior of vim | |||||
| everywhere, only when editing. You should not expect every vim command to be | |||||
| available, although many are. You cannot use Vimscript to configure Spacemacs, | |||||
| but who likes Vimscript anyway? It is important to understand that Spacemacs is | |||||
| an attempt to improve on both vim and Emacs using the superior modal editing of | |||||
| vim and the nicer configuration language of Emacs. | |||||
| * Basic orientation | |||||
| ** Terms | |||||
| Spacemacs uses some different terminology than vim, which can cause confusion | |||||
| for new users. This section attempts to clear up any confusion. | |||||
| *** Modes vs. States | |||||
| In vim you have various editing modes like =insert mode= and =visual mode= to | |||||
| manipulate text. In Emacs, we have [[./DOCUMENTATION.org#states][states]]. These are equivalent to vim modes. | |||||
| For example, =evil-insert-state= is the same as =insert-mode= in vim. | |||||
| A =minor-mode= in Emacs is like a feature that is activated. For example, | |||||
| =aggressive-indent-mode= is a =minor-mode= that automatically indents code as you | |||||
| type. It is important to know that there can be many =minor-modes= activated in a | |||||
| buffer. Many Emacs packages work by providing a =minor-mode=. A =major-mode= | |||||
| determines the editing behavior of Emacs in the current buffer. There is | |||||
| generally a corresponding =major-mode= per filetype. An example of a =major-mode= is | |||||
| =python-mode=, which provides python specific settings in python files. There is | |||||
| only one =major-mode= per buffer. | |||||
| *** Layers | |||||
| Spacemacs has the concept of layers. Layers are similar to vim plugins. They | |||||
| provide new features to use in Spacemacs. However, layers are often comprised of | |||||
| several packages that integrate well with each other. For example, the =python= | |||||
| layer includes support for auto-completion, documentation look-up, tests, and | |||||
| much more by using several different packages. This keeps you from thinking | |||||
| about what packages to install, and instead worry about what features you want. | |||||
| More information on layers can be found in the [[./VIMUSERS.org#customization][customization]] section and in the | |||||
| [[./DOCUMENTATION.org#configuration-layers][documentation]]. There is also a more in-depth guide on writing layers [[file:LAYERS.org][here]]. | |||||
| *** Transient-states | |||||
| Spacemacs provides a special functionality called transient-states. Transient-states | |||||
| allow similar commands to be run in succession without repeatedly pressing the | |||||
| ~<Leader>~ key. Transient-states are usually triggered by using a keybinding with the | |||||
| following pattern: ~<Leader> <group> .~ where group is the category the | |||||
| transient-state falls under. When in a transient-state you will see documentation at the | |||||
| bottom of your window. To exit a transient-state press ~q~. | |||||
| #+CAPTION: Transient-state documentation window | |||||
| [[file:img/spacemacs-scale-transient-state.png]] | |||||
| ** Keybinding conventions | |||||
| Spacemacs uses ~SPC~ as its ~<Leader>~ key. This document will use ~SPC~ to refer to | |||||
| the ~<Leader>~ key. All keybindings are mnemonic and are organized under the | |||||
| ~<Leader>~ key. For example, the keybindings for language-specific commands are | |||||
| always under the ~SPC m~ prefix. A full list of conventions used in Spacemacs is | |||||
| [[./CONVENTIONS.org][here]]. Note that all keybindings can be changed. | |||||
| Spacemacs uses [[https://github.com/justbur/emacs-which-key][which-key]] to show available keybindings after a delay: | |||||
| #+CAPTION: Which-key window | |||||
| [[file:img/which-key.png]] | |||||
| ** Running commands | |||||
| Emacs commands can be run using ~SPC SPC~. This will pop up a buffer using [[https://github.com/emacs-helm/helm][Helm]] | |||||
| which can be used to run any Emacs command. You can also run many ex commands | |||||
| using ~:~, just like in vim. | |||||
| Note: You can run Emacs interactive commands using ~:~, but you cannot run ex | |||||
| commands using ~SPC SPC~. | |||||
| ** Buffer and window management | |||||
| *** Buffers | |||||
| Buffers in Emacs and vim are essentially the same. The keybindings for buffers | |||||
| are located under the ~SPC b~ prefix. | |||||
| | Keybinding | Function | | |||||
| |---------------------------+------------------------------------------------------| | |||||
| | ~SPC b b <buffer-name>~ | Create a buffer named =<buffer-name>=. | | |||||
| | ~SPC b b~ | Search through open buffers and recent files. | | |||||
| | ~SPC b n~ or ~:bnext~ | Switch to the next buffer. (See [[*Special%20buffers][Special buffers]]) | | |||||
| | ~SPC b p~ or ~:bprevious~ | Switch to the previous buffer. (See [[*Special%20buffers][Special buffers]]) | | |||||
| | ~SPC b d~ or ~:bdelete~ | Kill current buffer. | | |||||
| | ~SPC b C-d~ | Kill buffers using a regular expression. | | |||||
| | ~SPC b m~ | Kill all buffers except the current buffer. | | |||||
| | ~SPC b .~ | Buffer transient-state. | | |||||
| **** Special buffers | |||||
| By default Emacs creates a lot of buffers that most people will never need, like | |||||
| =*Messages*=. Spacemacs automatically ignores these when using these | |||||
| key bindings. More information can be found [[./DOCUMENTATION.org#special-buffers][here]]. | |||||
| *** Windows | |||||
| Windows are like splits in vim. They are useful for editing multiple files at | |||||
| once. All window keybindings are under the ~SPC w~ prefix. | |||||
| | Keybinding | Function | | |||||
| |------------------------+--------------------------------------| | |||||
| | ~SPC w v~ or ~:vsplit~ | Opens a vertical split on the right. | | |||||
| | ~SPC w s~ or ~:split~ | Opens a horizontal split below. | | |||||
| | ~SPC w h/j/k/l~ | Navigate among windows. | | |||||
| | ~SPC w H/J/K/L~ | Move the current window. | | |||||
| | ~SPC w .~ | Window transient-state. | | |||||
| ** Files | |||||
| All file commands in Spacemacs are available under the ~SPC f~ prefix. | |||||
| | Keybinding | Function | | |||||
| |-------------------+--------------------------------------------------------------| | |||||
| | ~SPC f f~ | Opens a buffer to search for files in the current directory. | | |||||
| | ~SPC f r~ | Opens a buffer to search through recently opened files. | | |||||
| | ~SPC f s~ or ~:w~ | Save the current file. | | |||||
| | ~:x~ | Save the current file and quit. | | |||||
| | ~:e <file>~ | Open =<file>= | | |||||
| ** The Help System | |||||
| Emacs has an extensive help system. All keybindings under the ~SPC h d~ prefix | |||||
| allow convenient access to the help system. The most important of these | |||||
| keybindings are ~SPC h d f~ , ~SPC h d k~ , and ~SPC h d v~. There is also the | |||||
| ~SPC <f1>~ keybinding which allows you to search for documentation. | |||||
| | Keybinding | Function | | |||||
| |-------------+----------------------------------------------------------------------------------| | |||||
| | ~SPC h d f~ | Prompts for a function and shows its documentation. | | |||||
| | ~SPC h d k~ | Prompts for a keybinding and shows what it is bound to. | | |||||
| | ~SPC h d v~ | Prompts for a variable and shows its documentation and current value. | | |||||
| | ~SPC <f1>~ | Searches for a command, function, variable, or face and shows its documentation. | | |||||
| Whenever, you see weird behavior or want to know what something does, these | |||||
| functions are the first thing you should refer to. | |||||
| ** Exploring | |||||
| There are a few ways to explore the functionality of Spacemacs. One is to read | |||||
| the [[https://github.com/syl20bnr/spacemacs][source code]] on Github. You can begin to feel your way around Emacs Lisp and | |||||
| how Spacemacs works this way. You can also use the following keybindings to | |||||
| explore: | |||||
| | Keybinding | Function | | |||||
| |-------------+---------------------------------------------------------------| | |||||
| | ~SPC h SPC~ | Lists all layers and allows you to view files from the layer. | | |||||
| | ~SPC ?~ | Lists all keybindings. | | |||||
| * Customization | |||||
| ** The .spacemacs file | |||||
| When you first start spacemacs, you will be prompted to choose an editing style. | |||||
| If you are reading this, you likely want to choose the vim style. A =.spacemacs= | |||||
| file will be created with the appropriate style selected. Most trivial | |||||
| configuration will go in this file. | |||||
| There are four top-level functions in the file: =dotspacemacs/layers=, | |||||
| =dotspacemacs/init=, =dotspacemacs/user-init= and =dotspacemacs/user-config=. | |||||
| The =dotspacemacs/layers= function exist only to enable and disable layers and | |||||
| packages. The =dotspacemacs/init= function is run before anything else during | |||||
| startup and contains Spacemacs settings. You will never need to touch this | |||||
| function except to change default Spacemacs settings. | |||||
| The =dotspacemacs/user-init= function is also run before anything else and | |||||
| contains user specific configuration. The =dotspacemacs/user-config= function | |||||
| is the one you will use the most. This is where you define any user configuration. | |||||
| | Keybinding | Function | | |||||
| |-------------+--------------------------------------------------------------------------| | |||||
| | ~SPC f e d~ | Open your =.spacemacs= | | |||||
| | ~SPC f e D~ | Update your =.spacemacs= manually using a diff with the default template | | |||||
| ** Emacs Lisp | |||||
| This section introduces a few emacs lisp functions that are needed to configure | |||||
| Spacemacs. For a more detailed look at the language, see [[http://learnxinyminutes.com/docs/elisp/][this]] link. If you | |||||
| really want to learn everything there is about emacs lisp, use the info page | |||||
| found at ~SPC h i elisp RET~ . | |||||
| *** Variables | |||||
| Setting variables is the most common way to customize the behavior of Spacemacs. | |||||
| The syntax is simple: | |||||
| #+begin_src emacs-lisp | |||||
| (setq variable value) ; Syntax | |||||
| ;; Setting variables example | |||||
| (setq variable1 t ; True | |||||
| variable2 nil ; False | |||||
| variable3 '("A" "list" "of" "things")) | |||||
| #+end_src | |||||
| *** Keybindings | |||||
| Defining keybindings is something that almost everyone will want to do. The | |||||
| built-in =define-key= function is the best way to do that. | |||||
| #+begin_src emacs-lisp | |||||
| (define-key map new-keybinding function) ; Syntax | |||||
| ;; Map H to go to the previous buffer in normal mode | |||||
| (define-key evil-normal-state-map (kbd "H") 'previous-buffer) | |||||
| ;; Mapping keybinding to another keybinding | |||||
| (define-key evil-normal-state-map (kbd "H") (kbd "^")) ; H goes to beginning of the line | |||||
| #+end_src | |||||
| The map is the keymap you want to bind the key in. Most of the time you will use | |||||
| =evil-<state-name>-state-map=. These correspond to different =evil-mode= states. | |||||
| For example, using =evil-insert-state-map= maps the keybinding in insert mode. | |||||
| To map ~<Leader>~ keybindings, use the =spacemacs/set-leader-keys= function. | |||||
| #+begin_src emacs-lisp | |||||
| (spacemacs/set-leader-keys key function) ; Syntax | |||||
| ;; Map killing a buffer to <Leader> b c | |||||
| (spacemacs/set-leader-keys "bc" 'spacemacs/kill-this-buffer) | |||||
| ;; Map opening a link to <Leader> o l only in org-mode (works for any major-mode) | |||||
| (spacemacs/set-leader-keys-for-major-mode 'org-mode | |||||
| "ol" 'org-open-at-point) | |||||
| #+end_src | |||||
| *** Functions | |||||
| You may occasionally want to define a function to do a more complex | |||||
| customization. The syntax is simple: | |||||
| #+begin_src emacs-lisp | |||||
| (defun func-name (arg1 arg2) | |||||
| "docstring" | |||||
| ;; Body | |||||
| ) | |||||
| ;; Calling a function | |||||
| (func-name arg1 arg1) | |||||
| #+end_src | |||||
| Here is an example of a function that is useful in real life: | |||||
| #+begin_src emacs-lisp | |||||
| ;; This snippet allows you to run clang-format before saving | |||||
| ;; given the current file as the correct filetype. | |||||
| ;; This relies on the c-c++ layer being enabled. | |||||
| (defun clang-format-for-filetype () | |||||
| "Run clang-format if the current file has a file extensions | |||||
| in the filetypes list." | |||||
| (let ((filetypes '("c" "cpp"))) | |||||
| (when (member (file-name-extension (buffer-file-name)) filetypes) | |||||
| (clang-format-buffer)))) | |||||
| ;; See http://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html for | |||||
| ;; what this line means | |||||
| (add-hook 'before-save-hook 'clang-format-for-filetype) | |||||
| #+end_src | |||||
| ** Activating a Layer | |||||
| As said in the terms section, layers provide an easy way to add features. | |||||
| Activating a layer is done in the =.spacemacs= file. In the file search for the | |||||
| =dotspacemacs-configuration-layers= variable. By default, it should look like | |||||
| this: | |||||
| #+begin_src emacs-lisp | |||||
| (defun dotspacemacs/layers () | |||||
| (setq-default | |||||
| ;; ... | |||||
| dotspacemacs-configuration-layers '(;; auto-completion | |||||
| ;; better-defaults | |||||
| emacs-lisp | |||||
| ;; (git :variables | |||||
| ;; git-gutter-use-fringe t) | |||||
| ;; markdown | |||||
| ;; org | |||||
| ;; syntax-checking | |||||
| ))) | |||||
| #+end_src | |||||
| You can uncomment these suggested layers by deleting the semi-colons for a nice | |||||
| out-of-the-box experience. To add a layer, add its name to the list and restart | |||||
| Emacs or press ~SPC f e R~ . To view all layers and their documentation use ~SPC | |||||
| h SPC~. | |||||
| ** Creating a Layer | |||||
| To group configuration or when configuration doesn't fit well in your | |||||
| =.spacemacs= file, you can create a configuration layer. Spacemacs provides a | |||||
| builtin command to generate the layer boilerplate: ~SPC SPC | |||||
| configuration-layer/create-layer~. This generates a folder that looks like this: | |||||
| #+BEGIN_EXAMPLE | |||||
| [layer-name] | |||||
| |__ [local]* | |||||
| | |__ [example-mode-1] | |||||
| | | ... | |||||
| | |__ [example-mode-n] | |||||
| |__ config.el* | |||||
| |__ funcs.el* | |||||
| |__ keybindings.el* | |||||
| |__ packages.el | |||||
| [] = directory | |||||
| * = not created by the command | |||||
| #+END_EXAMPLE | |||||
| The =packages.el= file contains a list of packages that you can install in the | |||||
| variable =<layer-name>-packages=. Any package that is available on the [[http:melpa.org][MELPA]] | |||||
| repository can be added to the list. A list can also exclude packages using the | |||||
| =:excluded t= property. | |||||
| Each package requires a function to initialize it. The function /must/ be named | |||||
| with this pattern: =<layer-name>/init-<package-name>=. This function contains | |||||
| configuration for the package. There are also =pre/post-init= functions to | |||||
| execute code before or after a package loads. It would look like this: | |||||
| #+begin_src emacs-lisp | |||||
| (setq layer-name-packages '(example-package | |||||
| ;; This layer uninstalls example-package-2 | |||||
| ;; by setting the :excluded property to true (t) | |||||
| (example-package-2 :excluded t))) | |||||
| (defun layer-name/post-init-package () | |||||
| ;; Add configuration to a package in another layer here | |||||
| ) | |||||
| (defun layer-name/init-example-package () | |||||
| ;; Configuration for example-package goes here | |||||
| ) | |||||
| #+end_src | |||||
| **Note**: Only one layer can have a =init= function for a package. If you want | |||||
| to override the configuration of a package in another layer, use a | |||||
| =<layer-name>/pre-init= function in addition to [[file:LAYERS.org#use-package-hooks][use-package hooks]]. | |||||
| If a package is not available on MELPA, you must use a local package or a | |||||
| package recipe. For more details see [[file:LAYERS.org#anatomy-of-a-layer][anatomy of a layer]]. | |||||
| Make sure you [[Activating a Layer][add]] your layer to your =.spacemacs= file and restart to | |||||
| activate it. | |||||
| A detailed description of the loading process and how layers work can be found in | |||||
| [[file:LAYERS.org][LAYERS.org]]. | |||||
| ** Installing a single package | |||||
| Sometimes creating a layer is a bit overkill. Maybe you just want one package | |||||
| and don't want to maintain a whole layer. Spacemacs provides a variable in the | |||||
| =dotspacemacs/layers= function in =.spacemacs= called | |||||
| =dotspacemacs-additional-packages=. Just add a package name to the list and it | |||||
| will be installed when you restart. Loading the package is covered in the next | |||||
| [[Loading packages][section]]. | |||||
| ** Loading packages | |||||
| Ever wonder how Spacemacs can load over a 100 packages in just a few seconds? | |||||
| Such low loading times must require some kind of unreadable black magic that no | |||||
| one can understand. Thanks to [[https://github.com/jwiegley/use-package][use-package]], this is not true. It is a package | |||||
| that allows easy lazy-loading and configuration of packages. Here are the basics | |||||
| to using it: | |||||
| #+begin_src emacs-lisp | |||||
| ;; Basic form of use-package declaration. The :defer t tells use-package to | |||||
| ;; try to lazy load the package. | |||||
| (use-package package-name | |||||
| :defer t) | |||||
| ;; The :init section is run before the package loads The :config section is | |||||
| ;; run after the package loads | |||||
| (use-package package-name | |||||
| :defer t | |||||
| :init | |||||
| (progn | |||||
| ;; Change some variables | |||||
| (setq variable1 t variable2 nil) | |||||
| ;; Define a function | |||||
| (defun foo () | |||||
| (message "%s" "Hello, World!"))) | |||||
| :config | |||||
| (progn | |||||
| ;; Calling a function that is defined when the package loads | |||||
| (function-defined-when-package-loads))) | |||||
| #+end_src | |||||
| This is just a very basic overview of =use-package=. There are many other ways | |||||
| to control how a package loads using it that aren't covered here. | |||||
| ** Uninstalling a package | |||||
| Spacemacs provides a variable in the =dotspacemacs/init= function in | |||||
| =.spacemacs= called =dotspacemacs-excluded-packages=. Just add a package name to | |||||
| the list and it will be uninstalled when you restart. | |||||
| ** Common tweaks | |||||
| This section is for things many will want to change. All of these settings go in | |||||
| the =dotspacemacs/user-config= function in your =.spacemacs= unless otherwise noted. | |||||
| *** Changing the escape key | |||||
| Spacemacs uses [[https://github.com/syl20bnr/evil-escape][evil-escape]] to | |||||
| allow escaping from many =major-modes= with one keybinding. You can customize | |||||
| the variable in your =dotspacemacs/user-config= like this: | |||||
| #+begin_src emacs-lisp | |||||
| (defun dotspacemacs/user-config () | |||||
| ;; ... | |||||
| ;; Set escape keybinding to "jk" | |||||
| (setq-default evil-escape-key-sequence "jk")) | |||||
| #+end_src | |||||
| More documentation is found in the =evil-escape= [[https://github.com/syl20bnr/evil-escape/blob/master/README.md][README]]. | |||||
| *** Changing the colorscheme | |||||
| The =.spacemacs= file contains the =dotspacemacs-themes= variable in the | |||||
| =dotspacemacs/init= function. This is a list of themes that can be cycled | |||||
| through with the ~SPC T n~ keybinding. The first theme in the list is the one | |||||
| that is loaded at startup. Here is an example: | |||||
| #+begin_src emacs-lisp | |||||
| (defun dotspacemacs/init | |||||
| ;; Darktooth theme is the default theme | |||||
| ;; Each theme is automatically installed. | |||||
| ;; Note that we drop the -theme from the package name. | |||||
| ;; Ex. darktooth-theme -> darktooth | |||||
| (setq-default dotspacemacs-themes '(darktooth | |||||
| soothe | |||||
| gotham))) | |||||
| #+end_src | |||||
| All installed themes can be listed and chosen using the ~SPC T h~ keybinding. | |||||
| *** Nohlsearch | |||||
| Spacemacs emulates the default vim behavior which highlights search results even | |||||
| when you are not navigating between them. You can use ~SPC s c~ or ~:nohlsearch~ | |||||
| to disable search result highlighting. | |||||
| To disable the result highlighting when it is not needed anymore automatically, | |||||
| you can [[Uninstalling a package][uninstall]] the =evil-search-highlight-persist= package. | |||||
| *** Sessions | |||||
| Spacemacs does not automatically restore your windows and buffers when you | |||||
| reopen it. If you use vim sessions regularly you may want to set | |||||
| =dotspacemacs-auto-resume-layouts= to =t= in your =.spacemacs=. | |||||
| *** Navigating using visual lines | |||||
| Spacemacs uses the vim default of navigating by actual lines, even if they are | |||||
| wrapped. If you want ~j~ and ~k~ to behave like ~g j~ and ~g k~, add this to | |||||
| your =.spacemacs=: | |||||
| #+begin_src emacs-lisp | |||||
| (define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line) | |||||
| (define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line) | |||||
| #+end_src | |||||
| * Other useful links | |||||
| - [[https://www.gnu.org/software/emacs/manual/emacs.html][Emacs Manual]] | |||||
| - [[file:DOCUMENTATION.org][Spacemacs Documentation]] | |||||
| - [[http://ian.mccowan.space/2015/04/07/Spacemacs/][Spacemacs: A Vimmer's Emacs Prerequisites]] | |||||
| - Note: The article refers to ~SPC b s~ as the keybinding to switch buffers. | |||||
| It is ~SPC b b~ | |||||
| - [[http://thume.ca/howto/2015/03/07/configuring-spacemacs-a-tutorial/][Configuring Spacemacs: A Tutorial]] | |||||
| - [[http://juanjoalvarez.net/es/detail/2014/sep/19/vim-emacsevil-chaotic-migration-guide/][From Vim to Emacs+Evil chaotic migration guide]] | |||||