diff --git a/.gitignore b/.gitignore index 22e8323..2dab54b 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ python-*-docs-html /session.* /srecode-map.el /recentf +.mc-lists.el # Private directory private/ diff --git a/.travis-build.sh b/.travis-build.sh index 0b8be23..6be4ead 100755 --- a/.travis-build.sh +++ b/.travis-build.sh @@ -21,7 +21,7 @@ fi if [ $TRAVIS_SECURE_ENV_VARS = false ] && [ $TRAVIS_PULL_REQUEST != false ] && - [ $TRAVIS_BRANCH = "master" ]; then + [ "$TRAVIS_BRANCH" = "master" ]; then printf '=%.0s' {1..70} printf "\n し(*・∀・)/ Thanks for the contribution! \(・∀・*)ノ\n" @@ -32,6 +32,23 @@ if [ $TRAVIS_SECURE_ENV_VARS = false ] && exit 1 fi +if [ "${FORMATTING}" = "space-test" ]; then + cd "${TRAVIS_BUILD_DIR}" + echo "Testing for trailing and all sorts of broken white spaces" + echo "TRAVIS_COMMIT_RANGE: ${TRAVIS_COMMIT_RANGE}" + first_commit=`echo ${TRAVIS_COMMIT_RANGE} | sed -r 's/\..*//'` + git reset -q "${first_commit}" +## git reset -q HEAD~1 + git diff --check > space_test_result + if [[ -s space_test_result ]]; then + cat space_test_result + exit 1 + fi + echo "No bad spaces detected" + exit 0 +fi + +# Emacs tests echo "Pwd $(pwd)" rm -rf ~/.emacs.d ln -sf `pwd` ~/.emacs.d diff --git a/.travis.yml b/.travis.yml index 6a8b254..e440e2c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,20 @@ branches: - develop before_install: - - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh - - evm install $EVM_EMACS --use --skip + - if [ ! -z "$EVM_EMACS" ]; then curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh; fi + - if [ ! -z "$EVM_EMACS" ]; then evm install $EVM_EMACS --use --skip; fi env: - EVM_EMACS=emacs-24.4-travis - EVM_EMACS=emacs-24.5-travis + - EVM_EMACS=emacs-25.1-travis - EVM_EMACS=emacs-git-snapshot-travis + - FORMATTING=space-test matrix: fast_finish: true allow_failures: - env: - - EVM_EMACS=emacs-git-snapshot-travis + - env: EVM_EMACS=emacs-git-snapshot-travis script: - ./.travis-build.sh diff --git a/CHANGELOG.org b/CHANGELOG.org index 9773499..f135c35 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1,4 +1,216 @@ * Release 0.200.x +** 0.200.9 (2017/04/06) +*** Fixes +- Fix theme loading with terminal Emacs (thanks to wang0z) +** 0.200.8 (2017/04/01) +*** Convention changes +- Update debug conventions + - Step in and Step out are now, ~i~ and ~o~ respectively + - Inspect a value is now ~v~ + - Next step is now ~s~ +*** Dotspacemacs changes +- Improve variable =dotspacemacs-line-numbers=. The variable can now take a + property list with the following keywords supported: =:relative t= to turn on + relative lines, =:disabled-for-modes mode1 mode2 ...= to disable line numbers + in specific major modes and =:size-limit-kb n= to disable line numbers when + the size of the buffer is greater than n (thanks to deb0ch) +*** Core changes +- Import =quela=, =package-build=, =ido-vertical-mode= and =spacemacs-theme= in + =core/libs= +- Speedup ~SPC h SPC~ loading. +- Force installation of =org-contrib-plus= instead of =org= effectively avoiding + to install Org twice. +- Display some additional information message in mode-line at startup. +- Throw an error instead of a warning if emacs version is too old + (thanks to deb0ch) +- Refactor =rotate-windows= (thanks to bmag) +- Don’t toggle maximized window at startup if already maximized + (thanks to TheBB) +- Set default value of =dotspacemacs-enable-paste-transient-state= to nil to + reflect its value in the doftile template (tanks to toupeira) +- which-key: Update usage of replacement alists (thanks to justbur) +- which-key: Fix transient state descriptions (thanks to justbur) +- which-key: Implement combined select window keys (thanks to justbur) +- Maximize frame earlier in the startup process (thanks to deb0ch) +- Fix unbound holy-mode error (thanks to TheBB) +- Fix error on footer insertion when window is narrow (thanks to deb0ch) +- Fix encoding of =;= in issue report body (thanks to d12frosted) +- Fix variable is void: system-info in spacemacs/report-issue +- Fix delayed warning display in emacs 25.5 +- Fix computation of package installation lazyness +- Fix false warning about duplicate layers at startup. (thanks to puzl) +- Fix indentation rules for declare-prefix functions +- Add support for interpreter-mode-alist to layer lazy installation +- Add support for local elpa repositories +- Always return `t` from use-package pre/post hooks. (thanks to Stebalien) +- Jump-handers =:async= keyword can now take a predicate function +- home buffer: update quickhelp.txt in [?] (thanks to kccai) +- Filter out private vars in dotspacemacs/get-variable-string-list +- Add support for go to definition in other window with ~SPC m g G~ +- Scope minor-mode specific key bindings under major-mode leader +*** Distribution layer changes +- New key binding ~SPC w +~ to toggle between vertical and horizontal windows + layout (thanks to nixmaniack, bmag) +- New key binding ~SPC w TAB~ to go to last selected window (thanks to adelq) +- New key binding ~gf~ in compilation mode to find file at point + (thanks to FrancescElies) +- New key binding ~gD~ to jump to definition in another window + (thanks to quicknir) +- New key binding ~SPC x l S~ to reverse sort lines (duianto) +- New key bindings ~SPC x l c~ and ~SPC x l C~ to sort lines by column (duianto) +- New key binding ~SPC f T~ to jump to currently opened file in =neotree= + (thanks to arjun-urs) +- New key binding ~'~ in =neotree= to take a quick look at the currently + selected file (thanks to sdwolf) +- Overhaul the buffer transient state on ~SPC b .~ (thanks to quicknir) +- Improve =spacemacs/count-word-analysis= by including information from + =count-words= function +- Use use =winum.el= instead of =window-numbering.el= for window numbers + (thanks to deb0ch) +- Add copy key to neotree under ~C~ (thanks to lanejo01) +- Move generation of tags from ~SPC p C-g~ to easier ~SPC p G~ (thanks to TheBB) +- Add duplicate-line-or-region on ~SPC x l d~ (thanks to deb0ch) +- Integrate =auto-highlight-symbol= with =evil= as well as =isearch= + (thanks to TheBB) +- Change default fringe color for centered-buffer-mode. +- Use =helm= or =ivy= as completion framework for =dumb-jump= (thanks to deuill) +- Hide PROPERTIES drawers in space-doc-mode (thanks to nikolaiam) +- Disable auto-revert of =buffer-menu-mode= (thanks to bgamari) +- Fix spacemacs/rename-current-buffer-file on non-file buffers + (thanks to lislon) +*** Layer changes +**** Ansible +- Add support for =ansible-vault= (auto-de/encryption of files) +- Add support for =company= with =company-ansible= package +**** Auto-completion +- Add new package =fuzzy= for =auto-complete=. +**** Better defaults +- Add new package =unfill= (thanks to d12frosted) +**** Chinese +- Move =pyim= into the =.cache= directory (thanks to DCPRevere) +**** Chrome ++ Add package =flymd=. Flymd is a realtime markdown preview (hodge) +**** Clojure +- Update debugger key bindings to meet new conventions +- Add new key bindings to convert collections (thanks to benedekfazekas) +- Fix calls to =cider-test-xxxx= functions (thanks to mahinshaw) +**** Common Lisp +- Add neew key binding ~SPC m h i~ to inspect a definition +- Set jump handler to =slime-edit-definition= (thanks to phoe) +**** CSharp +- Fix Omnisharp jump handler by marking it async (thanks to razzmatazz) +**** Elixir +- Add support for =credo= (denin) +- Prevent from inserting too many "end"s in Elixir (thanks to michalmuskala) +**** Emacs Lisp +- Fix cursor position for =eval-last-sexp=. +- Add ~SPC m e c~ to evaluate current sexp. Evaluation of current =setq= or + =defun= form is under ~SPC m e C~. +- Add support for =debugger= and =edebug=, see tutorial in =README.org= file. +**** Extra-langs +- Add extension =.wl= for =wolfram-mode= (kenkangxgwe) +**** Finance +- Add new key bindings for ledger account reconciliation (thanks to timjaeger) +**** Games +- Add =sudoku= game. (thanks to et2010) +**** Go +- Fix void reference to =go--position-bytes= (thanks to db47h) +**** Haskell +- Update debugger key bindings to meet new conventions +**** Html +- Defer =company-web= loading (ralesi) +**** IBuffer +- New key bindings ~g r~ to update buffer, ~g j~ to move to next filter group + and ~g k~ to move to previous filter group (thanks to donm) +**** IPthon-notebook +- Fix =axes.color_cycle= warning in matplotlibrc (thanks to Retorz) +**** Ivy +- Rebind ~SPC f b~ to =counsel-bookmark= (thanks to gilbertw1) +- Add confirmation between deleting a file with ~d~ (thanks to d12frosted) +- Add C-c C-e to edit counsel-ag search results (thanks to aaronjensen) +- Correctly close =ivy= layout transient state when pressing ~b~ + (thanks to gilbertw1) +**** Javascript +- Fix jump handler using =tern= by marking it async (thanks to coreygrunewald) +**** LaTeX +- Add new key bindings for folding functions (thanks to nashamri) +**** Markdown +- Add new key binding ~SPC m i t~ to insert a Table of Contents +- Fix activation of =mmm-mode= +- Add support for ini files +- Hide =MMM= linter in mode-line +**** Org +- New key binding ~,~ for =org-edit-src-exit= (thanks to david-sawatzke) +- New key binding ~SPC m i a~ for =org-attach= (thanks to smile12341234) +- Move ~SPC m e~ to ~SPC m e e~ for =org-export-dispatch= +- Fix ~o~ on folded headings (thanks to dschoepe) +**** Prodigy +- Add new key binding ~R~ to refresh buffer (thanks to FrancescElies) +- Add new key binding ~gf~ to go to file at point (thanks to FrancescElies) +**** Python +- New layer variable =python-auto-set-local-pyvenv-virtualenv= to autoload + a virtual env with a =.venv= file (thanks to korayal) +- Simplify python test runner setup (thanks to TheBB) +- Fix debug string for python3 (thanks to yangguang760) +- Fix python path with virtualenv on Windows in Python nose package + (thanks to brenttaylor) +- Fix python-enable-yapf-format-on-save (thanks to magia) +**** Restclient +- Add package =ob-restclient= to add =org-babel= support to =restclient= +- Add helm support to jump to variable or request with ~SPC m j~ (thanks to tko) +- Add autocompletion for methods and headers (thanks to tko) +- Add key bindings for jump to next / previous query with ~SPC m n~ and + ~SPC m p~ (thanks to tko) +**** Ruby-On-Rails +- Use projectile-rails-global-mode if available (thanks to asok) +**** Rust +- Add binding for describing symbol at point under ~SPC m h h~ + (thanks to NJBS) +- Add key binding to run current Rust file under ~SPC m q~ + (thanks to swaroopch) +- Make Racer respect =help-window-select= (thanks to bmag) +**** Scala +- Update debugger key bindings to meet new conventions +- Update deprecated =ensime= variable name =user-emacs-ensime-directory= + (thanks to brakhane) +- Remove sbt-hydra rename wrapper (thanks to jdnavarro) +**** Scheme +- Fix void-variable =company-backends-scheme-mode= (thanks to pnagy) +**** Semantic +- Make Semantic fast (thanks to tudho) +**** Shaders +- Add support for =company= with =glsl-company= package (thanks to d12frosted) +**** Spell-checking +- Defer loading of =flyspell-correct-helm= and =flyspell-correct= + (thanks to ralesi and d12frosted) +**** Themes +- Add sourcerer theme to themes-megapack (thanks to gilbertw1) +- Added new base16 themes (thanks to bezhermoso and metamode) +- Add madhat2r theme to megapack (thanks to madhat2r) +**** Typescript +- Fix eldoc initialization in typescript layer. (thanks to Stebalien) +**** Version control +- New layer variable =version-control-diff-side= to set the fringe + side where to display version control info (thanks to emmanueltouzery) +- Add a transient state for =smerge-mode= on ~SPC g r~ (thanks to perfectayush) +**** Ymcd +- Add ycmd-eldoc to ycmd layer (thanks to quicknir) +*** Improvements +- Improve home buffer responsiveness, add centering for release notes and lists + (thanks to deb0ch) +- Add keybindings to move buffers by window number with ~SPC b #~ where + ~#~ is a number between 0 and 9 (thanks to quicknir) +- Add toggle to display time in modeline on ~SPC t m t~. Toggle of the modeline + is now in ~SPC t m T~. (thanks to jupl) +- Add toggle for syntax highlighting on ~SPC t h s~ (thanks to jupl) +- Message instead of warn on failed auto-evilify (thanks to TheBB) +- Warn if both helm and ivy are enabled (thanks to TheBB) +- Add new documentation file =doc/BEGINNERS_TUTORIAL.org= (nikolaiam) +- Various documentation improvements (thanks to antonshwab, benbotwin, bmag, + cyberxndr, d12frosted, duianto, erictapen, FrancescElies, idoo, jr0cket, + jgertm, jumarko, jwintz, LemmingAvalanche, lpenz, Melon-Bread, mineo, + nightuser, nikolaiam, primeos, rodonn, roryokane, rski, skade, smile12341234, + stratosgear, Trevoke, xiaohanyu, Wiliamvdv, zetok, zhexuany) ** 0.200.7 (2017/01/02) *** Fixes - More robust fix for error helm :config: ‘fuzzy-match’ not supported in async sources @@ -75,7 +287,7 @@ - Fix usage of =go-rename= on symlinked projects (thanks to grncdr) **** Helm - Add key binding ~M-RET~ (meta-return) to open the file =packages.el= - of a layer in =helm-spacemacs-help= under ~SPC h SPC~ (thansk to CestDiego) + of a layer in =helm-spacemacs-help= under ~SPC h SPC~ (thanks to CestDiego) **** Html - Fix hooks for CSS-mode since it now derives from =prog-mode= in Emacs 25 (thanks to TheBB) @@ -1196,11 +1408,11 @@ *** Core team members **** Current - Sylvain Benner (syl20bnr) -- Boris (d12frosted) -- Eivind Fonn (TheBB) +- Boris (thanks to d12frosted) +- Eivind Fonn (thanks to TheBB) **** Old - Fabien Dubosson (StreakyCobra) -- Justin Burkett (justbur) +- Justin Burkett (thanks to justbur) * Release 0.105.x ** 0.105.22 (2016/08/19) *** Fixes @@ -1483,7 +1695,7 @@ Improve loading robustness: - Improve =describe-system-info= function with completion engine info (ivy completion engine will be available in 0.106) (thanks to StreakyCobra) - Add link to =BountySource= page to =README.md= (thanks to houli) -- Move =request= storage folder to =.cache= directory +- Move =request= storage folder to =.cache= directory *** Layer changes **** Markdown - Add support for javascript code blocks syntax highlighting @@ -1532,9 +1744,9 @@ Improve loading robustness: *** Fixes **** Core - Fix home buffer obfuscating opened file when Emacs starts (thanks to justbur) -**** Ruby layer +**** Ruby layer - Fix =rbenv= loading (thanks to TheBB) -**** Spacemacs layouts +**** Spacemacs layouts - Fix jumping to last layout when the last layout is the default layout (thanks to TheBB) **** Yasnippet @@ -1927,7 +2139,7 @@ Improve loading robustness: - Add =company-css= backend in =web-mode= (thanks to TheBB) - Enable Emmet tab expansion in hybrid mode (thanks to geo7) - Expand to className when using Emmet, for =instance div.react-class= - expands to =
= (thanks to CestDegio) + expands to =< div className = "react-class">= (thanks to CestDegio) - Mark =css-indent-offset= as safe local variable (thanks to lunaryorn) - Fix =smartparens= loading (thanks to TheBB) - Fix erroneous micro-state key binding (thanks to StreakyCobra) @@ -2212,9 +2424,9 @@ Improve loading robustness: vijaykiran, xfq, xtian, ZachLiss) *** Core team members - Sylvain Benner (syl20bnr) -- Eivind Fonn (TheBB) +- Eivind Fonn (thanks to TheBB) - Fabien Dubosson (StreakyCobra) -- Justin Burkett (justbur) +- Justin Burkett (thanks to justbur) * Release 0.104.x ** 0.104.8 (2015/12/16) *** Hotfix @@ -2268,7 +2480,7 @@ Improve loading robustness: **** Markdown - Fix ~SPC m c r~ binding (thanks to tko) *** Core -- Silence =ad-handle-definition= about advised functions getting redefined +- Silence =ad-handle-definition= about advised functions getting redefined - Improve evilification rules, now ~:~ is rebound to ~|~, ~/~ is rebound to ~\~ and ~SPC~ is rebound to ~​'​~ *** Other fixes and improvements @@ -2653,7 +2865,7 @@ Improve loading robustness: prefix (thanks to katshinka) + Add more cycling options for time-stamps, headlines, items, properties with ~SPC m L~, ~SPC m K~, etc... (thanks to katshinka) -+ Add key bindings ~SPC m .~ to insert time-stamps (thanks to katshinka) ++ Add key bindings ~SPC m .~ to insert time-stamps (thanks to katshinka) + Set =toc-org-max-depth= to 10. + Move ~SPC m o~ to ~SPC m l~ since ~SPC m o~ is now reserved for users (thanks to TheBB) @@ -2836,7 +3048,7 @@ Improve loading robustness: **** Git - Fix ~F~ in Vim style in =Magit= status buffer, now ~F~ is correctly bound to =pull= popup menu -- Fix intermittent erroneous ~k~ key binding in =Magit= status buffer. +- Fix intermittent erroneous ~k~ key binding in =Magit= status buffer. *** Core - Fix mandatory dependency on =evil-escape= - Fix evilification of =evil-escape= starter key @@ -3006,7 +3218,7 @@ Improve loading robustness: - Add font-locking for code blocks (thanks to kennethlove) - Add support for a bunch of languages for code blocks (thanks to dexafree) **** Ocaml -- Don't auto-close backticks (thanks to edwintorok) +- Don't auto-close backticks (thanks to edwintorok) **** Org - Fontify code blocks (thanks to tuhdo) - Add =toc-org= package (thanks to CestDiego) @@ -3605,7 +3817,7 @@ a batch of packages. - Fix =flycheck= loading - Move ~SPC m t~ to ~SPC m h t~ according to Spacemacs conventions (thanks to jeremyjh) -- Add C-- =cmm-mode= (thanks to bgamari) +- Add C-- =cmm-mode= (thanks to bgamari) *** Helm - Add =helm-colors= key binding on ~SPC C l~ (thanks to tuhdo) - Make =helm-ff-doted-directory= consistent (thanks to tuhdo) diff --git a/CONTRIBUTING.org b/CONTRIBUTING.org index b6ee605..6013ec2 100644 --- a/CONTRIBUTING.org +++ b/CONTRIBUTING.org @@ -25,18 +25,24 @@ Thanks! :heart: :heart: :heart: - [[#credits][Credits]] * Asking for help + :PROPERTIES: +:CUSTOM_ID: asking-for-help +:END: 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)]]. +- [[file:doc/FAQ.org][The FAQ]]. Some of the most frequently asked questions are answered there. +- [[file:doc/DOCUMENTATION.org][The documentation]]. It's the general documentation of Spacemacs. +- You may also read the =README.org= of the [[file: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 +:PROPERTIES: +:CUSTOM_ID: reporting-issues +:END: 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. @@ -56,6 +62,9 @@ Issues have to be reported on our [[https://github.com/syl20bnr/spacemacs/issues step guide. * Contributing code +:PROPERTIES: +:CUSTOM_ID: contributing-code +:END: 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! @@ -164,7 +173,7 @@ 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 + ;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: YOUR_NAME ;; URL: https://github.com/syl20bnr/spacemacs @@ -198,7 +207,7 @@ 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 +the [[file: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 diff --git a/README.md b/README.md index 8555d27..ddec4d6 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ | contribute | -achievements +achievements | FAQ

@@ -157,6 +157,13 @@ providing Spacemacs icon. See [emacs-plus](https://github.com/d12frosted/homebrew-emacs-plus) for more information. +*Note*: to have the title bar match your theme background color, +consider using instead: + +``` sh +$ brew install emacs-plus --HEAD --with-natural-title-bars +``` + *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. diff --git a/core/aprilfool/zemacs.el b/core/aprilfool/zemacs.el index 55bc519..ac72ee6 100644 --- a/core/aprilfool/zemacs.el +++ b/core/aprilfool/zemacs.el @@ -1,6 +1,6 @@ ;;; zemacs.el --- Spacemacs 2016 April Fools File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-command-line.el b/core/core-command-line.el index e6f6a17..ed21bfe 100644 --- a/core/core-command-line.el +++ b/core/core-command-line.el @@ -1,6 +1,6 @@ ;;; core-command-line.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index c68d6e7..4eb089d 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -1,6 +1,6 @@ ;;; core-configuration-layer.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -61,6 +61,14 @@ ROOT is returned." (eval dotspacemacs-elpa-subdirectory)))) (file-name-as-directory (expand-file-name subdir root))))) +(defun configuration-layer/get-elpa-package-install-directory (pkg) + "Return the install directory of elpa PKG. Return nil if it is not found." + (let ((elpa-dir 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)))))) + (defvar configuration-layer-rollback-directory (concat spacemacs-cache-directory ".rollback/") "Spacemacs rollback directory.") @@ -105,29 +113,31 @@ ROOT is returned." "(Takes precedence over `:disabled-for'.)"))) "A configuration layer.") -(defmethod cfgl-layer-owned-packages ((layer cfgl-layer)) +(defmethod cfgl-layer-owned-packages ((layer cfgl-layer) &optional props) "Return the list of owned packages by LAYER. +If PROPS is non-nil then return packages as lists with their properties. LAYER has to be installed for this method to work properly." (delq nil (mapcar (lambda (x) - (let ((pkg (configuration-layer/get-package x))) - (when (and pkg (eq (oref layer :name) - (car (oref pkg :owners)))) - pkg))) - (oref layer :packages)))) + (let* ((pkg-name (if (listp x) (car x) x)) + (pkg (configuration-layer/get-package pkg-name))) + (when (eq (oref layer :name) (car (oref pkg :owners))) x))) + (cfgl-layer-get-packages layer props)))) -(defmethod cfgl-layer-owned-packages ((layer nil)) +(defmethod cfgl-layer-owned-packages ((layer nil) &optional props) "Accept nil as argument and return nil." nil) -(defmethod cfgl-layer-get-packages ((layer cfgl-layer)) - "Return the list of packages for LAYER." - (if (eq 'all (oref layer :selected-packages)) - (oref layer :packages) +(defmethod cfgl-layer-get-packages ((layer cfgl-layer) &optional props) + "Return the list of packages for LAYER. +If PROPS is non-nil then return packages as lists with their properties" + (let ((all (eq 'all (oref layer :selected-packages)))) (delq nil (mapcar (lambda (x) (let ((pkg-name (if (listp x) (car x) x))) - (when (memq pkg-name (oref layer :selected-packages)) x))) + (when (or all (memq pkg-name + (oref layer :selected-packages))) + (if props x pkg-name)))) (oref layer :packages))))) (defclass cfgl-package () @@ -183,7 +193,9 @@ LAYER has to be installed for this method to work properly." "If non-nil this package is excluded from all layers."))) (defmethod cfgl-package-enabledp ((pkg cfgl-package) &optional inhibit-messages) - "Evaluate the `toggle' slot of passed PKG." + "Evaluate the `toggle' slot of passed PKG. +If INHIBIT-MESSAGES is non nil then any message emitted by the toggle evaluation +is ignored." (let ((message-log-max (unless inhibit-messages message-log-max)) (toggle (oref pkg :toggle))) (eval toggle))) @@ -211,6 +223,7 @@ is not set for the given SLOT." '(("melpa" . "melpa.org/packages/") ("org" . "orgmode.org/elpa/") ("gnu" . "elpa.gnu.org/packages/")) + ;; '(("spacelpa" . "~/.emacs.d/.cache/spacelpa/")) "List of ELPA archives required by Spacemacs.") (defvar configuration-layer-exclude-all-layers nil @@ -285,15 +298,28 @@ cache folder.") (setq package-enable-at-startup nil) (package-initialize 'noactivate))) -(defun configuration-layer//install-quelpa () - "Install `quelpa'." +(defun configuration-layer//configure-quelpa () + "Configure `quelpa' package." (setq quelpa-verbose init-file-debug quelpa-dir (concat spacemacs-cache-directory "quelpa/") quelpa-build-dir (expand-file-name "build" quelpa-dir) quelpa-persistent-cache-file (expand-file-name "cache" quelpa-dir) quelpa-update-melpa-p nil) - (configuration-layer/load-or-install-protected-package 'package-build) - (configuration-layer/load-or-install-protected-package 'quelpa)) + (require 'quelpa)) + +(defun configuration-layer//package-archive-absolute-pathp (archive) + "Return t if ARCHIVE has an absolute path defined." + (let ((path (cdr archive))) + (or (string-match-p "http" path) + (string-prefix-p "~" path) + (string-prefix-p "/" path)))) + +(defun configuration-layer//package-archive-local-pathp (archive) + "Return t if ARCHIVE has a local path." + (let ((path (cdr archive))) + (or (string-prefix-p "~" path) + (string-prefix-p "/" path) + (string-prefix-p "\." path)))) (defun configuration-layer//resolve-package-archives (archives) "Resolve HTTP handlers for each archive in ARCHIVES and return a list @@ -303,22 +329,23 @@ left untouched. The returned list has a `package-archives' compliant format." (mapcar (lambda (x) - (cons (car x) - (if (or (string-match-p "http" (cdr x)) - (string-prefix-p "/" (cdr x))) - (cdr x) - (concat - (if (and dotspacemacs-elpa-https - (not spacemacs-insecure) - ;; for now org ELPA repository does - ;; not support HTTPS - ;; TODO when org ELPA repo support - ;; HTTPS remove the check - ;; `(not (equal "org" (car x)))' - (not (equal "org" (car x)))) - "https://" - "http://") - (cdr x))))) + (let ((aname (car x)) + (apath (cdr x))) + (cons aname + (if (configuration-layer//package-archive-absolute-pathp x) + apath + (concat + (if (and dotspacemacs-elpa-https + (not spacemacs-insecure) + ;; for now org ELPA repository does + ;; not support HTTPS + ;; TODO when org ELPA repo support + ;; HTTPS remove the check + ;; `(not (equal "org" aname))' + (not (equal "org" aname))) + "https://" + "http://") + apath))))) archives)) (defun configuration-layer/retrieve-package-archives (&optional quiet force) @@ -342,32 +369,38 @@ refreshed during the current session." (let ((count (length package-archives)) (i 1)) (dolist (archive package-archives) - (unless quiet - (spacemacs-buffer/replace-last-line - (format "--> refreshing package archive: %s... [%s/%s]" - (car archive) i count) t)) - (spacemacs//redisplay) - (setq i (1+ i)) - (unless (eq 'error - (with-timeout - (dotspacemacs-elpa-timeout - (progn - (display-warning - 'spacemacs - (format - "\nError connection time out for %s repository!" - (car archive)) :warning) - 'error)) - (condition-case err - (url-retrieve-synchronously (cdr archive)) - ('error - (display-warning 'spacemacs - (format - "\nError while contacting %s repository!" - (car archive)) :warning) - 'error)))) - (let ((package-archives (list archive))) - (package-refresh-contents)))) + (let ((aname (car archive)) + (apath (cdr archive))) + (unless quiet + (spacemacs-buffer/replace-last-line + (format "--> refreshing package archive: %s... [%s/%s]" + aname i count) t)) + (spacemacs//redisplay) + (setq i (1+ i)) + (unless + (and (not (configuration-layer//package-archive-local-pathp + archive)) + (eq 'error + (with-timeout + (dotspacemacs-elpa-timeout + (progn + (display-warning + 'spacemacs + (format + "\nError connection time out for %s repository!" + aname) :warning) + 'error)) + (condition-case err + (url-retrieve-synchronously apath) + ('error + (display-warning + 'spacemacs + (format + "\nError while contacting %s repository!" + aname) :warning) + 'error))))) + (let ((package-archives (list archive))) + (package-refresh-contents))))) (package-read-all-archive-contents) (unless quiet (spacemacs-buffer/append "\n"))))) @@ -620,9 +653,10 @@ If TOGGLEP is nil then `:toggle' parameter is ignored." pkg-name (car (oref obj :owners)) layer-name))) ;; last owner wins over the previous one (object-add-to-list obj :owners layer-name)) - ;; check consistency betwween package and defined init functions + ;; check consistency between package and defined init functions (unless (or ownerp (eq 'dotfile layer-name) + (eq 'system layer-name) (fboundp pre-init-func) (fboundp post-init-func) (oref obj :excluded)) @@ -887,11 +921,17 @@ Return nil if package object is not found." "Return a sorted list of PACKAGES objects." (sort packages (lambda (x y) (string< (symbol-name x) (symbol-name y))))) -(defun configuration-layer/make-all-packages (&optional usedp) - "Create objects for _all_ packages. -USEDP if non-nil indicates that made packages are used packages." - (configuration-layer/make-packages-from-layers - (configuration-layer/get-layers-list) usedp)) +(defun configuration-layer/make-all-packages (&optional skip-layer-discovery) + "Create objects for _all_ packages supported by Spacemacs. +If SKIP-LAYER-DISCOVERY is non-nil then do not check for new layers." + (let ((all-layers (configuration-layer/get-layers-list)) + (configuration-layer--load-packages-files t) + (configuration-layer--package-properties-read-onlyp t) + (configuration-layer--inhibit-warnings t)) + (unless skip-layer-discovery + (configuration-layer/discover-layers)) + (configuration-layer/declare-layers all-layers) + (configuration-layer/make-packages-from-layers all-layers))) (defun configuration-layer/make-packages-from-layers (layer-names &optional usedp) @@ -901,7 +941,7 @@ DOTFILE if non-nil will process the dotfile `dotspacemacs-additional-packages' variable as well." (dolist (layer-name layer-names) (let ((layer (configuration-layer/get-layer layer-name))) - (dolist (pkg (cfgl-layer-get-packages layer)) + (dolist (pkg (cfgl-layer-get-packages layer 'with-props)) (let* ((pkg-name (if (listp pkg) (car pkg) pkg)) (obj (configuration-layer/get-package pkg-name))) (setq obj (configuration-layer/make-package pkg layer-name obj)) @@ -929,27 +969,30 @@ USEDP if non-nil indicates that made packages are used packages." "Configure auto-installation of layer with name LAYER-NAME." (declare (indent 1)) (when (configuration-layer//lazy-install-p layer-name) - (let ((extensions (spacemacs/mplist-get props :extensions))) + (let ((extensions (spacemacs/mplist-get props :extensions)) + (interpreter (plist-get props :interpreter))) (when (configuration-layer/layer-usedp layer-name) (let* ((layer (configuration-layer/get-layer layer-name)) - (packages (when layer (cfgl-layer-owned-packages layer))) - (package-names (mapcar (lambda (x) (oref x :name)) packages))) + (package-names (when layer (cfgl-layer-owned-packages layer)))) ;; set lazy install flag for a layer if and only if its owned ;; distant packages are all not already installed - (let ((lazy (cl-reduce - (lambda (x y) (and x y)) - (mapcar - (lambda (p) - (let ((pkg (configuration-layer/get-package p))) - (or (not (eq layer-name (car (oref pkg :owners)))) - (null (package-installed-p - (oref pkg :name)))))) - (configuration-layer//get-distant-packages - package-names t)) - :initial-value t))) + (let ((lazy + (or (eq 'all dotspacemacs-enable-lazy-installation) + (cl-reduce + (lambda (x y) (and x y)) + (mapcar + (lambda (p) + (let ((pkg (configuration-layer/get-package p))) + (or (not (eq layer-name (car (oref pkg :owners)))) + (null (package-installed-p + (oref pkg :name)))))) + package-names) + :initial-value t)))) (oset layer :lazy-install lazy) - (dolist (pkg packages) - (cfgl-package-set-property pkg :lazy-install lazy))))) + (dolist (pkg-name package-names) + (let ((pkg (configuration-layer/get-package pkg-name))) + (cfgl-package-set-property pkg :lazy-install lazy)))))) + ;; configure `auto-mode-alist' (dolist (x extensions) (let ((ext (car x)) (mode (cadr x))) @@ -958,7 +1001,16 @@ USEDP if non-nil indicates that made packages are used packages." 'auto-mode-alist `(,ext . (lambda () (configuration-layer//auto-mode - ',layer-name ',mode))))))))) + ',layer-name ',mode)))) + )) + ;; configure `interpreter-mode-alist' + (when interpreter + (let ((regex (car interpreter)) + (mode (cadr interpreter))) + (add-to-list + 'interpreter-mode-alist + `(,regex . (lambda () (configuration-layer//auto-mode + ',layer-name ',mode))))))))) (defun configuration-layer//auto-mode (layer-name mode) "Auto mode support of lazily installed layers." @@ -987,7 +1039,7 @@ return both used and unused packages." (or (null usedp) (and (not (null (oref pkg :owners))) (not (oref pkg :excluded)) - (cfgl-package-enabledp pkg)))))))) + (cfgl-package-enabledp pkg t)))))))) (defun configuration-layer//get-private-layer-dir (name) "Return an absolute path to the private configuration layer string NAME." @@ -1059,12 +1111,30 @@ Returns nil if the directory is not a category." ;; must have the final word on configuration choices. Let ;; `dotspacemacs-directory' override the private directory if it exists. (setq configuration-layer--indexed-layers (make-hash-table :size 1024)) - (let ((search-paths (append (list configuration-layer-directory) - dotspacemacs-configuration-layer-path - (list configuration-layer-private-layer-directory) - (when dotspacemacs-directory - (list dotspacemacs-directory)))) + (spacemacs-buffer/set-mode-line "Indexing layers...") + (spacemacs//redisplay) + (let ((search-paths (append + ;; layers shipped with spacemacs + (list configuration-layer-directory) + ;; layers in private folder ~/.emacs.d/private + (list configuration-layer-private-directory) + ;; layers in dotdirectory + (when dotspacemacs-directory + (list (expand-file-name (concat dotspacemacs-directory + "layers/")))) + ;; additional layer directories provided by the user + dotspacemacs-configuration-layer-path)) (discovered '())) + ;; filter out directories that don't exist + (setq search-paths (configuration-layer/filter-objects + search-paths + (lambda (x) + (let ((exists (file-exists-p x))) + (unless exists + (configuration-layer//warning + "Layer directory \"%s\" not found. Ignoring it." + x)) + exists)))) ;; depth-first search of subdirectories (while search-paths (let ((current-path (car search-paths))) @@ -1091,7 +1161,9 @@ Returns nil if the directory is not a category." (if indexed-layer ;; the same layer may have been discovered twice, ;; in which case we don't need a warning - (unless (string-equal (oref indexed-layer :dir) sub) + (unless (string-equal + (directory-file-name (oref indexed-layer :dir)) + (directory-file-name sub)) (configuration-layer//warning (concat "Duplicated layer %s detected in directory \"%s\", " @@ -1100,8 +1172,10 @@ Returns nil if the directory is not a category." (oset indexed-layer :dir sub)) (spacemacs-buffer/message "-> Discovered configuration layer: %s" layer-name-str) - (configuration-layer//add-layer - (configuration-layer/make-layer layer-name nil nil sub))))) + (let ((configuration-layer--load-packages-files nil)) + (configuration-layer//add-layer + (configuration-layer/make-layer layer-name + nil nil sub)))))) (t ;; layer not found, add it to search path (setq search-paths (cons sub search-paths))))))))))) @@ -1325,23 +1399,30 @@ wether the declared layer is an used one or not." (side . bottom) (window-height . 0.2))))) ;; ensure we have quelpa available first - (configuration-layer//install-quelpa) + (configuration-layer//configure-quelpa) (let* ((upkg-names (configuration-layer//get-uninstalled-packages packages)) (not-inst-count (length upkg-names)) installed-count) ;; installation (when upkg-names - (spacemacs-buffer/append - (format "Found %s new package(s) to install...\n" - not-inst-count)) - (configuration-layer/retrieve-package-archives) - (setq installed-count 0) + (spacemacs-buffer/set-mode-line "Installing packages...") (spacemacs//redisplay) - (dolist (pkg-name upkg-names) - (setq installed-count (1+ installed-count)) - (configuration-layer//install-package - (configuration-layer/get-package pkg-name))) - (spacemacs-buffer/append "\n"))))) + (let ((delayed-warnings-backup delayed-warnings-list)) + (spacemacs-buffer/append + (format "Found %s new package(s) to install...\n" + not-inst-count)) + (configuration-layer/retrieve-package-archives) + (setq installed-count 0) + (spacemacs//redisplay) + (dolist (pkg-name upkg-names) + (setq installed-count (1+ installed-count)) + (configuration-layer//install-package + (configuration-layer/get-package pkg-name))) + (spacemacs-buffer/append "\n") + (unless init-file-debug + ;; get rid of all delayed warnings when byte-compiling packages + ;; unless --debug-init was passed on the command line + (setq delayed-warnings-list delayed-warnings-backup))))))) (defun configuration-layer//install-from-elpa (pkg-name) "Install PKG from ELPA." @@ -1482,7 +1563,7 @@ wether the declared layer is an used one or not." ((null (oref pkg :owners)) (spacemacs-buffer/message (format "%S ignored since it has no owner layer." pkg-name))) - ((not (cfgl-package-enabledp pkg t)) + ((not (cfgl-package-enabledp pkg)) (spacemacs-buffer/message (format "%S is toggled off." pkg-name))) (t ;; load-path @@ -1755,9 +1836,11 @@ to select one." (unless (memq pkg package-activated-list) (package-activate pkg))) -(defun configuration-layer//get-packages-dependencies () - "Returns dependencies hash map for all packages in `package-alist'." - (let ((result (make-hash-table :size 512))) +(defun configuration-layer//get-packages-upstream-dependencies-from-alist () + "Returns upsteam dependencies hash map for all packages in `package-alist'. +The keys are package names and the values are lists of package names that +depends on it." + (let ((result (make-hash-table :size 1024))) (dolist (pkg package-alist) (let* ((pkg-sym (car pkg)) (deps (configuration-layer//get-package-deps-from-alist pkg-sym))) @@ -1769,7 +1852,7 @@ to select one." result))))) result)) -(defun configuration-layer//get-implicit-packages (packages) +(defun configuration-layer//get-implicit-packages-from-alist (packages) "Returns packages in `packages-alist' which are not found in PACKAGES." (let (imp-pkgs) (dolist (pkg package-alist) @@ -1862,9 +1945,11 @@ to select one." (defun configuration-layer/delete-orphan-packages (packages) "Delete PACKAGES if they are orphan." (interactive) - (let* ((dependencies (configuration-layer//get-packages-dependencies)) - (implicit-packages (configuration-layer//get-implicit-packages - packages)) + (let* ((dependencies + (configuration-layer//get-packages-upstream-dependencies-from-alist)) + (implicit-packages + (configuration-layer//get-implicit-packages-from-alist + packages)) (orphans (configuration-layer//get-orphan-packages packages implicit-packages @@ -1876,6 +1961,8 @@ to select one." ;; (message "orphans: %s" orphans) (if orphans (progn + (spacemacs-buffer/set-mode-line "Uninstalling not used packages...") + (spacemacs//redisplay) (spacemacs-buffer/append (format "Found %s orphan package(s) to delete...\n" orphans-count)) @@ -1910,13 +1997,12 @@ to select one." (defun configuration-layer//lazy-install-extensions-for-layer (layer-name) "Return an alist of owned modes and extensions for the passed layer." (let* ((layer (configuration-layer/get-layer layer-name)) - (packages (cfgl-layer-owned-packages layer)) + (package-names (cfgl-layer-owned-packages layer)) result) - (dolist (pkg packages) - (let ((pkg-sym (oref pkg :name))) - (dolist (mode (list pkg-sym (intern (format "%S-mode" pkg-sym)))) - (let ((ext (configuration-layer//gather-auto-mode-extensions mode))) - (when ext (push (cons mode ext) result)))))) + (dolist (pkg-name package-names) + (dolist (mode (list pkg-name (intern (format "%S-mode" pkg-name)))) + (let ((ext (configuration-layer//gather-auto-mode-extensions mode))) + (when ext (push (cons mode ext) result))))) result)) (defun configuration-layer//insert-lazy-install-form (layer-name mode ext) @@ -1971,17 +2057,18 @@ to select one." (insert "\n"))))) (defun configuration-layer/load-or-install-protected-package - (pkg &optional log file-to-load) + (pkg &optional install log file-to-load) "Load PKG package, and protect it against being deleted as an orphan. See `configuration-layer/load-or-install-package' for more information." (push pkg configuration-layer--protected-packages) (configuration-layer/load-or-install-package pkg log file-to-load)) (defun configuration-layer/load-or-install-package - (pkg &optional log file-to-load) + (pkg &optional install log file-to-load) "Load PKG package. PKG will be installed if it is not already installed. Whenever the initial require fails the absolute path to the package directory is returned. +If INSTALL is non-nil then try to install the package if needed. If LOG is non-nil a message is displayed in spacemacs-buffer-mode buffer. FILE-TO-LOAD is an explicit file to load after the installation." (let ((warning-minimum-level :error)) @@ -1989,22 +2076,162 @@ FILE-TO-LOAD is an explicit file to load after the installation." ;; not installed, we try to initialize package.el only if required to ;; precious seconds during boot time (require 'cl) - (let ((pkg-elpa-dir (spacemacs//get-package-directory pkg))) + (let ((pkg-elpa-dir + (configuration-layer/get-elpa-package-install-directory pkg))) (if pkg-elpa-dir (add-to-list 'load-path pkg-elpa-dir) ;; install the package - (when log - (spacemacs-buffer/append - (format "(Bootstrap) Installing %s...\n" pkg)) - (spacemacs//redisplay)) - (configuration-layer/retrieve-package-archives 'quiet) - (package-install pkg) - (setq pkg-elpa-dir (spacemacs//get-package-directory pkg))) + (when install + (when log + (spacemacs-buffer/append + (format "Installing package: %s...\n" pkg)) + (spacemacs//redisplay)) + (configuration-layer/retrieve-package-archives 'quiet) + (let ((delayed-warnings-backup delayed-warnings-list)) + (package-install pkg) + (unless init-file-debug + (setq delayed-warnings-list delayed-warnings-backup))) + (setq pkg-elpa-dir + (configuration-layer/get-elpa-package-install-directory pkg)))) + (unless (configuration-layer/get-package pkg) + (let ((obj (configuration-layer/make-package pkg 'system))) + (configuration-layer//add-package obj))) (require pkg nil 'noerror) (when file-to-load (load-file (concat pkg-elpa-dir file-to-load))) pkg-elpa-dir)))) +(defun configuration-layer//get-indexed-elpa-package-names () + "Return a list of all ELPA packages in indexed packages and dependencies." + (let (result) + (dolist (pkg-sym (configuration-layer//get-distant-packages + (ht-keys configuration-layer--indexed-packages) nil)) + (when (assq pkg-sym package-archive-contents) + (let* ((deps (mapcar 'car + (configuration-layer//get-package-deps-from-archive + pkg-sym))) + (elpa-deps (configuration-layer/filter-objects + deps (lambda (x) + (assq x package-archive-contents))))) + (dolist (pkg (cons pkg-sym elpa-deps)) + ;; avoid duplicates + (add-to-list 'result pkg))))) + result)) + +(defun configuration-layer//create-archive-contents-item (pkg-name) + "Return an item with an ELPA archive-contents compliant format." + (let ((obj (cadr (assq pkg-name package-archive-contents)))) + (cons pkg-name `[,(package-desc-version obj) + ,(package-desc-reqs obj) + ,(package-desc-summary obj) + ,(package-desc-kind obj) + ,(package-desc-extras obj)]))) + +(defun configuration-layer//download-elpa-file + (pkg-name filename archive-url output-dir + &optional signaturep readmep) + "Download FILENAME from distant ELPA repository to OUTPUT-DIR. + +Original code from dochang at https://github.com/dochang/elpa-clone" + (let ((source (concat archive-url filename)) + (target (expand-file-name filename output-dir))) + (unless (file-exists-p target) + (let* ((readme-filename (format "%S-readme.txt" pkg-name)) + (source-readme (concat archive-url readme-filename))) + (when (and readmep (url-http-file-exists-p source-readme)) + (url-copy-file source-readme + (expand-file-name readme-filename output-dir) + 'ok-if-already-exists))) + (when signaturep + (let* ((sig-filename (concat filename ".sig")) + (source-sig (concat archive-url sig-filename)) + (target-sig (expand-file-name sig-filename output-dir))) + (url-copy-file source-sig target-sig 'ok-if-already-exists))) + (url-copy-file source target)))) + +(defun configuration-layer//sync-elpa-packages-files (packages output-dir) + "Synchronize PACKAGES files from remote ELPA directory to OUTPUT-DIR" + (message "Synchronizing files in ELPA repository at %s..." output-dir) + (let (filenames + (output-filenames (directory-files + output-dir nil "\\.\\(el\\|tar\\)$")) + (pkg-count (length packages)) + (i 1)) + (dolist (pkg-name packages) + (let* ((obj (cadr (assq pkg-name package-archive-contents))) + (filename (concat (package-desc-full-name obj) + (package-desc-suffix obj))) + (archive-url (cdr (assq (package-desc-archive obj) + package-archives)))) + (push filename filenames) + (if (member filename output-filenames) + (message "[%s/%s] Skip %s..." i pkg-count filename) + (message "[%s/%s] Download %s..." i pkg-count filename) + (configuration-layer//download-elpa-file + pkg-name filename archive-url output-dir)) + (setq i (1+ i)))) + (dolist (ofilename output-filenames) + (unless (member ofilename filenames) + (message "Remove outdated %s..." ofilename) + (delete-file (concat output-dir ofilename)))))) + +(defun configuration-layer/create-elpa-repository (name output-dir) + "Create an ELPA repository containing all packages supported by Spacemacs." + (configuration-layer/make-all-packages 'no-discover) + (let (package-archive-contents + (package-archives '(("melpa" . "https://melpa.org/packages/") + ("org" . "http://orgmode.org/elpa/") + ("gnu" . "https://elpa.gnu.org/packages/")))) + (package-refresh-contents) + (package-read-all-archive-contents) + (let* ((packages (configuration-layer//get-indexed-elpa-package-names)) + (archive-contents + (mapcar 'configuration-layer//create-archive-contents-item + packages)) + (path (file-name-as-directory (concat output-dir name)))) + (unless (file-exists-p path) (make-directory path 'create-parents)) + (configuration-layer//sync-elpa-packages-files packages path) + (push 1 archive-contents) + (with-current-buffer (find-file-noselect + (concat path "archive-contents")) + (erase-buffer) + (prin1 archive-contents (current-buffer)) + (save-buffer))))) + +(defun configuration-layer//package-install-org (func &rest args) + "Advice around `package-install' to patch package name and dependencies at +install time in order to replace all `org' package installation by +`org-plus-contrib'. We avoid installing unecessarily both `org' and +`org-plus-contrib' at the same time (i.e. we always install `org-plus-contrib')" + (let* ((pkg (car args)) + (patched + (cond + ;; patch symbol name + ((and (symbolp pkg) (eq 'org pkg)) + (setcar args 'org-plus-contrib) + t) + ;; patch name in package-desc object + ((and (package-desc-p pkg) + (eq 'org (package-desc-name pkg))) + (setf (package-desc-name pkg) 'org-plus-contrib) + t) + ;; patch dependencies in package-desc object + ((and (package-desc-p pkg) + (assq 'org (package-desc-reqs pkg))) + (setf (car (assq 'org (package-desc-reqs pkg))) 'org-plus-contrib) + t)))) + (let ((name (if (package-desc-p pkg) + (package-desc-name pkg) + pkg))) + ;; check manually if `org-plus-contrib' is already installed since + ;; package.el may install `org-plus-contrib' more than once. + ;; Maybe we could hook somewhere else (at transaction computation time?) + (if (or patched (eq 'org-plus-contrib name)) + (unless (package-installed-p name) + (apply func args)) + (apply func args))))) +(advice-add 'package-install :around #'configuration-layer//package-install-org) + (defun configuration-layer//increment-error-count () "Increment the error counter." (if configuration-layer-error-count diff --git a/core/core-debug.el b/core/core-debug.el index b2af85c..ba44490 100644 --- a/core/core-debug.el +++ b/core/core-debug.el @@ -1,6 +1,6 @@ ;;; core-debug.el --- Spacemacs Core File -*- lexical-binding: t; -*- ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,6 +9,15 @@ ;; ;;; License: GPLv3 +(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))) + + +;; startup debug + (require 'profiler) (defvar spacemacs-debug-timer-threshold 0.15 @@ -140,4 +149,150 @@ seconds to load") ;; Keep debug-on-error on for stuff that is lazily loaded (add-hook 'after-init-hook (lambda () (setq debug-on-error t)))) + +;; Report issue + +(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))) + "<>")) + (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 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: encode some characters according to HTML URL Encoding Reference + ;; http://www.w3schools.com/tags/ref_urlencode.asp + (setq url (replace-regexp-in-string "#" "%23" url)) + (setq url (replace-regexp-in-string ";" "%3B" url)) + (browse-url url))) + (provide 'core-debug) diff --git a/core/core-display-init.el b/core/core-display-init.el index 8249b0f..2077b5c 100644 --- a/core/core-display-init.el +++ b/core/core-display-init.el @@ -1,6 +1,6 @@ ;;; core-display-init.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-documentation.el b/core/core-documentation.el index 35b00e8..f9e4afc 100644 --- a/core/core-documentation.el +++ b/core/core-documentation.el @@ -1,6 +1,6 @@ ;;; core-spacemacs.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index cf454cb..dba0489 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -1,6 +1,6 @@ ;;; core-dotspacemacs.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -232,7 +232,7 @@ 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 +(defvar dotspacemacs-enable-paste-transient-state nil "If non nil the paste transient-state is enabled. While enabled pressing `p` several times cycle between the kill ring content.'") (defvaralias @@ -293,8 +293,20 @@ 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.") + "Control line numbers activation. +If set to `t' or `relative' line numbers are turned on in all `prog-mode' and +`text-mode' derivatives. If set to `relative', line numbers are relative. +This variable can also be set to a property list for finer control: +'(:relative nil + :disabled-for-modes dired-mode + doc-view-mode + markdown-mode + org-mode + pdf-view-mode + text-mode + :size-limit-kb 1000) +The property `:enabled-for-modes' takes priority over `:disabled-for-modes' and +restricts line-number to the specified list of major-mode.") (defvar dotspacemacs-persistent-server nil "If non nil advises quit functions to keep server open when quitting.") @@ -456,8 +468,9 @@ Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary tests." (lambda (x) (and (boundp x) (not (keywordp x)) - (string-prefix-p "dotspacemacs" - (symbol-name x)))))) + ;; avoid private variables to show up + (not (string-match-p "--" (symbol-name x))) + (string-prefix-p "dotspacemacs" (symbol-name x)))))) (defun dotspacemacs/get-variable-list () "Return a list of all dotspacemacs variable symbols." @@ -493,6 +506,14 @@ a display strng and the value is the actual value to return." (cadr (assoc (ido-completing-read prompt (mapcar 'car candidates)) candidates)))) +(defun dotspacemacs/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 dotspacemacs/install (arg) "Install the dotfile, return non nil if the doftile has been installed. @@ -548,20 +569,16 @@ If ARG is non nil then Ask questions to the user before installing the dotfile." (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." - ) + (dotspacemacs/load-file) + ;; force new wizard values to be applied + (dotspacemacs/init)) (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)) + (unless (with-demoted-errors "Error loading .spacemacs: %S" + (load dotspacemacs)) (dotspacemacs/safe-load))))) (defun dotspacemacs/safe-load () diff --git a/core/core-emacs-backports.el b/core/core-emacs-backports.el index 5c177ee..056d752 100644 --- a/core/core-emacs-backports.el +++ b/core/core-emacs-backports.el @@ -1,6 +1,6 @@ ;;; core-emacs-backports.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-fonts-support.el b/core/core-fonts-support.el index ffeedb4..634e960 100644 --- a/core/core-fonts-support.el +++ b/core/core-fonts-support.el @@ -1,6 +1,6 @@ ;;; core-fonts-support.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-funcs.el b/core/core-funcs.el index 9f7334f..41544f5 100644 --- a/core/core-funcs.el +++ b/core/core-funcs.el @@ -1,6 +1,6 @@ ;;; core-funcs.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -35,14 +35,6 @@ `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. @@ -301,6 +293,15 @@ buffer." (let ((message-log-max nil)) (apply 'message msg args))) +(defun spacemacs/derived-mode-p (mode &rest modes) + "Non-nil if MODE is derived from one of MODES." + ;; We could have copied the built-in `derived-mode-p' and modified it a bit so + ;; it works on arbitrary modes instead of only the current major-mode. We + ;; don't do that because then we will need to modify the function if + ;; `derived-mode-p' changes. + (let ((major-mode mode)) + (apply #'derived-mode-p modes))) + (defun spacemacs/alternate-buffer (&optional window) "Switch back and forth between current and last buffer in the current window." @@ -319,6 +320,16 @@ current window." ;; `other-buffer' honors `buffer-predicate' so no need to filter (other-buffer current-buffer t))))) +(defun spacemacs/alternate-window () + "Switch back and forth between current and last window in the +current frame." + (interactive) + (let (;; switch to first window previously shown in this frame + (prev-window (get-mru-window nil t t))) + ;; Check window was not found successfully + (unless prev-window (user-error "Last window not found.")) + (select-window prev-window))) + (defun spacemacs/comint-clear-buffer () (interactive) (let ((comint-buffer-maximum-size 0)) diff --git a/core/core-jump.el b/core/core-jump.el index 48676d2..6505e8e 100644 --- a/core/core-jump.el +++ b/core/core-jump.el @@ -1,6 +1,6 @@ ;;; core-jump.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -36,9 +36,11 @@ sets `spacemacs-jump-handlers' in buffers of that mode." (add-hook ',mode-hook ',func) (with-eval-after-load 'bind-map (spacemacs/set-leader-keys-for-major-mode ',mode - "gg" 'spacemacs/jump-to-definition))))) + "gg" 'spacemacs/jump-to-definition + "gG" 'spacemacs/jump-to-definition-other-window))))) (defun spacemacs/jump-to-definition () + "Jump to definition around point using the best tool for this action." (interactive) (catch 'done (let ((old-buffer (current-buffer)) @@ -49,12 +51,23 @@ sets `spacemacs-jump-handlers' in buffers of that mode." (plist-get (cdr -handler) :async)))) (ignore-errors (call-interactively handler)) - (when (or async + (when (or (eq async t) + (and (fboundp async) (funcall 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."))) +(defun spacemacs/jump-to-definition-other-window () + "Jump to definition around point in other window." + (interactive) + (let ((pos (point))) + ;; since `spacemacs/jump-to-definition' can be asynchronous we cannot use + ;; `save-excursion' here, so we have to bear with the jumpy behavior. + (switch-to-buffer-other-window (current-buffer)) + (goto-char pos) + (spacemacs/jump-to-definition))) + ;; 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. diff --git a/core/core-keybindings.el b/core/core-keybindings.el index fc3cf6d..249ca6b 100644 --- a/core/core-keybindings.el +++ b/core/core-keybindings.el @@ -1,6 +1,6 @@ ;;; core-keybindings.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -57,6 +57,7 @@ LONG-NAME if given is stored in `spacemacs/prefix-titles'." (which-key-declare-prefixes full-prefix-emacs (cons name long-name) full-prefix (cons name long-name)))) +(put 'spacemacs/declare-prefix 'lisp-indent-function 'defun) (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 @@ -81,6 +82,7 @@ used as the prefix command." (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))))) +(put 'spacemacs/declare-prefix-for-mode 'lisp-indent-function 'defun) (defun spacemacs/set-leader-keys (key def &rest bindings) "Add KEY and DEF as key bindings under @@ -120,15 +122,13 @@ minor-mode, the third argument should be non nil." dotspacemacs-major-mode-leader-key)) (leader2 (when (spacemacs//acceptable-leader-p dotspacemacs-leader-key) - (concat dotspacemacs-leader-key - (unless minor " m")))) + (concat dotspacemacs-leader-key " 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")))) + (concat dotspacemacs-emacs-leader-key " m"))) (leaders (delq nil (list leader1 leader2))) (emacs-leaders (delq nil (list emacs-leader1 emacs-leader2)))) (or (boundp prefix) diff --git a/core/core-load-paths.el b/core/core-load-paths.el index 0c752b3..3e17d4e 100644 --- a/core/core-load-paths.el +++ b/core/core-load-paths.el @@ -1,6 +1,6 @@ ;;; core-load-paths.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -73,5 +73,11 @@ `( ,spacemacs-core-directory ,(concat spacemacs-core-directory "libs/") - ,(concat spacemacs-core-directory "aprilfool/") + ,(concat spacemacs-core-directory "libs/spacemacs-theme/") + ;; ,(concat spacemacs-core-directory "aprilfool/") )) + +;; themes +(add-to-list 'custom-theme-load-path (concat spacemacs-core-directory + "libs/spacemacs-theme/")) + diff --git a/core/core-micro-state.el b/core/core-micro-state.el index 98c34b8..3a34118 100644 --- a/core/core-micro-state.el +++ b/core/core-micro-state.el @@ -1,7 +1,7 @@ ;;; -*- lexical-binding: t -*- ;;; core-micro-state.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-release-management.el b/core/core-release-management.el index 7967f9f..db7728f 100644 --- a/core/core-release-management.el +++ b/core/core-release-management.el @@ -1,6 +1,6 @@ ;;; core-spacemacs.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-spacemacs-buffer.el b/core/core-spacemacs-buffer.el index 5d11296..ae62c19 100644 --- a/core/core-spacemacs-buffer.el +++ b/core/core-spacemacs-buffer.el @@ -1,6 +1,6 @@ ;;; core-spacemacs-buffer.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -8,7 +8,12 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 -(defconst spacemacs-buffer-version-info "0.200" +;; +;;; Commentary: +;; +;;; Code: + +(defconst spacemacs-buffer-version-info "0.200.9" "Current version used to display addition release information.") (defconst spacemacs-buffer-name "*spacemacs*" @@ -18,38 +23,39 @@ "The title displayed beneath the logo.") (defconst spacemacs-buffer-buttons-startup-lists-offset 25 - "Relative position in characters of the home buffer buttons and the home - buffer startup lists.") + "Relative position between the home buffer buttons and startup lists.") -(defconst spacemacs-buffer--banner-length 75 - "Width of a banner.") +(defconst spacemacs-buffer--window-width 80 + "Current width of the home buffer if responsive, 80 otherwise. +See `dotspacemacs-startup-buffer-responsive'.") (defconst spacemacs-buffer--cache-file (expand-file-name (concat spacemacs-cache-directory "spacemacs-buffer.el")) - "Cache file for various persistent data for the spacemacs startup buffer") + "Cache file for various persistent data for the spacemacs startup buffer.") (defvar spacemacs-buffer-startup-lists-length 20 "Length used for startup lists with otherwise unspecified bounds. Set to nil for unbounded.") (defvar spacemacs-buffer--release-note-version nil - "If nil the release note is displayed. If non nil it contains -a version number, if the version number is lesser than the current -version the release note it displayed") + "If nil the release note is displayed. +If non nil it contains a version number, if the version number is lesser than +the current version the release note it displayed") (defvar spacemacs-buffer--note-widgets nil - "List of widgets used to display the release note.") + "List of widgets used in currently inserted notes. +Allows to keep track of widgets to delete when removing them.") -(defvar spacemacs-buffer--previous-insert-type nil - "Previous type of note inserted.") +(defvar spacemacs-buffer--current-note-type nil + "Type of note currently displayed.") (defvar spacemacs-buffer--fresh-install (not (file-exists-p dotspacemacs-filepath)) "Non-nil if this Emacs instance if a fresh install.") (defvar spacemacs-buffer--buttons-position nil - "Offset in characters between the edge of the screen and the beginning of the - home buffer buttons. Do not set this variable.") + "Horizontal position of the home buffer buttons. +Internal use, do not set this variable.") (defvar spacemacs-buffer-mode-map (let ((map (make-sparse-keymap))) @@ -72,10 +78,7 @@ version the release note it displayed") (evil-make-overriding-map spacemacs-buffer-mode-map 'motion)) (define-derived-mode spacemacs-buffer-mode fundamental-mode "Spacemacs buffer" - "Spacemacs major mode for startup screen. - -\\ -" + "Spacemacs major mode for startup screen." :group 'spacemacs :syntax-table nil :abbrev-table nil @@ -88,8 +91,10 @@ version the release note it displayed") ;; motion state since this is a special mode (evil-set-initial-state 'spacemacs-buffer-mode 'motion)) -(defun spacemacs-buffer/insert-ascii-banner-centered (file) - (insert-string +(defun spacemacs-buffer//insert-ascii-banner-centered (file) + "Insert the ascii banner contain in file and center it in the window. +FILE: the path to the file containing the banner." + (insert (with-temp-buffer (insert-file-contents file) (let ((banner-width 0)) @@ -99,16 +104,16 @@ version the release note it displayed") (setq banner-width line-length))) (forward-line 1)) (goto-char 0) - (let ((margin (max 0 (floor (/ (- spacemacs-buffer--banner-length banner-width) 2))))) + (let ((margin (max 0 (floor (/ (- spacemacs-buffer--window-width + banner-width) 2))))) (while (not (eobp)) - (insert (make-string margin ?\ )) + (insert (make-string margin ?\s)) (forward-line 1)))) (buffer-string)))) (defun spacemacs-buffer/insert-banner-and-buttons () - "Choose a banner according to `dotspacemacs-startup-banner'and insert it + "Choose a banner according to `dotspacemacs-startup-banner'and insert it. in spacemacs buffer along with quick buttons underneath. - Easter egg: Doge special text banner can be reachable via `999', `doge' or `random*'. Cate special text banner can de reachable via `998', `cat' or `random*'. @@ -120,32 +125,28 @@ Cate special text banner can de reachable via `998', `cat' or `random*'. (spacemacs-buffer/message (format "Banner: %s" banner)) (if (image-type-available-p (intern (file-name-extension banner))) (spacemacs-buffer//insert-image-banner banner) - (spacemacs-buffer/insert-ascii-banner-centered banner)) + (spacemacs-buffer//insert-ascii-banner-centered banner)) (spacemacs-buffer//inject-version)) (spacemacs-buffer//insert-buttons) (spacemacs//redisplay)))) -(defun spacemacs-buffer/display-info-box () - "Display an info box." +(defun spacemacs-buffer/display-startup-note () + "Decide of the startup note and display it if relevant." (when (file-exists-p spacemacs-buffer--cache-file) (load spacemacs-buffer--cache-file)) (cond (spacemacs-buffer--fresh-install ;; we assume the user is new to spacemacs and open the quickhelp - (spacemacs-buffer/toggle-note - (concat spacemacs-info-directory "quickhelp.txt") - (spacemacs-buffer//insert-note-p 'quickhelp)) + (spacemacs-buffer/toggle-note 'quickhelp) (setq spacemacs-buffer--release-note-version spacemacs-version) (spacemacs/dump-vars-to-file '(spacemacs-buffer--release-note-version) - spacemacs-buffer--cache-file)) + spacemacs-buffer--cache-file)) ((or (not spacemacs-buffer--release-note-version) (version< spacemacs-buffer--release-note-version spacemacs-version)) - ;; check the variable ;; spacemacs-buffer--release-note-version - ;; to decide whether ;; we show the release note - (spacemacs-buffer/toggle-note - (concat spacemacs-release-notes-directory - spacemacs-buffer-version-info ".txt") 'release-note))) + ;; check the variable spacemacs-buffer--release-note-version + ;; to decide whether we show the release note + (spacemacs-buffer/toggle-note 'release-note))) (spacemacs//redisplay)) (defun spacemacs-buffer//choose-banner () @@ -181,7 +182,6 @@ Cate special text banner can de reachable via `998', `cat' or `random*'. (defun spacemacs-buffer//choose-random-text-banner (&optional all) "Return the full path of a banner chosen randomly. - If ALL is non-nil then truly all banners can be selected." (setq spacemacs-buffer--random-banner (or spacemacs-buffer--random-banner @@ -196,41 +196,43 @@ If ALL is non-nil then truly all banners can be selected." (concat spacemacs-banner-directory (format "%03d-banner.txt" index))) (defun spacemacs-buffer//insert-image-banner (banner) - "Display an image banner." + "Display an image banner. +BANNER: the path to an ascii banner file." (when (file-exists-p banner) (let* ((title spacemacs-buffer-logo-title) (spec (create-image banner)) (size (image-size spec)) (width (car size)) - (left-margin (max 0 (floor (- spacemacs-buffer--banner-length width) 2)))) + (left-margin (max 0 (floor (- spacemacs-buffer--window-width width) 2)))) (goto-char (point-min)) (insert "\n") - (insert (make-string left-margin ?\ )) + (insert (make-string left-margin ?\s)) (insert-image spec) (insert "\n\n") - (insert (make-string (max 0 (floor (/ (- spacemacs-buffer--banner-length - (+ (length title) 1)) 2))) ?\ )) + (insert (make-string (max 0 (floor (/ (- spacemacs-buffer--window-width + (+ (length title) 1)) 2))) ?\s)) (insert (format "%s\n\n" title))))) (defun spacemacs-buffer//inject-version () - "Inject the current version of spacemacs in the first line of the -buffer, right justified." + "Inject the current version of spacemacs. +Insert it in the first line of the buffer, right justified." (with-current-buffer (get-buffer-create spacemacs-buffer-name) (save-excursion - (let ((maxcol spacemacs-buffer--banner-length) - (version (format "%s@%s (%s)" + (let ((version (format "%s@%s (%s)" spacemacs-version emacs-version dotspacemacs-distribution)) (buffer-read-only nil)) (goto-char (point-min)) (delete-region (point) (progn (end-of-line) (point))) - (insert (format (format "%%%ds" maxcol) version)))))) + (insert (format (format "%%%ds" + spacemacs-buffer--window-width) + version)))))) (defun spacemacs-buffer//insert-footer () + "Insert the footer of the home buffer." (save-excursion - (let* ((maxcol spacemacs-buffer--banner-length) - (badge-path spacemacs-badge-official-png) + (let* ((badge-path spacemacs-badge-official-png) (badge (when (and (display-graphic-p) (image-type-available-p (intern (file-name-extension badge-path)))) @@ -250,77 +252,154 @@ buffer, right justified." (spacemacs-buffer/insert-page-break) (insert "\n") (when badge - (insert (make-string (floor (/ (- maxcol badge-size) 2)) ?\ )) - (insert-image badge)) + (insert-image badge) + (spacemacs-buffer//center-line badge-size)) (when heart (when badge (insert "\n\n")) - (insert (make-string (floor (/ (- maxcol - (length build-lhs) - heart-size - (length build-rhs)) 2)) ?\ )) (insert build-lhs) (insert-image heart) (insert build-rhs) + (spacemacs-buffer//center-line (+ (length build-lhs) + heart-size + (length build-rhs))) (insert "\n")))))) -(defun spacemacs-buffer//insert-note (file caption &optional additional-widgets) +(defun spacemacs-buffer//notes-render-framed-text + (content &optional topcaption botcaption hpadding max-width min-width) + "Return a formated string framed with plained lines. +The width of the created frame is the width of the content, unless it does not +satisfy max-width or min-width. Note that max-width can be limited by the +window's width. +CONTENT can be a text or a filepath. +TOPCAPTION is a text to be encrusted at the top of the frame. +BOTCAPTION is a text to be encrusted at the bottom of the frame. +HPADDING is the horizontal spacing between the text and the frame. The vertical + spacing is always one line. +MAX-WIDTH is the maximum width of the frame, frame included. When + `dotspacemacs-startup-buffer-responsive' is t, MAX-WIDTH will be + limited to the window's width. MAX-WIDTH takes precedence over + MIN-WIDTH. +MIN-WIDTH is the minimal width of the frame, frame included. The frame will not + shrink any thinner than MIN-WIDTH characters unless MAX-WIDTH says + otherwise." + (with-temp-buffer + (if (not (file-exists-p content)) + (insert content) + (insert-file-contents content) + (goto-char (point-max)) + (when (eq ?\n (char-before)) ;; remove additional newline at eof + (delete-char -1))) + (let* ((hpadding (if hpadding hpadding 1)) + (text-width (spacemacs-buffer//get-buffer-width)) + (width (+ 2 (* 2 hpadding) text-width)) + (fill-column text-width) + (sentence-end-double-space nil) ; needed by fill-region + (paragraph-start "\f\\|[ \t]*$\\|[ \t]*[-+*] \\|[ \t]*[0-9]+[.)] ") + (topcaption-length (if topcaption (length topcaption) 0)) + (botcaption-length (if botcaption (length botcaption) 0))) + (setq max-width (or max-width width) + min-width (or min-width 1) + max-width (if (< max-width min-width) min-width max-width) + max-width (if (> max-width spacemacs-buffer--window-width) + spacemacs-buffer--window-width + max-width)) + (when (< width min-width) + (setq width min-width + fill-column (max 0 (- min-width 2 (* hpadding 2))))) + (when (> width max-width) + (setq width max-width + fill-column (max 0 (- max-width 2 (* hpadding 2))))) + (spacemacs-buffer||notes-adapt-caption-to-width topcaption + topcaption-length + width) + (spacemacs-buffer||notes-adapt-caption-to-width botcaption + botcaption-length + width) + (fill-region (point-min) (point-max) nil nil) + (concat + "╭─" (when topcaption (propertize (concat " " topcaption " ") + 'face + '(:weight bold))) + (make-string (max 0 (- width (if topcaption 6 4) topcaption-length)) ?─) "─╮\n" + (spacemacs-buffer//notes-render-framed-line "" width hpadding) + (mapconcat (lambda (line) + (spacemacs-buffer//notes-render-framed-line line width hpadding)) + (split-string (buffer-string) "\n" nil) "") + (spacemacs-buffer//notes-render-framed-line "" width hpadding) + "╰─" (when botcaption (propertize (concat " " botcaption " ") + 'face '(:weight bold))) + (make-string (max 0 (- width (if botcaption 6 4) botcaption-length)) ?─) + "─╯" (when botcaption "\n"))))) + +(defmacro spacemacs-buffer||notes-adapt-caption-to-width (caption + caption-length + width) + "Adapt caption string's length to the note's frame current width. +For internal use in `spacemacs-buffer//notes-render-framed-text'. +CAPTION: string to be encrusted onto the note's frame +CAPTION-LENGTH: length of the caption +WIDTH: current external width of the note's frame." + `(when (> ,caption-length (- ,width 6)) ; minimum frame width is 6 + (if (> ,width 8) + (setq ,caption (concat (substring ,caption + 0 + (min -3 (- (- ,width 6 3) + ,caption-length))) + "...")) + (setq ,caption nil + ,caption-length 0)))) + +(defun spacemacs-buffer//notes-render-framed-line (line width hpadding) + "Return a formated LINE with borders of a frame on each side. +WIDTH: external width of the frame. LINE should be shorter than WIDTH. +HPADDING: horizontal padding on both sides of the framed string." + (let ((fill (max 0 (- width 2 hpadding (length line))))) + (concat "│" (make-string hpadding ?\s) line (make-string fill ?\s) + "│\n"))) + +(defun spacemacs-buffer//notes-insert-note + (file topcaption botcaption &optional additional-widgets) "Insert the release note just under the banner. - -FILE is the file that contains the content to show. -CAPTION is the title of the note. -TAG-STRING is the label of the button for additional action. -HELP-STRING is the help message of the button for additional action." +FILE: the file that contains the content to show. +TOPCAPTION: the title of the note. +BOTCAPTION: a text to be encrusted at the bottom of the frame. +ADDITIONAL-WIDGETS: a function for inserting a widget under the frame." (save-excursion (goto-char (point-min)) - (search-forward "Search in Spacemacs\]") + (search-forward "Search in Spacemacs\]") ; TODO: this is dirty (forward-line) - (let* ((note (concat "\n" (spacemacs//render-framed-text - file spacemacs-buffer--banner-length caption)))) - (add-to-list 'spacemacs-buffer--note-widgets (widget-create 'text note)) - (save-excursion + (let* ((buffer-read-only nil) + (note (concat "\n" + (spacemacs-buffer//notes-render-framed-text file + topcaption + botcaption + 2 + nil + 80)))) + (save-restriction + (narrow-to-region (point) (point)) + (add-to-list 'spacemacs-buffer--note-widgets (widget-create 'text note)) + (let* ((width (spacemacs-buffer//get-buffer-width)) + (padding (max 0 (floor (/ (- spacemacs-buffer--window-width + width) 2))))) + (goto-char (point-min)) + (while (not (eobp)) + (beginning-of-line) + (insert (make-string padding ?\s)) + (forward-line)))) + (save-excursion (while (re-search-backward "\\[\\[\\(.*\\)\\]\\]" nil t) - (let ((buffer-read-only nil)) - (make-text-button - (match-beginning 1) - (match-end 1) - 'type 'help-url - 'help-args (list (match-string 1)))))) - (funcall additional-widgets)))) - -(defun spacemacs-buffer//insert-note-p (type) - "Decicde if whether to insert note widget or not based on current note TYPE. - -If note TYPE is `quickhelp' or `release-note' and is equal to -previous insert type in `spacemacs-buffer--previous-insert-type', -which means previous note widget of the same type already -inserted. In this case, we simply delete the widgets but don't insert. - -Otherwise, delete and allow insert note of TYPE." - (if (not (eq spacemacs-buffer--previous-insert-type type)) - type - (setq spacemacs-buffer--previous-insert-type nil))) - -(defun spacemacs-buffer/toggle-note (file type) - "Toggle the note in FILE for the buffer based on TYPE. - -If TYPE is nil, just remove widgets." - (interactive) - (spacemacs-buffer//remove-existing-widget-if-exist) - (cond - ((eq type 'quickhelp) - (spacemacs-buffer//insert-quickhelp-widget file)) - ((eq type 'release-note) - (spacemacs-buffer//insert-release-note-widget file)) - (t))) - -(defun spacemacs-buffer//remove-existing-widget-if-exist () - "Remove existing note widgets if exists." - (when spacemacs-buffer--note-widgets - (spacemacs-buffer//remove-note-widgets))) + (make-text-button (match-beginning 1) + (match-end 1) + 'type 'help-url + 'help-args (list (match-string 1))))) + (funcall additional-widgets) + (spacemacs-buffer//center-line) + (delete-trailing-whitespace (line-beginning-position) + (line-end-position))))) -(defun spacemacs-buffer//insert-quickhelp-widget (file) - "Insert quickhelp with content from FILE." - (spacemacs-buffer//remove-existing-widget-if-exist) +(defun spacemacs-buffer//notes-insert-quickhelp () + "Insert quickhelp." (let ((widget-func (lambda () (add-to-list @@ -358,12 +437,14 @@ If TYPE is nil, just remove widgets." "VIMUSERS.org") "^" 'all)) :mouse-face 'highlight :follow-link "\C-m"))))) - (spacemacs-buffer//insert-note file "Quick Help" widget-func)) - (setq spacemacs-buffer--previous-insert-type 'quickhelp)) - -(defun spacemacs-buffer//insert-release-note-widget (file) - "Insert release note with content from FILE." - (spacemacs-buffer//remove-existing-widget-if-exist) + (spacemacs-buffer//notes-insert-note (concat spacemacs-info-directory + "quickhelp.txt") + "Quick Help" + nil + widget-func))) + +(defun spacemacs-buffer//notes-insert-release-note () + "Insert release note." (let ((widget-func (lambda () (add-to-list @@ -382,31 +463,62 @@ If TYPE is nil, just remove widgets." 'subtree)) :mouse-face 'highlight :follow-link "\C-m"))))) - (spacemacs-buffer//insert-note file - (format " Important Notes (Release %s.x) " - spacemacs-buffer-version-info) - widget-func)) - + (spacemacs-buffer//notes-insert-note (concat spacemacs-release-notes-directory + spacemacs-buffer-version-info + ".txt") + (format "Important Notes (Release %s.x)" + spacemacs-buffer-version-info) + "Update your dotfile (SPC f e D) and\ + packages after every update" + widget-func)) (setq spacemacs-buffer--release-note-version nil) - (spacemacs/dump-vars-to-file - '(spacemacs-buffer--release-note-version) spacemacs-buffer--cache-file) - (setq spacemacs-buffer--previous-insert-type 'release-note)) + (spacemacs/dump-vars-to-file '(spacemacs-buffer--release-note-version) + spacemacs-buffer--cache-file)) -(defun spacemacs-buffer//remove-note-widgets () - (mapc 'widget-delete spacemacs-buffer--note-widgets) - (setq spacemacs-buffer--note-widgets nil) - (setq spacemacs-buffer--release-note-version spacemacs-version) - (spacemacs/dump-vars-to-file - '(spacemacs-buffer--release-note-version) spacemacs-buffer--cache-file)) +(defun spacemacs-buffer//notes-clear-notes-and-widgets () + "Remove existing note widgets if exists." + (when spacemacs-buffer--note-widgets + (mapc 'widget-delete spacemacs-buffer--note-widgets) + (setq spacemacs-buffer--note-widgets nil) + (setq spacemacs-buffer--release-note-version spacemacs-version) + (spacemacs/dump-vars-to-file + '(spacemacs-buffer--release-note-version) spacemacs-buffer--cache-file))) + +(defun spacemacs-buffer//notes-redisplay-current-note () + "Delete and rediplay the currently displayed note." + (spacemacs-buffer//notes-clear-notes-and-widgets) + (let ((type spacemacs-buffer--current-note-type)) + (cond + ((eq type 'quickhelp) (spacemacs-buffer//notes-insert-quickhelp)) + ((eq type 'release-note) (spacemacs-buffer//notes-insert-release-note)) + (t)))) + +(defun spacemacs-buffer/toggle-note (type) + "Toggle the displayed note based on TYPE. +If TYPE is nil or unknown, just remove the currently displayed note. Currently +allowed types are `quickhelp' and `release-note'" + (spacemacs-buffer//notes-clear-notes-and-widgets) + (if (or (eq spacemacs-buffer--current-note-type nil) + (not (eq spacemacs-buffer--current-note-type type))) + (progn + (setq spacemacs-buffer--current-note-type type) + (cond + ((eq type 'quickhelp) (spacemacs-buffer//notes-insert-quickhelp)) + ((eq type 'release-note) (spacemacs-buffer//notes-insert-release-note)) + (t (setq spacemacs-buffer--current-note-type nil) + (message "Unknown note type: %s" 'type)))) + (setq spacemacs-buffer--current-note-type nil))) (defun spacemacs-buffer/set-mode-line (format) - "Set mode-line format for spacemacs buffer." + "Set mode-line format for spacemacs buffer. +FORMAT: the `mode-line-format' variable Emacs will use to build the mode-line." (with-current-buffer (get-buffer-create spacemacs-buffer-name) (setq mode-line-format format))) (defun spacemacs-buffer/message (msg &rest args) - "Display MSG in message prepended with '(Spacemacs)'. -The message is displayed only if `init-file-debug' is non nil." + "Display MSG in *Messages* prepended with '(Spacemacs)'. +The message is displayed only if `init-file-debug' is non nil. +ARGS: format string arguments." (when init-file-debug (message "(Spacemacs) %s" (apply 'format msg args)))) @@ -415,128 +527,41 @@ The message is displayed only if `init-file-debug' is non nil." (defun spacemacs-buffer/warning (msg &rest args) "Display MSG as a warning message but in buffer `*Messages*'. -The message is always displayed. " +ARGS: format string arguments." (let ((msg (apply 'format msg args))) (message "(Spacemacs) Warning: %s" msg) - (add-to-list 'spacemacs-buffer--warnings msg 'append))) + (when message-log-max + (add-to-list 'spacemacs-buffer--warnings msg 'append)))) (defun spacemacs-buffer/insert-page-break () "Insert a page break line in spacemacs buffer." (spacemacs-buffer/append "\n \n")) (defun spacemacs-buffer/append (msg &optional messagebuf) - "Append MSG to spacemacs buffer. If MESSAGEBUF is not nil then MSG is - also written in message buffer." + "Append MSG to spacemacs buffer. +If MESSAGEBUF is not nil then MSG is also written in message buffer." (with-current-buffer (get-buffer-create spacemacs-buffer-name) (goto-char (point-max)) (let ((buffer-read-only nil)) (insert msg) - (if messagebuf (message "(Spacemacs) %s" msg))) - (spacemacs-buffer/set-mode-line ""))) + (when messagebuf + (message "(Spacemacs) %s" msg))))) (defun spacemacs-buffer/replace-last-line (msg &optional messagebuf) - "Replace the last line of the spacemacs buffer with MSG. If MESSAGEBUF is - not nil then MSG is also written in message buffer." + "Replace the last line of the spacemacs buffer with MSG. +If MESSAGEBUF is not nil then MSG is also written in message buffer." (with-current-buffer (get-buffer-create spacemacs-buffer-name) (goto-char (point-max)) (let ((buffer-read-only nil)) (delete-region (line-beginning-position) (point-max)) (insert msg) - (if messagebuf (message "(Spacemacs) %s" msg))) - (spacemacs-buffer/set-mode-line ""))) - -(defun spacemacs-buffer/insert-framed-text - (msg &optional caption hpadding) - "Insert MSG in spacemacs buffer within a frame of width FILL-COLUMN. - -See `spacemacs//render-framed-text' for documentation of the other -parameters." - (with-current-buffer (get-buffer-create spacemacs-buffer-name) - (let ((buffer-read-only nil)) - (insert (spacemacs//render-framed-text msg spacemacs-buffer--banner-length - caption hpadding))))) - -(defun spacemacs-buffer/insert-framed-text-from-file - (filepath &optional caption hpadding) - "Insert at point the content of FILENAME file in spacemacs buffer in a -frame. - -If FILEPATH does not exists the function returns nil. - -See `spacemacs//render-framed-text' for documentation of the other -parameters." - (when (file-exists-p filepath) - (with-current-buffer (get-buffer-create spacemacs-buffer-name) - (let ((buffer-read-only nil)) - (insert (spacemacs//render-framed-text - filepath spacemacs-buffer--banner-length caption hpadding)))))) - -(defun spacemacs//render-framed-text (content &optional width caption hpadding) - "Return a formated string framed with plained lines of width FILL-COLUMN. - -CONTENT can be a text or a filepath. - -WIDTH set the `fill-column' variable. - -If CAPTION is non nil string then it is included in at the top of the frame. -If CAPTION length is greater than FILL-COLUMN minus 5 the function returns -nil. - -HPADDING is the horizontal spacing between the text and the frame. -The vertical spacing is always one line." - (with-temp-buffer - (if (not (file-exists-p content)) - (insert content) - (insert-file-contents content) - ;; remove additional newline at eof - (goto-char (point-max)) - (delete-char -1)) - (let* ((hpadding (or hpadding 1)) - (fill-column (if width - (- width (+ 2 (* 2 hpadding))) - fill-column)) - (sentence-end-double-space nil) - (caption-len (length caption))) - (fill-region (point-min) (point-max) 'justify 'nosqueeze) - (concat - ;; top - "╭─" - (if caption - (concat caption - (make-string (max 0 (+ (- fill-column caption-len 1) - hpadding)) ?─)) - (make-string fill-column ?─)) - (make-string hpadding ?─) "╮\n" - ;; content - (spacemacs//render-framed-line "" hpadding) - (mapconcat (lambda (x) - (spacemacs//render-framed-line x hpadding)) - (split-string (buffer-string) "\n" nil) "") - (spacemacs//render-framed-line "" hpadding) - ;; bottom - "╰" (make-string hpadding ?─) - (make-string fill-column ?─) - (make-string hpadding ?─) "╯")))) - -(defun spacemacs//render-framed-line (line hpadding) - "Return a formated LINE with borders of a frame on each side and -with width FILL-COLUMN. - -If length of LINE is bigger than FILL-COLUMN it returns nil. - -HPADDING is the horizontal spacing betwee the content line and the frame -border." - (let* ((len (length line)) - (fill (- fill-column len))) - (when (>= fill 0) - (concat "│" (make-string hpadding ?\s) - line (make-string fill ?\s) - (make-string hpadding ?\s) "│\n")))) + (when messagebuf + (message "(Spacemacs) %s" msg))))) (defun spacemacs-buffer/loading-animation () - "Display the progress bar by chunk of size -`spacemacs--loading-dots-chunk-threshold'." - (when (and (not noninteractive) dotspacemacs-loading-progress-bar) + "Display the progress bar by chunks of size `spacemacs--loading-dots-chunk-threshold'." + (when (and (not noninteractive) + dotspacemacs-loading-progress-bar) (setq spacemacs-loading-counter (1+ spacemacs-loading-counter)) (setq spacemacs-loading-value (1+ spacemacs-loading-value)) (when (>= spacemacs-loading-counter spacemacs-loading-dots-chunk-threshold) @@ -555,8 +580,13 @@ border." suffix))) (spacemacs//redisplay)))) -(defmacro spacemacs//insert--shortcut (shortcut-char search-label - &optional no-next-line) +(defmacro spacemacs-buffer||add-shortcut + (shortcut-char search-label &optional no-next-line) + "Add a single-key keybinding for quick navigation in the home buffer. +Navigation is done by searching for a specific word in the buffer. +SHORTCUT-CHAR: the key that the user will have to press. +SEARCH-LABEL: the word the cursor will be brought under (or on). +NO-NEXT-LINE: if nil the cursor is brought under the searched word." `(define-key spacemacs-buffer-mode-map ,shortcut-char (lambda () (interactive) @@ -566,116 +596,118 @@ border." '((forward-line 1))) (back-to-indentation)))) -(defun spacemacs-buffer//center-line () - (let* ((width (current-column)) - (margin (max 0 (floor (/ (- spacemacs-buffer--banner-length width) 2))))) +(defun spacemacs-buffer//center-line (&optional real-width) + "When point is at the end of a line, center it. +REAL-WIDTH: the real width of the line. If the line contains an image, the size + of that image will be considered to be 1 by the calculation method + used in this function. As a consequence, the caller must calculate + himself the correct length of the line taking into account the + images he inserted in it." + (let* ((width (or real-width (current-column))) + (margin (max 0 (floor (/ (- spacemacs-buffer--window-width + width) + 2))))) (beginning-of-line) - (insert (make-string margin ?\ )) + (insert (make-string margin ?\s)) (end-of-line))) (defun spacemacs-buffer//insert-buttons () - (goto-char (point-max)) - (spacemacs//insert--shortcut "m" "[?]" t) - (widget-create 'url-link - :tag (propertize "?" 'face 'font-lock-doc-face) - :help-echo "Open the quickhelp." - :action (lambda (&rest ignore) - (spacemacs-buffer/toggle-note - (concat spacemacs-info-directory "quickhelp.txt") - ;; if nil is returned, - ;; just delete the current note widgets - (spacemacs-buffer//insert-note-p 'quickhelp))) - :mouse-face 'highlight - :follow-link "\C-m") - (insert " ") - (widget-create 'url-link - :tag (propertize "Homepage" 'face 'font-lock-keyword-face) - :help-echo "Open the Spacemacs Github page in your browser." - :mouse-face 'highlight - :follow-link "\C-m" - "http://spacemacs.org") - (insert " ") - (widget-create 'url-link - :tag (propertize "Documentation" 'face 'font-lock-keyword-face) - :help-echo "Open the Spacemacs documentation in your browser." - :mouse-face 'highlight - :follow-link "\C-m" - "http://spacemacs.org/doc/DOCUMENTATION.html") - (insert " ") - (widget-create 'url-link - :tag (propertize "Gitter Chat" 'face 'font-lock-keyword-face) - :help-echo - "Ask questions and chat with fellow users in our chat room." - :mouse-face 'highlight - :follow-link "\C-m" - "https://gitter.im/syl20bnr/spacemacs") - (insert " ") - (widget-create 'push-button - :help-echo "Update Spacemacs core and layers." - :action (lambda (&rest ignore) (spacemacs/switch-to-version)) - :mouse-face 'highlight - :follow-link "\C-m" - (propertize "Update Spacemacs" 'face 'font-lock-keyword-face)) - (let ((len (- (line-end-position) - (line-beginning-position)))) - (spacemacs-buffer//center-line) - (setq spacemacs-buffer--buttons-position (- (line-end-position) - (line-beginning-position) - len))) - (insert "\n") - (widget-create 'push-button - :help-echo "Update all ELPA packages to the latest versions." - :action (lambda (&rest ignore) - (configuration-layer/update-packages)) - :mouse-face 'highlight - :follow-link "\C-m" - (propertize "Update Packages" 'face 'font-lock-keyword-face)) - (insert " ") - (widget-create 'push-button - :help-echo - "Rollback ELPA package updates if something got borked." - :action (lambda (&rest ignore) - (call-interactively 'configuration-layer/rollback)) - :mouse-face 'highlight - :follow-link "\C-m" - (propertize "Rollback Package Update" - 'face 'font-lock-keyword-face)) - (spacemacs-buffer//center-line) - (insert "\n") - (widget-create 'push-button - :tag (propertize "Release Notes" - 'face 'font-lock-preprocessor-face) - :help-echo "Hide or show the Changelog" - :action (lambda (&rest ignore) - (spacemacs-buffer/toggle-note - (concat spacemacs-release-notes-directory - spacemacs-buffer-version-info - ".txt") - ;; if nil is returned, - ;; just delete the current note widgets - (spacemacs-buffer//insert-note-p 'release-note))) - :mouse-face 'highlight - :follow-link "\C-m") - (insert " ") - (widget-create 'url-link - :tag (propertize "Search in Spacemacs" - 'face 'font-lock-function-name-face) - :help-echo "Search Spacemacs contents." - :action - (lambda (&rest ignore) - (let ((comp-frontend - (cond - ((configuration-layer/layer-usedp 'helm) - 'helm-spacemacs-help) - ((configuration-layer/layer-usedp 'ivy) - 'ivy-spacemacs-help)))) - (call-interactively comp-frontend))) - :mouse-face 'highlight - :follow-link "\C-m") + "Create and insert the interactive buttons under Spacemacs banner." + (goto-char (point-max)) + (spacemacs-buffer||add-shortcut "m" "[?]" t) + (widget-create 'url-link + :tag (propertize "?" 'face 'font-lock-doc-face) + :help-echo "Open the quickhelp." + :action (lambda (&rest ignore) + (spacemacs-buffer/toggle-note 'quickhelp)) + :mouse-face 'highlight + :follow-link "\C-m") + (insert " ") + (widget-create 'url-link + :tag (propertize "Homepage" 'face 'font-lock-keyword-face) + :help-echo "Open the Spacemacs Github page in your browser." + :mouse-face 'highlight + :follow-link "\C-m" + "http://spacemacs.org") + (insert " ") + (widget-create 'url-link + :tag (propertize "Documentation" 'face 'font-lock-keyword-face) + :help-echo "Open the Spacemacs documentation in your browser." + :mouse-face 'highlight + :follow-link "\C-m" + "http://spacemacs.org/doc/DOCUMENTATION.html") + (insert " ") + (widget-create 'url-link + :tag (propertize "Gitter Chat" 'face 'font-lock-keyword-face) + :help-echo + "Ask questions and chat with fellow users in our chat room." + :mouse-face 'highlight + :follow-link "\C-m" + "https://gitter.im/syl20bnr/spacemacs") + (insert " ") + (widget-create 'push-button + :help-echo "Update Spacemacs core and layers." + :action (lambda (&rest ignore) (spacemacs/switch-to-version)) + :mouse-face 'highlight + :follow-link "\C-m" + (propertize "Update Spacemacs" 'face 'font-lock-keyword-face)) + (let ((len (- (line-end-position) + (line-beginning-position)))) (spacemacs-buffer//center-line) - (insert "\n\n")) + (setq spacemacs-buffer--buttons-position (- (line-end-position) + (line-beginning-position) + len))) + (insert "\n") + (widget-create 'push-button + :help-echo "Update all ELPA packages to the latest versions." + :action (lambda (&rest ignore) + (configuration-layer/update-packages)) + :mouse-face 'highlight + :follow-link "\C-m" + (propertize "Update Packages" 'face 'font-lock-keyword-face)) + (insert " ") + (widget-create 'push-button + :help-echo + "Rollback ELPA package updates if something got borked." + :action (lambda (&rest ignore) + (call-interactively 'configuration-layer/rollback)) + :mouse-face 'highlight + :follow-link "\C-m" + (propertize "Rollback Package Update" + 'face 'font-lock-keyword-face)) + (spacemacs-buffer//center-line) + (insert "\n") + (widget-create 'push-button + :tag (propertize "Release Notes" + 'face 'font-lock-preprocessor-face) + :help-echo "Hide or show the Changelog" + :action (lambda (&rest ignore) + (spacemacs-buffer/toggle-note 'release-note)) + :mouse-face 'highlight + :follow-link "\C-m") + (insert " ") + (widget-create 'url-link + :tag (propertize "Search in Spacemacs" + 'face 'font-lock-function-name-face) + :help-echo "Search Spacemacs contents." + :action + (lambda (&rest ignore) + (let ((comp-frontend + (cond + ((configuration-layer/layer-usedp 'helm) + 'helm-spacemacs-help) + ((configuration-layer/layer-usedp 'ivy) + 'ivy-spacemacs-help)))) + (call-interactively comp-frontend))) + :mouse-face 'highlight + :follow-link "\C-m") + (spacemacs-buffer//center-line) + (insert "\n\n")) (defun spacemacs-buffer//insert-string-list (list-display-name list) + "Insert a non-interactive startup list in the home buffer. +LIST-DISPLAY-NAME: the displayed title of the list. +LIST: a list of strings displayed as entries." (when (car list) (insert list-display-name) (mapc (lambda (el) @@ -692,6 +724,9 @@ border." list))) (defun spacemacs-buffer//insert-file-list (list-display-name list) + "Insert an interactive list of files in the home buffer. +LIST-DISPLAY-NAME: the displayed title of the list. +LIST: a list of string pathnames made interactive in this function." (when (car list) (insert list-display-name) (mapc (lambda (el) @@ -708,6 +743,9 @@ border." list))) (defun spacemacs-buffer//insert-bookmark-list (list-display-name list) + "Insert an interactive list of bookmarks entries (if any) in the home buffer. +LIST-DISPLAY-NAME: the displayed title of the list. +LIST: a list of string bookmark names made interactive in this function." (when (car list) (insert list-display-name) (mapc (lambda (el) @@ -727,7 +765,8 @@ border." list))) (defun spacemacs-buffer//get-org-items (types) - "Make a list of agenda file items for today of kind types" + "Make a list of agenda file items for today of kind types. +TYPES: list of `org-mode' types to fetch." (require 'org-agenda) (let ((date (calendar-gregorian-from-absolute (org-today)))) (apply #'append @@ -739,24 +778,28 @@ border." types)))))) (defun spacemacs-buffer//agenda-list () - "Returns today's agenda" + "Return today's agenda." (require 'org-agenda) (spacemacs-buffer//get-org-items org-agenda-entry-types)) (defun spacemacs-buffer//todo-list () - "Returns current todos" + "Return current todos." (require 'org-agenda) (spacemacs-buffer//get-org-items '(:todo))) (defun spacemacs-buffer//make-org-items (file items) - "make a spacemacs-buffer org item list" + "Make a spacemacs-buffer org item list. +FILE: file name. +ITEMS:" (loop for item in items collect (spacemacs-buffer//make-org-item file item))) (defun spacemacs-buffer//make-org-item (file item) - "make a spacemacs-buffer version of an org item" + "Make a spacemacs-buffer version of an org item. +FILE: file name. +ITEM:" (list (cons "text" (get-text-property 0 'txt item)) (cons "file" file) @@ -767,6 +810,8 @@ border." (get-text-property 0 'time item)))) (defun spacemacs-buffer//org-jump (el) + "Action executed when using an item in the home buffer's todo list. +EL: `org-agenda' element to jump to." (require 'org-agenda) (find-file-other-window (cdr (assoc "file" el))) (widen) @@ -775,9 +820,9 @@ border." (org-show-context 'agenda) (save-excursion (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading + (org-flag-heading nil))) ; show the next heading (when (outline-invisible-p) - (outline-show-entry)) ; display invisible text + (outline-show-entry)) ; display invisible text (recenter (/ (window-height) 2)) (org-back-to-heading t) (if (re-search-forward org-complex-heading-regexp nil t) @@ -785,6 +830,9 @@ border." (run-hooks 'org-agenda-after-show-hook)) (defun spacemacs-buffer//insert-todo-list (list-display-name list) + "Insert an interactive todo list of `org-agenda' entries in the home buffer. +LIST-DISPLAY-NAME: the displayed title of the list. +LIST: list of `org-agenda' entries in the todo list." (when (car list) (insert list-display-name) (setq list (sort list @@ -818,71 +866,75 @@ border." list))) (defun spacemacs//subseq (seq start end) - "Use `cl-subseq`, but accounting for end points greater than the size of the -list. Return entire list if `END' is omitted." + "Adapted version of `cl-subseq'. +Use `cl-subseq', but accounting for end points greater than the size of the +list. Return entire list if end is omitted. +SEQ, START and END are the same arguments as for `cl-subseq'" (let ((len (length seq))) (cl-subseq seq start (and (number-or-marker-p end) (min len end))))) (defun spacemacs-buffer//do-insert-startupify-lists () - (let ((list-separator "\n\n")) - (mapc (lambda (els) - (let ((el (or (car-safe els) els)) - (list-size - (or (cdr-safe els) - spacemacs-buffer-startup-lists-length))) - (cond - ((eq el 'warnings) - (when (spacemacs-buffer//insert-string-list - "Warnings:" - spacemacs-buffer--warnings) - (spacemacs//insert--shortcut "w" "Warnings:") - (insert list-separator))) - ((eq el 'recents) - (recentf-mode) - (when (spacemacs-buffer//insert-file-list - "Recent Files:" - (spacemacs//subseq recentf-list 0 list-size)) - (spacemacs//insert--shortcut "r" "Recent Files:") - (insert list-separator))) - ((eq el 'todos) - (when (spacemacs-buffer//insert-todo-list - "ToDo:" - (spacemacs//subseq (spacemacs-buffer//todo-list) - 0 list-size)) - (spacemacs//insert--shortcut "d" "ToDo:") - (insert list-separator))) - ((eq el 'agenda) - (when (spacemacs-buffer//insert-todo-list - "Agenda:" - (spacemacs//subseq (spacemacs-buffer//agenda-list) - 0 list-size)) - (spacemacs//insert--shortcut "c" "Agenda:") - (insert list-separator))) - ((eq el 'bookmarks) - (when (configuration-layer/layer-usedp 'spacemacs-helm) - (helm-mode)) - (require 'bookmark) - (when (spacemacs-buffer//insert-bookmark-list - "Bookmarks:" - (spacemacs//subseq (bookmark-all-names) - 0 list-size)) - (spacemacs//insert--shortcut "b" "Bookmarks:") - (insert list-separator))) - ((and (eq el 'projects) - (fboundp 'projectile-mode)) - (projectile-mode) - (when (spacemacs-buffer//insert-file-list - "Projects:" - (spacemacs//subseq (projectile-relevant-known-projects) - 0 list-size)) - (spacemacs//insert--shortcut "p" "Projects:") - (insert list-separator)))))) - (append - '(warnings) - dotspacemacs-startup-lists)))) + "Insert the startup lists in the current buffer." + (let ((list-separator "\n\n")) + (mapc (lambda (els) + (let ((el (or (car-safe els) els)) + (list-size + (or (cdr-safe els) + spacemacs-buffer-startup-lists-length))) + (cond + ((eq el 'warnings) + (when (spacemacs-buffer//insert-string-list + "Warnings:" + spacemacs-buffer--warnings) + (spacemacs-buffer||add-shortcut "w" "Warnings:") + (insert list-separator))) + ((eq el 'recents) + (recentf-mode) + (when (spacemacs-buffer//insert-file-list + "Recent Files:" + (spacemacs//subseq recentf-list 0 list-size)) + (spacemacs-buffer||add-shortcut "r" "Recent Files:") + (insert list-separator))) + ((eq el 'todos) + (when (spacemacs-buffer//insert-todo-list + "ToDo:" + (spacemacs//subseq (spacemacs-buffer//todo-list) + 0 list-size)) + (spacemacs-buffer||add-shortcut "d" "ToDo:") + (insert list-separator))) + ((eq el 'agenda) + (when (spacemacs-buffer//insert-todo-list + "Agenda:" + (spacemacs//subseq (spacemacs-buffer//agenda-list) + 0 list-size)) + (spacemacs-buffer||add-shortcut "c" "Agenda:") + (insert list-separator))) + ((eq el 'bookmarks) + (when (configuration-layer/layer-usedp 'spacemacs-helm) + (helm-mode)) + (require 'bookmark) + (when (spacemacs-buffer//insert-bookmark-list + "Bookmarks:" + (spacemacs//subseq (bookmark-all-names) + 0 list-size)) + (spacemacs-buffer||add-shortcut "b" "Bookmarks:") + (insert list-separator))) + ((and (eq el 'projects) + (fboundp 'projectile-mode)) + (projectile-mode) + (when (spacemacs-buffer//insert-file-list + "Projects:" + (spacemacs//subseq (projectile-relevant-known-projects) + 0 list-size)) + (spacemacs-buffer||add-shortcut "p" "Projects:") + (insert list-separator)))))) + (append + '(warnings) + dotspacemacs-startup-lists)))) (defun spacemacs-buffer//get-buffer-width () + "Return the length of longest line in the current buffer." (save-excursion (goto-char 0) (let ((current-max 0)) @@ -893,20 +945,25 @@ list. Return entire list if `END' is omitted." (forward-line 1)) current-max))) -(defun spacemacs-buffer//center-startupify-lists () +(defun spacemacs-buffer//center-startup-lists () + "Center startup lists after they were inserted." (let* ((lists-width (spacemacs-buffer//get-buffer-width)) (margin (max 0 (- spacemacs-buffer--buttons-position spacemacs-buffer-buttons-startup-lists-offset))) - (final-padding (if (< spacemacs-buffer--banner-length (+ margin lists-width)) - (max 0 (floor (/ (- spacemacs-buffer--banner-length lists-width) 2))) + (final-padding (if (< spacemacs-buffer--window-width + (+ margin lists-width)) + (max 0 (floor (/ (- spacemacs-buffer--window-width + lists-width) + 2))) margin))) - (goto-char 0) + (goto-char (point-min)) (while (not (eobp)) - (line-beginning-position) - (insert (make-string final-padding ?\ )) + (beginning-of-line) + (insert (make-string final-padding ?\s)) (forward-line)))) -(defun spacemacs-buffer/insert-startupify-lists () +(defun spacemacs-buffer/insert-startup-lists () + "Insert startup lists in home buffer." (interactive) (with-current-buffer (get-buffer spacemacs-buffer-name) (let ((buffer-read-only nil)) @@ -916,7 +973,7 @@ list. Return entire list if `END' is omitted." (save-restriction (narrow-to-region (point) (point)) (spacemacs-buffer//do-insert-startupify-lists) - (spacemacs-buffer//center-startupify-lists))))) + (spacemacs-buffer//center-startup-lists))))) (defun spacemacs-buffer/goto-link-line () "Set point to the beginning of the link line." @@ -930,7 +987,7 @@ list. Return entire list if `END' is omitted." "Code executed when Emacs has finished loading." (with-current-buffer (get-buffer spacemacs-buffer-name) (when dotspacemacs-startup-lists - (spacemacs-buffer/insert-startupify-lists)) + (spacemacs-buffer/insert-startup-lists)) (spacemacs-buffer//insert-footer) (if configuration-layer-error-count (progn @@ -948,19 +1005,23 @@ list. Return entire list if `END' is omitted." (spacemacs-buffer/goto-link-line))) (defvar spacemacs-buffer--last-width nil - "Previous width of spacemacs-buffer") + "Previous width of spacemacs-buffer.") (defun spacemacs-buffer/goto-buffer (&optional refresh) - "Create the special buffer for `spacemacs-buffer-mode' if it doesn't -already exist, and switch to it." + "Create the special buffer for `spacemacs-buffer-mode' and switch to it. +REFRESH if the buffer should be redrawn." (interactive) (let ((buffer-exists (buffer-live-p (get-buffer spacemacs-buffer-name))) (save-line nil)) + (when (not buffer-exists) + (setq spacemacs-buffer--note-widgets nil)) (when (or (not (eq spacemacs-buffer--last-width (window-width))) (not buffer-exists) refresh) - (setq spacemacs-buffer--banner-length (window-width) - spacemacs-buffer--last-width spacemacs-buffer--banner-length) + (setq spacemacs-buffer--window-width (if dotspacemacs-startup-buffer-responsive + (window-width) + 80) + spacemacs-buffer--last-width spacemacs-buffer--window-width) (with-current-buffer (get-buffer-create spacemacs-buffer-name) (page-break-lines-mode) (save-excursion @@ -969,20 +1030,16 @@ already exist, and switch to it." (let ((inhibit-read-only t)) (erase-buffer))) (spacemacs-buffer/set-mode-line "") - ;; needed in case the buffer was deleted and we are recreating it - (setq spacemacs-buffer--note-widgets nil) (spacemacs-buffer/insert-banner-and-buttons) - ;; non-nil if emacs-startup-hook was run - (if (bound-and-true-p spacemacs-initialized) - (progn - (configuration-layer/display-summary emacs-start-time) - (when dotspacemacs-startup-lists - (spacemacs-buffer/insert-startupify-lists)) - (spacemacs-buffer//insert-footer) - (spacemacs-buffer/set-mode-line spacemacs--default-mode-line) - (force-mode-line-update) - (spacemacs-buffer-mode)) - (add-hook 'emacs-startup-hook 'spacemacs-buffer//startup-hook t)))) + (when (bound-and-true-p spacemacs-initialized) + (spacemacs-buffer//notes-redisplay-current-note) + (configuration-layer/display-summary emacs-start-time) + (when dotspacemacs-startup-lists + (spacemacs-buffer/insert-startup-lists)) + (spacemacs-buffer//insert-footer) + (spacemacs-buffer/set-mode-line spacemacs--default-mode-line) + (force-mode-line-update) + (spacemacs-buffer-mode)))) (if save-line (progn (goto-char (point-min)) (forward-line (1- save-line)) @@ -993,16 +1050,18 @@ already exist, and switch to it." (add-hook 'window-setup-hook (lambda () - (add-hook 'window-configuration-change-hook 'spacemacs-buffer//resize-on-hook) + (add-hook 'window-configuration-change-hook + 'spacemacs-buffer//resize-on-hook) (spacemacs-buffer//resize-on-hook))) (defun spacemacs-buffer//resize-on-hook () - (let ((space-win (get-buffer-window spacemacs-buffer-name)) + "Hook run on window resize events to redisplay the home buffer." + (let ((home-buffer (get-buffer-window spacemacs-buffer-name)) (frame-win (frame-selected-window))) (when (and dotspacemacs-startup-buffer-responsive - space-win + home-buffer (not (window-minibuffer-p frame-win))) - (with-selected-window space-win + (with-selected-window home-buffer (spacemacs-buffer/goto-buffer))))) (defun spacemacs-buffer/refresh () @@ -1022,3 +1081,5 @@ Useful for making the home buffer the only visible buffer in the frame." (delete-other-windows)) (provide 'core-spacemacs-buffer) + +;;; core-spacemacs-buffer ends here diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index 0eaafc8..f40f93c 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -1,6 +1,6 @@ ;;; core-spacemacs.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -67,6 +67,7 @@ the final step of executing code in `emacs-startup-hook'.") ;; this is for a smoother UX at startup (i.e. less graphical glitches) (hidden-mode-line-mode) (spacemacs//removes-gui-elements) + (spacemacs//setup-ido-vertical-mode) ;; explicitly set the prefered coding systems to avoid annoying prompt ;; from emacs (especially on Microsoft Windows) (prefer-coding-system 'utf-8) @@ -80,13 +81,26 @@ the final step of executing code in `emacs-startup-hook'.") (dotspacemacs/load-file) (require 'core-configuration-layer) (dotspacemacs|call-func dotspacemacs/init "Calling dotfile init...") + (when dotspacemacs-maximized-at-startup + (unless (frame-parameter nil 'fullscreen) + (toggle-frame-maximized)) + (add-to-list 'default-frame-alist '(fullscreen . maximized))) (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 + ;; Apply theme (let ((default-theme (car dotspacemacs-themes))) - (spacemacs/load-theme default-theme) + (condition-case err + (spacemacs/load-theme default-theme nil) + ('error + ;; fallback on Spacemacs default theme + (setq spacemacs--default-user-theme default-theme) + (setq dotspacemacs-themes (delq spacemacs--fallback-theme + dotspacemacs-themes)) + (add-to-list 'dotspacemacs-themes spacemacs--fallback-theme) + (setq default-theme spacemacs--fallback-theme) + (load-theme spacemacs--fallback-theme t))) ;; protect used themes from deletion as orphans (setq configuration-layer--protected-packages (append @@ -133,35 +147,42 @@ the final step of executing code in `emacs-startup-hook'.") "with this build."))) ;; check for new version (if dotspacemacs-mode-line-unicode-symbols - (setq-default spacemacs-version-check-lighter "[⇪]"))) + (setq-default spacemacs-version-check-lighter "[⇪]")) + ;; install the dotfile if required + (dotspacemacs/maybe-install-dotfile) + ;; install user default theme if required + (when spacemacs--default-user-theme + (spacemacs/load-theme spacemacs--default-user-theme 'install))) (defun spacemacs//removes-gui-elements () "Remove the menu bar, tool bar and scroll bars." ;; removes the GUI elements + (when (and (fboundp 'tool-bar-mode) (not (eq tool-bar-mode -1))) + (tool-bar-mode -1)) (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 spacemacs//setup-ido-vertical-mode () + "Setup `ido-vertical-mode'." + (require 'ido-vertical-mode) + (ido-vertical-mode t) + (add-hook + 'ido-setup-hook + ;; think about hacking directly `ido-vertical-mode' source in libs instead. + (defun spacemacs//ido-vertical-natural-navigation () + ;; more natural navigation keys: up, down to change current item + ;; left to go up dir + ;; right to open the selected item + (define-key ido-completion-map (kbd "") 'ido-prev-match) + (define-key ido-completion-map (kbd "") 'ido-next-match) + (define-key ido-completion-map (kbd "") 'ido-delete-backward-updir) + (define-key ido-completion-map (kbd "") 'ido-exit-minibuffer)))) (defun display-startup-echo-area-message () "Change the default welcome message of minibuffer to another one." @@ -178,7 +199,7 @@ defer call using `spacemacs-post-user-config-hook'." "Add post init processing." (add-hook 'emacs-startup-hook - (lambda () + (defun spacemacs/startup-hook () ;; 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 @@ -194,148 +215,8 @@ defer call using `spacemacs-post-user-config-hook'." (with-current-buffer "*scratch*" (funcall dotspacemacs-scratch-mode))) (configuration-layer/display-summary emacs-start-time) + (spacemacs-buffer//startup-hook) (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))) - "<>")) - (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) diff --git a/core/core-themes-support.el b/core/core-themes-support.el index 8ce8182..7647917 100644 --- a/core/core-themes-support.el +++ b/core/core-themes-support.el @@ -1,6 +1,6 @@ ;;; core-themes-support.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -12,6 +12,12 @@ (defconst emacs-built-in-themes (cons 'default (custom-available-themes)) "List of emacs built-in themes") +(defvar spacemacs--fallback-theme 'spacemacs-dark + "Fallback theme if user theme cannot be applied.") + +(defvar spacemacs--default-user-theme nil + "Internal variable storing user theme to be installed.") + (defface org-kbd '((t (:background "LemonChiffon1" :foreground "black" :box (:line-width 2 :color nil :style released-button)))) @@ -20,120 +26,140 @@ (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) + (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-light . base16-theme) + (base16-atelier-cave . base16-theme) + (base16-atelier-dune-light . base16-theme) + (base16-atelier-dune . base16-theme) + (base16-atelier-estuary-light . base16-theme) + (base16-atelier-estuary . base16-theme) + (base16-atelier-forest-light . base16-theme) + (base16-atelier-forest . base16-theme) + (base16-atelier-heath-light . base16-theme) + (base16-atelier-heath . base16-theme) + (base16-atelier-lakeside-light . base16-theme) + (base16-atelier-lakeside . base16-theme) + (base16-atelier-plateau-light . base16-theme) + (base16-atelier-plateau . base16-theme) + (base16-atelier-savanna-light . base16-theme) + (base16-atelier-savanna . base16-theme) + (base16-atelier-seaside-light . base16-theme) + (base16-atelier-seaside . base16-theme) + (base16-atelier-sulphurpool-light . 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-cupcake . base16-theme) + (base16-darktooth . base16-theme) + (base16-default-dark . base16-theme) + (base16-default-light . base16-theme) + (base16-dracula . 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-materia . base16-theme) + (base16-mexico-light . base16-theme) + (base16-mocha . base16-theme) + (base16-monokai . base16-theme) + (base16-ocean . base16-theme) + (base16-oceanicnext . base16-theme) + (base16-onedark . base16-theme) + (base16-paraiso . base16-theme) + (base16-phd . base16-theme) + (base16-pico . base16-theme) + (base16-pop . base16-theme) + (base16-railscasts . base16-theme) + (base16-rebecca . base16-theme) + (base16-seti . 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-spacemacs . base16-theme) + (base16-summerfruit-dark . base16-theme) + (base16-summerfruit-light . base16-theme) + (base16-tomorrow-night . base16-theme) + (base16-tomorrow . base16-theme) + (base16-tube . base16-theme) + (base16-twilight . base16-theme) + (base16-unikitty-dark . base16-theme) + (base16-unikitty-light . base16-theme) + (base16-woodland . 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.") @@ -152,16 +178,25 @@ package name does not match theme name + `-theme' suffix.") ;; fallback to -theme (t (intern (format "%S-theme" theme))))) -(defun spacemacs/load-theme (theme) - "Load THEME." +(defun spacemacs/load-theme (theme &optional install) + "Load THEME. + If INSTALL is non-nil then attempt to install the theme." ;; Required dependencies for some themes - (condition-case-unless-debug err + (condition-case 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)) + (when install + (spacemacs-buffer/append + (format "--> Installing user theme: %s..." + spacemacs--default-user-theme)) + (redisplay)) + ;; Load theme + (when (or (memq theme '(zonokai-blue + zonokai-red + solarized-light + solarized-dark + doom-one + doom-molokai))) + (configuration-layer/load-or-install-package 'dash install)) ;; Unless Emacs stock themes (unless (or (memq theme (custom-available-themes)) (eq 'default theme)) @@ -169,35 +204,49 @@ package name does not match theme name + `-theme' suffix.") ;; 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))) + (pkg-dir (configuration-layer/load-or-install-package + pkg install))) (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))) + (when pkg-dir + (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)))))) + (configuration-layer/load-or-install-package pkg install))))) + ;; Apply theme + (mapc 'disable-theme custom-enabled-themes) + ;; explicitly reload the theme for the first GUI client + (eval `(spacemacs|do-after-display-system-init + (load-theme ',theme t))) + (unless (display-graphic-p) + (load-theme theme t)) + (when install + (spacemacs-buffer/replace-last-line + (format (concat "--> User theme \"%s\" has been applied, you may " + "have to restart Emacs.\n") + spacemacs--default-user-theme)) + (redisplay))) ('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))))) + (if install + (progn + (spacemacs-buffer/warning + (concat "An error occurred while applying " + "the theme \"%s\", fallback on theme \"%s\". \n" + "Error was: %s") theme spacemacs--fallback-theme err) + (spacemacs-buffer/warning + (concat "Please check the value of \"dotspacemacs-themes\" in your " + "dotfile or open an issue \n" + "so we can add support for the theme \"%s\".") theme) + (unless (display-graphic-p) + (eval `(spacemacs|do-after-display-system-init + (load-theme ',spacemacs--fallback-theme t))))) + (throw 'error))))) (defun spacemacs/cycle-spacemacs-theme () "Cycle through themes defined in `dotspacemacs-themes.'" @@ -209,8 +258,11 @@ package name does not match theme name + `-theme' suffix.") (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)) + (let ((progress-reporter + (make-progress-reporter + (format "Loading theme %s..." spacemacs--cur-theme)))) + (spacemacs/load-theme spacemacs--cur-theme) + (progress-reporter-done progress-reporter))) (defadvice load-theme (after spacemacs/load-theme-adv activate) "Perform post load processing." diff --git a/core/core-toggle.el b/core/core-toggle.el index e3f88dc..25db538 100644 --- a/core/core-toggle.el +++ b/core/core-toggle.el @@ -1,6 +1,6 @@ ;;; core-toggle.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-transient-state.el b/core/core-transient-state.el index 5e572a0..c75784b 100644 --- a/core/core-transient-state.el +++ b/core/core-transient-state.el @@ -1,7 +1,7 @@ ;;; -*- lexical-binding: t -*- ;;; core-transient-state.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Justin Burkett ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/core-use-package-ext.el b/core/core-use-package-ext.el index f9c7040..2ff790f 100644 --- a/core/core-use-package-ext.el +++ b/core/core-use-package-ext.el @@ -1,6 +1,6 @@ ;;; core-use-package-ext.el --- Spacemacs Core File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -44,7 +44,7 @@ override lazy-loaded settings." (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))))) + (push `(add-hook ',hook (lambda nil ,@body t)) expanded-forms))))) `(progn ,@expanded-forms))) (provide 'core-use-package-ext) diff --git a/core/info/quickhelp.txt b/core/info/quickhelp.txt index 0591722..d220318 100644 --- a/core/info/quickhelp.txt +++ b/core/info/quickhelp.txt @@ -2,12 +2,18 @@ Press [TAB] or [J] to move to next button. Press [Shift-TAB] or [K] to move to previous button. +Press [w] to jump to warning list. + 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 [c] to jump to org-agenda list if it is enabled. + +Press [d] to jump to org-todo list if it is enabled. + Press [o] to jump to any link or button. Press [m] to jump to the top menu. diff --git a/core/info/release-notes/0.102.txt b/core/info/release-notes/0.102.txt index 1305f63..060a9fb 100644 --- a/core/info/release-notes/0.102.txt +++ b/core/info/release-notes/0.102.txt @@ -9,7 +9,7 @@ available in the dotfile. and `(defvar -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. +`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. diff --git a/core/info/release-notes/0.200.9.txt b/core/info/release-notes/0.200.9.txt new file mode 100644 index 0000000..000ddda --- /dev/null +++ b/core/info/release-notes/0.200.9.txt @@ -0,0 +1,12 @@ + Spacemacs at your fingertips... in your browser! + +Thanks to @JAremko's wonderful work, it is now possible to try out Spacemacs in +the browser. + +Try it on your phone and be amazed that even without any modifier you can still +use Emacs thanks to the 'spacebar' and 'fd' available on any touch keyboard. + +We are looking into useful applications of this feature, if you want to share some +ideas you can post on https://github.com/syl20bnr/spacemacs/issues/8634 :heart: + + Go to http://spacemacs.org to test it now! diff --git a/core/info/release-notes/af-2.01.txt b/core/info/release-notes/af-2.01.txt new file mode 100644 index 0000000..0a41ba1 --- /dev/null +++ b/core/info/release-notes/af-2.01.txt @@ -0,0 +1,20 @@ + Spacemacs at your fingertips... in your browser! + +You are not dreaming, this is not an alien technology coming from the futur. + + Spacemacs has been ported to the WEB! + +Better than that, our technology flawlessly compiles Emacs Lisp on the fly to +Javascript thanks to the last version of our transpiler. Yes! This very same +transpiler which was capable to transpile Emacs Lisp to Vimscript, except Java +is better than Vim so we decided to go nuts and support the supperior +Javascript. + +Spacemacs can benefit from all the candies provided by a WEB browser like being +able to run on any device supporting a decent browser, try it on your phone and +be amazed that even without any modifier you can still use Emacs thanks to the +'spacebar' and 'fd' or not... + +Now Spacemacs can really be like all the cool kids. + +Go to http://spacemacs.org to test it NOW! diff --git a/core/libs/ht.el b/core/libs/ht.el index 0d5d8b0..5af043b 100644 --- a/core/libs/ht.el +++ b/core/libs/ht.el @@ -75,7 +75,7 @@ Errors if LIST doesn't contain an even number of elements." ;; 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) @@ -83,7 +83,7 @@ Errors if LIST doesn't contain an even number of elements." (setq result (cons (nreverse sublist) result)) (setq sublist nil) (setq len 0))) - + (when sublist (error "Expected an even number of elements")) (nreverse result))) diff --git a/core/libs/ido-vertical-mode.el b/core/libs/ido-vertical-mode.el new file mode 100644 index 0000000..07172c4 --- /dev/null +++ b/core/libs/ido-vertical-mode.el @@ -0,0 +1,360 @@ +;;; ido-vertical-mode.el --- Makes ido-mode display vertically. + +;; Copyright (C) 2013, 2014 Steven Degutis + +;; Author: Steven Degutis +;; Maintainer: Christopher Reichert +;; Version: 1.0.0 +;; Package-Version: 20160429.1037 +;; Keywords: convenience +;; URL: https://github.com/creichert/ido-vertical-mode.el + +;; 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 . + +;;; Commentary: + +;; Makes ido-mode display prospects vertically + +;;; Code: + +(require 'ido) + +;;; The following three variables and their comments are lifted +;;; directly from `ido.el'; they are defined here to avoid compile-log +;;; warnings. See `ido.el' for more information. + +;; Non-nil if we should add [confirm] to prompt +(defvar ido-show-confirm-message) + +;; Remember if current directory is non-readable (so we cannot do completion). +(defvar ido-directory-nonreadable) + +;; Remember if current directory is 'huge' (so we don't want to do completion). +(defvar ido-directory-too-big) + +(defcustom ido-vertical-indicator "->" + "Indicator displayed next to the candidate that will be selected." + :type 'string + :group 'ido-vertical-mode) + +(defvar ido-vertical-decorations + `(,(format "\n%s " ido-vertical-indicator) ; left bracket around prospect list + "" ; right bracket around prospect list + "\n " ; separator between prospects, depends on `ido-separator` + "\n ..." ; inserted at the end of a truncated list of prospects + "[" ; left bracket around common match string + "]" ; right bracket around common match string + " [No match]" + " [Matched]" + " [Not readable]" + " [Too big]" + " [Confirm]" + ,(format "\n%s " ido-vertical-indicator) ; left bracket around the sole remaining completion + "" ; right bracket around the sole remaining completion + ) + + "Changing the decorations does most of the work for ido-vertical + +This sets up newlines and arrows before, between, and after the +prospects. For additional information, see `ido-decorations'.") + +(defvar ido-vertical-old-decorations nil + "The original `ido-decorations' variable + +We need to keep track of the original value so we can restore it +when turning `ido-vertical-mode' off") + +(defvar ido-vertical-old-completions nil + "The original `ido-completions' function + +We need to keep track of the original value of `ido-completions' +so we can restore it when turning `ido-vertical-mode' off") + +(defgroup ido-vertical-mode nil + "Make ido behave vertically." + :group 'ido) + +(defcustom ido-vertical-show-count nil + "Non nil means show the count of candidates while completing." + :type 'boolean + :group 'ido-vertical-mode) + +(defvar ido-vertical-count-active nil + "Used internally to track whether we're already showing the count") + +(defcustom ido-vertical-define-keys nil + "Defines which keys that `ido-vertical-mode' redefines." + :type '(choice + (const :tag "Keep default ido keys." nil) + (const :tag "C-p and C-n are up & down in match" C-n-and-C-p-only) + (const :tag "C-p/up and C-n/down are up and down in match." C-n-C-p-up-and-down) + (const :tag "C-p/up, C-n/down are up/down in match. left or right cycle history or directory." C-n-C-p-up-down-left-right)) + :group 'ido-vertical-mode) + +(defcustom ido-vertical-pad-list t + "Non nil means to pad the list of candidates to ensure the minibuffer area is always tall" + :type 'boolean + :group 'ido-vertical-mode) + +(defcustom ido-vertical-disable-if-short nil + "Non nil means that ido will go back to horizontal mode if the candidates all fit in the minibuffer area" + :type 'boolean + :group 'ido-vertical-mode) + +(defface ido-vertical-first-match-face + '((t (:inherit ido-first-match))) + "Face used by Ido Vertical for highlighting first match." + :group 'ido-vertical-mode) + +(defface ido-vertical-only-match-face + '((t (:inherit ido-only-match))) + "Face used by Ido Vertical for highlighting only match." + :group 'ido-vertical-mode) + +(defface ido-vertical-match-face + '((t (:inherit font-lock-variable-name-face :bold t :underline t))) + "Face used by Ido Vertical for the matched part." + :group 'ido-vertical-mode) + +(defun ido-vertical-or-horizontal-completions (name) + (if (and ido-vertical-disable-if-short + (<= (length ido-matches) ido-max-prospects)) + + (let ((short-result + (let ((ido-decorations ido-vertical-old-decorations)) + (funcall ido-vertical-old-completions name)))) + (if (>= (window-body-width (minibuffer-window)) + (+ (minibuffer-prompt-width) + (length short-result))) + short-result + (ido-vertical-completions name))) + + (ido-vertical-completions name))) + +;; borrowed from ido.el and modified to work better when vertical +(defun ido-vertical-completions (name) + ;; Return the string that is displayed after the user's text. + ;; Modified from `icomplete-completions'. + + (let* ((comps ido-matches) + (ind (and (consp (car comps)) (> (length (cdr (car comps))) 1) + ido-merged-indicator)) + (lencomps (length comps)) + (additional-items-indicator (nth 3 ido-decorations)) + (comps-empty (null comps)) + (ncomps lencomps) + first) + + ;; Keep the height of the suggestions list constant by padding + ;; when lencomps is too small. Also, if lencomps is too short, we + ;; should not indicate that there are additional prospects. + (when (< lencomps (1+ ido-max-prospects)) + (setq additional-items-indicator "\n") + (when ido-vertical-pad-list + (setq comps (append comps (make-list (- (1+ ido-max-prospects) lencomps) ""))) + (setq ncomps (length comps)))) + + (if (not ido-incomplete-regexp) + (when ido-use-faces + ;; Make a copy of [ido-matches], otherwise the selected string + ;; could contain text properties which could lead to weird + ;; artifacts, e.g. buffer-file-name having text properties. + (when (eq comps ido-matches) + (setq comps (copy-sequence ido-matches))) + + (dotimes (i ncomps) + (let ((comps-i (nth i comps))) + (setf comps-i + (setf (nth i comps) (substring (if (listp comps-i) + (car comps-i) + comps-i) + 0))) + + (when (string-match (if ido-enable-regexp name (regexp-quote name)) comps-i) + (ignore-errors + (add-face-text-property (match-beginning 0) + (match-end 0) + 'ido-vertical-match-face + nil comps-i))))))) + + (if (and ind ido-use-faces) + (put-text-property 0 1 'face 'ido-indicator ind)) + + (when ido-vertical-show-count + (setcar ido-vertical-decorations (format " [%d]\n%s " lencomps ido-vertical-indicator)) + (setq ido-vertical-count-active t)) + (when (and (not ido-vertical-show-count) + ido-vertical-count-active) + (setcar ido-vertical-decorations (format "\n%s "ido-vertical-indicator)) + (setq ido-vertical-count-active nil)) + + (if (and ido-use-faces comps) + (let* ((fn (ido-name (car comps))) + (ln (length fn))) + (setq first (format "%s" fn)) + (if (fboundp 'add-face-text-property) + (add-face-text-property 0 (length first) + (cond ((> lencomps 1) + 'ido-vertical-first-match-face) + + (ido-incomplete-regexp + 'ido-incomplete-regexp) + + (t + 'ido-vertical-only-match-face)) + nil first) + (put-text-property 0 ln 'face + (if (= lencomps 1) + (if ido-incomplete-regexp + 'ido-incomplete-regexp + 'ido-vertical-only-match-face) + 'ido-vertical-first-match-face) + first)) + (if ind (setq first (concat first ind))) + (setq comps (cons first (cdr comps))))) + + ;; Previously we'd check null comps to see if the list was + ;; empty. We pad the list with empty items to keep the list at a + ;; constant height, so we have to check if the entire list is + ;; empty, instead of (null comps) + (cond (comps-empty + (cond + (ido-show-confirm-message + (or (nth 10 ido-decorations) " [Confirm]")) + (ido-directory-nonreadable + (or (nth 8 ido-decorations) " [Not readable]")) + (ido-directory-too-big + (or (nth 9 ido-decorations) " [Too big]")) + (ido-report-no-match + (nth 6 ido-decorations)) ;; [No match] + (t ""))) + (ido-incomplete-regexp + (concat " " (car comps))) + ((null (cdr comps)) ;one match + (concat (concat (nth 11 ido-decorations) ;; [ ... ] + (ido-name (car comps)) + (nth 12 ido-decorations)) + (if (not ido-use-faces) (nth 7 ido-decorations)))) ;; [Matched] + (t ;multiple matches + (let* ((items (if (> ido-max-prospects 0) (1+ ido-max-prospects) 999)) + (alternatives + (apply + #'concat + (cdr (apply + #'nconc + (mapcar + (lambda (com) + (setq com (ido-name com)) + (setq items (1- items)) + (cond + ((< items 0) ()) + ((= items 0) (list additional-items-indicator)) ; " | ..." + (t + (list (nth 2 ido-decorations) ; " | " + (let ((str (substring com 0))) + (if (and ido-use-faces + (not (string= str first)) + (ido-final-slash str)) + (put-text-property 0 (length str) 'face 'ido-subdir str)) + str))))) + comps)))))) + + (concat + ;; put in common completion item -- what you get by pressing tab + (if (and (stringp ido-common-match-string) + (> (length ido-common-match-string) (length name))) + (concat (nth 4 ido-decorations) ;; [ ... ] + (substring ido-common-match-string (length name)) + (nth 5 ido-decorations))) + ;; list all alternatives + (nth 0 ido-decorations) ;; { ... } + alternatives + (nth 1 ido-decorations))))))) + +(defun ido-vertical-disable-line-truncation () + "Prevent the newlines in the minibuffer from being truncated" + (set (make-local-variable 'truncate-lines) nil)) + +(defun turn-on-ido-vertical () + (if (and (eq nil ido-vertical-old-decorations) + (eq nil ido-vertical-old-completions)) + (progn + (setq ido-vertical-old-decorations ido-decorations) + (setq ido-vertical-old-completions (symbol-function 'ido-completions)))) + + (setq ido-decorations ido-vertical-decorations) + (fset 'ido-completions 'ido-vertical-or-horizontal-completions) + + (add-hook 'ido-minibuffer-setup-hook 'ido-vertical-disable-line-truncation) + (add-hook 'ido-setup-hook 'ido-vertical-define-keys)) + +(defun turn-off-ido-vertical () + (setq ido-decorations ido-vertical-old-decorations) + (fset 'ido-completions ido-vertical-old-completions) + + (remove-hook 'ido-minibuffer-setup-hook 'ido-vertical-disable-line-truncation) + (remove-hook 'ido-setup-hook 'ido-vertical-define-keys)) + +(defun ido-vertical-next-match () + "Call the correct next-match function for right key. + +This is based on: +- Different functions for completing directories and prior history. +" + (interactive) + (cond + ((and (boundp 'item) item (eq item 'file)) + (ido-next-match-dir)) + (t + (next-history-element 1)))) + +(defun ido-vertical-prev-match () + "Call the correct prev-match function for left key. + +This is based on: +- Different functions for completing directories and prior history. +" + (interactive) + (cond + ((and (boundp 'item) item (eq item 'file)) + (ido-prev-match-dir)) + (t + (previous-history-element 1)))) + +(defun ido-vertical-define-keys () ;; C-n/p is more intuitive in vertical layout + (when ido-vertical-define-keys + (define-key ido-completion-map (kbd "C-n") 'ido-next-match) + (define-key ido-completion-map (kbd "C-p") 'ido-prev-match) + (define-key ido-completion-map (kbd "C-c C-t") 'ido-toggle-prefix)) + (when (memq ido-vertical-define-keys '(C-n-C-p-up-and-down C-n-C-p-up-down-left-right)) + (define-key ido-completion-map (kbd "") 'ido-prev-match) + (define-key ido-completion-map (kbd "") 'ido-next-match)) + (when (eq ido-vertical-define-keys 'C-n-C-p-up-down-left-right) + (define-key ido-completion-map (kbd "") 'ido-vertical-prev-match) + (define-key ido-completion-map (kbd "") 'ido-vertical-next-match))) + +;;;###autoload +(define-minor-mode ido-vertical-mode + "Makes ido-mode display vertically." + :global t + :group 'ido-vertical-mode + (if ido-vertical-mode + (turn-on-ido-vertical) + (turn-off-ido-vertical))) + +(provide 'ido-vertical-mode) +;; Local Variables: +;; indent-tabs-mode: nil +;; End: +;;; ido-vertical-mode.el ends here diff --git a/core/libs/package-build.el b/core/libs/package-build.el new file mode 100644 index 0000000..9ed150a --- /dev/null +++ b/core/libs/package-build.el @@ -0,0 +1,1536 @@ +;;; package-build.el --- Tools for assembling a package archive + +;; Copyright (C) 2011-2013 Donald Ephraim Curtis +;; Copyright (C) 2012-2014 Steve Purcell +;; Copyright (C) 2009 Phil Hagelberg + +;; Author: Donald Ephraim Curtis +;; Created: 2011-09-30 +;; Version: 0.1 +;; Package-Version: 20161014.2251 +;; Keywords: tools +;; Package-Requires: ((cl-lib "0.5")) + +;; This file is not (yet) part of GNU Emacs. +;; However, it is distributed under the same license. + +;; GNU Emacs 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, or (at your option) +;; any later version. + +;; GNU Emacs 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., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: + +;; This file allows a curator to publish an archive of Emacs packages. + +;; The archive is generated from a set of recipes which describe elisp +;; projects and repositories from which to get them. The term +;; "package" here is used to mean a specific version of a project that +;; is prepared for download and installation. + +;;; Code: + +(require 'cl-lib) + +(require 'package) +(require 'lisp-mnt) +(require 'json) + +(defconst package-build--melpa-base + (file-name-directory + (directory-file-name + (file-name-directory (or load-file-name (buffer-file-name)))))) + +(defgroup package-build nil + "Facilities for building package.el-compliant packages from upstream source code." + :group 'development) + +(defcustom package-build-working-dir (expand-file-name "working/" package-build--melpa-base) + "Directory in which to keep checkouts." + :group 'package-build + :type 'string) + +(defcustom package-build-archive-dir (expand-file-name "packages/" package-build--melpa-base) + "Directory in which to keep compiled archives." + :group 'package-build + :type 'string) + +(defcustom package-build-recipes-dir (expand-file-name "recipes/" package-build--melpa-base) + "Directory containing recipe files." + :group 'package-build + :type 'string) + +(defcustom package-build-verbose t + "When non-nil, `package-build' feels free to print information about its progress." + :group 'package-build + :type 'boolean) + +(defcustom package-build-stable nil + "When non-nil, `package-build' tries to build packages from versions-tagged code." + :group 'package-build + :type 'boolean) + +(defcustom package-build-timeout-executable + (let ((prog (or (executable-find "timeout") + (executable-find "gtimeout")))) + (when (and prog + (string-match-p "^ *-k" (shell-command-to-string (concat prog " --help")))) + prog)) + "Path to a GNU coreutils \"timeout\" command if available. +This must be a version which supports the \"-k\" option." + :group 'package-build + :type '(file :must-match t)) + +(defcustom package-build-timeout-secs 600 + "Wait this many seconds for external processes to complete. + +If an external process takes longer than +`package-build-timeout-secs' seconds to complete, the process is +terminated. The `package-build-timeout-secs' variable will only +have an effect if `package-build-timeout-executable' is not nil." + :group 'package-build + :type 'number) + +(defcustom package-build-tar-executable + (or (executable-find "gtar") + (executable-find "tar")) + "Path to a (preferably GNU) tar command. +Certain package names (e.g. \"@\") may not work properly with a BSD tar." + :group 'package-build + :type '(file :must-match t)) + +(defcustom package-build-write-melpa-badge-images nil + "When non-nil, write MELPA badge images alongside packages, for use on GitHub pages etc." + :group 'package-build + :type 'boolean) + +(defcustom package-build-version-regexp "^[rRvV]?\\(.*\\)$" + "Default pattern for matching valid version-strings within repository tags. +The string in the capture group should be parsed as valid by `version-to-list'." + :group 'package-build + :type 'string) + +;;; Internal Variables + +(defvar package-build--recipe-alist nil + "Internal list of package build specs. + +Do not use this directly. Use `package-build-recipe-alist' +function.") + +(defvar package-build--recipe-alist-initialized nil + "Determines if `package-build--recipe-alist` has been initialized.") + +(defvar package-build--archive-alist nil + "Internal list of already-built packages, in the standard package.el format. + +Do not use this directly. Use `package-build-archive-alist' +function for access to this function") + +(defvar package-build--archive-alist-initialized nil + "Determines if package-build--archive-alist has been initialized.") + +(defconst package-build-default-files-spec + '("*.el" "*.el.in" "dir" + "*.info" "*.texi" "*.texinfo" + "doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo" + (:exclude ".dir-locals.el" "test.el" "tests.el" "*-test.el" "*-tests.el")) + "Default value for :files attribute in recipes.") + +(defun package-build--message (format-string &rest args) + "Log a message using FORMAT-STRING and ARGS as per `message'." + (when package-build-verbose + (apply 'message format-string args))) + +(defun package-build--slurp-file (file-name) + "Return the contents of FILE-NAME as a string, or nil if no such file exists." + (when (file-exists-p file-name) + (with-temp-buffer + (insert-file-contents file-name) + (buffer-substring-no-properties (point-min) (point-max))))) + +(defun package-build--string-rtrim (str) + "Remove trailing whitespace from `STR'." + (replace-regexp-in-string "[ \t\n\r]+$" "" str)) + + +(defun package-build--valid-version (str &optional regexp) + "Apply to STR the REGEXP if defined, \ +then pass the string to `version-to-list' and return the result, \ +or nil if the version cannot be parsed." + (when (and regexp (string-match regexp str)) + (setq str (match-string 1 str))) + (ignore-errors (version-to-list str))) + +(defun package-build--parse-time (str) + "Parse STR as a time, and format as a YYYYMMDD.HHMM string." + ;; We remove zero-padding the HH portion, as it is lost + ;; when stored in the archive-contents + (let* ((s (substring-no-properties str)) + (time (date-to-time + (if (string-match "^\\([0-9]\\{4\\}\\)/\\([0-9]\\{2\\}\\)/\\([0-9]\\{2\\}\\) \\([0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)$" s) + (concat (match-string 1 s) "-" (match-string 2 s) "-" + (match-string 3 s) " " (match-string 4 s)) + s)))) + (concat (format-time-string "%Y%m%d." time) + (format "%d" (string-to-number (format-time-string "%H%M" time)))))) + +(defun package-build--find-parse-time (regex &optional bound) + "Find REGEX in current buffer and format as a time-based version string, \ +optionally looking only as far back as BOUND." + (package-build--parse-time (and (re-search-backward regex bound t) + (match-string-no-properties 1)))) + +(defun package-build--find-parse-time-newest (regex &optional bound) + "Find REGEX in current buffer and format as a time-based version string, \ +optionally looking only as far back as BOUND." + (save-match-data + (let (cur matches) + (while (setq cur (ignore-errors (package-build--find-parse-time regex bound))) + (push cur matches)) + (car (nreverse (sort matches 'string<)))))) + +(defun package-build--find-version-newest (regex &optional bound) + "Find the newest version matching REGEX before point, optionally stopping at BOUND." + (let ((tags (split-string + (buffer-substring-no-properties + (or bound (point-min)) (point)) + "\n"))) + (setq tags (append + (mapcar + ;; Because the default `version-separator' is ".", + ;; version-strings like "1_4_5" will be parsed + ;; wrongly as (1 -4 4 -4 5), so we set + ;; `version-separator' to "_" below and run again. + (lambda (tag) + (when (package-build--valid-version tag regex) + (list (package-build--valid-version tag regex) tag))) + tags) + (mapcar + ;; Check for valid versions again, this time using + ;; "_" as a separator instead of "." to catch + ;; version-strings like "1_4_5". Since "_" is + ;; otherwise treated as a snapshot separator by + ;; `version-regexp-alist', we don't have to worry + ;; about the incorrect version list above—(1 -4 4 -4 + ;; 5)—since it will always be treated as older by + ;; `version-list-<'. + (lambda (tag) + (let ((version-separator "_")) + (when (package-build--valid-version tag regex) + (list (package-build--valid-version tag regex) tag)))) + tags))) + (setq tags (cl-remove-if nil tags)) + ;; Returns a list like ((0 1) ("v0.1")); the first element is used + ;; for comparison and for `package-version-join', and the second + ;; (the original tag) is used by git/hg/etc. + (car (nreverse (sort tags (lambda (v1 v2) (version-list-< (car v1) (car v2)))))))) + +(defun package-build--run-process (dir command &rest args) + "In DIR (or `default-directory' if unset) run COMMAND with ARGS. +Output is written to the current buffer." + (let* ((default-directory (file-name-as-directory (or dir default-directory))) + (timeout (number-to-string package-build-timeout-secs)) + (argv (append + (unless (eq system-type 'windows-nt) + '("env" "LC_ALL=C")) + (if package-build-timeout-executable + (append (list package-build-timeout-executable "-k" "60" timeout command) args) + (cons command args))))) + (unless (file-directory-p default-directory) + (error "Can't run process in non-existent directory: %s" default-directory)) + (let ((exit-code (apply 'process-file (car argv) nil (current-buffer) t (cdr argv)))) + (or (zerop exit-code) + (error "Command '%s' exited with non-zero status %d: %s" + argv exit-code (buffer-string)))))) + +(defun package-build--run-process-match (regex dir prog &rest args) + "Find match for REGEX when - in DIR, or `default-directory' if unset - we run PROG with ARGS." + (with-temp-buffer + (apply 'package-build--run-process dir prog args) + (goto-char (point-min)) + (re-search-forward regex) + (match-string-no-properties 1))) + +(defun package-build-checkout (package-name config working-dir) + "Check out source for PACKAGE-NAME with CONFIG under WORKING-DIR. +In turn, this function uses the :fetcher option in the CONFIG to +choose a source-specific fetcher function, which it calls with +the same arguments. + +Returns the package version as a string." + (let ((repo-type (plist-get config :fetcher))) + (package-build--message "Fetcher: %s" (symbol-name repo-type)) + (unless (eq 'wiki repo-type) + (package-build--message "Source: %s\n" (or (plist-get config :repo) (plist-get config :url)))) + (funcall (intern (format "package-build--checkout-%s" (symbol-name repo-type))) + package-name config (file-name-as-directory working-dir)))) + +(defvar package-build--last-wiki-fetch-time 0 + "The time at which an emacswiki URL was last requested. +This is used to avoid exceeding the rate limit of 1 request per 2 +seconds; the server cuts off after 10 requests in 20 seconds.") + +(defvar package-build--wiki-min-request-interval 3 + "The shortest permissible interval between successive requests for Emacswiki URLs.") + +(defmacro package-build--with-wiki-rate-limit (&rest body) + "Rate-limit BODY code passed to this macro to match EmacsWiki's rate limiting." + (let ((now (cl-gensym)) + (elapsed (cl-gensym))) + `(let* ((,now (float-time)) + (,elapsed (- ,now package-build--last-wiki-fetch-time))) + (when (< ,elapsed package-build--wiki-min-request-interval) + (let ((wait (- package-build--wiki-min-request-interval ,elapsed))) + (package-build--message "Waiting %.2f secs before hitting Emacswiki again" wait) + (sleep-for wait))) + (unwind-protect + (progn ,@body) + (setq package-build--last-wiki-fetch-time (float-time)))))) + +(require 'mm-decode) +(defvar url-http-response-status) +(defvar url-http-end-of-headers) + +(defun package-build--url-copy-file (url newname &optional ok-if-already-exists) + "Copy URL to NEWNAME. Both args must be strings. +Returns the http request's header as a string. +Like `url-copy-file', but it produces an error if the http response is not 200. +Signals a `file-already-exists' error if file NEWNAME already exists, +unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. +A number as third arg means request confirmation if NEWNAME already exists." + (if (and (file-exists-p newname) + (not ok-if-already-exists)) + (error "Opening output file: File already exists, %s" newname)) + (let ((buffer (url-retrieve-synchronously url)) + (headers nil) + (handle nil)) + (if (not buffer) + (error "Opening input file: No such file or directory, %s" url)) + (with-current-buffer buffer + (unless (= 200 url-http-response-status) + (error "HTTP error %s fetching %s" url-http-response-status url)) + (setq handle (mm-dissect-buffer t)) + (mail-narrow-to-head) + (setq headers (buffer-string))) + (mm-save-part-to-file handle newname) + (kill-buffer buffer) + (mm-destroy-parts handle) + headers)) + +(defun package-build--grab-wiki-file (filename) + "Download FILENAME from emacswiki, returning its last-modified time." + (let* ((download-url + (format "https://www.emacswiki.org/emacs/download/%s" filename)) + headers) + (package-build--with-wiki-rate-limit + (setq headers (package-build--url-copy-file download-url filename t))) + (when (zerop (nth 7 (file-attributes filename))) + (error "Wiki file %s was empty - has it been removed?" filename)) + (package-build--parse-time + (with-temp-buffer + (insert headers) + (mail-fetch-field "last-modified"))))) + +(defun package-build--checkout-wiki (name config dir) + "Checkout package NAME with config CONFIG from the EmacsWiki into DIR." + (unless package-build-stable + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (unless (file-exists-p dir) + (make-directory dir)) + (let ((files (or (plist-get config :files) + (list (format "%s.el" name)))) + (default-directory dir)) + (car (nreverse (sort (mapcar 'package-build--grab-wiki-file files) 'string-lessp))))))) + +(defun package-build--darcs-repo (dir) + "Get the current darcs repo for DIR." + (package-build--run-process-match "Default Remote: \\(.*\\)" dir "darcs" "show" "repo")) + +(defun package-build--checkout-darcs (name config dir) + "Check package NAME with config CONFIG out of darcs into DIR." + (let ((repo (plist-get config :url))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (cond + ((and (file-exists-p (expand-file-name "_darcs" dir)) + (string-equal (package-build--darcs-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "darcs" "pull" "--all")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (package-build--run-process nil "darcs" "get" repo dir))) + (if package-build-stable + (let* ( (bound (goto-char (point-max))) + (regexp (or (plist-get config :version-regexp) + package-build-version-regexp)) + (tag-version (and (package-build--run-process dir "darcs" "show" "tags") + (or (package-build--find-version-newest regexp bound) + (error "No valid stable versions found for %s" name)))) ) + (package-build--run-process dir "darcs" "obliterate" "--all" "--from-tag" (cadr tag-version)) + ;; Return the parsed version as a string + (package-version-join (car tag-version))) + (apply 'package-build--run-process dir "darcs" "changes" "--max-count" "1" + (package-build--expand-source-file-list dir config)) + (package-build--find-parse-time + "\\([a-zA-Z]\\{3\\} [a-zA-Z]\\{3\\} \\( \\|[0-9]\\)[0-9] [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\} [A-Za-z]\\{3\\} [0-9]\\{4\\}\\)"))))) + +(defun package-build--fossil-repo (dir) + "Get the current fossil repo for DIR." + (package-build--run-process-match "\\(.*\\)" dir "fossil" "remote-url")) + +(defun package-build--checkout-fossil (name config dir) + "Check package NAME with config CONFIG out of fossil into DIR." + (unless package-build-stable + (let ((repo (plist-get config :url))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (cond + ((and (or (file-exists-p (expand-file-name ".fslckout" dir)) + (file-exists-p (expand-file-name "_FOSSIL_" dir))) + (string-equal (package-build--fossil-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "fossil" "update")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (make-directory dir) + (package-build--run-process dir "fossil" "clone" repo "repo.fossil") + (package-build--run-process dir "fossil" "open" "repo.fossil"))) + (package-build--run-process dir "fossil" "timeline" "-n" "1" "-t" "ci") + (or (package-build--find-parse-time + "=== \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ===\n[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\) ") + (error "No valid timestamps found!")))))) + +(defun package-build--svn-repo (dir) + "Get the current svn repo for DIR." + (package-build--run-process-match "URL: \\(.*\\)" dir "svn" "info")) + +(defun package-build--trim (str &optional chr) + "Return a copy of STR without any trailing CHR (or space if unspecified)." + (if (equal (elt str (1- (length str))) (or chr ? )) + (substring str 0 (1- (length str))) + str)) + +(defun package-build--princ-exists (dir) + "Print a message that the contents of DIR will be updated." + (package-build--message "Updating %s" dir)) + +(defun package-build--princ-checkout (repo dir) + "Print a message that REPO will be checked out into DIR." + (package-build--message "Cloning %s to %s" repo dir)) + +(defun package-build--checkout-svn (name config dir) + "Check package NAME with config CONFIG out of svn into DIR." + (unless package-build-stable + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (let ((repo (package-build--trim (plist-get config :url) ?/)) + (bound (goto-char (point-max)))) + (cond + ((and (file-exists-p (expand-file-name ".svn" dir)) + (string-equal (package-build--svn-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "svn" "up")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (package-build--run-process nil "svn" "checkout" repo dir))) + (apply 'package-build--run-process dir "svn" "info" + (package-build--expand-source-file-list dir config)) + (or (package-build--find-parse-time-newest "Last Changed Date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)" bound) + (error "No valid timestamps found!")))))) + + +(defun package-build--cvs-repo (dir) + "Get the current CVS root and repository for DIR. + +Return a cons cell whose `car' is the root and whose `cdr' is the repository." + (apply 'cons + (mapcar (lambda (file) + (package-build--string-rtrim (package-build--slurp-file (expand-file-name file dir)))) + '("CVS/Root" "CVS/Repository")))) + +(defun package-build--checkout-cvs (name config dir) + "Check package NAME with config CONFIG out of cvs into DIR." + (unless package-build-stable + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (let ((root (package-build--trim (plist-get config :url) ?/)) + (repo (or (plist-get config :module) (symbol-name name))) + (bound (goto-char (point-max))) + latest) + (cond + ((and (file-exists-p (expand-file-name "CVS" dir)) + (equal (package-build--cvs-repo dir) (cons root repo))) + (package-build--princ-exists dir) + (package-build--run-process dir "cvs" "update" "-dP")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout (format "%s from %s" repo root) dir) + ;; CVS insists on relative paths as target directory for checkout (for + ;; whatever reason), and puts "CVS" directories into every subdirectory + ;; of the current working directory given in the target path. To get CVS + ;; to just write to DIR, we need to execute CVS from the parent + ;; directory of DIR, and specific DIR as relative path. Hence all the + ;; following mucking around with paths. CVS is really horrid. + (let* ((dir (directory-file-name dir)) + (working-dir (file-name-directory dir)) + (target-dir (file-name-nondirectory dir))) + (package-build--run-process working-dir "env" "TZ=UTC" "cvs" "-z3" "-d" root "checkout" + "-d" target-dir repo)))) + (apply 'package-build--run-process dir "cvs" "log" + (package-build--expand-source-file-list dir config)) + + ;; `cvs log` does not provide a way to view the previous N + ;; revisions, so instead of parsing the entire log we examine + ;; the Entries file, which looks like this: + ;; + ;; /.cvsignore/1.2/Thu Sep 1 12:42:02 2005// + ;; /CHANGES/1.1/Tue Oct 4 11:47:54 2005// + ;; /GNUmakefile/1.8/Tue Oct 4 11:47:54 2005// + ;; /Makefile/1.14/Tue Oct 4 11:47:54 2005// + ;; + (insert-file-contents (concat dir "/CVS/Entries")) + (setq latest (car (sort + (split-string (buffer-substring-no-properties (point) (point-max)) "\n") + (lambda (x y) + (when (string-match "^\\/[^\\/]*\\/[^\\/]*\\/\\([^\\/]*\\)\\/\\/$" x) + (setq x (package-build--parse-time (match-string 1 x)))) + (when (string-match "^\\/[^\\/]*\\/[^\\/]*\\/\\([^\\/]*\\)\\/\\/$" y) + (setq y (package-build--parse-time (match-string 1 y)))) + (version-list-<= (package-build--valid-version y) + (package-build--valid-version x)))))) + (when (string-match "^\\/[^\\/]*\\/[^\\/]*\\/\\([^\\/]*\\)\\/\\/$" latest) + (setq latest (match-string 1 latest))) + (or (package-build--parse-time latest) + (error "No valid timestamps found!")))))) + +(defun package-build--git-repo (dir) + "Get the current git repo for DIR." + (package-build--run-process-match + "Fetch URL: \\(.*\\)" dir "git" "remote" "show" "-n" "origin")) + +(defun package-build--git-head-branch (dir) + "Get the current git repo for DIR." + (or (ignore-errors + (package-build--run-process-match + "HEAD branch: \\(.*\\)" dir "git" "remote" "show" "origin")) + "master")) + +(defun package-build--checkout-git (name config dir) + "Check package NAME with config CONFIG out of git into DIR." + (let ((repo (plist-get config :url)) + (commit (or (plist-get config :commit) + (let ((branch (plist-get config :branch))) + (when branch + (concat "origin/" branch)))))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (goto-char (point-max)) + (cond + ((and (file-exists-p (expand-file-name ".git" dir)) + (string-equal (package-build--git-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "git" "fetch" "--all" "--tags")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (package-build--run-process nil "git" "clone" repo dir))) + (if package-build-stable + (let* ((bound (goto-char (point-max))) + (regexp (or (plist-get config :version-regexp) + package-build-version-regexp)) + (tag-version (and (package-build--run-process dir "git" "tag") + (or (package-build--find-version-newest regexp bound) + (error "No valid stable versions found for %s" name)))) ) + + ;; Using reset --hard here to comply with what's used for + ;; unstable, but maybe this should be a checkout? + (package-build--update-git-to-ref dir (concat "tags/" (cadr tag-version))) + ;; Return the parsed version as a string + (package-version-join (car tag-version))) + (package-build--update-git-to-ref dir (or commit (concat "origin/" (package-build--git-head-branch dir)))) + (apply 'package-build--run-process dir "git" "log" "--first-parent" "-n1" "--pretty=format:'\%ci'" + (package-build--expand-source-file-list dir config)) + (package-build--find-parse-time + "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))) + +(defun package-build--update-git-to-ref (dir ref) + "Update the git repo in DIR so that HEAD is REF." + (package-build--run-process dir "git" "reset" "--hard" ref) + (package-build--run-process dir "git" "submodule" "sync" "--recursive") + (package-build--run-process dir "git" "submodule" "update" "--init" "--recursive")) + +(defun package-build--checkout-github (name config dir) + "Check package NAME with config CONFIG out of github into DIR." + (let* ((url (format "https://github.com/%s.git" (plist-get config :repo)))) + (package-build--checkout-git name (plist-put (copy-sequence config) :url url) dir))) + +(defun package-build--checkout-gitlab (name config dir) + "Check package NAME with config CONFIG out of gitlab into DIR." + (let* ((url (format "https://gitlab.com/%s.git" (plist-get config :repo)))) + (package-build--checkout-git name (plist-put (copy-sequence config) :url url) dir))) + +(defun package-build--checkout-bitbucket (name config dir) + "Check package NAME with config CONFIG out of bitbucket into DIR." + (let* ((url (format "https://bitbucket.com/%s" (plist-get config :repo)))) + (package-build--checkout-hg name (plist-put (copy-sequence config) :url url) dir))) + +(defun package-build--bzr-expand-repo (repo) + "Get REPO expanded name." + (package-build--run-process-match "\\(?:branch root\\|repository branch\\): \\(.*\\)" nil "bzr" "info" repo)) + +(defun package-build--bzr-repo (dir) + "Get the current bzr repo for DIR." + (package-build--run-process-match "parent branch: \\(.*\\)" dir "bzr" "info")) + +(defun package-build--checkout-bzr (name config dir) + "Check package NAME with config CONFIG out of bzr into DIR." + (let ((repo (package-build--bzr-expand-repo (plist-get config :url)))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (goto-char (point-max)) + (cond + ((and (file-exists-p (expand-file-name ".bzr" dir)) + (string-equal (package-build--bzr-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "bzr" "merge" "--force")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (package-build--run-process nil "bzr" "branch" repo dir))) + (if package-build-stable + (let ( (bound (goto-char (point-max))) + (regexp (or (plist-get config :version-regexp) + package-build-version-regexp)) + tag-version ) + (package-build--run-process dir "bzr" "tags") + (goto-char bound) + (ignore-errors (while (re-search-forward "\\ +.*") + (replace-match ""))) + (setq tag-version (or (package-build--find-version-newest regexp bound) + (error "No valid stable versions found for %s" name))) + + (package-build--run-process dir "bzr" "revert" "-r" (concat "tag:" (cadr tag-version))) + ;; Return the parsed version as a string + (package-version-join (car tag-version))) + (apply 'package-build--run-process dir "bzr" "log" "-l1" + (package-build--expand-source-file-list dir config)) + (package-build--find-parse-time + "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))) + +(defun package-build--hg-repo (dir) + "Get the current hg repo for DIR." + (package-build--run-process-match "default = \\(.*\\)" dir "hg" "paths")) + +(defun package-build--checkout-hg (name config dir) + "Check package NAME with config CONFIG out of hg into DIR." + (let ((repo (plist-get config :url))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (goto-char (point-max)) + (cond + ((and (file-exists-p (expand-file-name ".hg" dir)) + (string-equal (package-build--hg-repo dir) repo)) + (package-build--princ-exists dir) + (package-build--run-process dir "hg" "pull") + (package-build--run-process dir "hg" "update")) + (t + (when (file-exists-p dir) + (delete-directory dir t)) + (package-build--princ-checkout repo dir) + (package-build--run-process nil "hg" "clone" repo dir))) + (if package-build-stable + (let ( (bound (goto-char (point-max))) + (regexp (or (plist-get config :version-regexp) + package-build-version-regexp)) + tag-version ) + (package-build--run-process dir "hg" "tags") + ;; The output of `hg tags` shows the ref of the tag as well + ;; as the tag itself, e.g.: + ;; + ;; tip 1696:73ad80e8fea1 + ;; 1.2.8 1691:464af57fd2b7 + ;; + ;; So here we remove that second column before passing the + ;; buffer contents to `package-build--find-version-newest'. + ;; This isn't strictly necessary for Mercurial since the + ;; colon in "1691:464af57fd2b7" means that won't be parsed + ;; as a valid version-string, but it's an example of how to + ;; do it in case it's necessary elsewhere. + (goto-char bound) + (ignore-errors (while (re-search-forward "\\ +.*") + (replace-match ""))) + (setq tag-version (or (package-build--find-version-newest regexp bound) + (error "No valid stable versions found for %s" name))) + + (package-build--run-process dir "hg" "update" (cadr tag-version)) + ;; Return the parsed version as a string + (package-version-join (car tag-version))) + (apply 'package-build--run-process dir "hg" "log" "--style" "compact" "-l1" + (package-build--expand-source-file-list dir config)) + (package-build--find-parse-time + "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))) + +(defun package-build--dump (data file &optional pretty-print) + "Write DATA to FILE as a Lisp sexp. +Optionally PRETTY-PRINT the data." + (with-temp-file file + (package-build--message "File: %s" file) + (if pretty-print + (pp data (current-buffer)) + (print data (current-buffer))))) + +(defun package-build--write-pkg-file (pkg-file pkg-info) + "Write PKG-FILE containing PKG-INFO." + (with-temp-file pkg-file + (pp + `(define-package + ,(aref pkg-info 0) + ,(aref pkg-info 3) + ,(aref pkg-info 2) + ',(mapcar + (lambda (elt) + (list (car elt) + (package-version-join (cadr elt)))) + (aref pkg-info 1)) + ;; Append our extra information + ,@(cl-mapcan (lambda (entry) + (let ((value (cdr entry))) + (when (or (symbolp value) (listp value)) + ;; We must quote lists and symbols, + ;; because Emacs 24.3 and earlier evaluate + ;; the package information, which would + ;; break for unquoted symbols or lists + (setq value (list 'quote value))) + (list (car entry) value))) + (when (> (length pkg-info) 4) + (aref pkg-info 4)))) + (current-buffer)) + (princ ";; Local Variables:\n;; no-byte-compile: t\n;; End:\n" (current-buffer)))) + +(defun package-build--read-from-file (file-name) + "Read and return the Lisp data stored in FILE-NAME, or nil if no such file exists." + (when (file-exists-p file-name) + (car (read-from-string (package-build--slurp-file file-name))))) + +(defun package-build--create-tar (file dir &optional files) + "Create a tar FILE containing the contents of DIR, or just FILES if non-nil." + (when (eq system-type 'windows-nt) + (setq file (replace-regexp-in-string "^\\([a-z]\\):" "/\\1" file))) + (apply 'process-file + package-build-tar-executable nil + (get-buffer-create "*package-build-checkout*") + nil "-cvf" + file + "--exclude=.svn" + "--exclude=CVS" + "--exclude=.git" + "--exclude=_darcs" + "--exclude=.fslckout" + "--exclude=_FOSSIL_" + "--exclude=.bzr" + "--exclude=.hg" + (or (mapcar (lambda (fn) (concat dir "/" fn)) files) (list dir)))) + + +(defun package-build--find-package-commentary (file-path) + "Get commentary section from FILE-PATH." + (when (file-exists-p file-path) + (with-temp-buffer + (insert-file-contents file-path) + (lm-commentary)))) + +(defun package-build--write-pkg-readme (target-dir commentary file-name) + "In TARGET-DIR, write COMMENTARY to a -readme.txt file prefixed with FILE-NAME." + (when commentary + (with-temp-buffer + (insert commentary) + ;; Adapted from `describe-package-1'. + (goto-char (point-min)) + (save-excursion + (when (re-search-forward "^;;; Commentary:\n" nil t) + (replace-match "")) + (while (re-search-forward "^\\(;+ ?\\)" nil t) + (replace-match "")) + (goto-char (point-min)) + (when (re-search-forward "\\`\\( *\n\\)+" nil t) + (replace-match ""))) + (delete-trailing-whitespace) + (let ((coding-system-for-write buffer-file-coding-system)) + (write-region nil nil + (package-build--readme-file-name target-dir file-name)))))) + +(defun package-build--readme-file-name (target-dir file-name) + "Name of the readme file in TARGET-DIR for the package FILE-NAME." + (expand-file-name (concat file-name "-readme.txt") + target-dir)) + +(defun package-build--update-or-insert-version (version) + "Ensure current buffer has a \"Package-Version: VERSION\" header." + (goto-char (point-min)) + (if (let ((case-fold-search t)) + (re-search-forward "^;+* *Package-Version *: *" nil t)) + (progn + (move-beginning-of-line nil) + (search-forward "V" nil t) + (backward-char) + (insert "X-Original-") + (move-beginning-of-line nil)) + ;; Put the new header in a sensible place if we can + (re-search-forward "^;+* *\\(Version\\|Package-Requires\\|Keywords\\|URL\\) *:" nil t) + (forward-line)) + (insert (format ";; Package-Version: %s" version)) + (newline)) + +(defun package-build--ensure-ends-here-line (file-path) + "Add a 'FILE-PATH ends here' trailing line if missing." + (save-excursion + (goto-char (point-min)) + (let* ((fname (file-name-nondirectory file-path)) + (trailer (concat ";;; " fname " ends here"))) + (unless (search-forward trailer nil t) + (goto-char (point-max)) + (newline) + (insert trailer) + (newline))))) + +(defun package-build--get-package-info (file-path) + "Get a vector of package info from the docstrings in FILE-PATH." + (when (file-exists-p file-path) + (ignore-errors + (with-temp-buffer + (insert-file-contents file-path) + ;; next few lines are a hack for some packages that aren't + ;; commented properly. + (package-build--update-or-insert-version "0") + (package-build--ensure-ends-here-line file-path) + (cl-flet ((package-strip-rcs-id (str) "0")) + (package-build--package-buffer-info-vec)))))) + +(defun package-build--get-pkg-file-info (file-path) + "Get a vector of package info from \"-pkg.el\" file FILE-PATH." + (when (file-exists-p file-path) + (let ((package-def (package-build--read-from-file file-path))) + (if (eq 'define-package (car package-def)) + (let* ((pkgfile-info (cdr package-def)) + (descr (nth 2 pkgfile-info)) + (rest-plist (cl-subseq pkgfile-info (min 4 (length pkgfile-info)))) + (extras (let (alist) + (while rest-plist + (unless (memq (car rest-plist) '(:kind :archive)) + (let ((value (cadr rest-plist))) + (when value + (push (cons (car rest-plist) + (if (eq (car-safe value) 'quote) + (cadr value) + value)) + alist)))) + (setq rest-plist (cddr rest-plist))) + alist))) + (when (string-match "[\r\n]" descr) + (error "Illegal multi-line package description in %s" file-path)) + (vector + (nth 0 pkgfile-info) + (mapcar + (lambda (elt) + (unless (symbolp (car elt)) + (error "Invalid package name in dependency: %S" (car elt))) + (list (car elt) (version-to-list (cadr elt)))) + (eval (nth 3 pkgfile-info))) + descr + (nth 1 pkgfile-info) + extras)) + (error "No define-package found in %s" file-path))))) + +(defun package-build--merge-package-info (pkg-info name version) + "Return a version of PKG-INFO updated with NAME, VERSION and info from CONFIG. +If PKG-INFO is nil, an empty one is created." + (let* ((merged (or (copy-sequence pkg-info) + (vector name nil "No description available." version)))) + (aset merged 0 name) + (aset merged 3 version) + merged)) + +(defun package-build--archive-entry (pkg-info type) + "Return the archive-contents cons cell for PKG-INFO and TYPE." + (let* ((name (intern (aref pkg-info 0))) + (requires (aref pkg-info 1)) + (desc (or (aref pkg-info 2) "No description available.")) + (version (aref pkg-info 3)) + (extras (when (> (length pkg-info) 4) + (aref pkg-info 4)))) + (cons name + (vector (version-to-list version) + requires + desc + type + extras)))) + +(defun package-build--archive-file-name (archive-entry) + "Return the path of the file in which the package for ARCHIVE-ENTRY is stored." + (let* ((name (car archive-entry)) + (pkg-info (cdr archive-entry)) + (version (package-version-join (aref pkg-info 0))) + (flavour (aref pkg-info 3))) + (expand-file-name + (format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar")) + package-build-archive-dir))) + +(defun package-build--entry-file-name (archive-entry) + "Return the path of the file in which the package for ARCHIVE-ENTRY is stored." + (let* ((name (car archive-entry)) + (pkg-info (cdr archive-entry)) + (version (package-version-join (aref pkg-info 0)))) + (expand-file-name + (format "%s-%s.entry" name version) + package-build-archive-dir))) + +(defun package-build--delete-file-if-exists (file) + "Delete FILE if it exists." + (when (file-exists-p file) + (delete-file file))) + +(defun package-build--remove-archive-files (archive-entry) + "Remove ARCHIVE-ENTRY from archive-contents, and delete associated file. +Note that the working directory (if present) is not deleted by +this function, since the archive list may contain another version +of the same-named package which is to be kept." + (package-build--message "Removing archive: %s" archive-entry) + (mapcar 'package-build--delete-file-if-exists + (list (package-build--archive-file-name archive-entry) + (package-build--entry-file-name archive-entry)))) + +(defun package-build--read-recipe (file-name) + "Return the plist of recipe info for the package called FILE-NAME. +It performs some basic checks on the recipe to ensure that known +keys have values of the right types, and raises an error if that +is the not the case. If invalid combinations of keys are +supplied then errors will only be caught when an attempt is made +to build the recipe." + (let* ((pkg-info (package-build--read-from-file file-name)) + (pkg-name (car pkg-info)) + (rest (cdr pkg-info))) + (cl-assert pkg-name) + (cl-assert (symbolp pkg-name)) + (cl-assert (string= (symbol-name pkg-name) (file-name-nondirectory file-name)) + nil + "Recipe '%s' contains mismatched package name '%s'" + (file-name-nondirectory file-name) + (car pkg-info)) + (cl-assert rest) + (let* ((symbol-keys '(:fetcher)) + (string-keys '(:url :repo :module :commit :branch :version-regexp)) + (list-keys '(:files :old-names)) + (all-keys (append symbol-keys string-keys list-keys))) + (dolist (thing rest) + (when (keywordp thing) + (cl-assert (memq thing all-keys) nil "Unknown keyword %S" thing))) + (let ((fetcher (plist-get rest :fetcher))) + (cl-assert fetcher nil ":fetcher is missing") + (when (memq fetcher '(github gitlab bitbucket)) + (cl-assert (plist-get rest :repo) ":repo is missing"))) + (dolist (key symbol-keys) + (let ((val (plist-get rest key))) + (when val + (cl-assert (symbolp val) nil "%s must be a list but is %S" key val)))) + (dolist (key list-keys) + (let ((val (plist-get rest key))) + (when val + (cl-assert (listp val) nil "%s must be a list but is %S" key val )))) + (dolist (key string-keys) + (let ((val (plist-get rest key))) + (when val + (cl-assert (stringp val) nil "%s must be a string but is %S" key val ))))) + pkg-info)) + +(defun package-build--read-recipes () + "Return a list of data structures for all recipes in `package-build-recipes-dir'." + (cl-loop for file-name in (directory-files package-build-recipes-dir t "^[^.]") + collect (package-build--read-recipe file-name))) + +(defun package-build--read-recipes-ignore-errors () + "Return a list of data structures for all recipes in `package-build-recipes-dir'." + (cl-loop for file-name in (directory-files package-build-recipes-dir t "^[^.]") + for pkg-info = (condition-case err (package-build--read-recipe file-name) + (error (package-build--message "Error reading recipe %s: %s" + file-name + (error-message-string err)) + nil)) + when pkg-info + collect pkg-info)) + + +(defun package-build-expand-file-specs (dir specs &optional subdir allow-empty) + "In DIR, expand SPECS, optionally under SUBDIR. +The result is a list of (SOURCE . DEST), where SOURCE is a source +file path and DEST is the relative path to which it should be copied. + +If the resulting list is empty, an error will be reported. Pass t +for ALLOW-EMPTY to prevent this error." + (let ((default-directory dir) + (prefix (if subdir (format "%s/" subdir) "")) + (lst)) + (dolist (entry specs lst) + (setq lst + (if (consp entry) + (if (eq :exclude (car entry)) + (cl-nset-difference lst + (package-build-expand-file-specs dir (cdr entry) nil t) + :key 'car + :test 'equal) + (nconc lst + (package-build-expand-file-specs + dir + (cdr entry) + (concat prefix (car entry)) + t))) + (nconc + lst (mapcar (lambda (f) + (let ((destname))) + (cons f + (concat prefix + (replace-regexp-in-string + "\\.in\\'" + "" + (file-name-nondirectory f))))) + (file-expand-wildcards entry)))))) + (when (and (null lst) (not allow-empty)) + (error "No matching file(s) found in %s: %s" dir specs)) + lst)) + + +(defun package-build--config-file-list (config) + "Get the :files spec from CONFIG, or return `package-build-default-files-spec'." + (let ((file-list (plist-get config :files))) + (cond + ((null file-list) + package-build-default-files-spec) + ((eq :defaults (car file-list)) + (append package-build-default-files-spec (cdr file-list))) + (t + file-list)))) + +(defun package-build--expand-source-file-list (dir config) + "Shorthand way to expand paths in DIR for source files listed in CONFIG." + (mapcar 'car (package-build-expand-file-specs dir (package-build--config-file-list config)))) + +(defun package-build--generate-info-files (files source-dir target-dir) + "Create .info files from any .texi files listed in FILES. + +The source and destination file paths are expanded in SOURCE-DIR +and TARGET-DIR respectively. + +Any of the original .texi(nfo) files found in TARGET-DIR are +deleted." + (dolist (spec files) + (let* ((source-file (car spec)) + (source-path (expand-file-name source-file source-dir)) + (dest-file (cdr spec)) + (info-path (expand-file-name + (concat (file-name-sans-extension dest-file) ".info") + target-dir))) + (when (string-match ".texi\\(nfo\\)?$" source-file) + (when (not (file-exists-p info-path)) + (with-current-buffer (get-buffer-create "*package-build-info*") + (ignore-errors + (package-build--run-process + (file-name-directory source-path) + "makeinfo" + source-path + "-o" + info-path) + (package-build--message "Created %s" info-path)))) + (package-build--message "Removing %s" (expand-file-name dest-file target-dir)) + (delete-file (expand-file-name dest-file target-dir)))))) + +(defun package-build--generate-dir-file (files target-dir) + "Create dir file from any .info files listed in FILES in TARGET-DIR." + (dolist (spec files) + (let* ((source-file (car spec)) + (dest-file (cdr spec)) + (info-path (expand-file-name + (concat (file-name-sans-extension dest-file) ".info") + target-dir))) + (when (and (or (string-match ".info$" source-file) + (string-match ".texi\\(nfo\\)?$" source-file)) + (file-exists-p info-path)) + (with-current-buffer (get-buffer-create "*package-build-info*") + (ignore-errors + (package-build--run-process + nil + "install-info" + (concat "--dir=" (expand-file-name "dir" target-dir)) + info-path))))))) + +(defun package-build--copy-package-files (files source-dir target-dir) + "Copy FILES from SOURCE-DIR to TARGET-DIR. +FILES is a list of (SOURCE . DEST) relative filepath pairs." + (cl-loop for (source-file . dest-file) in files + do (package-build--copy-file + (expand-file-name source-file source-dir) + (expand-file-name dest-file target-dir)))) + +(defun package-build--copy-file (file newname) + "Copy FILE to NEWNAME and create parent directories for NEWNAME if they don't exist." + (let ((newdir (file-name-directory newname))) + (unless (file-exists-p newdir) + (make-directory newdir t))) + (cond + ((file-regular-p file) + (package-build--message "%s -> %s" file newname) + (copy-file file newname)) + ((file-directory-p file) + (package-build--message "%s => %s" file newname) + (copy-directory file newname)))) + + +(defun package-build--package-name-completing-read () + "Prompt for a package name, returning a symbol." + (intern (completing-read "Package: " (package-build-recipe-alist)))) + +(defun package-build--find-source-file (target files) + "Search for source of TARGET in FILES." + (let* ((entry (rassoc target files))) + (when entry (car entry)))) + +(defun package-build--find-package-file (name) + "Return the filename of the most recently built package of NAME." + (package-build--archive-file-name (assoc name (package-build-archive-alist)))) + +(defun package-build--package-buffer-info-vec () + "Return a vector of package info. +`package-buffer-info' returns a vector in older Emacs versions, +and a cl struct in Emacs HEAD. This wrapper normalises the results." + (let ((desc (package-buffer-info)) + (keywords (lm-keywords-list))) + (if (fboundp 'package-desc-create) + (let ((extras (package-desc-extras desc))) + (when (and keywords (not (assq :keywords extras))) + ;; Add keywords to package properties, if not already present + (push (cons :keywords keywords) extras)) + (vector (package-desc-name desc) + (package-desc-reqs desc) + (package-desc-summary desc) + (package-desc-version desc) + extras)) + ;; The regexp and the processing is taken from `lm-homepage' in Emacs 24.4 + (let* ((page (lm-header "\\(?:x-\\)?\\(?:homepage\\|url\\)")) + (homepage (if (and page (string-match "^<.+>$" page)) + (substring page 1 -1) + page)) + extras) + (when keywords (push (cons :keywords keywords) extras)) + (when homepage (push (cons :url homepage) extras)) + (vector (aref desc 0) + (aref desc 1) + (aref desc 2) + (aref desc 3) + extras))))) + +(defconst package-build--this-file load-file-name) + +;; TODO: This function should be fairly sound, but it has a few +;; possible failure modes. Primarily, if a file matching the recipe's +;; file spec appears in a new upstream revision, but that file has an +;; older date than the version timestamp provided here, the function +;; will return t. +(defun package-build--up-to-date-p (name version) + "Return non-nil if there is an up-to-date package for NAME with the given VERSION." + (let* ((package-file-base (expand-file-name (format "%s-%s." name version) package-build-archive-dir)) + (recipe-file (expand-file-name name package-build-recipes-dir))) + (cl-dolist (ext '("tar" "el")) + (let ((package-file (concat package-file-base ext))) + (when (and (file-newer-than-file-p package-file recipe-file) + (or (null package-build--this-file) + (file-newer-than-file-p package-file package-build--this-file))) + (cl-return t)))))) + + +;;; Public interface +;;;###autoload +(defun package-build-archive (name) + "Build a package archive for package NAME." + (interactive (list (package-build--package-name-completing-read))) + (let* ((file-name (symbol-name name)) + (rcp (or (cdr (assoc name (package-build-recipe-alist))) + (error "Cannot find package %s" (symbol-name name)))) + (pkg-working-dir + (file-name-as-directory + (expand-file-name file-name package-build-working-dir)))) + + (unless (file-exists-p package-build-archive-dir) + (package-build--message "Creating directory %s" package-build-archive-dir) + (make-directory package-build-archive-dir)) + + (package-build--message "\n;;; %s\n" file-name) + (let* ((version (package-build-checkout name rcp pkg-working-dir)) + (default-directory package-build-working-dir) + (start-time (current-time))) + (if (package-build--up-to-date-p (symbol-name name) version) + (package-build--message "Package %s is up to date - skipping." name) + (progn + (let ((archive-entry (package-build-package (symbol-name name) + version + (package-build--config-file-list rcp) + pkg-working-dir + package-build-archive-dir))) + (package-build--dump archive-entry (package-build--entry-file-name archive-entry))) + (when package-build-write-melpa-badge-images + (package-build--write-melpa-badge-image (symbol-name name) version package-build-archive-dir)) + (package-build--message "Built %s in %.3fs, finished at %s" + name + (time-to-seconds (time-since start-time)) + (current-time-string)))) + (list file-name version)))) + +;;;###autoload +(defun package-build-package (package-name version file-specs source-dir target-dir) + "Create PACKAGE-NAME with VERSION. + +The information in FILE-SPECS is used to gather files from +SOURCE-DIR. + +The resulting package will be stored as a .el or .tar file in +TARGET-DIR, depending on whether there are multiple files. + +Argument FILE-SPECS is a list of specs for source files, which +should be relative to SOURCE-DIR. The specs can be wildcards, +and optionally specify different target paths. They extended +syntax is currently only documented in the MELPA README. You can +simply pass `package-build-default-files-spec' in most cases. + +Returns the archive entry for the package." + (when (symbolp package-name) + (setq package-name (symbol-name package-name))) + (let ((files (package-build-expand-file-specs source-dir file-specs))) + (unless (equal file-specs package-build-default-files-spec) + (when (equal files (package-build-expand-file-specs + source-dir package-build-default-files-spec nil t)) + (package-build--message "Note: %s :files spec is equivalent to the default." + package-name))) + (cond + ((not version) + (error "Unable to check out repository for %s" package-name)) + ((= 1 (length files)) + (package-build--build-single-file-package package-name version (caar files) source-dir target-dir)) + ((< 1 (length files)) + (package-build--build-multi-file-package package-name version files source-dir target-dir)) + (t (error "Unable to find files matching recipe patterns"))))) + +(defun package-build--build-single-file-package (package-name version file source-dir target-dir) + (let* ((pkg-source (expand-file-name file source-dir)) + (pkg-target (expand-file-name + (concat package-name "-" version ".el") + target-dir)) + (pkg-info (package-build--merge-package-info + (package-build--get-package-info pkg-source) + package-name + version))) + (unless (string-equal (downcase (concat package-name ".el")) + (downcase (file-name-nondirectory pkg-source))) + (error "Single file %s does not match package name %s" + (file-name-nondirectory pkg-source) package-name)) + (if (file-exists-p pkg-target) + (package-build--message "Skipping rebuild of %s" pkg-target) + (copy-file pkg-source pkg-target) + (let ((enable-local-variables nil) + (make-backup-files nil)) + (with-current-buffer (find-file pkg-target) + (package-build--update-or-insert-version version) + (package-build--ensure-ends-here-line pkg-source) + (write-file pkg-target nil) + (condition-case err + (package-build--package-buffer-info-vec) + (error + (package-build--message "Warning: %S" err))) + (kill-buffer))) + + (package-build--write-pkg-readme target-dir + (package-build--find-package-commentary pkg-source) + package-name)) + (package-build--archive-entry pkg-info 'single))) + +(defun package-build--build-multi-file-package (package-name version files source-dir target-dir) + (let ((tmp-dir (file-name-as-directory (make-temp-file package-name t)))) + (unwind-protect + (let* ((pkg-dir-name (concat package-name "-" version)) + (pkg-tmp-dir (expand-file-name pkg-dir-name tmp-dir)) + (pkg-file (concat package-name "-pkg.el")) + (pkg-file-source (or (package-build--find-source-file pkg-file files) + pkg-file)) + (file-source (concat package-name ".el")) + (pkg-source (or (package-build--find-source-file file-source files) + file-source)) + (pkg-info (package-build--merge-package-info + (let ((default-directory source-dir)) + (or (package-build--get-pkg-file-info pkg-file-source) + ;; some packages (like magit) provide name-pkg.el.in + (package-build--get-pkg-file-info + (expand-file-name (concat pkg-file ".in") + (file-name-directory pkg-source))) + (package-build--get-package-info pkg-source))) + package-name + version))) + (package-build--copy-package-files files source-dir pkg-tmp-dir) + (package-build--write-pkg-file (expand-file-name pkg-file + (file-name-as-directory pkg-tmp-dir)) + pkg-info) + + (package-build--generate-info-files files source-dir pkg-tmp-dir) + (package-build--generate-dir-file files pkg-tmp-dir) + + (let ((default-directory tmp-dir)) + (package-build--create-tar (expand-file-name (concat package-name "-" version ".tar") + target-dir) + pkg-dir-name)) + + (let ((default-directory source-dir)) + (package-build--write-pkg-readme target-dir + (package-build--find-package-commentary pkg-source) + package-name)) + (package-build--archive-entry pkg-info 'tar)) + (delete-directory tmp-dir t nil)))) + + +;; In future we should provide a hook, and perform this step in a separate package. +;; Note also that it would be straightforward to generate the SVG ourselves, which would +;; save the network overhead. +(defun package-build--write-melpa-badge-image (package-name version target-dir) + (let ((badge-url (concat "https://img.shields.io/badge/" + (if package-build-stable "melpa stable" "melpa") + "-" + (url-hexify-string version) + "-" + (if package-build-stable "3e999f" "922793") + ".svg")) + (badge-filename (expand-file-name (concat package-name "-badge.svg") target-dir))) + (if (executable-find "curl") + ;; Not strictly needed, but less likely to break due to gnutls issues + (shell-command (mapconcat #'identity + (list "curl" "-f" "-o" + (shell-quote-argument badge-filename) + (shell-quote-argument badge-url)) + " ")) + (package-build--url-copy-file badge-url badge-filename t)))) + + +;;; Helpers for recipe authors + +(defvar package-build-minor-mode-map + (let ((m (make-sparse-keymap))) + (define-key m (kbd "C-c C-c") 'package-build-current-recipe) + m) + "Keymap for `package-build-minor-mode'.") + +(define-minor-mode package-build-minor-mode + "Helpful functionality for building packages." + nil + " PBuild" + package-build-minor-mode-map + (when package-build-minor-mode + (message "Use C-c C-c to build this recipe."))) + +;;;###autoload +(defun package-build-create-recipe (name fetcher) + "Create a new recipe for package NAME using FETCHER." + (interactive + (list (intern (read-string "Package name: ")) + (intern + (let ((fetcher-types (mapcar #'symbol-name '(github gitlab bitbucket git wiki bzr hg cvs svn)))) + (completing-read + "Fetcher: " + fetcher-types + nil t nil nil (car fetcher-types)))))) + (let ((recipe-file (expand-file-name (symbol-name name) package-build-recipes-dir))) + (when (file-exists-p recipe-file) + (error "Recipe already exists")) + (find-file recipe-file) + (let* ((extra-params + (cond + ((eq 'github fetcher) '(:repo "USER/REPO")) + ((eq 'wiki fetcher) '()) + (t '(:url "SCM_URL_HERE")))) + (template `(,name :fetcher ,fetcher ,@extra-params))) + (insert (pp-to-string template)) + (emacs-lisp-mode) + (package-build-minor-mode) + (goto-char (point-min))))) + +;;;###autoload +(defun package-build-current-recipe () + "Build archive for the recipe defined in the current buffer." + (interactive) + (unless (and (buffer-file-name) + (file-equal-p (file-name-directory (buffer-file-name)) + package-build-recipes-dir)) + (error "Buffer is not visiting a recipe")) + (when (buffer-modified-p) + (if (y-or-n-p (format "Save file %s? " buffer-file-name)) + (save-buffer) + (error "Aborting"))) + (check-parens) + (package-build-reinitialize) + (let ((pkg-name (intern (file-name-nondirectory (buffer-file-name))))) + (package-build-archive pkg-name) + (package-build-dump-archive-contents) + (let ((output-buffer-name "*package-build-result*")) + (with-output-to-temp-buffer output-buffer-name + (princ ";; Please check the following package descriptor.\n") + (princ ";; If the correct package description or dependencies are missing,\n") + (princ ";; then the source .el file is likely malformed, and should be fixed.\n") + (pp (assoc pkg-name (package-build-archive-alist)))) + (with-current-buffer output-buffer-name + (emacs-lisp-mode) + (view-mode))) + (when (yes-or-no-p "Install new package? ") + (package-install-file (package-build--find-package-file pkg-name))))) + +(defun package-build-archive-ignore-errors (pkg) + "Build archive for package PKG, ignoring any errors." + (interactive (list (package-build--package-name-completing-read))) + (let* ((debug-on-error t) + (debug-on-signal t) + (package-build--debugger-return nil) + (debugger (lambda (&rest args) + (setq package-build--debugger-return (with-output-to-string + (backtrace)))))) + (condition-case err + (package-build-archive pkg) + (error + (package-build--message "%s" (error-message-string err)) + nil)))) + + + +;;;###autoload +(defun package-build-all () + "Build all packages in the `package-build-recipe-alist'." + (interactive) + (let ((failed (cl-loop for pkg in (mapcar 'car (package-build-recipe-alist)) + when (not (package-build-archive-ignore-errors pkg)) + collect pkg))) + (if (not failed) + (princ "\nSuccessfully Compiled All Packages\n") + (princ "\nFailed to Build the Following Packages\n") + (princ (mapconcat 'symbol-name failed "\n")) + (princ "\n"))) + (package-build-cleanup)) + +(defun package-build-cleanup () + "Remove previously-built packages that no longer have recipes." + (interactive) + (let* ((known-package-names (mapcar 'car (package-build-recipe-alist))) + (stale-archives (cl-loop for built in (package-build--archive-entries) + when (not (memq (car built) known-package-names)) + collect built))) + (mapc 'package-build--remove-archive-files stale-archives) + (package-build-dump-archive-contents))) + +(defun package-build-recipe-alist () + "Retun the list of avalailable packages." + (unless package-build--recipe-alist-initialized + (setq package-build--recipe-alist (package-build--read-recipes-ignore-errors) + package-build--recipe-alist-initialized t)) + package-build--recipe-alist) + +(defun package-build-archive-alist () + "Return the archive list." + (cdr (package-build--read-from-file + (expand-file-name "archive-contents" + package-build-archive-dir)))) + +(defun package-build-reinitialize () + "Forget any information about packages which have already been built." + (interactive) + (setq package-build--recipe-alist-initialized nil)) + +(defun package-build-dump-archive-contents (&optional file-name pretty-print) + "Dump the list of built packages to FILE-NAME. + +If FILE-NAME is not specified, the default archive-contents file is used." + (package-build--dump (cons 1 (package-build--archive-entries)) + (or file-name + (expand-file-name "archive-contents" package-build-archive-dir)) + pretty-print)) + +(defun package-build--archive-entries () + "Read all .entry files from the archive directory and return a list of all entries." + (let ((entries '())) + (dolist (new (mapcar 'package-build--read-from-file + (directory-files package-build-archive-dir t + ".*\.entry$")) + entries) + (let ((old (assq (car new) entries))) + (when old + (when (version-list-< (elt (cdr new) 0) + (elt (cdr old) 0)) + ;; swap old and new + (cl-rotatef old new)) + (package-build--remove-archive-files old) + (setq entries (remove old entries))) + (add-to-list 'entries new))))) + + + +;;; Exporting data as json + +(defun package-build-recipe-alist-as-json (file-name) + "Dump the recipe list to FILE-NAME as json." + (interactive) + (with-temp-file file-name + (insert (json-encode (package-build-recipe-alist))))) + +(defun package-build--sym-to-keyword (s) + "Return a version of symbol S as a :keyword." + (intern (concat ":" (symbol-name s)))) + +(defun package-build--pkg-info-for-json (info) + "Convert INFO into a data structure which will serialize to JSON in the desired shape." + (let* ((ver (elt info 0)) + (deps (elt info 1)) + (desc (elt info 2)) + (type (elt info 3)) + (props (when (> (length info) 4) (elt info 4)))) + (list :ver ver + :deps (cl-mapcan (lambda (dep) + (list (package-build--sym-to-keyword (car dep)) + (cadr dep))) + deps) + :desc desc + :type type + :props props))) + +(defun package-build--archive-alist-for-json () + "Return the archive alist in a form suitable for JSON encoding." + (cl-mapcan (lambda (entry) + (list (package-build--sym-to-keyword (car entry)) + (package-build--pkg-info-for-json (cdr entry)))) + (package-build-archive-alist))) + +(defun package-build-archive-alist-as-json (file-name) + "Dump the build packages list to FILE-NAME as json." + (interactive) + (with-temp-file file-name + (insert (json-encode (package-build--archive-alist-for-json))))) + + +(provide 'package-build) + +;; Local Variables: +;; coding: utf-8 +;; checkdoc-minor-mode: 1 +;; End: + +;;; package-build.el ends here diff --git a/core/libs/quelpa.el b/core/libs/quelpa.el new file mode 100644 index 0000000..f2c55dd --- /dev/null +++ b/core/libs/quelpa.el @@ -0,0 +1,654 @@ +;;; quelpa.el --- Emacs Lisp packages built directly from source + +;; Copyright 2014-2015, Steckerhalter +;; Copyright 2014-2015, Vasilij Schneidermann + +;; Author: steckerhalter +;; URL: https://github.com/quelpa/quelpa +;; Version: 0.0.1 +;; Package-Requires: ((package-build "0") (emacs "24.3")) +;; Keywords: package management build source elpa + +;; This file is not part of GNU Emacs. + +;; 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 3, 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: + +;; Your personal local Emacs Lisp Package Archive (ELPA) with packages +;; built on-the-fly directly from source. + +;; See the README for more info: +;; https://github.com/quelpa/quelpa/blob/master/README.md + +;;; Requirements: + +;; Emacs 24.3.1 + +;;; Code: + +(require 'package-build) +(require 'cl-lib) +(require 'help-fns) +(require 'url-parse) + +;; --- customs / variables --------------------------------------------------- + +(defgroup quelpa nil + "Build and install packages from source code" + :group 'package) + +(defcustom quelpa-upgrade-p nil + "When non-nil, `quelpa' will try to upgrade packages. +The global value can be overridden for each package by supplying +the `:upgrade' argument." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-stable-p nil + "When non-nil, try to build stable packages like MELPA does." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-verbose t + "When non-nil, `quelpa' prints log messages." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-before-hook nil + "List of functions to be called before quelpa." + :group 'quelpa + :type 'hook) + +(defcustom quelpa-after-hook nil + "List of functions to be called after quelpa." + :group 'quelpa + :type 'hook) + +(defcustom quelpa-dir (expand-file-name "quelpa" user-emacs-directory) + "Where quelpa builds and stores packages." + :group 'quelpa + :type 'string) + +(defcustom quelpa-melpa-dir (expand-file-name "melpa" quelpa-dir) + "Where the melpa repo cloned to." + :group 'quelpa + :type 'string) + +(defcustom quelpa-build-dir (expand-file-name "build" quelpa-dir) + "Where quelpa builds packages." + :group 'quelpa + :type 'string) + +(defcustom quelpa-packages-dir (expand-file-name "packages" quelpa-dir) + "Where quelpa puts built packages." + :group 'quelpa + :type 'string) + +(defcustom quelpa-melpa-recipe-stores (list (expand-file-name + "recipes" + quelpa-melpa-dir)) + "Recipe stores where quelpa finds default recipes for packages. +A store can either be a string pointing to a directory with +recipe files or a list with recipes." + :group 'quelpa + :type '(repeat + (choice directory + (repeat + :tag "List of recipes" + (restricted-sexp :tag "Recipe" + :match-alternatives (listp)))))) + +(defcustom quelpa-persistent-cache-file (expand-file-name "cache" quelpa-dir) + "Location of the persistent cache file." + :group 'quelpa + :type 'string) + +(defcustom quelpa-persistent-cache-p t + "Non-nil when quelpa's cache is saved on and read from disk." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-checkout-melpa-p t + "If non-nil the MELPA git repo is cloned when quelpa is initialized." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-update-melpa-p t + "If non-nil the MELPA git repo is updated when quelpa is initialized. +If nil the update is disabled and the repo is only updated on +`quelpa-upgrade' or `quelpa-self-upgrade'." + :group 'quelpa + :type 'boolean) + +(defcustom quelpa-melpa-repo-url "https://github.com/melpa/melpa.git" + "The melpa git repository url." + :group 'quelpa + :type 'string) + +(defvar quelpa-initialized-p nil + "Non-nil when quelpa has been initialized.") + +(defvar quelpa-cache nil + "The `quelpa' command stores processed pkgs/recipes in the cache.") + +(defvar quelpa-recipe '(quelpa :repo "quelpa/quelpa" :fetcher github) + "The recipe for quelpa.") + +;; --- compatibility for legacy `package.el' in Emacs 24.3 ------------------- + +(defun quelpa-setup-package-structs () + "Setup the struct `package-desc' when not available. +`package-desc-from-legacy' is provided to convert the legacy +vector desc into a valid PACKAGE-DESC." + (unless (functionp 'package-desc-p) + (cl-defstruct + (package-desc + (:constructor + ;; convert legacy package desc into PACKAGE-DESC + package-desc-from-legacy + (pkg-info kind + &aux + (name (intern (aref pkg-info 0))) + (version (version-to-list (aref pkg-info 3))) + (summary (if (string= (aref pkg-info 2) "") + "No description available." + (aref pkg-info 2))) + (reqs (aref pkg-info 1)) + (kind kind)))) + name + version + (summary "No description available.") + reqs + kind + archive + dir + extras + signed))) + +;; --- package building ------------------------------------------------------ + +(defun quelpa-package-type (file) + "Determine the package type of FILE. +Return `tar' for tarball packages, `single' for single file +packages, or nil, if FILE is not a package." + (let ((ext (file-name-extension file))) + (cond + ((string= ext "tar") 'tar) + ((string= ext "el") 'single) + (:else nil)))) + +(defun quelpa-get-package-desc (file) + "Extract and return the PACKAGE-DESC struct from FILE. +On error return nil." + (let* ((kind (quelpa-package-type file)) + (desc (with-demoted-errors "Error getting PACKAGE-DESC: %s" + (with-temp-buffer + (pcase kind + (`single (insert-file-contents file) + (package-buffer-info)) + (`tar (insert-file-contents-literally file) + (tar-mode) + (if (help-function-arglist 'package-tar-file-info) + ;; legacy `package-tar-file-info' requires an arg + (package-tar-file-info file) + (with-no-warnings (package-tar-file-info))))))))) + (pcase desc + ((pred package-desc-p) desc) + ((pred vectorp) (package-desc-from-legacy desc kind))))) + +(defun quelpa-archive-file-name (archive-entry) + "Return the path of the file in which the package for ARCHIVE-ENTRY is stored." + (let* ((name (car archive-entry)) + (pkg-info (cdr archive-entry)) + (version (package-version-join (aref pkg-info 0))) + (flavour (aref pkg-info 3))) + (expand-file-name + (format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar")) + quelpa-packages-dir))) + +(defun quelpa-version>-p (name version) + "Return non-nil if VERSION of pkg with NAME is newer than what is currently installed." + (not (or (not version) + (let ((pkg-desc (cdr (assq name package-alist)))) + (and pkg-desc + (version-list-<= + (version-to-list version) + (if (functionp 'package-desc-vers) + (package-desc-vers pkg-desc) ;old implementation + (package-desc-version (car pkg-desc)))))) + ;; Also check built-in packages. + (package-built-in-p name (version-to-list version))))) + +(defun quelpa-checkout (rcp dir) + "Return the version of the new package given a RCP. +Return nil if the package is already installed and should not be upgraded." + (pcase-let ((`(,name . ,config) rcp) + (package-build-stable quelpa-stable-p)) + (unless (or (and (assq name package-alist) (not quelpa-upgrade-p)) + (and (not config) + (quelpa-message t "no recipe found for package `%s'" name))) + (let ((version (condition-case err + (package-build-checkout name config dir) + (error (quelpa-message t + "failed to checkout `%s': `%s'" + name + (error-message-string err)) + nil)))) + (when (quelpa-version>-p name version) + version))))) + +(defun quelpa-build-package (rcp) + "Build a package from the given recipe RCP. +Uses the `package-build' library to get the source code and build +an elpa compatible package in `quelpa-build-dir' storing it in +`quelpa-packages-dir'. Return the path to the created file or nil +if no action is necessary (like when the package is installed +already and should not be upgraded etc)." + (let* ((name (car rcp)) + (build-dir (expand-file-name (symbol-name name) quelpa-build-dir)) + (version (quelpa-checkout rcp build-dir))) + (when version + (quelpa-archive-file-name + (package-build-package (symbol-name name) + version + (package-build--config-file-list (cdr rcp)) + build-dir + quelpa-packages-dir))))) + +;; --- package-build.el integration ------------------------------------------ + +(defun quelpa-file-version (file-path type version time-stamp) + "Return version of file at FILE-PATH." + (if (eq type 'directory) + time-stamp + (cl-letf* ((package-strip-rcs-id-orig (symbol-function 'package-strip-rcs-id)) + ((symbol-function 'package-strip-rcs-id) + (lambda (str) + (or (funcall package-strip-rcs-id-orig (lm-header "package-version")) + (funcall package-strip-rcs-id-orig (lm-header "version")) + "0")))) + (concat (mapconcat + #'number-to-string + (package-desc-version (quelpa-get-package-desc file-path)) ".") + (pcase version + (`original "") + (_ (concat "pre0." time-stamp))))))) + +(defun quelpa-directory-files (path) + "Return list of directory files from PATH recursively." + (let ((result '())) + (mapc + (lambda (file) + (if (file-directory-p file) + (progn + ;; When directory is not empty. + (when (cddr (directory-files file)) + (dolist (subfile (quelpa-directory-files file)) + (add-to-list 'result subfile)))) + (add-to-list 'result file))) + (mapcar + (lambda (file) (expand-file-name file path)) + ;; Without first two entries because they are always "." and "..". + (cddr (directory-files path)))) + result)) + +(defun quelpa-expand-source-file-list (file-path config) + "Return list of source files from FILE-PATH corresponding to +CONFIG." + (let ((source-files + (mapcar + (lambda (file) (expand-file-name file file-path)) + (package-build--expand-source-file-list file-path config)))) + ;; Replace any directories in the source file list with the filenames of the + ;; files they contain (so that these files can subsequently be hashed). + (dolist (file source-files source-files) + (when (file-directory-p file) + (setq source-files (remove file source-files)) + (setq source-files (append source-files + (quelpa-directory-files file))))))) + +(defun quelpa-slurp-file (file) + "Return the contents of FILE as a string, or nil if no such +file exists." + (when (file-exists-p file) + (with-temp-buffer + (set-buffer-multibyte nil) + (setq-local buffer-file-coding-system 'binary) + (insert-file-contents-literally file) + (buffer-substring-no-properties (point-min) (point-max))))) + +(defun quelpa-check-hash (name config file-path dir &optional fetcher) + "Check if hash of FILE-PATH is different as in STAMP-FILE. +If it is different save the new hash and timestamp to STAMP-FILE +and return TIME-STAMP, otherwise return OLD-TIME-STAMP." + (unless (file-directory-p dir) + (make-directory dir)) + (let* (files + hashes + new-stamp-info + new-content-hash + (time-stamp + (replace-regexp-in-string "\\.0" "." (format-time-string "%Y%m%d.%H%M%S"))) + (stamp-file (concat (expand-file-name (symbol-name name) dir) ".stamp")) + (old-stamp-info (package-build--read-from-file stamp-file)) + (old-content-hash (cdr old-stamp-info)) + (old-time-stamp (car old-stamp-info)) + (type (if (file-directory-p file-path) 'directory 'file)) + (version (plist-get config :version))) + + (if (not (file-exists-p file-path)) + (error (quelpa-message t "`%s' does not exist" file-path)) + (if (eq type 'directory) + (setq files (quelpa-expand-source-file-list file-path config) + hashes (mapcar + (lambda (file) + (secure-hash + 'sha1 (concat file (quelpa-slurp-file file)))) files) + new-content-hash (secure-hash 'sha1 (mapconcat 'identity hashes ""))) + (setq new-content-hash (secure-hash 'sha1 (quelpa-slurp-file file-path))))) + + (setq new-stamp-info (cons time-stamp new-content-hash)) + (if (and old-content-hash + (string= new-content-hash old-content-hash)) + (quelpa-file-version file-path type version old-time-stamp) + (unless (eq fetcher 'url) + (delete-directory dir t) + (make-directory dir) + (if (eq type 'file) + (copy-file file-path dir t t t t) + (copy-directory file-path dir t t t))) + (package-build--dump new-stamp-info stamp-file) + (quelpa-file-version file-path type version time-stamp)))) + +(defun package-build--checkout-file (name config dir) + "Build according to a PATH with config CONFIG into DIR as NAME. +Generic local file handler for package-build.el. + +Handles the following cases: + +local file: + +Installs a single-file package from a local file. Use the :path +attribute with a PATH like \"/path/to/file.el\". + +local directory: + +Installs a multi-file package from a local directory. Use +the :path attribute with a PATH like \"/path/to/dir\"." + (quelpa-check-hash name config (expand-file-name (plist-get config :path)) dir)) + +(defun package-build--checkout-url (name config dir) + "Build according to an URL with config CONFIG into DIR as NAME. +Generic URL handler for package-build.el. + +Handles the following cases: + +local file: + +Installs a single-file package from a local file. Use the :url +attribute with an URL like \"file:///path/to/file.el\". + +remote file: + +Installs a single-file package from a remote file. Use the :url +attribute with an URL like \"http://domain.tld/path/to/file.el\"." + (let* ((url (plist-get config :url)) + (remote-file-name (file-name-nondirectory + (url-filename (url-generic-parse-url url)))) + (local-path (expand-file-name remote-file-name dir)) + (mm-attachment-file-modes (default-file-modes))) + (unless (string= (file-name-extension url) "el") + (error (quelpa-message t "<%s> does not end in .el" url))) + (unless (file-directory-p dir) + (make-directory dir)) + (url-copy-file url local-path t) + (quelpa-check-hash name config local-path dir 'url))) + +;; --- helpers --------------------------------------------------------------- + +(defun quelpa-message (wait format-string &rest args) + "Log a message with FORMAT-STRING and ARGS when `quelpa-verbose' is non-nil. +If WAIT is nil don't wait after showing the message. If it is a +number, wait so many seconds. If WAIT is t wait the default time. +Return t in each case." + (when quelpa-verbose + (message "Quelpa: %s" (apply 'format format-string args)) + (when (or (not noninteractive) wait) ; no wait if emacs is noninteractive + (sit-for (or (and (numberp wait) wait) 1.5) t))) + t) + +(defun quelpa-read-cache () + "Read from `quelpa-persistent-cache-file' in `quelpa-cache'." + (when (and quelpa-persistent-cache-p + (file-exists-p quelpa-persistent-cache-file)) + (with-temp-buffer + (insert-file-contents-literally quelpa-persistent-cache-file) + (setq quelpa-cache + (read (buffer-substring-no-properties (point-min) (point-max))))))) + +(defun quelpa-save-cache () + "Write `quelpa-cache' to `quelpa-persistent-cache-file'." + (when quelpa-persistent-cache-p + (let (print-level print-length) + (with-temp-file quelpa-persistent-cache-file + (insert (prin1-to-string quelpa-cache)))))) + +(defun quelpa-update-cache (cache-item) + ;; try removing existing recipes by name + (setq quelpa-cache (cl-remove (car cache-item) + quelpa-cache :key #'car)) + (push cache-item quelpa-cache) + (setq quelpa-cache + (cl-sort quelpa-cache #'string< + :key (lambda (item) (symbol-name (car item)))))) + +(defun quelpa-parse-stable (cache-item) + ;; in case :stable doesn't originate from PLIST, shadow the + ;; default value anyways + (when (plist-member (cdr cache-item) :stable) + (setq quelpa-stable-p (plist-get (cdr cache-item) :stable))) + (when (and quelpa-stable-p (not (plist-get (cdr cache-item) :stable))) + (setf (cdr (last cache-item)) '(:stable t)))) + +(defun quelpa-checkout-melpa () + "Fetch or update the melpa source code from Github. +If there is no error return non-nil. +If there is an error but melpa is already checked out return non-nil. +If there is an error and no existing checkout return nil." + (or (and (null quelpa-update-melpa-p) + (file-exists-p (expand-file-name ".git" quelpa-melpa-dir))) + (condition-case err + (package-build--checkout-git + 'package-build + `(:url ,quelpa-melpa-repo-url :files ("*")) + quelpa-melpa-dir) + (error (quelpa-message t "failed to checkout melpa git repo: `%s'" (error-message-string err)) + (file-exists-p (expand-file-name ".git" quelpa-melpa-dir)))))) + +(defun quelpa-get-melpa-recipe (name) + "Read recipe with NAME for melpa git checkout. +Return the recipe if it exists, otherwise nil." + (cl-loop for store in quelpa-melpa-recipe-stores + if (stringp store) + for file = (assoc-string name (directory-files store nil "^[^\.]+")) + when file + return (with-temp-buffer + (insert-file-contents-literally + (expand-file-name file store)) + (read (buffer-string))) + else + for rcp = (assoc-string name store) + when rcp + return rcp)) + +(defun quelpa-setup-p () + "Setup what we need for quelpa. +Return non-nil if quelpa has been initialized properly." + (catch 'quit + (dolist (dir (list quelpa-packages-dir quelpa-build-dir)) + (unless (file-exists-p dir) (make-directory dir t))) + (unless quelpa-initialized-p + (quelpa-read-cache) + (quelpa-setup-package-structs) + (if quelpa-checkout-melpa-p + (unless (quelpa-checkout-melpa) (throw 'quit nil))) + (setq quelpa-initialized-p t)) + t)) + +(defun quelpa-shutdown () + "Do things that need to be done after running quelpa." + (quelpa-save-cache) + ;; remove the packages dir because we are done with the built pkgs + (ignore-errors (delete-directory quelpa-packages-dir t))) + +(defun quelpa-arg-rcp (arg) + "Given recipe or package name, return an alist '(NAME . RCP). +If RCP cannot be found it will be set to nil" + (pcase arg + (`(,a . nil) (quelpa-get-melpa-recipe (car arg))) + (`(,a . ,_) arg) + ((pred symbolp) (quelpa-get-melpa-recipe arg)))) + +(defun quelpa-parse-plist (plist) + "Parse the optional PLIST argument of `quelpa'. +Recognized keywords are: + +:upgrade + +If t, `quelpa' tries to do an upgrade. + +:stable + +If t, `quelpa' tries building the stable version of a package." + (while plist + (let ((key (car plist)) + (value (cadr plist))) + (pcase key + (:upgrade (setq quelpa-upgrade-p value)) + (:stable (setq quelpa-stable-p value)))) + (setq plist (cddr plist)))) + +(defun quelpa-package-install-file (file) + "Workaround problem with `package-install-file'. +`package-install-file' uses `insert-file-contents-literally' +which causes problems when the file inserted has crlf line +endings (Windows). So here we replace that with +`insert-file-contents' for non-tar files." + (if (eq system-type 'windows-nt) + (cl-letf* ((insert-file-contents-literally-orig + (symbol-function 'insert-file-contents-literally)) + ((symbol-function 'insert-file-contents-literally) + (lambda (file) + (if (string-match "\\.tar\\'" file) + (funcall insert-file-contents-literally-orig file) + (insert-file-contents file))))) + (package-install-file file)) + (package-install-file file))) + +(defun quelpa-package-install (arg) + "Build and install package from ARG (a recipe or package name). +If the package has dependencies recursively call this function to +install them." + (let* ((rcp (quelpa-arg-rcp arg)) + (file (and rcp (quelpa-build-package rcp)))) + (when file + (let* ((pkg-desc (quelpa-get-package-desc file)) + (requires (package-desc-reqs pkg-desc))) + (when requires + (mapc (lambda (req) + (unless (equal 'emacs (car req)) + (quelpa-package-install (car req)))) + requires)) + (quelpa-package-install-file file))))) + +(defun quelpa-interactive-candidate () + "Query the user for a recipe and return the name." + (when (quelpa-setup-p) + (let ((recipes (directory-files + (expand-file-name "recipes" quelpa-melpa-dir) + ;; this regexp matches all files except dotfiles + nil "^[^.].+$"))) + (intern (completing-read "Choose MELPA recipe: " + recipes nil t))))) + +;; --- public interface ------------------------------------------------------ + +;;;###autoload +(defun quelpa-expand-recipe (recipe-name) + "Expand a given recipe name into full recipe. +If called interactively, let the user choose a recipe name and +insert the result into the current buffer." + (interactive (list (quelpa-interactive-candidate))) + (when (quelpa-setup-p) + (let* ((recipe (quelpa-get-melpa-recipe recipe-name))) + (when recipe + (if (called-interactively-p 'any) + (prin1 recipe (current-buffer))) + recipe)))) + +;;;###autoload +(defun quelpa-self-upgrade (&optional args) + "Upgrade quelpa itself. +ARGS are additional options for the quelpa recipe." + (interactive) + (when (quelpa-setup-p) + (quelpa (append quelpa-recipe args) :upgrade t))) + +;;;###autoload +(defun quelpa-upgrade () + "Upgrade all packages found in `quelpa-cache'. +This provides an easy way to upgrade all the packages for which +the `quelpa' command has been run in the current Emacs session." + (interactive) + (when (quelpa-setup-p) + (let ((quelpa-upgrade-p t)) + (quelpa-self-upgrade) + (setq quelpa-cache + (cl-remove-if-not #'package-installed-p quelpa-cache :key #'car)) + (mapc (lambda (item) + (when (package-installed-p (car (quelpa-arg-rcp item))) + (quelpa item))) + quelpa-cache)))) + +;;;###autoload +(defun quelpa (arg &rest plist) + "Build and install a package with quelpa. +ARG can be a package name (symbol) or a melpa recipe (list). +PLIST is a plist that may modify the build and/or fetch process. +If called interactively, `quelpa' will prompt for a MELPA package +to install. + +When `quelpa' is called interactively with a prefix argument (e.g +C-u M-x quelpa) it will try to upgrade the given package even if +the global var `quelpa-upgrade-p' is set to nil." + + (interactive (list (quelpa-interactive-candidate))) + (run-hooks 'quelpa-before-hook) + (when (quelpa-setup-p) ;if init fails we do nothing + (let* ((quelpa-upgrade-p (if current-prefix-arg t quelpa-upgrade-p)) ;shadow `quelpa-upgrade-p' + (quelpa-stable-p quelpa-stable-p) ;shadow `quelpa-stable-p' + (cache-item (if (symbolp arg) (list arg) arg))) + (quelpa-parse-plist plist) + (quelpa-parse-stable cache-item) + (quelpa-package-install arg) + (quelpa-update-cache cache-item))) + (quelpa-shutdown) + (run-hooks 'quelpa-after-hook)) + +(provide 'quelpa) + +;;; quelpa.el ends here diff --git a/core/libs/spacemacs-theme/README.md b/core/libs/spacemacs-theme/README.md new file mode 100644 index 0000000..9e4b345 --- /dev/null +++ b/core/libs/spacemacs-theme/README.md @@ -0,0 +1,161 @@ +# Spacemacs-theme + +[![MELPA](http://melpa.org/packages/spacemacs-theme-badge.svg)](http://melpa.org/#/spacemacs-theme) ![Made with Spacemacs](https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg) + [![Join the chat at https://gitter.im/nashamri/spacemacs-theme](https://badges.gitter.im/Join%20Chat.svg)] (https://gitter.im/nashamri/spacemacs-theme?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +![spacemacs-theme](/../screenshots/spacemacs-theme.png) + +Spacemacs theme is an Emacs color theme that started as a theme for [spacemacs](https://github.com/syl20bnr/spacemacs). +The theme comes with dark and light variants and it should work well with 256 color terminals. + +## Screenshots + +![spacemacs-theme-preview](/../screenshots/preview.png) + +## Highlights + +The theme has good support for org mode. + +![spacemacs-theme-org](/../screenshots/org.png) + +## Installation + +You can install it from MELPA by: + +``` +M-x package-install RET spacemacs-theme +``` + +## Supported modes + +Some of the supported modes are: + +* company +* ein +* erc +* gnus +* helm +* ido +* info +* magit +* neotree +* org +* and others :) more are coming! + +## Customizations + +The theme has some options that can be tweaked via `M-x customize`: + +* `spacemacs-theme-comment-bg`: + +This toggles a background color for the comment lines. + +* `spacemacs-theme-org-agenda-height`: + +This toggles the use of varying org agenda heights. + +* `spacemacs-theme-org-height`: + +This toggles the use of varying org headings heights. + +* `spacemacs-theme-org-highlight`: + +This toggles highlighting of org headings. + +* `spacemacs-theme-custom-colors`: + +This allows for specifying a list of custom colors to override spacemacs theme colors. More details in the next section. + +### Override theme's colors + +The theme can be customized by overriding one of the theme local variables by setting a list in the `spacemacs-theme-custom-colors` variable. +Here's a list of all the local variables and roles: + +| var | role | +|---------------|---------------------------------------------------------------------------------------------------| +| act1 | One of mode-line's active colors. | +| act2 | The other active color of mode-line. | +| base | The basic color of normal text. | +| base-dim | A dimmer version of the normal text color. | +| bg1 | The background color. | +| bg2 | A darker background color. Used to highlight current line. | +| bg3 | Yet another darker shade of the background color. | +| bg4 | The darkest background color. | +| border | A border line color. Used in mode-line borders. | +| cblk | A code block color. Used in org's code blocks. | +| cblk-bg | The background color of a code block. | +| cblk-ln | A code block header line. | +| cblk-ln-bg | The background of a code block header line. | +| cursor | The cursor/point color. | +| const | A constant. | +| comment | A comment. | +| comment-bg | The background color of a comment. To disable this, `customize` `spacemacs-theme-comment-bg`. | +| comp | A complementary color. | +| err | errors. | +| func | functions. | +| head1 | Level 1 of a heading. Used in org's headings. | +| head1-bg | The background of level 2 headings. To disable this, `customize` `spacemacs-theme-org-highlight`. | +| head2 | Level 2 headings. | +| head2-bg | Level 2 headings background. | +| head3 | Level 3 headings. | +| head3-bg | Level 3 headings background. | +| head4 | Level 4 headings. | +| head4-bg | Level 4 headings background. | +| highlight | A highlighted area. | +| highlight-dim | A dimmer highlighted area. | +| keyword | A keyword or a builtin color. | +| lnum | Line numbers. | +| mat | A matched color. Used in matching parens, brackets and tags. | +| meta | A meta line. Used in org's meta line. | +| str | A string. | +| suc | To indicate success. Opposite of error. | +| ttip | Tooltip color. | +| ttip-sl | Tooltip selection color. | +| ttip-bg | Tooltip background color. | +| type | A type color. | +| var | A variable color. | +| war | A warning color. | + + +There is also explicit colors variables that can be customized: + +* aqua +* aqua-bg +* green +* green-bg +* green-bg-s +* cyan +* red +* red-bg +* red-bg-s +* blue +* blue-bg +* violet +* yellow +* yellow-bg + +The `green` and `red` colors have two background versions. The `green-bg` and `red-bg` are normal light background colors. +The `green-bg-s` and `red-bg-s` are a stronger version and are used in `ediff` and places were text is added or deleted. + +Here are some screenshots of the various variables: + +![spacemacs-theme-guide-generic](/../screenshots/guide-generic.png) + +![spacemacs-theme-guide-org](/../screenshots/guide-org.png) + +![spacemacs-theme-guide-extra](/../screenshots/guide-extra.png) + +If you are using [spacemacs](https://github.com/syl20bnr/spacemacs), you can put this snippet in your `dotspacemacs/user-init` to override these colors: + +``` + (custom-set-variables '(spacemacs-theme-custom-colors + '((act1 . "#ff0000") + (act2 . "#0000ff") + (base . "#ffffff")))) +``` + +This will override `act1`, `act1` and `base` to use the specified colors. + +# Like the theme and want to use it in other places? + +Then check out this project [base16-builder](https://github.com/auduchinok/base16-builder). diff --git a/core/libs/spacemacs-theme/spacemacs-common.el b/core/libs/spacemacs-theme/spacemacs-common.el new file mode 100644 index 0000000..6d998ba --- /dev/null +++ b/core/libs/spacemacs-theme/spacemacs-common.el @@ -0,0 +1,786 @@ +;;; spacemacs-common.el --- Color theme with a dark and light versions. + +;; Copyright (C) 2015-2016 Nasser Alshammari + +;; Author: Nasser Alshammari +;; URL: +;; +;; Version: 0.1 +;; Keywords: color, theme +;; Package-Requires: ((emacs "24")) + +;; Initially created with the help of emacs-theme-generator, . + +;; 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 . + +;; This file is not part of Emacs. + +;;; Commentary: + +;; This is a color theme for spacemacs . +;; It comes with two versions, dark and light and should work well in +;; a 256 color terminal. + +;;; Code: + +(defmacro dyn-let (varlist fn setfaces setvars) + (list 'let (append varlist (funcall fn)) setfaces setvars)) + +(defgroup spacemacs-theme nil + "Spacemacs-theme options." + :group 'faces) + +(defcustom spacemacs-theme-comment-bg t + "Use a background for comment lines." + :type 'boolean + :group 'spacemacs-theme) + +(defcustom spacemacs-theme-org-agenda-height t + "Use varying text heights for org agenda." + :type 'boolean + :group 'spacemacs-theme) + +(defcustom spacemacs-theme-org-height t + "Use varying text heights for org headings." + :type 'boolean + :group 'spacemacs-theme) + +(defcustom spacemacs-theme-org-highlight nil + "Highlight org headings." + :type 'boolean + :group 'spacemacs-theme) + +(defcustom spacemacs-theme-custom-colors nil + "Specify a list of custom colors" + :type 'alist + :group 'spacemacs-theme) + +(defun true-color-p () + (or + (display-graphic-p) + (= (tty-display-color-cells) 16777216))) + +(defun custom-colors-override () + (mapcar (lambda (x) (list (car x) (cdr x))) + spacemacs-theme-custom-colors)) + +(defun create-spacemacs-theme (variant theme-name) + (dyn-let ((class '((class color) (min-colors 89))) ;; ~~ Dark ~~ ~~ Light ~~ + ;; GUI TER GUI TER + ;; generic + (act1 (if (eq variant 'dark) (if (true-color-p) "#222226" "#121212") (if (true-color-p) "#e7e5eb" "#d7dfff"))) + (act2 (if (eq variant 'dark) (if (true-color-p) "#5d4d7a" "#444444") (if (true-color-p) "#d3d3e7" "#afafd7"))) + (base (if (eq variant 'dark) (if (true-color-p) "#b2b2b2" "#b2b2b2") (if (true-color-p) "#655370" "#5f5f87"))) + (base-dim (if (eq variant 'dark) (if (true-color-p) "#686868" "#585858") (if (true-color-p) "#a094a2" "#afafd7"))) + (bg1 (if (eq variant 'dark) (if (true-color-p) "#292b2e" "#262626") (if (true-color-p) "#fbf8ef" "#ffffff"))) + (bg2 (if (eq variant 'dark) (if (true-color-p) "#212026" "#1c1c1c") (if (true-color-p) "#efeae9" "#e4e4e4"))) + (bg3 (if (eq variant 'dark) (if (true-color-p) "#100a14" "#121212") (if (true-color-p) "#e3dedd" "#d0d0d0"))) + (bg4 (if (eq variant 'dark) (if (true-color-p) "#0a0814" "#080808") (if (true-color-p) "#d2ceda" "#bcbcbc"))) + (border (if (eq variant 'dark) (if (true-color-p) "#5d4d7a" "#111111") (if (true-color-p) "#b3b9be" "#b3b9be"))) + (cblk (if (eq variant 'dark) (if (true-color-p) "#cbc1d5" "#b2b2b2") (if (true-color-p) "#655370" "#5f5f87"))) + (cblk-bg (if (eq variant 'dark) (if (true-color-p) "#2f2b33" "#262626") (if (true-color-p) "#e8e3f0" "#ffffff"))) + (cblk-ln (if (eq variant 'dark) (if (true-color-p) "#827591" "#af5faf") (if (true-color-p) "#9380b2" "#af5fdf"))) + (cblk-ln-bg (if (eq variant 'dark) (if (true-color-p) "#373040" "#333333") (if (true-color-p) "#ddd8eb" "#dfdfff"))) + (cursor (if (eq variant 'dark) (if (true-color-p) "#e3dedd" "#d0d0d0") (if (true-color-p) "#100a14" "#121212"))) + (const (if (eq variant 'dark) (if (true-color-p) "#a45bad" "#d75fd7") (if (true-color-p) "#4e3163" "#8700af"))) + (comment (if (eq variant 'dark) (if (true-color-p) "#2aa1ae" "#008787") (if (true-color-p) "#2aa1ae" "#008787"))) + (comment-bg (if (eq variant 'dark) (if (true-color-p) "#292e34" "#262626") (if (true-color-p) "#ecf3ec" "#ffffff"))) + (comp (if (eq variant 'dark) (if (true-color-p) "#c56ec3" "#d75fd7") (if (true-color-p) "#6c4173" "#8700af"))) + (err (if (eq variant 'dark) (if (true-color-p) "#e0211d" "#e0211d") (if (true-color-p) "#e0211d" "#e0211d"))) + (func (if (eq variant 'dark) (if (true-color-p) "#bc6ec5" "#d75fd7") (if (true-color-p) "#6c3163" "#8700af"))) + (head1 (if (eq variant 'dark) (if (true-color-p) "#4f97d7" "#268bd2") (if (true-color-p) "#3a81c3" "#268bd2"))) + (head1-bg (if (eq variant 'dark) (if (true-color-p) "#293239" "#262626") (if (true-color-p) "#edf1ed" "#ffffff"))) + (head2 (if (eq variant 'dark) (if (true-color-p) "#2d9574" "#2aa198") (if (true-color-p) "#2d9574" "#2aa198"))) + (head2-bg (if (eq variant 'dark) (if (true-color-p) "#293235" "#262626") (if (true-color-p) "#edf2e9" "#ffffff"))) + (head3 (if (eq variant 'dark) (if (true-color-p) "#67b11d" "#67b11d") (if (true-color-p) "#67b11d" "#5faf00"))) + (head3-bg (if (eq variant 'dark) (if (true-color-p) "#293235" "#262626") (if (true-color-p) "#edf2e9" "#ffffff"))) + (head4 (if (eq variant 'dark) (if (true-color-p) "#b1951d" "#875f00") (if (true-color-p) "#b1951d" "#875f00"))) + (head4-bg (if (eq variant 'dark) (if (true-color-p) "#32322c" "#262626") (if (true-color-p) "#f6f1e1" "#ffffff"))) + (highlight (if (eq variant 'dark) (if (true-color-p) "#444155" "#444444") (if (true-color-p) "#d3d3e7" "#d7d7ff"))) + (highlight-dim (if (eq variant 'dark) (if (true-color-p) "#3b314d" "#444444") (if (true-color-p) "#e7e7fc" "#d7d7ff"))) + (keyword (if (eq variant 'dark) (if (true-color-p) "#4f97d7" "#268bd2") (if (true-color-p) "#3a81c3" "#268bd2"))) + (lnum (if (eq variant 'dark) (if (true-color-p) "#44505c" "#444444") (if (true-color-p) "#a8a8bf" "#af87af"))) + (mat (if (eq variant 'dark) (if (true-color-p) "#86dc2f" "#86dc2f") (if (true-color-p) "#ba2f59" "#af005f"))) + (meta (if (eq variant 'dark) (if (true-color-p) "#9f8766" "#af875f") (if (true-color-p) "#da8b55" "#df5f5f"))) + (str (if (eq variant 'dark) (if (true-color-p) "#2d9574" "#2aa198") (if (true-color-p) "#2d9574" "#2aa198"))) + (suc (if (eq variant 'dark) (if (true-color-p) "#86dc2f" "#86dc2f") (if (true-color-p) "#42ae2c" "#00af00"))) + (ttip (if (eq variant 'dark) (if (true-color-p) "#9a9aba" "#888888") (if (true-color-p) "#8c799f" "#5f5f87"))) + (ttip-sl (if (eq variant 'dark) (if (true-color-p) "#5e5079" "#333333") (if (true-color-p) "#c8c6dd" "#afafff"))) + (ttip-bg (if (eq variant 'dark) (if (true-color-p) "#34323e" "#444444") (if (true-color-p) "#e2e0ea" "#dfdfff"))) + (type (if (eq variant 'dark) (if (true-color-p) "#ce537a" "#df005f") (if (true-color-p) "#ba2f59" "#af005f"))) + (var (if (eq variant 'dark) (if (true-color-p) "#7590db" "#8787d7") (if (true-color-p) "#715ab1" "#af5fd7"))) + (war (if (eq variant 'dark) (if (true-color-p) "#dc752f" "#dc752f") (if (true-color-p) "#dc752f" "#dc752f"))) + + ;; colors + (aqua (if (eq variant 'dark) (if (true-color-p) "#2d9574" "#2aa198") (if (true-color-p) "#2d9574" "#2aa198"))) + (aqua-bg (if (eq variant 'dark) (if (true-color-p) "#293235" "#262626") (if (true-color-p) "#edf2e9" "#ffffff"))) + (green (if (eq variant 'dark) (if (true-color-p) "#67b11d" "#67b11d") (if (true-color-p) "#67b11d" "#5faf00"))) + (green-bg (if (eq variant 'dark) (if (true-color-p) "#293235" "#262626") (if (true-color-p) "#edf2e9" "#ffffff"))) + (green-bg-s (if (eq variant 'dark) (if (true-color-p) "#29422d" "#262626") (if (true-color-p) "#dae6d0" "#ffffff"))) + (cyan (if (eq variant 'dark) (if (true-color-p) "#28def0" "#00ffff") (if (true-color-p) "#21b8c7" "#008080"))) + (red (if (eq variant 'dark) (if (true-color-p) "#f2241f" "#d70000") (if (true-color-p) "#f2241f" "#d70008"))) + (red-bg (if (eq variant 'dark) (if (true-color-p) "#3c2a2c" "#262626") (if (true-color-p) "#faede4" "#ffffff"))) + (red-bg-s (if (eq variant 'dark) (if (true-color-p) "#512e31" "#262626") (if (true-color-p) "#eed9d2" "#ffffff"))) + (blue (if (eq variant 'dark) (if (true-color-p) "#4f97d7" "#268bd2") (if (true-color-p) "#3a81c3" "#268bd2"))) + (blue-bg (if (eq variant 'dark) (if (true-color-p) "#293239" "#262626") (if (true-color-p) "#edf1ed" "#d7d7ff"))) + (magenta (if (eq variant 'dark) (if (true-color-p) "#a31db1" "#af00df") (if (true-color-p) "#a31db1" "#800080"))) + (yellow (if (eq variant 'dark) (if (true-color-p) "#b1951d" "#875f00") (if (true-color-p) "#b1951d" "#875f00"))) + (yellow-bg (if (eq variant 'dark) (if (true-color-p) "#32322c" "#262626") (if (true-color-p) "#f6f1e1" "#ffffff"))) + ) + + custom-colors-override + + (custom-theme-set-faces + theme-name + +;;;;; basics + `(cursor ((,class (:background ,cursor)))) + `(custom-button ((,class :background ,bg2 :foreground ,base :box (:line-width 2 :style released-button)))) + `(default ((,class (:background ,bg1 :foreground ,base)))) + `(default-italic ((,class (:italic t)))) + `(error ((,class (:foreground ,err)))) + `(eval-sexp-fu-flash ((,class (:background ,suc :foreground ,bg1)))) + `(eval-sexp-fu-flash-error ((,class (:background ,err :foreground ,bg1)))) + `(font-lock-builtin-face ((,class (:foreground ,keyword)))) + `(font-lock-comment-face ((,class (:foreground ,comment :background ,(when spacemacs-theme-comment-bg comment-bg))))) + `(font-lock-constant-face ((,class (:foreground ,const)))) + `(font-lock-doc-face ((,class (:foreground ,comment)))) + `(font-lock-function-name-face ((,class (:foreground ,func :inherit bold)))) + `(font-lock-keyword-face ((,class (:inherit bold :foreground ,keyword)))) + `(font-lock-negation-char-face ((,class (:foreground ,const)))) + `(font-lock-preprocessor-face ((,class (:foreground ,func)))) + `(font-lock-reference-face ((,class (:foreground ,const)))) + `(font-lock-string-face ((,class (:foreground ,str)))) + `(font-lock-type-face ((,class (:foreground ,type :inherit bold)))) + `(font-lock-variable-name-face ((,class (:foreground ,var)))) + `(font-lock-warning-face ((,class (:foreground ,war :background ,bg1)))) + `(fringe ((,class (:background ,bg1 :foreground ,base)))) + `(header-line ((,class :background ,bg4))) + `(highlight ((,class (:foreground ,base :background ,highlight)))) + `(hl-line ((,class (:background ,bg2)))) + `(isearch ((,class (:foreground ,bg1 :background ,mat)))) + `(lazy-highlight ((,class (:background ,green-bg-s :weight normal)))) + `(link ((,class (:foreground ,comment :underline t)))) + `(link-visited ((,class (:foreground ,comp :underline t)))) + `(match ((,class (:background ,highlight :foreground ,mat)))) + `(minibuffer-prompt ((,class (:inherit bold :foreground ,keyword)))) + `(page-break-lines ((,class (:foreground ,act2)))) + `(region ((,class (:background ,highlight)))) + `(secondary-selection ((,class (:background ,bg3)))) + `(shadow ((,class (:foreground ,base-dim)))) + `(success ((,class (:foreground ,suc)))) + `(tooltip ((,class (:background ,ttip-sl :foreground ,base :bold nil :italic nil :underline nil)))) + `(vertical-border ((,class (:foreground ,border)))) + `(warning ((,class (:foreground ,war)))) + +;;;;; ahs + `(ahs-face ((,class (:background ,highlight)))) + `(ahs-plugin-whole-buffer-face ((,class (:background ,mat :foreground ,bg1)))) + +;;;;; anzu-mode + `(anzu-mode-line ((,class (:foreground ,yellow :inherit bold)))) + +;;;;; auto-complete + `(ac-completion-face ((,class (:background ,ttip-bg :foreground ,ttip)))) + +;;;;; avy + `(avy-lead-face ((,class (:background ,blue-bg :foreground ,magenta)))) + `(avy-lead-face-0 ((,class (:background ,blue-bg :foreground ,blue)))) + `(avy-lead-face-1 ((,class (:background ,blue-bg :foreground ,magenta)))) + `(avy-lead-face-2 ((,class (:background ,blue-bg :foreground ,blue)))) + +;;;;; cider + `(cider-enlightened ((,class (:background nil :box (:color ,yellow :line-width -1 :style nil) :foreground ,yellow)))) + `(cider-enlightened-local ((,class (:foreground ,yellow)))) + `(cider-instrumented-face ((,class (:background nil :box (:color ,red :line-width -1 :style nil) :foreground ,red)))) + `(cider-result-overlay-face ((,class (:background nil :box (:color ,blue :line-width -1 :style nil) :foreground ,blue)))) + `(cider-test-error-face ((,class (:background ,war :foreground ,bg1)))) + `(cider-test-failure-face ((,class (:background ,err :foreground ,bg1)))) + `(cider-test-success-face ((,class (:background ,suc :foreground ,bg1)))) + `(cider-traced-face ((,class :box (:color ,cyan :line-width -1 :style nil)))) + +;;;;; company + `(company-echo-common ((,class (:background ,base :foreground ,bg1)))) + `(company-preview ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(company-preview-common ((,class (:background ,ttip-bg :foreground ,base)))) + `(company-preview-search ((,class (:inherit match)))) + `(company-scrollbar-bg ((,class (:background ,bg2)))) + `(company-scrollbar-fg ((,class (:background ,act2)))) + `(company-template-field ((,class (:inherit region)))) + `(company-tooltip ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(company-tooltip-annotation ((,class (:foreground ,keyword)))) + `(company-tooltip-common ((,class (:background ,ttip-bg :foreground ,base)))) + `(company-tooltip-common-selection ((,class (:foreground ,base)))) + `(company-tooltip-mouse ((,class (:inherit highlight)))) + `(company-tooltip-search ((,class (:inherit match)))) + `(company-tooltip-selection ((,class (:background ,ttip-sl :foreground ,base)))) + +;;;;; diff + `(diff-added ((,class :background nil :foreground ,green))) + `(diff-changed ((,class :background nil :foreground ,keyword))) + `(diff-header ((,class :background ,cblk-ln-bg :foreground ,func))) + `(diff-file-header ((,class :background ,cblk-ln-bg :foreground ,cblk))) + `(diff-indicator-added ((,class :background nil :foreground ,green))) + `(diff-indicator-changed ((,class :background nil :foreground ,keyword))) + `(diff-indicator-removed ((,class :background nil :foreground ,red))) + `(diff-refine-added ((,class :background ,green :foreground ,bg4))) + `(diff-refine-changed ((,class :background ,keyword :foreground ,bg4))) + `(diff-refine-removed ((,class :background ,red :foreground ,bg4))) + `(diff-removed ((,class :background nil :foreground ,red))) + +;;;;; diff-hl + `(diff-hl-change ((,class :background ,blue-bg :foreground ,blue))) + `(diff-hl-delete ((,class :background ,red-bg :foreground ,red))) + `(diff-hl-insert ((,class :background ,green-bg :foreground ,green))) + +;;;;; dired + `(dired-directory ((,class (:foreground ,keyword :background ,bg1 :inherit bold)))) + `(dired-flagged ((,class (:foreground ,red)))) + `(dired-header ((,class (:foreground ,comp :inherit bold)))) + `(dired-ignored ((,class (:inherit shadow)))) + `(dired-mark ((,class (:foreground ,comp :inherit bold)))) + `(dired-marked ((,class (:foreground ,magenta :inherit bold)))) + `(dired-perm-write ((,class (:foreground ,base :underline t)))) + `(dired-symlink ((,class (:foreground ,cyan :background ,bg1 :inherit bold)))) + `(dired-warning ((,class (:foreground ,war)))) + +;;;;; ediff + `(ediff-current-diff-A ((,class(:background ,red-bg-s :foreground ,red)))) + `(ediff-current-diff-Ancestor ((,class(:background ,aqua-bg :foreground ,aqua)))) + `(ediff-current-diff-B ((,class(:background ,green-bg-s :foreground ,green)))) + `(ediff-current-diff-C ((,class(:background ,blue-bg :foreground ,blue)))) + `(ediff-even-diff-A ((,class(:background ,bg3)))) + `(ediff-even-diff-Ancestor ((,class(:background ,bg3)))) + `(ediff-even-diff-B ((,class(:background ,bg3)))) + `(ediff-even-diff-C ((,class(:background ,bg3)))) + `(ediff-fine-diff-A ((,class(:background nil :inherit bold)))) + `(ediff-fine-diff-Ancestor ((,class(:background nil :inherit bold)))) + `(ediff-fine-diff-B ((,class(:background nil :inherit bold)))) + `(ediff-fine-diff-C ((,class(:background nil :inherit bold)))) + `(ediff-odd-diff-A ((,class(:background ,bg4)))) + `(ediff-odd-diff-Ancestor ((,class(:background ,bg4)))) + `(ediff-odd-diff-B ((,class(:background ,bg4)))) + `(ediff-odd-diff-C ((,class(:background ,bg4)))) + +;;;;; ein + `(ein:cell-input-area((,class (:background ,bg2)))) + `(ein:cell-input-prompt ((,class (:foreground ,suc)))) + `(ein:cell-output-prompt ((,class (:foreground ,err)))) + `(ein:notification-tab-normal ((,class (:foreground ,keyword)))) + `(ein:notification-tab-selected ((,class (:foreground ,suc :inherit bold)))) + +;;;;; eldoc + `(eldoc-highlight-function-argument ((,class (:foreground ,mat :inherit bold)))) + +;;;;; elfeed + `(elfeed-search-date-face ((,class (:foreground ,head2)))) + `(elfeed-search-feed-face ((,class (:foreground ,blue)))) + `(elfeed-search-tag-face ((,class (:foreground ,func)))) + `(elfeed-search-title-face ((,class (:foreground ,base-dim)))) + `(elfeed-search-unread-title-face ((,class (:foreground ,base)))) + +;;;;; enh-ruby + `(enh-ruby-op-face ((,class (:background ,bg1 :foreground ,base)))) + `(enh-ruby-string-delimiter-face ((,class (:foreground ,str)))) + +;;;;; erc + `(erc-input-face ((,class (:foreground ,func)))) + `(erc-my-nick-face ((,class (:foreground ,keyword)))) + `(erc-nick-default-face ((,class (:foreground ,keyword)))) + `(erc-nick-prefix-face ((,class (:foreground ,yellow)))) + `(erc-notice-face ((,class (:foreground ,str)))) + `(erc-prompt-face ((,class (:foreground ,mat :inherit bold)))) + `(erc-timestamp-face ((,class (:foreground ,keyword)))) + +;;;;; eshell + `(eshell-ls-archive ((,class (:foreground ,red :inherit bold)))) + `(eshell-ls-backup ((,class (:inherit font-lock-comment-face)))) + `(eshell-ls-clutter ((,class (:inherit font-lock-comment-face)))) + `(eshell-ls-directory ((,class (:foreground ,keyword :inherit bold)))) + `(eshell-ls-executable ((,class (:foreground ,suc :inherit bold)))) + `(eshell-ls-missing ((,class (:inherit font-lock-warning-face)))) + `(eshell-ls-product ((,class (:inherit font-lock-doc-face)))) + `(eshell-ls-special ((,class (:foreground ,yellow :inherit bold)))) + `(eshell-ls-symlink ((,class (:foreground ,cyan :inherit bold)))) + `(eshell-ls-unreadable ((,class (:foreground ,base)))) + `(eshell-prompt ((,class (:foreground ,keyword :inherit bold)))) + +;;;;; evil + `(evil-ex-substitute-matches ((,class (:background ,red-bg :foreground ,red)))) + `(evil-ex-substitute-replacement ((,class (:background ,green-bg :foreground ,green)))) + +;;;;; flycheck + `(flycheck-error + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,err))) + (,class (:foreground ,base :background ,err :inherit bold :underline t)))) + `(flycheck-error-list-checker-name ((,class (:foreground ,keyword)))) + `(flycheck-fringe-error ((,class (:foreground ,err :inherit bold)))) + `(flycheck-fringe-info ((,class (:foreground ,keyword :inherit bold)))) + `(flycheck-fringe-warning ((,class (:foreground ,war :inherit bold)))) + `(flycheck-info + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,keyword))) + (,class (:foreground ,base :background ,keyword :inherit bold :underline t)))) + `(flycheck-warning + ((,(append '((supports :underline (:style line))) class) + (:underline (:style line :color ,war))) + (,class (:foreground ,base :background ,war :inherit bold :underline t)))) + +;;;;; jabber + `(jabber-activity-face ((,class (:inherit bold :foreground ,red)))) + `(jabber-activity-personal-face ((,class (:inherit bold :foreground ,blue)))) + `(jabber-chat-error ((,class (:inherit bold :foreground ,red)))) + `(jabber-chat-prompt-foreign ((,class (:inherit bold :foreground ,red)))) + `(jabber-chat-prompt-local ((,class (:inherit bold :foreground ,blue)))) + `(jabber-chat-prompt-system ((,class (:inherit bold :foreground ,green)))) + `(jabber-chat-text-foreign ((,class (:foreground ,base)))) + `(jabber-chat-text-local ((,class (:foreground ,base)))) + `(jabber-rare-time-face ((,class (:foreground ,green)))) + `(jabber-roster-user-away ((,class (:foreground ,yellow)))) + `(jabber-roster-user-chatty ((,class (:inherit bold :foreground ,green)))) + `(jabber-roster-user-dnd ((,class (:foreground ,red)))) + `(jabber-roster-user-error ((,class (:foreground ,err)))) + `(jabber-roster-user-offline ((,class (:foreground ,base)))) + `(jabber-roster-user-online ((,class (:inherit bold :foreground ,green)))) + `(jabber-roster-user-xa ((,class (:foreground ,aqua)))) + +;;;;; git-gutter-fr + `(git-gutter-fr:added ((,class (:foreground ,green :inherit bold)))) + `(git-gutter-fr:deleted ((,class (:foreground ,war :inherit bold)))) + `(git-gutter-fr:modified ((,class (:foreground ,keyword :inherit bold)))) + +;;;;; git-timemachine + `(git-timemachine-minibuffer-detail-face ((,class (:foreground ,blue :inherit bold :background ,blue-bg)))) + +;;;;; gnus + `(gnus-emphasis-highlight-words ((,class (:background ,suc :foreground ,bg1)))) + `(gnus-header-content ((,class (:foreground ,keyword)))) + `(gnus-header-from ((,class (:foreground ,var)))) + `(gnus-header-name ((,class (:foreground ,comp)))) + `(gnus-header-subject ((,class (:foreground ,func :inherit bold)))) + `(gnus-summary-cancelled ((,class (:background ,war :foreground ,bg1)))) + +;;;;; guide-key + `(guide-key/highlight-command-face ((,class (:foreground ,base)))) + `(guide-key/key-face ((,class (:foreground ,keyword)))) + `(guide-key/prefix-command-face ((,class (:foreground ,keyword :inherit bold)))) + +;;;;; helm + `(helm-bookmark-directory ((,class (:inherit helm-ff-directory)))) + `(helm-bookmark-file ((,class (:foreground ,base)))) + `(helm-bookmark-gnus ((,class (:foreground ,comp)))) + `(helm-bookmark-info ((,class (:foreground ,comp)))) + `(helm-bookmark-man ((,class (:foreground ,comp)))) + `(helm-bookmark-w3m ((,class (:foreground ,comp)))) + `(helm-buffer-directory ((,class (:foreground ,base :background ,bg1)))) + `(helm-buffer-file ((,class (:foreground ,base :background ,bg1)))) + `(helm-buffer-not-saved ((,class (:foreground ,comp :background ,bg1)))) + `(helm-buffer-process ((,class (:foreground ,keyword :background ,bg1)))) + `(helm-buffer-saved-out ((,class (:foreground ,base :background ,bg1)))) + `(helm-buffer-size ((,class (:foreground ,base :background ,bg1)))) + `(helm-candidate-number ((,class (:background ,bg1 :foreground ,keyword :inherit bold)))) + `(helm-ff-directory ((,class (:foreground ,keyword :background ,bg1 :inherit bold)))) + `(helm-ff-dotted-directory ((,class (:foreground ,keyword :background ,bg1 :inherit bold)))) + `(helm-ff-dotted-symlink-directory ((,class (:foreground ,cyan :background ,bg1 :inherit bold)))) + `(helm-ff-executable ((,class (:foreground ,suc :background ,bg1 :weight normal)))) + `(helm-ff-file ((,class (:foreground ,base :background ,bg1 :weight normal)))) + `(helm-ff-invalid-symlink ((,class (:foreground ,red :background ,bg1 :inherit bold)))) + `(helm-ff-prefix ((,class (:foreground ,bg1 :background ,keyword :weight normal)))) + `(helm-ff-symlink ((,class (:foreground ,cyan :background ,bg1 :inherit bold)))) + `(helm-grep-cmd-line ((,class (:foreground ,base :background ,bg1)))) + `(helm-grep-file ((,class (:foreground ,base :background ,bg1)))) + `(helm-grep-finish ((,class (:foreground ,base :background ,bg1)))) + `(helm-grep-lineno ((,class (:foreground ,type :background ,bg1 :inherit bold)))) + `(helm-grep-match ((,class (:foreground nil :background nil :inherit helm-match)))) + `(helm-header ((,class (:foreground ,base :background ,bg1 :underline nil :box nil)))) + `(helm-header-line-left-margin ((,class (:foreground ,keyword :background ,nil)))) + `(helm-match ((,class (:background ,head1-bg :foreground ,head1)))) + `(helm-match-item ((,class (:background ,head1-bg :foreground ,head1)))) + `(helm-moccur-buffer ((,class (:foreground ,var :background ,bg1)))) + `(helm-selection ((,class (:background ,highlight)))) + `(helm-selection-line ((,class (:background ,bg2)))) + `(helm-separator ((,class (:foreground ,comp :background ,bg1)))) + `(helm-source-header ((,class (:background ,comp :foreground ,bg1 :inherit bold)))) + `(helm-time-zone-current ((,class (:foreground ,keyword :background ,bg1)))) + `(helm-time-zone-home ((,class (:foreground ,comp :background ,bg1)))) + `(helm-visible-mark ((,class (:foreground ,keyword :background ,bg3)))) + +;;;;; helm-swoop + `(helm-swoop-target-line-block-face ((,class (:foreground ,base :background ,highlight)))) + `(helm-swoop-target-line-face ((,class (:background ,highlight)))) + `(helm-swoop-target-word-face ((,class (:background ,highlight :foreground ,mat)))) + +;;;;; highlights + `(hi-green ((,class (:foreground ,green :background ,green-bg)))) + `(hi-yellow ((,class (:foreground ,yellow :background ,yellow-bg)))) + +;;;;; highlight-indentation + `(highlight-indentation-face ((,class (:background ,comment-bg)))) + +;;;;; highlight-symbol + `(highlight-symbol-face ((,class (:background ,bg2)))) + +;;;;; hydra + `(hydra-face-blue ((,class (:foreground ,blue)))) + `(hydra-face-red ((,class (:foreground ,red)))) + +;;;;; ido + `(ido-first-match ((,class (:foreground ,comp :inherit bold)))) + `(ido-only-match ((,class (:foreground ,mat :inherit bold)))) + `(ido-subdir ((,class (:foreground ,keyword)))) + `(ido-vertical-match-face ((,class (:foreground ,comp :underline nil)))) + +;;;;; info + `(info-header-xref ((,class (:foreground ,func :underline t)))) + `(info-menu ((,class (:foreground ,suc)))) + `(info-node ((,class (:foreground ,func :inherit bold)))) + `(info-quoted-name ((,class (:foreground ,keyword)))) + `(info-reference-item ((,class (:background nil :underline t :inherit bold)))) + `(info-string ((,class (:foreground ,str)))) + `(info-title-1 ((,class (:height 1.4 :inherit bold)))) + `(info-title-2 ((,class (:height 1.3 :inherit bold)))) + `(info-title-3 ((,class (:height 1.3)))) + `(info-title-4 ((,class (:height 1.2)))) + +;;;;; ivy + `(ivy-current-match ((,class (:background ,highlight :inherit bold)))) + `(ivy-minibuffer-match-face-1 ((,class (:inherit bold)))) + `(ivy-minibuffer-match-face-2 ((,class (:foreground ,head1 :underline t)))) + `(ivy-minibuffer-match-face-3 ((,class (:foreground ,head4 :underline t)))) + `(ivy-minibuffer-match-face-4 ((,class (:foreground ,head3 :underline t)))) + `(ivy-remote ((,class (:foreground ,cyan)))) + +;;;;; latex + `(font-latex-bold-face ((,class (:foreground ,comp)))) + `(font-latex-italic-face ((,class (:foreground ,keyword :italic t)))) + `(font-latex-match-reference-keywords ((,class (:foreground ,const)))) + `(font-latex-match-variable-keywords ((,class (:foreground ,var)))) + `(font-latex-sectioning-0-face ((,class (:inherit bold :foreground ,head3 :height ,(if spacemacs-theme-org-height 1.3 1.0) :background ,(when spacemacs-theme-org-highlight head3-bg))))) + `(font-latex-sectioning-1-face ((,class (:inherit bold :foreground ,head4 :height ,(if spacemacs-theme-org-height 1.3 1.0) :background ,(when spacemacs-theme-org-highlight head4-bg))))) + `(font-latex-sectioning-2-face ((,class (:inherit bold :foreground ,head1 :height ,(if spacemacs-theme-org-height 1.3 1.0) :background ,(when spacemacs-theme-org-highlight head1-bg))))) + `(font-latex-sectioning-3-face ((,class (:inherit bold :foreground ,head2 :height ,(if spacemacs-theme-org-height 1.2 1.0) :background ,(when spacemacs-theme-org-highlight head2-bg))))) + `(font-latex-sectioning-4-face ((,class (:bold nil :foreground ,head3 :height ,(if spacemacs-theme-org-height 1.1 1.0) :background ,(when spacemacs-theme-org-highlight head3-bg))))) + `(font-latex-sectioning-5-face ((,class (:bold nil :foreground ,head4 :background ,(when spacemacs-theme-org-highlight head4-bg))))) + `(font-latex-string-face ((,class (:foreground ,str)))) + `(font-latex-warning-face ((,class (:foreground ,war)))) + +;;;;; linum-mode + `(linum ((,class (:foreground ,lnum :background ,bg2)))) + +;;;;; linum-relative + `(linum-relative-current-face ((,class (:foreground ,comp)))) + +;;;;; magit + `(magit-blame-culprit ((,class :background ,yellow-bg :foreground ,yellow))) + `(magit-blame-date ((,class :background ,yellow-bg :foreground ,green))) + `(magit-blame-hash ((,class :background ,yellow-bg :foreground ,func))) + `(magit-blame-header ((,class :background ,yellow-bg :foreground ,green))) + `(magit-blame-heading ((,class :background ,yellow-bg :foreground ,green))) + `(magit-blame-name ((,class :background ,yellow-bg :foreground ,yellow))) + `(magit-blame-sha1 ((,class :background ,yellow-bg :foreground ,func))) + `(magit-blame-subject ((,class :background ,yellow-bg :foreground ,yellow))) + `(magit-blame-summary ((,class :background ,yellow-bg :foreground ,yellow))) + `(magit-blame-time ((,class :background ,yellow-bg :foreground ,green))) + `(magit-branch ((,class (:foreground ,const :inherit bold)))) + `(magit-branch-current ((,class (:background ,blue-bg :foreground ,blue :inherit bold :box t)))) + `(magit-branch-local ((,class (:background ,blue-bg :foreground ,blue :inherit bold)))) + `(magit-branch-remote ((,class (:background ,aqua-bg :foreground ,aqua :inherit bold)))) + `(magit-diff-context-highlight ((,class (:background ,bg2 :foreground ,base)))) + `(magit-diff-file-header ((,class (:background ,comment-bg :foreground ,comment)))) + `(magit-diff-file-heading ((,class (:background ,comment-bg :foreground ,comment)))) + `(magit-diff-file-heading-highlight ((,class (:background ,comment-bg :foreground ,comment)))) + `(magit-diff-hunk-header ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(magit-diff-hunk-heading ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(magit-diff-hunk-heading-highlight ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(magit-hash ((,class (:foreground ,var)))) + `(magit-hunk-heading ((,class (:background ,bg3)))) + `(magit-hunk-heading-highlight ((,class (:background ,bg3)))) + `(magit-item-highlight ((,class :background ,bg2))) + `(magit-log-author ((,class (:foreground ,func)))) + `(magit-log-head-label-head ((,class (:background ,yellow :foreground ,bg1 :inherit bold)))) + `(magit-log-head-label-local ((,class (:background ,keyword :foreground ,bg1 :inherit bold)))) + `(magit-log-head-label-remote ((,class (:background ,suc :foreground ,bg1 :inherit bold)))) + `(magit-log-head-label-tags ((,class (:background ,magenta :foreground ,bg1 :inherit bold)))) + `(magit-log-head-label-wip ((,class (:background ,cyan :foreground ,bg1 :inherit bold)))) + `(magit-log-sha1 ((,class (:foreground ,str)))) + `(magit-process-ng ((,class (:foreground ,war :inherit bold)))) + `(magit-process-ok ((,class (:foreground ,func :inherit bold)))) + `(magit-reflog-amend ((,class (:foreground ,magenta)))) + `(magit-reflog-checkout ((,class (:foreground ,blue)))) + `(magit-reflog-cherry-pick ((,class (:foreground ,green)))) + `(magit-reflog-commit ((,class (:foreground ,green)))) + `(magit-reflog-merge ((,class (:foreground ,green)))) + `(magit-reflog-other ((,class (:foreground ,cyan)))) + `(magit-reflog-rebase ((,class (:foreground ,magenta)))) + `(magit-reflog-remote ((,class (:foreground ,cyan)))) + `(magit-reflog-reset ((,class (:foreground ,red)))) + `(magit-section-heading ((,class (:foreground ,keyword :inherit bold)))) + `(magit-section-highlight ((,class (:background ,bg2)))) + `(magit-section-title ((,class (:background ,bg1 :foreground ,keyword :inherit bold)))) + +;;;;; man + `(Man-overstrike ((,class (:foreground ,head1 :inherit bold)))) + `(Man-reverse ((,class (:foreground ,highlight)))) + `(Man-underline ((,class (:foreground ,comp :underline t)))) + +;;;;; markdown + `(markdown-header-face-1 ((,class (:inherit bold :foreground ,head1 :height ,(if spacemacs-theme-org-height 1.3 1.0) :background ,(when spacemacs-theme-org-highlight head1-bg))))) + `(markdown-header-face-2 ((,class (:inherit bold :foreground ,head2 :height ,(if spacemacs-theme-org-height 1.2 1.0) :background ,(when spacemacs-theme-org-highlight head2-bg))))) + `(markdown-header-face-3 ((,class (:bold nil :foreground ,head3 :height ,(if spacemacs-theme-org-height 1.1 1.0) :background ,(when spacemacs-theme-org-highlight head3-bg))))) + `(markdown-header-face-4 ((,class (:bold nil :foreground ,head4 :background ,(when spacemacs-theme-org-highlight head4-bg))))) + `(markdown-header-face-5 ((,class (:bold nil :foreground ,head1)))) + `(markdown-header-face-6 ((,class (:bold nil :foreground ,head2)))) + +;;;;; mode-line + `(mode-line ((,class (:foreground ,base :background ,act1 :box (:color ,border :line-width 1))))) + `(mode-line-buffer-id ((,class (:inherit bold :foreground ,func)))) + `(mode-line-inactive ((,class (:foreground ,base :background ,bg1 :box (:color ,border :line-width 1))))) + +;;;;; mu4e + `(mu4e-cited-1-face ((,class (:foreground ,base)))) + `(mu4e-cited-7-face ((,class (:foreground ,base)))) + `(mu4e-header-key-face ((,class (:foreground ,head2 :inherit bold)))) + `(mu4e-header-marks-face ((,class (:foreground ,comp)))) + `(mu4e-unread-face ((,class (:foreground ,yellow :inherit bold)))) + `(mu4e-view-url-number-face ((,class (:foreground ,comp)))) + +;;;;; notmuch + `(notmuch-search-date ((,class (:foreground ,func)))) + `(notmuch-search-flagged-face ((,class (:weight extra-bold)))) + `(notmuch-search-non-matching-authors ((,class (:foreground ,base-dim)))) + `(notmuch-search-unread-face ((,class (:background ,highlight-dim :box ,border)))) + `(notmuch-tag-face ((,class (:foreground ,keyword)))) + `(notmuch-tag-flagged ((,class (:foreground ,war)))) + +;;;;; neotree + `(neo-dir-link-face ((,class (:foreground ,keyword :inherit bold)))) + `(neo-expand-btn-face ((,class (:foreground ,base)))) + `(neo-file-link-face ((,class (:foreground ,base)))) + `(neo-root-dir-face ((,class (:foreground ,func :inherit bold)))) + +;;;;; org + `(org-agenda-clocking ((,class (:background ,highlight :foreground ,comp)))) + `(org-agenda-date ((,class (:foreground ,var :height ,(if spacemacs-theme-org-agenda-height 1.1 1.0))))) + `(org-agenda-date-today ((,class (:foreground ,keyword :inherit bold :height ,(if spacemacs-theme-org-agenda-height 1.3 1.0))))) + `(org-agenda-date-weekend ((,class (:inherit bold :foreground ,var)))) + `(org-agenda-done ((,class (:foreground ,suc :height ,(if spacemacs-theme-org-agenda-height 1.2 1.0))))) + `(org-agenda-structure ((,class (:inherit bold :foreground ,comp)))) + `(org-block ((,class (:background ,cblk-bg :foreground ,cblk)))) + `(org-block-begin-line ((,class (:background ,cblk-ln-bg :foreground ,cblk-ln)))) + `(org-block-end-line ((,class (:background ,cblk-ln-bg :foreground ,cblk-ln)))) + `(org-clock-overlay ((,class (:foreground ,comp)))) + `(org-code ((,class (:foreground ,cyan)))) + `(org-column ((,class (:background ,highlight)))) + `(org-column-title ((,class (:background ,highlight)))) + `(org-date ((,class (:underline t :foreground ,var)))) + `(org-date-selected ((,class (:background ,func :foreground ,bg1)))) + `(org-document-info-keyword ((,class (:foreground ,meta)))) + `(org-document-title ((,class (:foreground ,func :inherit bold :height ,(if spacemacs-theme-org-height 1.4 1.0) :underline t)))) + `(org-done ((,class (:foreground ,suc :inherit bold :background ,green-bg)))) + `(org-ellipsis ((,class (:foreground ,keyword)))) + `(org-footnote ((,class (:underline t :foreground ,base)))) + `(org-hide ((,class (:foreground ,base)))) + `(org-kbd ((,class (:inherit region :foreground ,base :box (:line-width 1 :style released-button))))) + `(org-level-1 ((,class (:inherit bold :foreground ,head1 :height ,(if spacemacs-theme-org-height 1.3 1.0) :background ,(when spacemacs-theme-org-highlight head1-bg))))) + `(org-level-2 ((,class (:inherit bold :foreground ,head2 :height ,(if spacemacs-theme-org-height 1.2 1.0) :background ,(when spacemacs-theme-org-highlight head2-bg))))) + `(org-level-3 ((,class (:bold nil :foreground ,head3 :height ,(if spacemacs-theme-org-height 1.1 1.0) :background ,(when spacemacs-theme-org-highlight head3-bg))))) + `(org-level-4 ((,class (:bold nil :foreground ,head4 :background ,(when spacemacs-theme-org-highlight head4-bg))))) + `(org-level-5 ((,class (:bold nil :foreground ,head1)))) + `(org-level-6 ((,class (:bold nil :foreground ,head2)))) + `(org-level-7 ((,class (:bold nil :foreground ,head3)))) + `(org-level-8 ((,class (:bold nil :foreground ,head4)))) + `(org-link ((,class (:underline t :foreground ,comment)))) + `(org-meta-line ((,class (:foreground ,meta)))) + `(org-mode-line-clock-overrun ((,class (:foreground ,err)))) + `(org-priority ((,class (:foreground ,war :inherit bold)))) + `(org-quote ((,class (:inherit org-block :slant italic)))) + `(org-scheduled ((,class (:foreground ,comp)))) + `(org-scheduled-today ((,class (:foreground ,func :height ,(if spacemacs-theme-org-agenda-height 1.2 1.0))))) + `(org-sexp-date ((,class (:foreground ,base)))) + `(org-special-keyword ((,class (:foreground ,func)))) + `(org-table ((,class (:foreground ,base :background ,head1-bg)))) + `(org-time-grid ((,class (:foreground ,str)))) + `(org-todo ((,class (:foreground ,war :inherit bold :background ,yellow-bg)))) + `(org-verbatim ((,class (:foreground ,keyword)))) + `(org-verse ((,class (:inherit org-block :slant italic)))) + `(org-warning ((,class (:foreground ,err)))) + +;;;;; perspective + `(persp-selected-face ((,class (:inherit bold :foreground ,func)))) + +;;;;; popup + `(popup-enu-selection-face ((,class (:background ,ttip-sl :foreground ,base)))) + `(popup-face ((,class (:background ,ttip-bg :foreground ,ttip)))) + `(popup-isearch-match ((,class (:inherit match)))) + `(popup-menu-face ((,class (:background ,ttip-bg :foreground ,base)))) + `(popup-menu-mouse-face ((,class (:inherit highlight)))) + `(popup-scroll-bar-background-face ((,class (:background ,bg2)))) + `(popup-scroll-bar-foreground-face ((,class (:background ,act2)))) + `(popup-tip-face ((,class (:background ,ttip-sl :foreground ,base :bold nil :italic nil :underline nil)))) + +;;;;; powerline + `(powerline-active1 ((,class (:background ,act2 :foreground ,base)))) + `(powerline-active2 ((,class (:background ,act2 :foreground ,base)))) + `(powerline-inactive1 ((,class (:background ,bg2 :foreground ,base)))) + `(powerline-inactive2 ((,class (:background ,bg2 :foreground ,base)))) + +;;;;; rainbow-delimiters + `(rainbow-delimiters-depth-1-face ((,class :foreground ,keyword))) + `(rainbow-delimiters-depth-2-face ((,class :foreground ,func))) + `(rainbow-delimiters-depth-3-face ((,class :foreground ,str))) + `(rainbow-delimiters-depth-4-face ((,class :foreground ,green))) + `(rainbow-delimiters-depth-5-face ((,class :foreground ,yellow))) + `(rainbow-delimiters-depth-6-face ((,class :foreground ,keyword))) + `(rainbow-delimiters-depth-7-face ((,class :foreground ,func))) + `(rainbow-delimiters-depth-8-face ((,class :foreground ,str))) + `(rainbow-delimiters-mismatched-face ((,class :foreground ,err :overline t))) + `(rainbow-delimiters-unmatched-face ((,class :foreground ,err :overline t))) + +;;;;; rcirc + `(rcirc-bright-nick ((,class (:background ,aqua-bg :foreground ,cyan)))) + `(rcirc-dim-nick ((,class (:foreground ,base-dim)))) + `(rcirc-keyword ((,class (:background ,green-bg-s :foreground ,green)))) + `(rcirc-timestamp ((,class (:foreground ,keyword)))) + `(rcirc-track-keyword ((,class (:background ,green :foreground ,bg1)))) + `(rcirc-url ((,class (:inherit link)))) + +;;;;; shm + `(shm-current-face ((,class (:background ,green-bg-s)))) + `(shm-quarantine-face ((,class (:background ,red-bg-s)))) + +;;;;; show-paren + `(show-paren-match ((,class (:background ,green-bg-s)))) + `(show-paren-mismatch ((,class (:background ,red-bg-s)))) + +;;;;; smartparens + `(sp-pair-overlay-face ((,class (:background ,highlight :foreground nil)))) + `(sp-show-pair-match-face ((,class (:foreground ,mat :inherit bold :underline t)))) + +;;;;; spaceline + `(spaceline-flycheck-error ((,class (:foreground ,err)))) + `(spaceline-flycheck-info ((,class (:foreground ,keyword)))) + `(spaceline-flycheck-warning((,class (:foreground ,war)))) + `(spaceline-python-venv ((,class (:foreground ,comp)))) + +;;;;; spacemacs-specific + `(spacemacs-transient-state-title-face ((,class (:background nil :foreground ,comp :box nil :inherit bold)))) + +;;;;; swiper + `(swiper-line-face ((,class (:background ,highlight :inherit bold)))) + `(swiper-match-face-1 ((,class (:inherit bold)))) + `(swiper-match-face-2 ((,class (:foreground ,head1 :underline t)))) + `(swiper-match-face-3 ((,class (:foreground ,head4 :underline t)))) + `(swiper-match-face-4 ((,class (:foreground ,head3 :underline t)))) + +;;;;; tabbar + `(tabbar-button ((,class (:inherit tabbar-default )))) + `(tabbar-button-highlight ((,class (:inherit tabbar-default)))) + `(tabbar-default ((,class (:background ,bg1 :foreground ,head1 :height 0.9)))) + `(tabbar-highlight ((,class (:underline t)))) + `(tabbar-selected ((,class (:inherit tabbar-default :foreground ,func :weight bold)))) + `(tabbar-separator ((,class (:inherit tabbar-default)))) + `(tabbar-unselected ((,class (:inherit tabbar-default :background ,bg1 :slant italic :weight light)))) + +;;;;; term + `(term ((,class (:foreground ,base :background ,bg1)))) + `(term-color-black ((,class (:foreground ,bg4)))) + `(term-color-blue ((,class (:foreground ,keyword)))) + `(term-color-cyan ((,class (:foreground ,cyan)))) + `(term-color-green ((,class (:foreground ,green)))) + `(term-color-magenta ((,class (:foreground ,magenta)))) + `(term-color-red ((,class (:foreground ,red)))) + `(term-color-white ((,class (:foreground ,base)))) + `(term-color-yellow ((,class (:foreground ,yellow)))) + +;;;;; web-mode + `(web-mode-builtin-face ((,class (:inherit ,font-lock-builtin-face)))) + `(web-mode-comment-face ((,class (:inherit ,font-lock-comment-face)))) + `(web-mode-constant-face ((,class (:inherit ,font-lock-constant-face)))) + `(web-mode-doctype-face ((,class (:inherit ,font-lock-comment-face)))) + `(web-mode-function-name-face ((,class (:inherit ,font-lock-function-name-face)))) + `(web-mode-html-attr-name-face ((,class (:foreground ,func)))) + `(web-mode-html-attr-value-face ((,class (:foreground ,keyword)))) + `(web-mode-html-tag-face ((,class (:foreground ,keyword)))) + `(web-mode-keyword-face ((,class (:foreground ,keyword)))) + `(web-mode-string-face ((,class (:foreground ,str)))) + `(web-mode-symbol-face ((,class (:foreground ,type)))) + `(web-mode-type-face ((,class (:inherit ,font-lock-type-face)))) + `(web-mode-warning-face ((,class (:inherit ,font-lock-warning-face)))) + +;;;;; which-key + `(which-key-command-description-face ((,class (:foreground ,base)))) + `(which-key-group-description-face ((,class (:foreground ,keyword)))) + `(which-key-key-face ((,class (:foreground ,func :inherit bold)))) + `(which-key-separator-face ((,class (:background nil :foreground ,str)))) + `(which-key-special-key-face ((,class (:background ,func :foreground ,bg1)))) + +;;;;; which-function-mode + `(which-func ((,class (:foreground ,func)))) + +;;;;; whitespace-mode + `(whitespace-empty ((,class (:background nil :foreground ,yellow)))) + `(whitespace-indentation ((,class (:background nil :foreground ,war)))) + `(whitespace-line ((,class (:background nil :foreground ,comp)))) + `(whitespace-newline ((,class (:background nil :foreground ,comp)))) + `(whitespace-space ((,class (:background nil :foreground ,act2)))) + `(whitespace-space-after-tab ((,class (:background nil :foreground ,yellow)))) + `(whitespace-space-before-tab ((,class (:background nil :foreground ,yellow)))) + `(whitespace-tab ((,class (:background nil)))) + `(whitespace-trailing ((,class (:background ,err :foreground ,war)))) + +;;;;; other, need more work + `(ac-completion-face ((,class (:underline t :foreground ,keyword)))) + `(ffap ((,class (:foreground ,base)))) + `(flx-highlight-face ((,class (:foreground ,comp :underline nil)))) + `(icompletep-determined ((,class :foreground ,keyword))) + `(js2-external-variable ((,class (:foreground ,comp)))) + `(js2-function-param ((,class (:foreground ,const)))) + `(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,str)))) + `(js2-jsdoc-html-tag-name ((,class (:foreground ,keyword)))) + `(js2-jsdoc-value ((,class (:foreground ,str)))) + `(js2-private-function-call ((,class (:foreground ,const)))) + `(js2-private-member ((,class (:foreground ,base)))) + `(js3-error-face ((,class (:underline ,war)))) + `(js3-external-variable-face ((,class (:foreground ,var)))) + `(js3-function-param-face ((,class (:foreground ,keyword)))) + `(js3-instance-member-face ((,class (:foreground ,const)))) + `(js3-jsdoc-tag-face ((,class (:foreground ,keyword)))) + `(js3-warning-face ((,class (:underline ,keyword)))) + `(slime-repl-inputed-output-face ((,class (:foreground ,comp)))) + `(trailing-whitespace ((,class :foreground nil :background ,err))) + `(undo-tree-visualizer-current-face ((,class :foreground ,keyword))) + `(undo-tree-visualizer-default-face ((,class :foreground ,base))) + `(undo-tree-visualizer-register-face ((,class :foreground ,comp))) + `(undo-tree-visualizer-unmodified-face ((,class :foreground ,var)))) + + (custom-theme-set-variables + theme-name + `(ansi-color-names-vector [,bg4 ,red ,green ,yellow ,blue ,magenta ,cyan ,base])) + + )) + + +;;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide 'spacemacs-common) + +;; Local Variables: +;; no-byte-compile: t +;; End: + +;;; spacemacs-common.el ends here diff --git a/core/libs/spacemacs-theme/spacemacs-dark-theme.el b/core/libs/spacemacs-theme/spacemacs-dark-theme.el new file mode 100644 index 0000000..7b5e33f --- /dev/null +++ b/core/libs/spacemacs-theme/spacemacs-dark-theme.el @@ -0,0 +1,7 @@ +(require 'spacemacs-common) + +(deftheme spacemacs-dark "Spacemacs theme, the dark version") + +(create-spacemacs-theme 'dark 'spacemacs-dark) + +(provide-theme 'spacemacs-dark) diff --git a/core/libs/spacemacs-theme/spacemacs-light-theme.el b/core/libs/spacemacs-theme/spacemacs-light-theme.el new file mode 100644 index 0000000..4b68588 --- /dev/null +++ b/core/libs/spacemacs-theme/spacemacs-light-theme.el @@ -0,0 +1,7 @@ +(require 'spacemacs-common) + +(deftheme spacemacs-light "Spacemacs theme, the light version") + +(create-spacemacs-theme 'light 'spacemacs-light) + +(provide-theme 'spacemacs-light) diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 76d942e..f0cd71a 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -246,8 +246,18 @@ values." ;; 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. + ;; Control line numbers activation. + ;; If set to `t' or `relative' line numbers are turned on in all `prog-mode' and + ;; `text-mode' derivatives. If set to `relative', line numbers are relative. + ;; This variable can also be set to a property list for finer control: + ;; '(:relative nil + ;; :disabled-for-modes dired-mode + ;; doc-view-mode + ;; markdown-mode + ;; org-mode + ;; pdf-view-mode + ;; text-mode + ;; :size-limit-kb 1000) ;; (default nil) dotspacemacs-line-numbers nil ;; Code folding method. Possible values are `evil' and `origami'. diff --git a/core/templates/packages.el.template b/core/templates/packages.el.template index af6bce2..f5aef9d 100644 --- a/core/templates/packages.el.template +++ b/core/templates/packages.el.template @@ -1,6 +1,6 @@ ;;; packages.el --- %LAYER_NAME% layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: %USER_FULL_NAME% <%USER_MAIL_ADDRESS%> ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/core/tools/spacefmt/spacefmt.el b/core/tools/spacefmt/spacefmt.el index cb3ea0a..5c43237 100644 --- a/core/tools/spacefmt/spacefmt.el +++ b/core/tools/spacefmt/spacefmt.el @@ -1,6 +1,6 @@ ;;; fmt.el --- .org file formatter. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -72,7 +72,7 @@ (while (re-search-backward org-heading-regexp nil t)) (open-line 3) (forward-line 1) - (insert-string toc-headline))) + (insert toc-headline))) (defun remove-empty-lines-after-headlines() "Remove empty liners after each headline." diff --git a/core/tools/spacefmt/tests/config.el b/core/tools/spacefmt/tests/config.el index 4bc681b..782a4ca 100644 --- a/core/tools/spacefmt/tests/config.el +++ b/core/tools/spacefmt/tests/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- test layer configuration file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; This file is not part of GNU Emacs. ;; diff --git a/doc/BEGINNERS_TUTORIAL.org b/doc/BEGINNERS_TUTORIAL.org new file mode 100644 index 0000000..26d9139 --- /dev/null +++ b/doc/BEGINNERS_TUTORIAL.org @@ -0,0 +1,330 @@ +#+TITLE: Beginners tutorial + +* Beginners tutorial :TOC_4_gh:noexport: + - [[#why-spacemacs][Why Spacemacs?]] + - [[#install][Install]] + - [[#1-install-emacs][1. Install Emacs]] + - [[#2-install-git][2. Install Git]] + - [[#3-install-spacemacs][3. Install Spacemacs]] + - [[#note-for-windows-users][Note for Windows users]] + - [[#4-install-the-default-font][4. Install the default font]] + - [[#5-open-spacemacs-and-choose-default-editing-style][5. Open Spacemacs and choose default editing style]] + - [[#getting-started][Getting started]] + - [[#keybinding-notation][Keybinding notation]] + - [[#modal-text-editing---why-and-how][Modal text editing - why and how?]] + - [[#start-the-vim-tutorial][Start the Vim tutorial]] + - [[#using-the-spacebar-to-launch-commands][Using the spacebar to launch commands]] + - [[#buffers-windows-and-frames][Buffers, windows and frames]] + - [[#accessing-files][Accessing files]] + - [[#configuring-spacemacs][Configuring Spacemacs]] + - [[#adding-language-support-and-other-features-using-layers][Adding language support and other features: using layers]] + - [[#changing-the-colour-theme][Changing the colour theme]] + - [[#starting-maximized][Starting maximized]] + - [[#quitting][Quitting]] + - [[#additional-features-tips-and-troubleshooting][Additional features, tips and troubleshooting]] + - [[#org-mode][Org mode]] + - [[#version-control---the-intelligent-way][Version control - the intelligent way]] + - [[#daemon-mode-and-instant-startup-linux][Daemon mode and instant startup (Linux)]] + - [[#swap-caps-lock-and-esc-keys-on-your-keyboard][Swap caps lock and esc keys on your keyboard]] + - [[#troubleshooting-and-further-info][Troubleshooting and further info]] + +* Why Spacemacs? +- Unparallelled text and structure editing for all types of writing tasks: + creative writing, blogging, note-taking, todo-lists, scientific papers... +- Powerful modes for programming in dozens of programming languages +- Deeply customizable yet beginner-friendly + +* Install + Spacemacs is a beginner-friendly and powerful extension of a popular text + editor called Emacs. To install Spacemacs you need to first install base Emacs + and then download the Spacemacs extension files, which is most easily done by + using a program called Git. The steps are easy and outlined below. + +** 1. [[https://github.com/syl20bnr/spacemacs#prerequisites][Install Emacs]] + +** 2. [[https://git-scm.com/downloads][Install Git]] + +** 3. Install Spacemacs +Open a terminal or command prompt, paste the following code to it: + +#+BEGIN_SRC sh +git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d +#+END_SRC + +Press enter to execute the code and the program you installed in the previous +step, Git, will download the Spacemacs extension files. + +*** Note for Windows users +If you use windows, you have to modify the git command by inserting the correct +path to your .emacs.d folder. The dot before the folder means that it is hidden, +so you'll have to search for hidden files to find the folder. When you have +found the folder, substitute the original path with the correct one. The proper +code would look something like this: + +#+BEGIN_SRC sh +git clone https://github.com/syl20bnr/spacemacs /path/to/your/.emacs.d +#+END_SRC + +** 4. Install the default font +The default font used by Spacemacs is Source Code Pro by Adobe. It is +recommended to [[https://github.com/adobe-fonts/source-code-pro#font-installation-instructions][install]] it on your system to ensure correct visual +representation. Also a "Fallback font" for nicer-looking symbols in the modeline +(bottom bar) is recommended. These depend on the system: + +- gnu/linux: Nanum +- MacOS: Arial Unicode MS +- Windows: MS Gothic or Lucida Sans Unicode + +If the modeline doesn't look as great as in the pictures, make sure you have the +correct fallback font installed on your system. + +** 5. Open Spacemacs and choose default editing style +Open Spacemacs by clicking the Emacs icon in your applications menu. The first +time Spacemacs launches, it will load and install packages and prompt you for +your preferred editing style. You have two options: Vim ("Among the stars aboard +the Evil flagship") and Emacs. If you haven't used Emacs before or are unsure +about the differences of the editing styles, we recommend selecting the default, +Vim, by pressing enter. Using this configuration is introduced more thoroughly +in the next section. If you are already familiar with Emacs or do not plan to +switch into modal editing style, select Emacs with the left and right arrow +keys. There is also a third option, "Hybrid", for more advanced users willing to +use both styles. All of these choices can be easily changed later by editing the +dotspacemacs-editing-style variable in the dotfile (see [[#configuring-spacemacs][Configuring Spacemacs]]), +so if modal editing does not sweep you away, you can switch to the Emacs style +later. + +Next, you will be prompted for the distribution you would like to start with. +The standard distribution is recommended, press enter to select it. + +Now Spacemacs will download and install required packages. This will take some +minutes depending on your connection. After everything is installed (you will +see the text "n packages loaded in x s" appear in the list under the Spacemacs +logo), restart Spacemacs. + +Now your installation process is complete, congratulations! For troubleshooting, +see the last section. + +* Getting started +** Keybinding notation +The power of Spacemacs lies in its efficient keybindings. Because it is built on +Emacs, we will use Emacs conventions for keybinding notation. The most important +modifier keys are: + +~SPC~ = ~Space~, used as the leader key in Vim editing style. +~C-~ = ~Ctrl~ +~M-~ (for "meta") = ~Alt~ +~S-~ = ~Shift~ + +The modifier keys can be used either in a sequence or as key chords by pressing +two keys at the same time. ~SPC 1~ is notation for a key sequence and means +pressing ~Space~ first and pressing ~1~ after it. Key chords are notated by +writing a ~-~ between the keys. Thus ~C-c~ means pressing ~Ctrl~ and the letter +~c~ simultaneously. Key chords and sequences can also be combined: ~C-c a~ means +"First press ~Ctrl~ and ~c~ simultaneously, then press ~a~". ~C-c C-a~ means +"First press ~Ctrl~ and ~c~ simultaneously, then press ~Ctrl~ and ~a~ +simultaneously". + +This document assumes you chose the "Vim" editing style and notates accordingly. +If you chose the Emacs editing style, just substitute ~SPC~ with ~M-m~ in all +the commands that begin with ~SPC~. + +(Note: Other modifier keys such as ~Super~, notated with a small-case ~s-~, can +be set up but this is rarely necessary in Spacemacs). + +** Modal text editing - why and how? +Writing (or programming) is typically not a simple linear process of adding +words and lines until finished. At least as important part of the work consists +of editing the text: deleting and rewriting parts, moving sentences around or +jumping to an earlier point to fix a discrepancy. + +The crudest way to, for example, delete a certain line is moving the mouse to +the line in question, clicking on the line and then deleting it by pressing +backspace repeatedly. This is slow and inefficient, both because you have to +take your hands from your keyboard and because repeatedly pressing backspace +takes time. The more time you spend pressing keys, the more time and energy is +wasted. + +To speed up editing, many editors use key chords for common editing tasks: +~Control-c~ for copying and so on. However, these types of shortcuts tend to +have two problems. First, you have to press two keys at the same time, which is +harder to coordinate and thus slower than pressing keys in a sequence. Second, +you typically have to use your weakest fingers (pinkies) extensively and bend +your wrists in unergonomic positions, which is uncomfortable for many and risks +developing carpal tunnel syndrome in the long run. + +By contrast, Spacemacs uses modal editing. Modal editing means that different +modes are used for editing and writing text. While this can sound complicated at +first, in practice it can be learned quickly and once learned is unparallelled +in speed and ergonomy. Our earlier example of deleting a certain line of text (a +very common edit task) can be achieved in Spacemacs by simply navigating to the +line in question with the keys ~j~ and ~k~ (navigation keys) and pressing ~d~ +(for "delete") two times! + +You might have noticed that this was achieved entirely without moving your +fingers from your home row (the row where your fingers lie in rest when +touch-typing) and without using modifier keys. + +** Start the Vim tutorial +The modal editing features of Spacemacs originate from a text editor called Vi, +and thus the modal editing tutorial is called eVIl tutor. Press ~SPC h T~ (that +is, the spacebar followed by ~h~ and ~T~) to familiarize yourself with +modal editig. + +** Using the spacebar to launch commands +Now that you are familiar with writing and editing text it is time to put the +"Space" into Spacemacs. Because the spacebar is the most accessible key on the +keyboard and is pressed by the strongest fingers (the thumbs), it is a natural +choice for launching commands. You can think of it as the start menu of +Spacemacs. + +A short instant after the spacebar is pressed a menu pops up. This interactive +menu shows you what submenus and commands can be accessed by subsequent +keypresses. Browsing around this menu is a great way of finding new features in +Spacemacs, so keep on eye on the different options! ~ESC~ usually breaks the +combination you don't want to use. + +** Buffers, windows and frames +Because Emacs (the extension of which Spacemacs is) was developed in the 80's +before the advent of modern graphical user interfaces, Emacs has +a different name of what we normally call "windows": in Emacs these are +called "frames". A frame is what pops up when you launch Spacemacs from your +desktop shortcut. A frame contains windows and buffers. + +Windows are the visual spaces a frame is divided into. The default +is one, but windows can be split to allow editing multiple files in one frame. +Let's try this. Press ~SPC~ to bring up the menu. You can see different letters +having different submenus associated with them, usually with a mnemonic for +easier recall. The letter w is assigned for "windows": press it. A new menu +opens with further options. Write the character / to split the currently active +window vertically into two. + +Now you should see two windows of this tutorial, and the one on the left should +be active, as can be seen from the modeline in the bottom or by moving the +cursor around using the navigation keys. This isn't very useful, as we +would probably want to see a different file on the right. + +First, activate the window on the right with ~SPC 2~. Now that the window on the +right is active, we can open a different buffer for a different file. We'll use +the scratch buffer, which can be used like a notepad. Be warned, unlike other +buffers it doesn't prompt you whether you want to save the changes you've made +when quitting the program! Press ~SPC b~ to open the buffers menu and then +switch to the scratch buffer by pressing s. Now you have two different buffers +in two different windows open, great! You can write something on the scratch +buffer, and when you're done, make sure that the scratch window is active and +close it by pressing ~SPC w d~. + +Now the tutorial window fills the whole frame. But you only closed the window, +not the scratch buffer, so the buffer is still open beneath the surface. You can +quickly switch between the current buffer and the last with ~SPC TAB~: use this +a couple of times to switch between the tutorial and the scratch buffer. ~SPC b~ +has more options for switching between buffers, for example ~SPC b b~ opens a +searchable list of all currently open buffers and ~SPC b d~ closes the current +buffer. + +** Accessing files +Files can be accessed under the ~SPC f~ mnemonic. You can navigate to any file +with ~SPC f f~ and open it by pressing enter. Accessing recently opened files is +a very common task and is done with ~SPC f r~. An edited file is saved with +~SPC f s~. + +* Configuring Spacemacs +:PROPERTIES: +:CUSTOM_ID: configuring-spacemacs +:END: +** Adding language support and other features: using 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. First, split +the window vertically to view both this tutorial and the dotfile simultaneously +(~SPC w /~). Open the dotfile by pressing ~SPC f e d~. Navigate to the line +starting with "dotspacemacs-configuration-layers". The following lines have +further instructions: uncomment org and git layers if you want to be +familiarized with them. More layers for different languages and tools can be +found on [[https://github.com/syl20bnr/spacemacs/tree/master/layers][github]] or by pressing ~SPC h SPC~. The added layers will be installed +upon restart of Spacemacs. + +Mac users: add the osx layer to use the OS X keybindings! + +** Changing the colour theme +You can toggle the theme by ~SPC T n~. This cycles between currently +activated themes. You can find more by adding the themes-megapack layer and +activate them by writing their names in the dotspacemacs-themes list. + +** Starting maximized +Editing the dotspacemacs-maximized-at-startup variable from nil to t will start +Spacemacs maximized. + +** Quitting +Save the changes you've made to the dotfile with ~SPC f s~ and then quit emacs +by ~SPC q q~. You can return to this tutorial by clicking it on the home screen! + +* Additional features, tips and troubleshooting +** Org mode +Org mode is one of the best features of Spacemacs and enough reason to warrant +its use. Org mode's official description tells that it is "for keeping notes, +maintaining todo lists, planning projects, and authoring documents with a fast +and effective plain-text system", but this gives only a small inkling of its +versatility. If you do any kind of writing at all, chances are that Org mode +will make it easier and more fun. This tutorial was written in Org mode. + +Install the Org layer and open this tutorial. Press ~S-TAB~ repeatedly and +observe that this cycles the visibility of the contents of different headlines. +Press t in normal mode and observe that you can add TODO tags on headlines. +Press ~M-k~ or ~M-j~ in normal mode and see how you can quickly move parts of +the document around. + +This is not even scratching the surface of Org mode, so you should look into its +[[https://github.com/syl20bnr/spacemacs/blob/master/layers/%252Bemacs/org/README.org][documentation]] for more information. Googling for Org mode tutorials is also very +helpful in finding out the most useful features of it! + +** Version control - the intelligent way +Version control means keeping track of the changes and edits you have made to +your document. Often version control is done by saving different versions of the +document with different names, such as "document version 13" and so on. This is +crude in many ways: if you want to, for example, re-add something you deleted, +you have to manually open several past versions of the document to find the one +with the deleted part, and then copy-paste it to the most recent file. More +complicated edits will be harder still. Fortunately, there is a much better way. +Git is the most popular version control system for programmers, but it can be as +useful for people that are writing school or scientific papers, fiction or blog +posts as well. + +Install the git layer, restart Spacemacs and open a file you want to version +control. You can check the status of your file by pressing ~SPC g s~. Select the +folder your file is in. You will be prompted whether you want to create a +repository in the folder. Select yes. You will see a list of "Untracked files": +navigate to the file you want to track and press s to "stage changes". You might +be prompted to save the file: save it if necessary. Now the new file needs to be +commited: press c and c again. Two windows pop up: one showing the changes +you've made since the last edit (in this case, the whole document) and another +prompting for a commit message. Write "Initial commit", press ESC to exit back +to normal mode and press ~, c~ confirm and quit the commit +message. To abort, press ~, a~. + +Now you know how to make a commit. The commits are saved in +the (hidden) .git folder in the same folder the tracked file(s) are in. You can +make further commits the same way. + +** Daemon mode and instant startup (Linux) +Emacs can be used in daemon mode: a daemon runs in the background and launches +clients. This way new frames launch instantly without delay. [[https://www.emacswiki.org/emacs/EmacsAsDaemon][Emacswiki]] tells +more about the daemon and how to set it to launch automatically on startup. + +** Swap caps lock and esc keys on your keyboard +This is useful outside of Spacemacs as well! + +** Troubleshooting and further info +~SPC ?~ shows you the keybindings in the current major mode, which is often +helpful. For troubleshooting, please refer to the FAQ by pressing ~SPC f e f~ or +[[https://github.com/syl20bnr/spacemacs/blob/master/doc/FAQ.org][online]]. More help is found under ~SPC h~, and with ~SPC h ~SPC~ you can access +the comprehensive Spacemacs documentation, including this tutorial and the layer +documents. + +The [[https://gitter.im/syl20bnr/spacemacs][Gitter chat]] can be used to ask questions if the answer cannot be found in +the documentation. For a detailed review of Spacemacs' features one can also +watch the [[https://www.youtube.com/playlist?list=PLrJ2YN5y27KLhd3yNs2dR8_inqtEiEweE][Spacemacs ABC series]] by Eivind Fonn on Youtube. Some of the +keybindings have changed since the videos were uploaded but seeing someone in +action helps spot helpful tricks that would otherwise be missed. diff --git a/doc/CONVENTIONS.org b/doc/CONVENTIONS.org index 76cfc4f..d2cb577 100644 --- a/doc/CONVENTIONS.org +++ b/doc/CONVENTIONS.org @@ -209,6 +209,7 @@ The base prefix for major mode specific compilation is ~SPC m c~. |-------------+-------------------| | ~m c b~ | compile buffer | | ~m c c~ | compile | + | ~m c C~ | clean | | ~m c r~ | clean and compile | Note: we don't distinguish between the file and the buffer. We can @@ -224,11 +225,12 @@ The base prefix for debugging commands is ~SPC d~. | ~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 i~ | step in | | ~m d l~ | local variables | -| ~m d n~ | next | +| ~m d o~ | step out | | ~m d r~ | run | -| ~m d s~ | step | +| ~m d s~ | next step | +| ~m d v~ | inspect value at point | Notes: - Ideally a transient-state for breakpoint navigation should be provided. diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 7e4d4b6..b469dab 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -94,6 +94,7 @@ - [[#c-z-and-tab-switch][C-z and Tab switch]] - [[#helm-focus][Helm focus]] - [[#helm-transient-state][Helm transient state]] + - [[#ivy][Ivy]] - [[#discovering][Discovering]] - [[#key-bindings][Key bindings]] - [[#which-key][Which-key]] @@ -259,7 +260,7 @@ project. * Who can benefit from this? - Spacemacs was initially intended to be used by *Vim users* who want to go to - the next level by using Emacs (see [[./VIMUSERS.org][guide]] for Vimmers). But it is now + the next level by using Emacs (see [[file:VIMUSERS.org][guide]] for Vimmers). But it is now perfectly *usable by non Vim users* by choosing the =emacs= editing style. - It is also a good fit for people wanting to *lower the [[http://en.wikipedia.org/wiki/Repetitive_strain_injury][risk of RSI]]* induced by @@ -324,6 +325,9 @@ and choosing a rollback slot (sorted by date). This button uses the command =configuration-layer/rollback=. * Configuration layers + :PROPERTIES: + :CUSTOM_ID: configuration-layers + :END: This section is an overview of layers. A more extensive introduction to writing configuration layers can be found [[file:LAYERS.org][here]] (recommended reading!). @@ -457,7 +461,7 @@ guidelines first in [[file:../CONTRIBUTING.org][CONTRIBUTING]]. ** Example: Themes Megapack example This is a simple configuration layer listing a bunch of themes which you can -find [[../layers/themes-megapack/README.org][here]]. +find [[file:../layers/+themes/themes-megapack/README.org][here]]. To install it, just add =themes-megapack= to your =~/.spacemacs= like so: @@ -500,6 +504,9 @@ Please refer to [[file:LAYERS.org][this]] introduction for some tips on writing best make them fit with the Spacemacs philosophy and loading strategy. * Dotfile Configuration +:PROPERTIES: +:CUSTOM_ID: dotfile-configuration +:END: User configuration can be stored in your =~/.spacemacs= file. ** Dotfile Installation @@ -597,7 +604,7 @@ to add some layers in =~/.myconfig=, set the variable like this: *** Setting configuration layers variables Some configuration layers have configuration variables to enable specific -feature. For instance the [[../layers/%2Bsource-control/git][git layer]] has several configuration variables, they +feature. For instance the [[file:../layers/+source-control/git/README.org][git layer]] has several configuration variables, they can be set directly in the =dotspacemacs-configuration-layers= like this: #+BEGIN_SRC emacs-lisp @@ -691,7 +698,7 @@ orphan so it is considered unused by Spacemacs). *** Excluding packages You can exclude packages you don't want to install with the variable -=dotspacemacs-excluded-packages= (see [[Configuration layers][Configuration layers]] for more info +=dotspacemacs-excluded-packages= (see [[#configuration-layers][Configuration layers]] for more info on packages). For instance, to disable the =rainbow-delimiters= package: @@ -708,7 +715,7 @@ of the configuration, this is a powerful feature which allows you to quickly remove any feature from Spacemacs. *Note:* A few packages are essential for Spacemacs to correctly operate, those -packages are protected and cannot be excluded or unsintalled even if they become +packages are protected and cannot be excluded or uninstalled even if they become orphans or are excluded. =use-package= is an example of a protected package that cannot be removed from Spacemacs. @@ -761,7 +768,7 @@ To bind keys in Hybrid editing style (=hybrid state=): #+END_SRC This style can be tweaked to be more like Emacs or more like Vim depending -on the user preferences. The following variable are available to change the +on the user preferences. The following variables are available to change the style configuration: - =hybrid-mode-default-state= The default state when opening a new buffer, @@ -784,6 +791,9 @@ To toggle the hybrid style on and off use ~SPC t E h~ and ~M-m t E h~. When off the =vim= style is enabled. ** States +:PROPERTIES: +:CUSTOM_ID: states +:END: Spacemacs has 10 states: | State | Default Color | Description | @@ -796,9 +806,9 @@ Spacemacs has 10 states: | replace | chocolate | exclusive to =Evil=, overwrites the character under point instead of inserting a new one | | hybrid | blue | exclusive to Spacemacs, this is like the insert state except that all the emacs key bindings are available | | evilified | light brown | exclusive to Spacemacs, this is an =emacs state= modified to bring Vim navigation, selection and search. | -| lisp | pink | exclusive to Spacemacs, used to navigate Lisp code and modify it (more [[Editing Lisp code][info]]) | -| iedit | red | exclusive to Spacemacs, used to navigate between multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | -| iedit-insert | red | exclusive to Spacemacs, used to replace multiple regions of text using =iedit= (more [[Replacing text with iedit][info]]) | +| lisp | pink | exclusive to Spacemacs, used to navigate Lisp code and modify it (more [[#editing-lisp-code][info]]) | +| iedit | red | exclusive to Spacemacs, used to navigate between multiple regions of text using =iedit= (more [[#replacing-text-with-iedit][info]]) | +| iedit-insert | red | exclusive to Spacemacs, used to replace multiple regions of text using =iedit= (more [[#replacing-text-with-iedit][info]]) | Note: Technically speaking there is also the =operator= evil state. @@ -844,7 +854,7 @@ are in =normal= mode by pressing the ~SPC~ leader key, here are a few examples: The universal argument ~C-u~ is an important command in Emacs but it is also a very handy Vim key binding to scroll up. -Spacemacs binds ~C-u~ to =scroll-up= and change the universal argument binding +Spacemacs binds ~C-u~ to =scroll-up= and changes the universal argument binding to ~SPC u~. *Note*: ~SPC u~ is not working before =helm-M-x= (~SPC SPC~). Instead, call @@ -852,6 +862,9 @@ to ~SPC u~. pressing ~RETURN~. For instance: ~SPC SPC org-reload C-u RET~ ** Transient-states + :PROPERTIES: + :CUSTOM_ID: transient-states + :END: Spacemacs defines a wide variety of =transient states= (temporary overlay maps) where it makes sense. This prevents one from doing repetitive and tedious presses on the ~SPC~ key. @@ -861,7 +874,7 @@ minibuffer. Additional information may as well be displayed in the minibuffer. Auto-highlight-symbol transient state: [[file:img/spacemacs-ahs-transient-state.png]] -[[Text][Text scale transient state]]: +[[#text][Text scale transient state]]: [[file:img/spacemacs-scale-transient-state.png]] @@ -976,7 +989,7 @@ Spacemacs has a minimalistic and distraction free graphical UI: ** Color themes The official Spacemacs theme is [[https://github.com/nashamri/spacemacs-theme][spacemacs-dark]] and it is the default theme installed when you first started Spacemacs. There are two variants of the -theme, a dark one and a light one. Some aspect of these themes can be customized +theme, a dark one and a light one. Some aspects of these themes can be customized in the function =dotspacemacs/user-init= of your =~/.spacemacs=: - the comment background with the boolean =spacemacs-theme-comment-bg= - the height of org section titles with =spacemacs-theme-org-height= @@ -1086,6 +1099,7 @@ and ~T~): | ~SPC t h h~ | toggle highlight of the current line | | ~SPC t h i~ | toggle highlight indentation levels | | ~SPC t h c~ | toggle highlight indentation current column | +| ~SPC t h s~ | toggle syntax highlighting | | ~SPC t i~ | toggle indentation guide at point | | ~SPC t l~ | toggle truncate lines | | ~SPC t L~ | toggle visual lines | @@ -1107,8 +1121,7 @@ and ~T~): **** Global line numbers Line numbers can be toggled on in all =prog-mode= and =text-mode= buffers by -setting the =dotspacemacs-line-numbers= variable in your =~/.spacemacs= -to something different than =nil=. +setting the =dotspacemacs-line-numbers= variable in your =~/.spacemacs= to =t=. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-line-numbers t) @@ -1120,6 +1133,59 @@ If it is set to =relative=, line numbers are show in a relative way: (setq-default dotspacemacs-line-numbers 'relative) #+END_SRC +=dotspacemacs-line-numbers= can also be set to a property list for finer control +over line numbers activation. + +Available properties: + +| Property | Description | +|-----------------------+----------------------------------------------------------------------------------------------| +| =:disabled-for-modes= | list of major modes where line numbering is inhibited | +| =:enabled-for-modes= | disable for all major modes except those listed. Takes precedence over =:disabled-for-modes= | +| =:relative= | if non-nil, line numbers are relative to the position of the cursor | +| =:size-limit-kb= | size limit in kilobytes after which line numbers are not activated | + +Examples: + +Disable line numbers in dired-mode, doc-view-mode, markdown-mode, org-mode, +pdf-view-mode, text-mode as well as buffers over 1Mb: + +#+BEGIN_SRC emacs-lisp +(setq-default dotspacemacs-lines-numbers '(:relative nil + :disabled-for-modes dired-mode + doc-view-mode + markdown-mode + org-mode + pdf-view-mode + text-mode + :size-limit-kb 1000)) +#+END_SRC + +Relative line numbers only in c-mode and c++ mode with a size limit of =dotspacemacs-large-file-size=: + +#+BEGIN_SRC emacs-lisp +(setq-default dotspacemacs-lines-numbers '(:relative t + :enabled-for-modes c-mode + c++-mode + :size-limit-kb (* dotspacemacs-large-file-size 1000)) +#+END_SRC + +Enable line numbers everywhere, except for buffers over 1Mb: + +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-lines-numbers '(:relative nil + :size-limit-kb 1000)) +#+END_SRC + +Enable line numbers only in programming modes, except for c-mode and c++ mode: + +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-lines-numbers '(:relative nil + :enabled-for-modes prog-mode + :disabled-for-modes c-mode c++-mode + :size-limit-kb (* dotspacemacs-large-file-size 1000)) +#+END_SRC + ** Mode-line The mode line is a heavily customized [[https://github.com/milkypostman/powerline][powerline]] with the following capabilities: - show the window number @@ -1152,7 +1218,8 @@ Some elements can be dynamically toggled: | ~SPC t m M~ | toggle the major mode | | ~SPC t m n~ | toggle the cat! (if =colors= layer is declared in your dotfile) | | ~SPC t m p~ | toggle the point character position | -| ~SPC t m t~ | toggle the mode line itself | +| ~SPC t m t~ | toggle the time | +| ~SPC t m T~ | toggle the mode line itself | | ~SPC t m v~ | toggle the version control info | | ~SPC t m V~ | toggle the new version lighter | @@ -1265,7 +1332,7 @@ can be reached using the =control= key. | ~SPC t p~ | =ⓟ= | p | [[https://github.com/Fuco1/smartparens][smartparens]] mode | | ~SPC t C-p~ | =ⓟ= | p | global smartparens | | ~SPC t s~ | =ⓢ= | s | syntax checking (flycheck) | -| ~SPC t S~ | =Ⓢ= | S | enabled in [[../layers/spell-checking][spell checking layer]] (flyspell) | +| ~SPC t S~ | =Ⓢ= | S | enabled in [[file:../layers/+checkers/spell-checking/README.org][spell checking layer]] (flyspell) | | ~SPC t w~ | =ⓦ= | w | whitespace mode | | ~SPC t C-w~ | =ⓦ= | w | global whitespace | | ~SPC t W~ | =Ⓦ= | W | automatic whitespace cleanup (see =dotspacemacs-whitespace-cleanup=) | @@ -1375,8 +1442,8 @@ Press ~?~ to toggle the full help. |-------------------+------------------------------------------------------------| | ~SPC l~ | activate the transient- state | | ~?~ | toggle the documentation | -| ~[1..9, 0]~ | switch to nth layout | -| ~[C-1..C-9, C-0]~ | switch to nth layout and keep the transient state active | +| ~[0..9]~ | switch to nth layout | +| ~[C-0..C-9]~ | switch to nth layout and keep the transient state active | | ~~ | switch to the latest layout | | ~a~ | add a buffer to the current layout | | ~A~ | add all the buffers from another layout in the current one | @@ -1430,8 +1497,8 @@ Press ~?~ to toggle the full help. |-------------------+-------------------------------------------------------------| | ~SPC l w~ | activate the transient state | | ~?~ | toggle the documentation | -| ~[1..9, 0]~ | switch to nth workspace | -| ~[C-1..C-9, C-0]~ | switch to nth workspace and keep the transient state active | +| ~[0..9]~ | switch to nth workspace | +| ~[C-0..C-9]~ | switch to nth workspace and keep the transient state active | | ~TAB~ | switch to last active workspace | | ~d~ | close current workspace | | ~n~ or ~l~ | switch to next workspace | @@ -1444,7 +1511,7 @@ There are also some handy globally available key bindings related to workspaces: | Key Binding | Description | |-------------+--------------------------------------| | ~gt~ | go to next workspace | -| ~gT~ | got to previous workspace | +| ~gT~ | go to previous workspace | | ~SPC b W~ | go to workspace and window by buffer | * Commands @@ -1554,7 +1621,10 @@ If you find yourself unable to return focus to Helm (after a careless mouse-click for example), use ~SPC w b~ to return focus to the minibuffer. **** Helm transient state -Spacemacs defines a [[Transient-states][transient state]] for =Helm= to make it work like [[https://github.com/Shougo/unite.vim][Vim's Unite]] + :PROPERTIES: + :CUSTOM_ID: helm-transient-state + :END: +Spacemacs defines a [[#transient-states][transient state]] for =Helm= to make it work like [[https://github.com/Shougo/unite.vim][Vim's Unite]] plugin. Initiate the transient state with ~M-SPC~ or ~s-M-SPC~ while in a =Helm= buffer. @@ -1585,6 +1655,19 @@ Initiate the transient state with ~M-SPC~ or ~s-M-SPC~ while in a =Helm= buffer. | ~T~ | mark all candidates | | ~v~ | execute persistent action | +*** Ivy +If you choose =ivy= as completion system, make sure to read [[http://oremacs.com/swiper/][official manual]]. In +case you don't want to read everything, at least familiarise with [[http://oremacs.com/swiper/#minibuffer-key-bindings][minibuffer key +bindings]]. Some useful key bindings are presented in following table. + +| Key Binding | Description | +|----------------+------------------------------------------------------------------------------------------------------| +| ~C-m~ or ~RET~ | call default action on current candidate | +| ~M-o~ | show the list of valid actions on current candidate (then press any of described keys to execute it) | +| ~C-M-m~ | the same as ~RET~ but doesn't close completion minibuffer | +| ~C-M-o~ | the same as ~M-o~ but doesn't close completion minibuffer | +| ~C-'~ | use avy to quickly select completion on current page (sometimes faster than using arrows) | + ** Discovering *** Key bindings **** Which-key @@ -1713,7 +1796,7 @@ Spacemacs. *** Toggles =helm-spacemacs-help= is also a central place to discover the available toggles. -To display only the toggles source press ~C-l~ (or in [[Helm transient state][Helm transient state]] you can +To display only the toggles source press ~C-l~ (or in [[#helm-transient-state][Helm transient state]] you can press just ~l~). The following helm actions are available on packages: @@ -1860,8 +1943,9 @@ Windows manipulation commands (start with ~w~): | Key Binding | Description | |------------------------+-----------------------------------------------------------------------------| +| ~SPC w TAB~ | switch to alternate window in the current frame (switch back and forth) | | ~SPC w =~ | balance split windows | -| ~SPC w b~ | force the focus back to the minibuffer (usefull with =helm= popups) | +| ~SPC w b~ | force the focus back to the minibuffer (useful with =helm= popups) | | ~SPC w c~ | maximize/minimize a window and center it | | ~SPC w C~ | maximize/minimize a window and center it using [[https://github.com/abo-abo/ace-window][ace-window]] | | ~SPC w d~ | delete a window | @@ -1993,10 +2077,13 @@ the opened buffer and kill them. | Any other key | leave the transient state | **** Special Buffers +:PROPERTIES: +:CUSTOM_ID: special-buffers +:END: Unlike vim, emacs creates many buffers that most people do not need to see. Some examples are =*Messages*= and =*Compile-Log*=. Spacemacs tries to automatically ignore buffers that are not useful. However, you may want to change the way -Spacemacs marks buffers as useful. For instructions, see the [[file:FAQ.org::Change%20special%20buffer%20rules?][special buffer howto]]. +Spacemacs marks buffers as useful. For instructions, see the [[file:FAQ.org::#change-special-buffer-rules][special buffer howto]]. **** Files manipulations key bindings Files manipulation commands (start with ~f~): @@ -2080,7 +2167,7 @@ Basic =ido= operations can be done with ~Ctrl~ key: | ~C-S-l~ | go to next directory | *** Ido transient state -Spacemacs defines a [[Transient-states][transient state]] for =ido=. +Spacemacs defines a [[#transient-states][transient state]] for =ido=. Initiate the transient state with ~M-SPC~ or ~s-M-SPC~ while in an =ido= buffer. @@ -2156,6 +2243,7 @@ open the file in a split window with ~|~ and ~-~: |-------------+---------------------------------| | ~TAB~ | toggle stretching of the buffer | | ~c~ | create a node | +| ~C~ | copy a node | | ~d~ | delete a node | | ~gr~ | refresh | | ~s~ | toggle showing of hidden files | @@ -2263,7 +2351,7 @@ OpenDocument, and Microsoft Office documents. *** Frequency of auto-saving By default auto-saving of files is performed every 300 characters and every 30 seconds of idle time which can be changed by setting to a -new value the variables =auto-save-inteval= and =auto-save-timeout= +new value the variables =auto-save-interval= and =auto-save-timeout= respectively. *** Location of auto-saved files @@ -2392,6 +2480,9 @@ bindings (~SPC e n~ and ~SPC e p~) as well as the error transient state (~SPC e~ | ~SPC s t F~ | =pt= with default text | **** Searching in a project +:PROPERTIES: +:CUSTOM_ID: searching-in-a-project +:END: | Key Binding | Description | |-----------------------+-----------------------------------------------------| @@ -2480,7 +2571,7 @@ Where = [x/y]*= is: With [[https://github.com/bling/evil-visualstar][evil-visualstar]] you can search for the next occurrence of the current selection. -It is pretty useful combined with the [[Region selection][expand-region]] bindings. +It is pretty useful combined with the [[#expand-region][expand-region]] bindings. *Note*: If the current state is not the =visual state= then pressing ~*~ uses auto-highlight-symbol and its transient state. @@ -2546,7 +2637,7 @@ Text related commands (start with ~x~): | ~SPC x a ;~ | align region at ; | | ~SPC x a =~ | align region at = | | ~SPC x a a~ | align region (or guessed section) using default rules | -| ~SPC x a c~ | align current intendation region using default rules | +| ~SPC x a c~ | align current indentation region using default rules | | ~SPC x a r~ | align region using user-specified regexp | | ~SPC x a m~ | align region at arithmetic operators (+-*/) | | ~SPC x a ¦~ | align region at ¦ | @@ -2562,6 +2653,7 @@ Text related commands (start with ~x~): | ~SPC x j r~ | set the justification to right | | ~SPC x J~ | move down a line of text (enter transient state) | | ~SPC x K~ | move up a line of text (enter transient state) | +| ~SPC x l d~ | duplicate line or region | | ~SPC x l s~ | sort lines | | ~SPC x l u~ | uniquify lines | | ~SPC x o~ | use avy to select a link in the frame and open it | @@ -2604,6 +2696,9 @@ It is possible to enable it easily for /all programming modes/ with the variable *** Zooming **** Text + :PROPERTIES: + :CUSTOM_ID: text + :END: The font size of the current buffer can be adjusted with the commands: | Key Binding | Description | @@ -2654,10 +2749,10 @@ In transient state: | Any other key | leave the transient state | *Tips:* you can increase or decrease a value by more that once by using a prefix -argument (ie. ~10 SPC n +~ will add 10 to the number under point). +argument (i.e. ~10 SPC n +~ will add 10 to the number under point). *** Spell checking -Spell checking is enabled by including the [[../layers/spell-checking][spell +Spell checking is enabled by including the [[file:../layers/+checkers/spell-checking/README.org][spell checking]] layer in your dotfile. Keybindings are listed in the layer documentation. @@ -2666,6 +2761,9 @@ Keybindings are listed in the layer documentation. Vi =Visual= modes are all supported by =evil=. **** Expand-region +:PROPERTIES: +:CUSTOM_ID: expand-region +:END: Spacemacs adds another =Visual= mode via the [[https://github.com/magnars/expand-region.el][expand-region]] mode. | Key Binding | Description | @@ -2699,14 +2797,17 @@ There are also ~a~ variants that include whitespace. Example (=|= indicates poin The displayed text of a buffer can be narrowed with the commands (start with ~n~): -| Key Binding | Description | -|-------------+-------------------------------------------| -| ~SPC n f~ | narrow the buffer to the current function | -| ~SPC n p~ | narrow the buffer to the visible page | -| ~SPC n r~ | narrow the buffer to the selected text | -| ~SPC n w~ | widen, i.e show the whole buffer again | +| Key Binding | Description | +|-------------+--------------------------------------------| +| ~SPC n f~ | narrow the buffer to the current function | +| ~SPC n p~ | narrow the buffer to the visible page | +| ~SPC n r~ | narrow the buffer to the selected text | +| ~SPC n w~ | widen, i.e. show the whole buffer again | *** Replacing text with iedit + :PROPERTIES: + :CUSTOM_ID: replacing-text-with-iedit + :END: Spacemacs uses the powerful [[https://github.com/tsdh/iedit][iedit]] mode through [[https://github.com/syl20bnr/evil-iedit-state][evil-iedit-state]] to quickly edit multiple occurrences of a symbol or selection. @@ -2824,7 +2925,7 @@ Comments are handled by [[https://github.com/redguardtoo/evil-nerd-commenter][ev | ~SPC c y~ | comment and yank | | ~SPC c Y~ | invert comment and yank | -*Tips:* To comment efficiently a block of line use the combo ~SPC ; SPC y~ +*Tips:* To comment efficiently a block of line use the combo ~SPC ; SPC j l~ *** Regular expressions Spacemacs uses the packages [[https://github.com/joddie/pcre2el][pcre2el]] to manipulate regular expressions. It is @@ -2868,6 +2969,9 @@ To disable the trash you can set the variable =delete-by-moving-to-trash= to =nil= in your =~/.spacemacs=. *** Editing Lisp code + :PROPERTIES: + :CUSTOM_ID: editing-lisp-code + :END: Editing of lisp code is provided by [[https://github.com/syl20bnr/evil-lisp-state][evil-lisp-state]]. Commands will set the current state to =lisp state= where different commands @@ -2968,7 +3072,7 @@ are defined implicitly, for instance the root of a project is found when a =Helm= is used whenever it is possible. -To search in a project see [[Searching in a project][project searching]]. +To search in a project see [[#searching-in-a-project][project searching]]. =projectile= commands start with p: @@ -2986,7 +3090,7 @@ To search in a project see [[Searching in a project][project searching]]. | ~SPC p f~ | find file | | ~SPC p F~ | find file based on path around point | | ~SPC p g~ | find tags | -| ~SPC p C-g~ | regenerate the project's =etags= / =gtags= | +| ~SPC p G~ | regenerate the project's =etags= / =gtags= | | ~SPC p h~ | find file using =helm= | | ~SPC p I~ | invalidate the projectile cache | | ~SPC p k~ | kill all project buffers | @@ -2998,7 +3102,7 @@ To search in a project see [[Searching in a project][project searching]]. | ~SPC p T~ | test project | | ~SPC p v~ | open project root in =vc-dir= or =magit= | | ~SPC /~ | search in project with the best search tool available | -| ~SPC s p~ | see [[Searching in a project][search in project]] | +| ~SPC s p~ | see [[#searching-in-a-project][searching in a project]] | | ~SPC s a p~ | run =ag= | | ~SPC s g p~ | run =grep= | | ~SPC s k p~ | run =ack= | @@ -3204,6 +3308,7 @@ with ~SPC SPC spacemacs/recompile-elpa~. | 7000th star!!!!!!! | [[https://github.com/mukhali][mukhali]] | | 8000th star!!!!!!!! | [[https://github.com/shsteven][shsteven]] | | 9000th star!!!!!!!!! | [[https://github.com/deb0ch][deb0ch]] | +| 10000th star :star: | [[https://github.com/colt365][colt365]] | ** Gitter chat diff --git a/doc/FAQ.org b/doc/FAQ.org index 1e3d57c..0e69017 100644 --- a/doc/FAQ.org +++ b/doc/FAQ.org @@ -206,7 +206,7 @@ change your terminal color palette. More explanations can be found 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 +The sequence of characters used can be customized. See the [[http://spacemacs.org/doc/DOCUMENTATION.html#escaping][documentation]] for more information. If you don't like this feature, you can deactivate it by adding =evil-escape= to @@ -263,6 +263,9 @@ the list =dotspacemacs-excluded-packages= if you prefer setting =exec-path= yourself. * How do I: +:PROPERTIES: +:CUSTOM_ID: how-do-i +:END: ** 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 @@ -301,6 +304,9 @@ dotfile. The following snippet disables company for =python-mode=: #+END_SRC ** Change special buffer rules? + :PROPERTIES: + :CUSTOM_ID: change-special-buffer-rules + :END: 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 diff --git a/doc/LAYERS.org b/doc/LAYERS.org index 9b58f27..879ca83 100644 --- a/doc/LAYERS.org +++ b/doc/LAYERS.org @@ -275,6 +275,9 @@ Use-package supports heaps of useful keywords. Look at the [[https://github.com/ more. * Anatomy of a layer +:PROPERTIES: +:CUSTOM_ID: anatomy-of-a-layer +:END: A layer is simply a folder somewhere in Spacemacs' layer search path that usually contains these files (listed in loading order). @@ -397,10 +400,11 @@ 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. +1. Spacemacs goes through all the enabled layers and evaluates their files. + First =layers.el= is loaded to declare layer dependencies. Then =packages.el= + and =funcs.el= are loaded, but nothing happens from them since these files + only define functions and variables, then the changes introduced by + =config.el= are applied. 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, @@ -477,7 +481,7 @@ 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. +Calls to these functions must go in the =layers.el= file. ** Use-package In the vast majority of cases, a package =init= function should do nothing but @@ -498,6 +502,9 @@ hooks, if the package should be loaded upon some event. It is not unusual to have both! ** Use-package hooks +:PROPERTIES: +:CUSTOM_ID: use-package-hooks +:END: 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 diff --git a/doc/QUICK_START.org b/doc/QUICK_START.org index dd35ba6..f7ff5a2 100644 --- a/doc/QUICK_START.org +++ b/doc/QUICK_START.org @@ -80,8 +80,8 @@ dotspacemacs-configuration-layers '(auto-completion 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 +The [[https://github.com/syl20bnr/spacemacs/blob/master/core/templates/.spacemacs.template][dotfile template]] contains further information about how to customize +Spacemacs. See the dotfile configuration section of the [[file:DOCUMENTATION.org::#dotfile-configuration][documentation]] for more details. * Dotdirectory (~/.spacemacs.d) @@ -174,4 +174,4 @@ about functions, variables, modes etc. These commands are bound thusly: | ~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. +Some quick =how-to's= are compiled in the [[file:FAQ.org::#how-do-i][FAQ.]] diff --git a/doc/VIMUSERS.org b/doc/VIMUSERS.org index 39820ec..86bf70e 100644 --- a/doc/VIMUSERS.org +++ b/doc/VIMUSERS.org @@ -60,7 +60,7 @@ 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. +manipulate text. In Emacs, we have [[file: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, @@ -79,8 +79,8 @@ 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]]. +More information on layers can be found in the [[#customization][customization]] section and in the +[[file: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 @@ -99,7 +99,7 @@ Spacemacs uses ~SPC~ as its ~~ key. This document will use ~SPC~ to refe the ~~ key. All keybindings are mnemonic and are organized under the ~~ 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. +[[file: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: @@ -124,17 +124,20 @@ are located under the ~SPC b~ prefix. |---------------------------+------------------------------------------------------| | ~SPC b b ~ | Create a buffer named ==. | | ~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 n~ or ~:bnext~ | Switch to the next buffer. (See [[#special-buffers][Special buffers]]) | +| ~SPC b p~ or ~:bprevious~ | Switch to the previous buffer. (See [[#special-buffers][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 +:PROPERTIES: +:CUSTOM_ID: special-buffers +:END: 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]]. +key bindings. More information can be found [[file:DOCUMENTATION.org::#special-buffers][here]]. *** Windows Windows are like splits in vim. They are useful for editing multiple files at @@ -187,6 +190,9 @@ explore: | ~SPC ?~ | Lists all keybindings. | * Customization +:PROPERTIES: +:CUSTOM_ID: customization +:END: ** 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= @@ -286,6 +292,9 @@ Here is an example of a function that is useful in real life: #+end_src ** Activating a Layer +:PROPERTIES: +:CUSTOM_ID: activating-a-layer +:END: 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 @@ -358,16 +367,16 @@ execute code before or after a package loads. It would look like this: **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 -=/pre-init= function in addition to [[file:LAYERS.org#use-package-hooks][use-package hooks]]. +=/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]]. +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 +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]]. +the [[file:LAYERS.org][configuration layers documentation.]] ** Installing a single package Sometimes creating a layer is a bit overkill. Maybe you just want one package @@ -375,9 +384,12 @@ 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][section]]. ** Loading packages +:PROPERTIES: +:CUSTOM_ID: loading-packages +:END: 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 @@ -410,6 +422,9 @@ 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 +:PROPERTIES: +:CUSTOM_ID: uninstalling-a-package +:END: 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. @@ -457,7 +472,7 @@ 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. +you can [[#uninstalling-a-package][uninstall]] the =evil-search-highlight-persist= package. *** Sessions Spacemacs does not automatically restore your windows and buffers when you diff --git a/init.el b/init.el index 6f2df0a..8fe3870 100644 --- a/init.el +++ b/init.el @@ -1,6 +1,6 @@ ;;; init.el --- Spacemacs Initialization File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,20 +16,19 @@ ;; lower value in your dotfile (function `dotspacemacs/user-config') (setq gc-cons-threshold 100000000) -(defconst spacemacs-version "0.200.7" "Spacemacs version.") +(defconst spacemacs-version "0.200.9" "Spacemacs version.") (defconst spacemacs-emacs-min-version "24.4" "Minimal version of Emacs.") (if (not (version<= spacemacs-emacs-min-version emacs-version)) - (message (concat "Your version of Emacs (%s) is too old. " - "Spacemacs requires Emacs version %s or above.") - emacs-version spacemacs-emacs-min-version) + (error (concat "Your version of Emacs (%s) is too old. " + "Spacemacs requires Emacs version %s or above.") + emacs-version spacemacs-emacs-min-version) (load-file (concat (file-name-directory load-file-name) "core/core-load-paths.el")) (require 'core-spacemacs) (spacemacs/init) - (spacemacs/maybe-install-dotfile) (configuration-layer/sync) - (spacemacs-buffer/display-info-box) + (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (require 'server) (unless (server-running-p) (server-start))) diff --git a/layers/+chat/erc/README.org b/layers/+chat/erc/README.org index 98ca526..eaaee66 100644 --- a/layers/+chat/erc/README.org +++ b/layers/+chat/erc/README.org @@ -18,7 +18,7 @@ Layer for [[http://www.emacswiki.org/emacs/ERC][ERC IRC chat]]. * Features - Highlight nicks (using [[https://github.com/leathekd/erc-hl-nicks][erc-hl-nicks]]) - Image inline support (using [[https://github.com/kidd/erc-image.el][erc-image]]) -- Logging to ~/.emacs.d/.cache/erc-logs and ViewLogMode for viewing logs +- Logging to =~/.emacs.d/.cache/erc-logs= and =ViewLogMode= for viewing logs (using [[https://github.com/Niluge-KiWi/erc-view-log][erc-view-log]]) - YouTube videos Thumbnails inline (using [[https://github.com/yhvh/erc-yt][erc-yt]]) - Social Graph for ERC messages (using [[https://github.com/vibhavp/erc-social-graph][erc-social-graph]]) diff --git a/layers/+chat/erc/config.el b/layers/+chat/erc/config.el index 7567fb1..ac72371 100644 --- a/layers/+chat/erc/config.el +++ b/layers/+chat/erc/config.el @@ -1,6 +1,6 @@ ;;; config.el --- erc Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/erc/funcs.el b/layers/+chat/erc/funcs.el index 34699e1..4f6b99e 100644 --- a/layers/+chat/erc/funcs.el +++ b/layers/+chat/erc/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs ERC Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/erc/local/erc-sasl/erc-sasl.el b/layers/+chat/erc/local/erc-sasl/erc-sasl.el index 0736b38..e376259 100644 --- a/layers/+chat/erc/local/erc-sasl/erc-sasl.el +++ b/layers/+chat/erc/local/erc-sasl/erc-sasl.el @@ -75,7 +75,7 @@ current session" (base64-encode-string (concat "\0" (erc-current-nick) "\0" erc-session-password) t))))) - (progn + (progn (erc-display-message parsed 'error (if erc-server-connected 'active proc) diff --git a/layers/+chat/erc/packages.el b/layers/+chat/erc/packages.el index c539b0d..ba180dc 100644 --- a/layers/+chat/erc/packages.el +++ b/layers/+chat/erc/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- erc Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/jabber/funcs.el b/layers/+chat/jabber/funcs.el index 9511581..dd43e87 100644 --- a/layers/+chat/jabber/funcs.el +++ b/layers/+chat/jabber/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Jabber layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/jabber/packages.el b/layers/+chat/jabber/packages.el index 60092ae..350a920 100644 --- a/layers/+chat/jabber/packages.el +++ b/layers/+chat/jabber/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- jabber Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Tosh Lyons ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/rcirc/config.el b/layers/+chat/rcirc/config.el index d8549e1..c915567 100644 --- a/layers/+chat/rcirc/config.el +++ b/layers/+chat/rcirc/config.el @@ -1,6 +1,6 @@ ;;; config.el --- rcirc Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/rcirc/funcs.el b/layers/+chat/rcirc/funcs.el index 58502c5..f6173c5 100644 --- a/layers/+chat/rcirc/funcs.el +++ b/layers/+chat/rcirc/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- rcirc Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+chat/slack/README.org b/layers/+chat/slack/README.org index f41a7d7..b2ee5ff 100644 --- a/layers/+chat/slack/README.org +++ b/layers/+chat/slack/README.org @@ -23,7 +23,7 @@ file. Follow the instructions in the [[https://github.com/yuya373/emacs-slack/blob/master/README.md][emacs-slack]] package for obtaining your client ID, client secret, and token. -To test that eveyrthing is alright put the following snippet in your +To test that everything is alright put the following snippet in your =dotspacemacs/user-config()= replacing =client-id=, =client-secret= and =token= with your info. diff --git a/layers/+chat/slack/packages.el b/layers/+chat/slack/packages.el index 6a18c67..8c5834f 100644 --- a/layers/+chat/slack/packages.el +++ b/layers/+chat/slack/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- slack layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Kosta Harlan ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+checkers/spell-checking/README.org b/layers/+checkers/spell-checking/README.org index 96b5560..a91ce54 100644 --- a/layers/+checkers/spell-checking/README.org +++ b/layers/+checkers/spell-checking/README.org @@ -85,7 +85,7 @@ set the layer variable =enable-flyspell-auto-completion= to t: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layers - '((spell-checking :variables =enable-flyspell-auto-completion= t))) + '((spell-checking :variables enable-flyspell-auto-completion t))) #+END_SRC * Key Bindings diff --git a/layers/+checkers/spell-checking/config.el b/layers/+checkers/spell-checking/config.el index 96664d2..7d4f361 100644 --- a/layers/+checkers/spell-checking/config.el +++ b/layers/+checkers/spell-checking/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Spell Checking Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+checkers/spell-checking/funcs.el b/layers/+checkers/spell-checking/funcs.el index cf8a36c..9dabb5d 100644 --- a/layers/+checkers/spell-checking/funcs.el +++ b/layers/+checkers/spell-checking/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spell Checking Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+checkers/spell-checking/packages.el b/layers/+checkers/spell-checking/packages.el index f103430..6085585 100644 --- a/layers/+checkers/spell-checking/packages.el +++ b/layers/+checkers/spell-checking/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spell Checking Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -75,13 +75,22 @@ (spacemacs/set-leader-keys "Sc" 'flyspell-correct-previous-word-generic))) (defun spell-checking/init-flyspell-correct-ivy () - (use-package flyspell-correct-ivy)) + (use-package flyspell-correct-ivy + :commands (flyspell-correct-ivy) + :init + (setq flyspell-correct-interface #'flyspell-correct-ivy))) (defun spell-checking/init-flyspell-correct-helm () - (use-package flyspell-correct-helm)) + (use-package flyspell-correct-helm + :commands (flyspell-correct-helm) + :init + (setq flyspell-correct-interface #'flyspell-correct-helm))) (defun spell-checking/init-flyspell-correct-popup () - (use-package flyspell-correct-popup)) + (use-package flyspell-correct-popup + :commands (flyspell-correct-popup) + :init + (setq flyspell-correct-interface #'flyspell-correct-popup))) (defun spell-checking/init-flyspell-popup () (use-package flyspell-popup diff --git a/layers/+checkers/syntax-checking/README.org b/layers/+checkers/syntax-checking/README.org index a4c9aa6..e556fb4 100644 --- a/layers/+checkers/syntax-checking/README.org +++ b/layers/+checkers/syntax-checking/README.org @@ -31,9 +31,9 @@ to =nil=: #+END_SRC ** Disabling by default -By default, syntax-checking is enabled in all available major modes and may be -toggled off with ~SPC t s~. You can default this to off by setting the variable -=syntax-checking-enable-by-default= to =nil=: +By default, syntax-checking is enabled in all available major modes (except for +=emacs-lisp-mode=) and may be toggled off with ~SPC t s~. You can default this to off +by setting the variable =syntax-checking-enable-by-default= to =nil=: #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layers diff --git a/layers/+checkers/syntax-checking/config.el b/layers/+checkers/syntax-checking/config.el index 65c495e..129c4bc 100644 --- a/layers/+checkers/syntax-checking/config.el +++ b/layers/+checkers/syntax-checking/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Syntax Checking Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+checkers/syntax-checking/funcs.el b/layers/+checkers/syntax-checking/funcs.el index be0f54b..c8abab0 100644 --- a/layers/+checkers/syntax-checking/funcs.el +++ b/layers/+checkers/syntax-checking/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Syntax Checking Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+checkers/syntax-checking/packages.el b/layers/+checkers/syntax-checking/packages.el index 874fade..f524e7e 100644 --- a/layers/+checkers/syntax-checking/packages.el +++ b/layers/+checkers/syntax-checking/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Syntax Checking Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+completion/auto-completion/README.org b/layers/+completion/auto-completion/README.org index 0b46a63..cee6930 100644 --- a/layers/+completion/auto-completion/README.org +++ b/layers/+completion/auto-completion/README.org @@ -27,7 +27,7 @@ This layer provides auto-completion to Spacemacs. The following completion engines are supported: - [[http://company-mode.github.io/][company]] -- [[http://auto-complete.org/][auto-complete]] +- [[https://github.com/auto-complete/auto-complete][auto-complete]] Snippets are supported via [[https://github.com/capitaomorte/yasnippet][yasnippet]] and [[https://github.com/abo-abo/auto-yasnippet][auto-yasnippet]]. @@ -81,10 +81,10 @@ you don't use it already. ** Snippets directories The following directories are added by default: -- ~/.emacs.d/elpa/yasnippet-xxxxx/snippets -- ~/.emacs.d/layers/auto-completion/snippets -- ~/.emacs.d/private/snippets (conditional to the value of =auto-completion-private-snippets-directory=) -- ~/.spacemacs.d/snippets (conditional to the existence of =~/.spacemacs.d= directory) +- =~/.emacs.d/elpa/yasnippet-xxxxx/snippets= +- =~/.emacs.d/layers/auto-completion/snippets= +- =~/.emacs.d/private/snippets= (conditional to the value of =auto-completion-private-snippets-directory=) +- =~/.spacemacs.d/snippets= (conditional to the existence of =~/.spacemacs.d= directory) You can provide additional directories by setting the variable =auto-completion-private-snippets-directory= which can take a string in case of @@ -142,7 +142,7 @@ for a given mode. You may want to enable company globally to get auto-completion everywhere even in the modes which are not configured by Spacemacs. To do so, you just have to add =(global-company-mode)= in the -=dotspacemacs/user -config= function of your dotfile. +=dotspacemacs/user-config= function of your dotfile. Note that if you want to enable =auto-complete= globally you will have to disable =company= first, see the next section to do so. @@ -192,7 +192,7 @@ your ~.spacemacs~ file with (e.g.) '((auto-completion :variables spacemacs-default-company-backends '(company-files company-capf)))) #+END_SRC - + ** Improved faces For nicer-looking faces, try adding the following to `custom-set-faces` in your dotspacemacs file. diff --git a/layers/+completion/auto-completion/config.el b/layers/+completion/auto-completion/config.el index 6e63c8e..236ded9 100644 --- a/layers/+completion/auto-completion/config.el +++ b/layers/+completion/auto-completion/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Auto-completion configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+completion/auto-completion/funcs.el b/layers/+completion/auto-completion/funcs.el index ceb2cea..dbff0a0 100644 --- a/layers/+completion/auto-completion/funcs.el +++ b/layers/+completion/auto-completion/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Auto-completion functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -232,7 +232,7 @@ "Call `yas-expand' and switch to `insert state'" (interactive) (call-interactively 'aya-expand) - (unless holy-mode (evil-insert-state))) + (evil-insert-state)) ;; Yasnippet and Smartparens diff --git a/layers/+completion/auto-completion/packages.el b/layers/+completion/auto-completion/packages.el index 5420240..fed9260 100644 --- a/layers/+completion/auto-completion/packages.el +++ b/layers/+completion/auto-completion/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Auto-completion Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,6 +16,7 @@ company (company-quickhelp :toggle auto-completion-enable-help-tooltip) company-statistics + fuzzy (helm-company :toggle (configuration-layer/package-usedp 'helm)) (helm-c-yasnippet :toggle (configuration-layer/package-usedp 'helm)) hippie-exp @@ -112,6 +113,9 @@ "company-statistics-cache.el")) (add-hook 'company-mode-hook 'company-statistics-mode)))) +(defun auto-completion/init-fuzzy () + (use-package fuzzy :defer t)) + (defun auto-completion/init-company-quickhelp () (use-package company-quickhelp :commands company-quickhelp-manual-begin diff --git a/layers/+completion/helm/funcs.el b/layers/+completion/helm/funcs.el index 65e8923..d11a075 100644 --- a/layers/+completion/helm/funcs.el +++ b/layers/+completion/helm/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Helm Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -213,3 +213,12 @@ Ensure that helm is required before calling FUNC." (line-number-at-pos)) spacemacs--gne-line-func 'helm-grep-action next-error-function 'spacemacs/gne-next))) + + +;; theme + +(defun spacemacs/helm-themes () + "Remove limit on number of candidates on `helm-themes'" + (interactive) + (let (helm-candidate-number-limit) + (helm-themes))) diff --git a/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-faq.el b/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-faq.el new file mode 100644 index 0000000..b588e3d --- /dev/null +++ b/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-faq.el @@ -0,0 +1,85 @@ +;;; helm-spacemacs-help.el --- Spacemacs layer exploration with `helm'. + +;; Author: Sylvain Benner +;; Keywords: helm, spacemacs +;; Version: 0.1 +;; Package-Requires: ((helm "1.5")) + +;; 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 3, 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., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. + +;;; Commentary: +;; This package adds a convenient way to discover Spacemacs FAQs in a +;; a helm buffer. +;; These sources are not part of `helm-spacemacs-help' feature because +;; of its `org' dependency which triggers lots of `require'. + +;;; Code: + +(require 'helm-spacemacs-help) +(require 'helm-org) + +(defvar helm-spacemacs-help--faq-filename + (concat spacemacs-docs-directory "FAQ.org") + "Location of the FAQ file.") + +;;;###autoload +(defun helm-spacemacs-help-faq () + "Helm session to search for the FAQ." + (interactive) + (helm-spacemacs-help-mode) + (helm :buffer "*helm: spacemacs*" + :sources `(,(helm-spacemacs-help//faq-source)))) + +(defun helm-spacemacs-help//faq-source () + "Construct the helm source for the FAQ." + `((name . "FAQ") + (candidates . ,(helm-spacemacs-help//faq-candidates)) + (candidate-number-limit) + (action . (("Go to question" . helm-spacemacs-help//faq-goto-marker))))) + +(defun helm-spacemacs-help//faq-candidate (cand) + (let ((str (substring-no-properties (car cand)))) + (when (string-match "\\`.*/\\([^/]*\\)/\\(.*\\)\\'" str) + (cons (concat (propertize + (match-string 1 str) + 'face 'font-lock-type-face) + ": " (match-string 2 str)) + (cdr cand))))) + +(defun helm-spacemacs-help//faq-candidates () + (let* ((helm-org-format-outline-path nil) + (cands (helm-org-get-candidates (list helm-spacemacs-help--faq-filename))) + section result) + (dolist (c cands) + (let ((str (substring-no-properties (car c)))) + (when (string-match "\\`\\* \\(.*\\)\\'" str) + (setq section (match-string 1 str))) + (when (string-match "\\`\\*\\* \\(.*\\)\\'" str) + (push (cons (concat (propertize section 'face 'font-lock-type-face) + ": " (match-string 1 str)) + (cdr c)) + result)))) + result)) + +(defun helm-spacemacs-help//faq-goto-marker (marker) + (find-file helm-spacemacs-help--faq-filename) + (goto-char marker) + (org-show-context) + (org-show-entry)) + +(provide 'helm-spacemacs-faq) + +;;; helm-spacemacs-faq.el ends here diff --git a/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-help.el b/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-help.el index e4c5375..cf445b4 100644 --- a/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-help.el +++ b/layers/+completion/helm/local/helm-spacemacs-help/helm-spacemacs-help.el @@ -30,7 +30,6 @@ (require 'ht) (require 'helm) (require 'helm-command) -(require 'helm-org) (require 'core-configuration-layer) (defvar helm-spacemacs--initialized nil @@ -44,13 +43,8 @@ (defun helm-spacemacs-help//init (&optional arg) (when (or arg (null helm-spacemacs--initialized)) - (let ((configuration-layer--load-packages-files t) - (configuration-layer--package-properties-read-onlyp t) - (configuration-layer--inhibit-warnings t)) - (configuration-layer/discover-layers) - (configuration-layer/declare-layers (configuration-layer/get-layers-list)) - (configuration-layer/make-all-packages) - (setq helm-spacemacs--initialized t)))) + (configuration-layer/make-all-packages) + (setq helm-spacemacs--initialized t))) ;;;###autoload (defun helm-spacemacs-help (arg) @@ -63,8 +57,7 @@ ,(helm-spacemacs-help//layer-source) ,(helm-spacemacs-help//package-source) ,(helm-spacemacs-help//dotspacemacs-source) - ,(helm-spacemacs-help//toggle-source) - ,(helm-spacemacs-help//faq-source)))) + ,(helm-spacemacs-help//toggle-source)))) ;;;###autoload (defun helm-spacemacs-help-dotspacemacs () @@ -107,14 +100,6 @@ (helm :buffer "*helm: spacemacs*" :sources `(,(helm-spacemacs-help//toggle-source)))) -;;;###autoload -(defun helm-spacemacs-help-faq () - "Helm session to search for the FAQ." - (interactive) - (helm-spacemacs-help-mode) - (helm :buffer "*helm: spacemacs*" - :sources `(,(helm-spacemacs-help//faq-source)))) - (defun helm-spacemacs-help//documentation-source () "Construct the helm source for the documentation section." (helm-build-sync-source "Spacemacs Documentation" @@ -143,6 +128,8 @@ ;; give each document an appropriate title (mapcar (lambda (r) (cond + ((string-equal r "BEGINNERS_TUTORIAL.org") + `("Beginners tutorial" . ,r)) ((string-equal r "CONTRIBUTING.org") `("How to contribute to Spacemacs" . ,r)) ((string-equal r "CONVENTIONS.org") @@ -369,47 +356,6 @@ (re-search-forward (format "^[a-z\s\\(\\-]*%s" candidate)) (beginning-of-line)) -(defvar helm-spacemacs-help--faq-filename - (concat spacemacs-docs-directory "FAQ.org") - "Location of the FAQ file.") - -(defun helm-spacemacs-help//faq-source () - "Construct the helm source for the FAQ." - `((name . "FAQ") - (candidates . ,(helm-spacemacs-help//faq-candidates)) - (candidate-number-limit) - (action . (("Go to question" . helm-spacemacs-help//faq-goto-marker))))) - -(defun helm-spacemacs-help//faq-candidate (cand) - (let ((str (substring-no-properties (car cand)))) - (when (string-match "\\`.*/\\([^/]*\\)/\\(.*\\)\\'" str) - (cons (concat (propertize - (match-string 1 str) - 'face 'font-lock-type-face) - ": " (match-string 2 str)) - (cdr cand))))) - -(defun helm-spacemacs-help//faq-candidates () - (let* ((helm-org-format-outline-path nil) - (cands (helm-org-get-candidates (list helm-spacemacs-help--faq-filename))) - section result) - (dolist (c cands) - (let ((str (substring-no-properties (car c)))) - (when (string-match "\\`\\* \\(.*\\)\\'" str) - (setq section (match-string 1 str))) - (when (string-match "\\`\\*\\* \\(.*\\)\\'" str) - (push (cons (concat (propertize section 'face 'font-lock-type-face) - ": " (match-string 1 str)) - (cdr c)) - result)))) - result)) - -(defun helm-spacemacs-help//faq-goto-marker (marker) - (find-file helm-spacemacs-help--faq-filename) - (goto-char marker) - (org-show-context) - (org-show-entry)) - (provide 'helm-spacemacs-help) ;;; helm-spacemacs-help.el ends here diff --git a/layers/+completion/helm/packages.el b/layers/+completion/helm/packages.el index c4d13be..275c2a0 100644 --- a/layers/+completion/helm/packages.el +++ b/layers/+completion/helm/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Helm Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -24,7 +24,9 @@ helm-swoop helm-themes (helm-spacemacs-help :location local) + (helm-spacemacs-faq :location local) imenu + persp-mode popwin projectile )) @@ -182,7 +184,7 @@ (defun spacemacs/helm-file-do-ag (&optional _) "Wrapper to execute `helm-ag-this-file.'" (interactive) - (helm-ag-this-file)) + (helm-do-ag-this-file)) (defun spacemacs/helm-file-do-ag-region-or-symbol () "Search in current file with `ag' using a default input." @@ -525,25 +527,19 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." helm-spacemacs-help-packages helm-spacemacs-help-docs helm-spacemacs-help-toggles) - :init - (progn - (defun spacemacs-base/helm-spacemacs-deprecated (arg) - "Provide helm-spacemacs with a binding's depreciation message." - (interactive "P") - (warn (concat "The 'SPC f e h' (or 'M-m f e h') binding is now " - "deprecated and will be remove in the next release. " - "Please use 'SPC h SPC' (or 'M-m h SPC') instead.")) - (helm-spacemacs arg)) - (spacemacs/set-leader-keys "feh" 'spacemacs-base/helm-spacemacs-deprecated) - (spacemacs/set-leader-keys "fef" 'helm-spacemacs-help-faq) - (spacemacs/set-leader-keys - "h ." 'helm-spacemacs-help-dotspacemacs - "h SPC" 'helm-spacemacs-help - "h f" 'helm-spacemacs-help-faq - "h l" 'helm-spacemacs-help-layers - "h p" 'helm-spacemacs-help-packages - "h r" 'helm-spacemacs-help-docs - "h t" 'helm-spacemacs-help-toggles)))) + :init (spacemacs/set-leader-keys + "h ." 'helm-spacemacs-help-dotspacemacs + "h SPC" 'helm-spacemacs-help + "h f" 'helm-spacemacs-help-faq + "h l" 'helm-spacemacs-help-layers + "h p" 'helm-spacemacs-help-packages + "h r" 'helm-spacemacs-help-docs + "h t" 'helm-spacemacs-help-toggles))) + +(defun helm/init-helm-spacemacs-faq () + (use-package helm-spacemacs-faq + :commands helm-spacemacs-help-faq + :init (spacemacs/set-leader-keys "h f" 'helm-spacemacs-help-faq))) (defun helm/init-helm-swoop () (use-package helm-swoop @@ -580,7 +576,7 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." :defer t :init (spacemacs/set-leader-keys - "Ts" 'helm-themes))) + "Ts" 'spacemacs/helm-themes))) (defun helm/post-init-imenu () (spacemacs/set-leader-keys "ji" 'spacemacs/helm-jump-in-buffer)) @@ -593,3 +589,8 @@ Search for a search tool in the order provided by `dotspacemacs-search-tools'." (defun helm/post-init-projectile () (setq projectile-completion-system 'helm)) + +(defun helm/post-init-persp-mode () + (setq spacemacs-layouts-transient-state-add-bindings + '(("b" spacemacs/persp-helm-mini :exit t) + ("l" spacemacs/helm-perspectives :exit t)))) diff --git a/layers/+completion/ivy/config.el b/layers/+completion/ivy/config.el index c2aa029..40ac445 100644 --- a/layers/+completion/ivy/config.el +++ b/layers/+completion/ivy/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Ivy Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -32,7 +32,7 @@ than this amount.") ("v" spacemacs/find-file-vsplit "in vertical split") ("s" spacemacs/find-file-split "in horizontal split") ("l" find-file-literally "literally") - ("d" spacemacs/delete-file "delete file") + ("d" spacemacs/delete-file-confirm "delete file") ("r" spacemacs/rename-file "rename file")) "Default ivy actions for files.") diff --git a/layers/+completion/ivy/funcs.el b/layers/+completion/ivy/funcs.el index 94973f9..0d058a4 100644 --- a/layers/+completion/ivy/funcs.el +++ b/layers/+completion/ivy/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Ivy Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -96,6 +96,12 @@ (spacemacs//gne-init-counsel)) (pop-to-buffer buf)))) +(defun spacemacs//counsel-edit () + "Edit the current search results in a buffer using wgrep." + (interactive) + (run-with-idle-timer 0 nil 'ivy-wgrep-change-to-wgrep-mode) + (ivy-occur)) + (defun spacemacs//gne-init-counsel () (with-current-buffer "*ivy results*" (setq spacemacs--gne-min-line 1 @@ -113,6 +119,7 @@ (defvar spacemacs--counsel-map (let ((map (make-sparse-keymap))) (define-key map (kbd "") 'spacemacs//counsel-save-in-buffer) + (define-key map (kbd "C-c C-e") 'spacemacs//counsel-edit) map)) ;; see `counsel-ag' diff --git a/layers/+completion/ivy/layers.el b/layers/+completion/ivy/layers.el index 865828a..eea5f16 100644 --- a/layers/+completion/ivy/layers.el +++ b/layers/+completion/ivy/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Ivy Layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+completion/ivy/local/ivy-spacemacs-help/ivy-spacemacs-help.el b/layers/+completion/ivy/local/ivy-spacemacs-help/ivy-spacemacs-help.el index fdef1af..5db6e3f 100644 --- a/layers/+completion/ivy/local/ivy-spacemacs-help/ivy-spacemacs-help.el +++ b/layers/+completion/ivy/local/ivy-spacemacs-help/ivy-spacemacs-help.el @@ -42,13 +42,8 @@ (defun ivy-spacemacs-help//init (&optional arg) (when (or arg (null ivy-spacemacs--initialized)) - (let ((configuration-layer--load-packages-files t) - (configuration-layer--package-properties-read-onlyp t) - (configuration-layer--inhibit-warnings t)) - (configuration-layer/discover-layers) - (configuration-layer/declare-layers (configuration-layer/get-layers-list)) - (configuration-layer/make-all-packages) - (setq ivy-spacemacs--initialized t)))) + (configuration-layer/make-all-packages) + (setq ivy-spacemacs--initialized t))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Docs diff --git a/layers/+completion/ivy/packages.el b/layers/+completion/ivy/packages.el index 5881475..d179c2c 100644 --- a/layers/+completion/ivy/packages.el +++ b/layers/+completion/ivy/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Ivy Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -12,6 +12,7 @@ (setq ivy-packages '( auto-highlight-symbol + bookmark counsel (counsel-projectile :toggle (configuration-layer/package-usedp 'projectile)) evil @@ -191,9 +192,9 @@ '(("c" persp-kill-without-buffers "Close layout(s)") ("k" persp-kill "Kill layout(s)"))) (setq spacemacs-layouts-transient-state-remove-bindings - '("b" "l" "C" "X")) + '("C" "X")) (setq spacemacs-layouts-transient-state-add-bindings - '(("b" spacemacs/ivy-spacemacs-layout-buffer) + '(("b" spacemacs/ivy-spacemacs-layout-buffer :exit t) ("l" spacemacs/ivy-spacemacs-layouts :exit t) ("C" spacemacs/ivy-spacemacs-layout-close-other :exit t) ("X" spacemacs/ivy-spacemacs-layout-kill-other :exit t)))) @@ -203,6 +204,9 @@ (spacemacs/set-leader-keys "pv" 'projectile-vc)) +(defun ivy/post-init-bookmark () + (spacemacs/set-leader-keys "fb" 'counsel-bookmark)) + (defun ivy/init-smex () (use-package smex :defer t diff --git a/layers/+distributions/spacemacs-base/config.el b/layers/+distributions/spacemacs-base/config.el index 8fededb..2abc0a3 100644 --- a/layers/+distributions/spacemacs-base/config.el +++ b/layers/+distributions/spacemacs-base/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Spacemacs Base Layer configuration File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -18,6 +18,7 @@ ;; Also auto refresh dired, but be quiet about it (setq global-auto-revert-non-file-buffers t auto-revert-verbose nil) +(add-to-list 'global-auto-revert-ignore-modes 'Buffer-menu-mode) ;; Make dired "guess" target directory for some operations, like copy to ;; directory visited in other split buffer. @@ -134,9 +135,7 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'." ;; but IS available during the subsequent config reloads (if (fboundp 'spacemacs/toggle-fullscreen-frame-on) (spacemacs/toggle-fullscreen-frame-on) - (spacemacs/toggle-frame-fullscreen)) - (if dotspacemacs-maximized-at-startup - (add-hook 'window-setup-hook 'toggle-frame-maximized))) + (spacemacs/toggle-frame-fullscreen))) (setq ns-use-native-fullscreen (not dotspacemacs-fullscreen-use-non-native)) diff --git a/layers/+distributions/spacemacs-base/funcs.el b/layers/+distributions/spacemacs-base/funcs.el index c4550ab..9e49d39 100644 --- a/layers/+distributions/spacemacs-base/funcs.el +++ b/layers/+distributions/spacemacs-base/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Base Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -47,6 +47,8 @@ the current state and point position." (dotimes (_ count) (save-excursion (evil-insert-newline-below)))) (defun spacemacs/evil-goto-next-line-and-indent (&optional count) + "Match the current lines indentation to the next line. +A COUNT argument matches the indentation to the next COUNT lines." (interactive "p") (let ((counter (or count 1))) (while (> counter 0) @@ -148,41 +150,113 @@ automatically applied to." "Determines if a buffer is useless." (not (spacemacs/useful-buffer-p buffer))) -;; from magnars modified by ffevotte for dedicated windows support -(defun spacemacs/rotate-windows (count) + +(defun spacemacs/swap-windows (window1 window2) + "Swap two windows. +WINDOW1 and WINDOW2 must be valid windows. They may contain child +windows." + (let ((state1 (window-state-get window1)) + (state2 (window-state-get window2))) + ;; to put state into dedicated windows, we must undedicate them first (not + ;; needed with Emacs 25.1) + (dolist (win (list window1 window2)) + (if (window-live-p win) + (set-window-dedicated-p win nil) + ;; win has sub-windows, undedicate all of them + (walk-window-subtree (lambda (leaf-window) + (set-window-dedicated-p leaf-window nil)) + win))) + (window-state-put state1 window2) + (window-state-put state2 window1))) + +;; from @bmag +(defun spacemacs/window-layout-toggle () + "Toggle between horizontal and vertical layout of two windows." + (interactive) + (if (= (count-windows) 2) + (let* ((window-tree (car (window-tree))) + (current-split-vertical-p (car window-tree)) + (first-window (nth 2 window-tree)) + (second-window (nth 3 window-tree)) + (second-window-state (window-state-get second-window)) + (splitter (if current-split-vertical-p + #'split-window-horizontally + #'split-window-vertically))) + (delete-other-windows first-window) + ;; `window-state-put' also re-selects the window if needed, so we don't + ;; need to call `select-window' + (window-state-put second-window-state (funcall splitter))) + (error "Can't toggle window layout when the number of windows isn't two."))) + +;; originally from magnars and modified by ffevotte for dedicated windows +;; support, it has quite diverged by now +(defun spacemacs/rotate-windows-forward (count) "Rotate each window forwards. A negative prefix argument rotates each window backwards. Dedicated (locked) windows are left untouched." (interactive "p") - (let* ((non-dedicated-windows (remove-if 'window-dedicated-p (window-list))) + (let* ((non-dedicated-windows (cl-remove-if 'window-dedicated-p (window-list))) + (states (mapcar #'window-state-get non-dedicated-windows)) (num-windows (length non-dedicated-windows)) - (i 0) (step (+ num-windows count))) - (cond ((not (> num-windows 1)) - (message "You can't rotate a single window!")) - (t - (dotimes (counter (- num-windows 1)) - (let* ((next-i (% (+ step i) num-windows)) - - (w1 (elt non-dedicated-windows i)) - (w2 (elt non-dedicated-windows next-i)) - - (b1 (window-buffer w1)) - (b2 (window-buffer w2)) - - (s1 (window-start w1)) - (s2 (window-start w2))) - (set-window-buffer w1 b2) - (set-window-buffer w2 b1) - (set-window-start w1 s2) - (set-window-start w2 s1) - (setq i next-i))))))) + (if (< num-windows 2) + (error "You can't rotate a single window!") + (dotimes (i num-windows) + (window-state-put + (elt states i) + (elt non-dedicated-windows (% (+ step i) num-windows))))))) (defun spacemacs/rotate-windows-backward (count) "Rotate each window backwards. Dedicated (locked) windows are left untouched." (interactive "p") - (spacemacs/rotate-windows (* -1 count))) + (spacemacs/rotate-windows-forward (* -1 count))) + +(defun spacemacs/move-buffer-to-window (windownum follow-focus-p) + "Moves a buffer to a window, using the spacemacs numbering. follow-focus-p + controls whether focus moves to new window (with buffer), or stays on + current" + (interactive) + (let ((b (current-buffer)) + (w1 (selected-window)) + (w2 (winum-get-window-by-number windownum))) + (unless (eq w1 w2) + (set-window-buffer w2 b) + (switch-to-prev-buffer) + (unrecord-window-buffer w1 b))) + (when follow-focus-p (select-window (winum-get-window-by-number windownum)))) + +(defun spacemacs/swap-buffers-to-window (windownum follow-focus-p) + "Swaps visible buffers between active window and selected window. + follow-focus-p controls whether focus moves to new window (with buffer), or + stays on current" + (interactive) + (let* ((b1 (current-buffer)) + (w1 (selected-window)) + (w2 (winum-get-window-by-number windownum)) + (b2 (window-buffer w2))) + (unless (eq w1 w2) + (set-window-buffer w1 b2) + (set-window-buffer w2 b1) + (unrecord-window-buffer w1 b1) + (unrecord-window-buffer w2 b2))) + (when follow-focus-p (select-window-by-number windownum))) + +(dotimes (i 9) + (let ((n (+ i 1))) + (eval `(defun ,(intern (format "buffer-to-window-%s" n)) (&optional arg) + ,(format "Move buffer to the window with number %i." n) + (interactive "P") + (if arg + (spacemacs/swap-buffers-to-window ,n t) + (spacemacs/move-buffer-to-window ,n t)))) + (eval `(defun ,(intern (format "move-buffer-window-no-follow-%s" n)) () + (interactive) + (spacemacs/move-buffer-to-window ,n nil))) + (eval `(defun ,(intern (format "swap-buffer-window-no-follow-%s" n)) () + (interactive) + (spacemacs/swap-buffers-to-window ,n nil))) + )) (defun spacemacs/rename-file (filename &optional new-filename) "Rename FILENAME to NEW-FILENAME. @@ -221,11 +295,11 @@ projectile cache when it's possible and update recentf list." "Renames current buffer and file it is visiting." (interactive) (let* ((name (buffer-name)) - (filename (buffer-file-name)) - (dir (file-name-directory filename))) + (filename (buffer-file-name))) (if (not (and filename (file-exists-p filename))) (error "Buffer '%s' is not visiting a file!" name) - (let ((new-name (read-file-name "New name: " dir))) + (let* ((dir (file-name-directory filename)) + (new-name (read-file-name "New name: " dir))) (cond ((get-buffer new-name) (error "A buffer named '%s' already exists!" new-name)) (t @@ -264,6 +338,13 @@ removal." (projectile-project-p)) (call-interactively #'projectile-invalidate-cache))))) +(defun spacemacs/delete-file-confirm (filename) + "Remove specified file or directory after users approval. + +FILENAME is deleted using `spacemacs/delete-file' function.." + (interactive "f") + (funcall-interactively #'spacemacs/delete-file filename t)) + ;; from magnars (defun spacemacs/delete-current-buffer-file () "Removes file connected to current buffer and kills buffer." @@ -283,7 +364,7 @@ removal." ;; from magnars (defun spacemacs/sudo-edit (&optional arg) - (interactive "p") + (interactive "P") (let ((fname (if (or arg (not buffer-file-name)) (read-file-name "File: ") buffer-file-name))) @@ -710,23 +791,68 @@ the right." (interactive) (call-interactively 'write-file)) +;; from https://www.emacswiki.org/emacs/CopyingWholeLines +(defun spacemacs/duplicate-line-or-region (&optional n) + "Duplicate current line, or region if active. +With argument N, make N copies. +With negative N, comment out original line and use the absolute value." + (interactive "*p") + (let ((use-region (use-region-p))) + (save-excursion + (let ((text (if use-region ; Get region if active, otherwise line + (buffer-substring (region-beginning) (region-end)) + (prog1 (thing-at-point 'line) + (end-of-line) + (if (< 0 (forward-line 1)) ; Go to beginning of next line, or make a new one + (newline)))))) + (dotimes (i (abs (or n 1))) ; Insert N times, or once if not specified + (insert text)))) + (if use-region nil ; Only if we're working with a line (not a region) + (let ((pos (- (point) (line-beginning-position)))) ; Save column + (if (> 0 n) ; Comment out original with negative arg + (comment-region (line-beginning-position) (line-end-position))) + (forward-line 1) + (forward-char pos))))) + (defun spacemacs/uniquify-lines () - "Remove duplicate adjacent lines in region or current buffer" + "Remove duplicate adjacent lines in a region or the current buffer" (interactive) (save-excursion (save-restriction - (let ((beg (if (region-active-p) (region-beginning) (point-min))) - (end (if (region-active-p) (region-end) (point-max)))) + (let* ((region-active (or (region-active-p) (evil-visual-state-p))) + (beg (if region-active (region-beginning) (point-min))) + (end (if region-active (region-end) (point-max)))) (goto-char beg) (while (re-search-forward "^\\(.*\n\\)\\1+" end t) (replace-match "\\1")))))) -(defun spacemacs/sort-lines () - "Sort lines in region or current buffer" +(defun spacemacs/sort-lines (&optional reverse) + "Sort lines in a region or the current buffer. +A non-nil argument sorts in reverse order." + (interactive "P") + (let* ((region-active (or (region-active-p) (evil-visual-state-p))) + (beg (if region-active (region-beginning) (point-min))) + (end (if region-active (region-end) (point-max)))) + (sort-lines reverse beg end))) + +(defun spacemacs/sort-lines-reverse () + "Sort lines in reverse order, in a region or the current buffer." + (interactive) + (spacemacs/sort-lines -1)) + +(defun spacemacs/sort-lines-by-column (&optional reverse) + "Sort lines by the selected column. +A non-nil argument sorts in reverse order." + (interactive "P") + (let* ((region-active (or (region-active-p) (evil-visual-state-p))) + (beg (if region-active (region-beginning) (point-min))) + (end (if region-active (region-end) (point-max)))) + (sort-columns reverse beg end))) + +(defun spacemacs/sort-lines-by-column-reverse () + "Sort lines by the selected column in reverse order." (interactive) - (let ((beg (if (region-active-p) (region-beginning) (point-min))) - (end (if (region-active-p) (region-end) (point-max)))) - (sort-lines nil beg end))) + (spacemacs/sort-lines-by-column -1)) ;; BEGIN linum mouse helpers @@ -767,16 +893,12 @@ the right." (defun spacemacs/select-current-block () "Select the current block of text between blank lines." (interactive) - (let (p1 p2) - (progn - (if (re-search-backward "\n[ \t]*\n" nil "move") - (progn (re-search-forward "\n[ \t]*\n") - (setq p1 (point))) - (setq p1 (point))) - (if (re-search-forward "\n[ \t]*\n" nil "move") - (progn (re-search-backward "\n[ \t]*\n") - (setq p2 (point))) - (setq p2 (point)))) + (let (p1) + (when (re-search-backward "\n[ \t]*\n" nil "move") + (re-search-forward "\n[ \t]*\n")) + (setq p1 (point)) + (if (re-search-forward "\n[ \t]*\n" nil "move") + (re-search-backward "\n[ \t]*\n")) (set-mark p1))) ;; END linum mouse helpers @@ -802,7 +924,10 @@ the right." "Count how many times each word is used in the region. Punctuation is ignored." (interactive "r") - (let (words alist_words_compare (formated "")) + (let (words + alist_words_compare + (formated "") + (overview (call-interactively 'count-words))) (save-excursion (goto-char start) (while (re-search-forward "\\w+" end t) @@ -829,7 +954,9 @@ Compare them on count first,and in case of tie sort them alphabetically." (setq formated (concat formated (format "[%s: %d], " name count))))) (when (interactive-p) (if (> (length formated) 2) - (message (substring formated 0 -2)) + (message (format "%s\nWord count: %s" + overview + (substring formated 0 -2))) (message "No words."))) words)) @@ -894,12 +1021,29 @@ a split-side entry, its value must be usable as the SIDE argument for (when compilation-last-buffer (delete-windows-on compilation-last-buffer))) + +;; Line number + (defun spacemacs/no-linum (&rest ignore) "Disable linum if current buffer." (when (or 'linum-mode global-linum-mode) (linum-mode 0))) -(defun spacemacs/linum-update-window-scale-fix (win) +(defun spacemacs/enable-line-numbers-p () + "Return non-nil if line numbers should be enabled for current buffer. +Decision is based on `dotspacemacs-line-numbers'." + (and dotspacemacs-line-numbers + (spacemacs//linum-current-buffer-is-not-special) + (spacemacs//linum-curent-buffer-is-not-too-big) + (or (spacemacs//linum-backward-compabitility) + (spacemacs//linum-enabled-for-current-major-mode)))) + +(defun spacemacs//linum-on (origfunc &rest args) + "Advice function to improve `linum-on' function." + (when (spacemacs/enable-line-numbers-p) + (apply origfunc args))) + +(defun spacemacs//linum-update-window-scale-fix (win) "Fix linum for scaled text in the window WIN." (set-window-margins win (ceiling (* (if (boundp 'text-scale-mode-step) @@ -908,3 +1052,51 @@ a split-side entry, its value must be usable as the SIDE argument for (if (car (window-margins)) (car (window-margins)) 1))))) +(defun spacemacs//linum-backward-compabitility () + "Return non-nil if `dotspacemacs-line-numbers' has an old format and if +`linum' should be enabled." + (and dotspacemacs-line-numbers + (not (listp dotspacemacs-line-numbers)) + (or (eq dotspacemacs-line-numbers t) + (eq dotspacemacs-line-numbers 'relative)))) + +(defun spacemacs//linum-current-buffer-is-not-special () + "Return non-nil if current buffer is not a special buffer." + (not (string-match-p "\\*.*\\*" (buffer-name)))) + +(defun spacemacs//linum-curent-buffer-is-not-too-big () + "Return non-nil if buffer size is not too big." + (not (and (listp dotspacemacs-line-numbers) + (spacemacs/mplist-get dotspacemacs-line-numbers :size-limit-kb) + (> (buffer-size) + (* 1000 (car (spacemacs/mplist-get dotspacemacs-line-numbers + :size-limit-kb))))))) + +;; mode in :enabled, not in :disabled ==> t +;; mode not in :enabled, in :disabled ==> nil +;; mode in :enabled, parent in :disabled ==> t +;; parent in :enabled, mode in :disabled ==> nil +;; not in :enabled, not in :disabled, :enabled is empty ==> t +;; not in :enabled, not in :disabled, :enabled is not empty ==> nil +;; both :enabled and :disabled are empty ==> t +(defun spacemacs//linum-enabled-for-current-major-mode () + "Return non-nil if line number is enabled for current major-mode." + (let* ((enabled-for-modes (spacemacs/mplist-get dotspacemacs-line-numbers + :enabled-for-modes)) + (disabled-for-modes (spacemacs/mplist-get dotspacemacs-line-numbers + :disabled-for-modes)) + (enabled-for-parent (apply #'derived-mode-p enabled-for-modes)) + (disabled-for-parent (apply #'derived-mode-p disabled-for-modes))) + (or + ;; current mode or a parent is in :enabled-for-modes, and there isn't a + ;; more specific parent (or the mode itself) in :disabled-for-modes + (and enabled-for-parent + ;; handles the case where current major-mode has a parent both in + ;; :enabled-for-modes and in :disabled-for-modes. Return non-nil if + ;; enabled-for-parent is the more specific parent (IOW doesn't derive + ;; from disabled-for-parent) + (not (spacemacs/derived-mode-p enabled-for-parent disabled-for-parent))) + ;; current mode (or parent) not explicitly disabled, and :enabled-for-modes + ;; not explicitly specified by user (meaning if it isn't explicitly + ;; disabled then it's enabled) + (and (null enabled-for-modes) (not disabled-for-parent))))) diff --git a/layers/+distributions/spacemacs-base/keybindings.el b/layers/+distributions/spacemacs-base/keybindings.el index bb214fb..230a424 100644 --- a/layers/+distributions/spacemacs-base/keybindings.el +++ b/layers/+distributions/spacemacs-base/keybindings.el @@ -1,6 +1,6 @@ ;;; keybindings.el --- Spacemacs Base Layer key-bindings File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -130,6 +130,10 @@ "bs" 'spacemacs/switch-to-scratch-buffer "bY" 'spacemacs/copy-whole-buffer-to-clipboard "bw" 'read-only-mode) +(dotimes (i 9) + (let ((n (+ i 1))) + (spacemacs/set-leader-keys (format "b%i" n) + (intern (format "buffer-to-window-%s" n))))) ;; Cycling settings ----------------------------------------------------------- (spacemacs/set-leader-keys "Tn" 'spacemacs/cycle-spacemacs-theme) ;; errors --------------------------------------------------------------------- @@ -229,6 +233,7 @@ "cr" 'recompile "cd" 'spacemacs/close-compilation-window) (with-eval-after-load 'compile + (evil-define-key 'motion compilation-mode-map (kbd "gf") 'find-file-at-point) (define-key compilation-mode-map "r" 'recompile) (define-key compilation-mode-map "g" nil)) ;; narrow & widen ------------------------------------------------------------- @@ -303,7 +308,15 @@ :on (hidden-mode-line-mode -1) :off (hidden-mode-line-mode) :documentation "Toggle the visibility of modeline." + :evil-leader "tmT") +(spacemacs|add-toggle display-time + :mode display-time-mode + :documentation "Display time in modeline." :evil-leader "tmt") +(spacemacs|add-toggle syntax-highlighting + :mode font-lock-mode + :documentation "Toggle syntax highlighting." + :evil-leader "ths") (spacemacs|add-toggle transparent-frame :status nil :on (spacemacs/toggle-transparency) @@ -353,6 +366,7 @@ (golden-ratio))) (spacemacs/set-leader-keys + "w TAB" 'spacemacs/alternate-window "w2" 'spacemacs/layout-double-columns "w3" 'spacemacs/layout-triple-columns "wb" 'spacemacs/switch-to-minibuffer-window @@ -380,7 +394,7 @@ "wc" 'spacemacs/toggle-centered-buffer-mode "wC" 'spacemacs/centered-buffer-mode-full-width "wo" 'other-frame - "wr" 'spacemacs/rotate-windows + "wr" 'spacemacs/rotate-windows-forward "wR" 'spacemacs/rotate-windows-backward "ws" 'split-window-below "wS" 'split-window-below-and-focus @@ -392,6 +406,7 @@ "ww" 'other-window "w/" 'split-window-right "w=" 'balance-windows + "w+" 'spacemacs/window-layout-toggle "w_" 'spacemacs/maximize-horizontally) ;; text ----------------------------------------------------------------------- (defalias 'count-region 'count-words-region) @@ -418,7 +433,11 @@ "xjl" 'set-justification-left "xjn" 'set-justification-none "xjr" 'set-justification-right + "xlc" 'spacemacs/sort-lines-by-column + "xlC" 'spacemacs/sort-lines-by-column-reverse + "xld" 'spacemacs/duplicate-line-or-region "xls" 'spacemacs/sort-lines + "xlS" 'spacemacs/sort-lines-reverse "xlu" 'spacemacs/uniquify-lines "xtc" 'transpose-chars "xtl" 'transpose-lines @@ -446,12 +465,44 @@ (spacemacs|define-transient-state buffer :title "Buffer Selection Transient State" + :doc (concat " + [_C-1_.._C-9_] goto nth window [_n_]^^ next buffer + [_1_.._9_] move buffer to nth window [_N_/_p_] previous buffer + [_M-1_.._M-9_] swap buffer w/ nth window [_d_]^^ kill buffer + ^^^^ [_q_]^^ quit") :bindings - ("n" next-buffer "next") - ("N" previous-buffer "previous") - ("p" previous-buffer "previous") - ("K" spacemacs/kill-this-buffer "kill") - ("q" nil "quit" :exit t)) + ("n" next-buffer) + ("N" previous-buffer) + ("p" previous-buffer) + ("d" spacemacs/kill-this-buffer) + ("q" nil :exit t) + ("1" move-buffer-window-no-follow-1) + ("2" move-buffer-window-no-follow-2) + ("3" move-buffer-window-no-follow-3) + ("4" move-buffer-window-no-follow-4) + ("5" move-buffer-window-no-follow-5) + ("6" move-buffer-window-no-follow-6) + ("7" move-buffer-window-no-follow-7) + ("8" move-buffer-window-no-follow-8) + ("9" move-buffer-window-no-follow-9) + ("M-1" swap-buffer-window-no-follow-1) + ("M-2" swap-buffer-window-no-follow-2) + ("M-3" swap-buffer-window-no-follow-3) + ("M-4" swap-buffer-window-no-follow-4) + ("M-5" swap-buffer-window-no-follow-5) + ("M-6" swap-buffer-window-no-follow-6) + ("M-7" swap-buffer-window-no-follow-7) + ("M-8" swap-buffer-window-no-follow-8) + ("M-9" swap-buffer-window-no-follow-9) + ("C-1" winum-select-window-1) + ("C-2" winum-select-window-2) + ("C-3" winum-select-window-3) + ("C-4" winum-select-window-4) + ("C-5" winum-select-window-5) + ("C-6" winum-select-window-6) + ("C-7" winum-select-window-7) + ("C-8" winum-select-window-8) + ("C-9" winum-select-window-9)) (spacemacs/set-leader-keys "b." 'spacemacs/buffer-transient-state/body) ;; end of Buffer transient state @@ -481,28 +532,29 @@ (spacemacs|define-transient-state window-manipulation :title "Window Manipulation Transient State" :doc (concat " - Select^^^^ Move^^^^ Split^^ Resize^^ Other^^ - ──────^^^^───────────── ────^^^^───────────── ─────^^─────────────── ──────^^──────────────────── ─────^^────────────────────────────── - [_j_/_k_] down/up [_J_/_K_] down/up [_s_] vertical [_[_] shrink horizontally [_q_] quit - [_h_/_l_] left/right [_H_/_L_] left/right [_S_] vert & follow [_]_] enlarge horizontally [_u_] restore prev layout - [_0_-_9_] window N [_r_]^^ rotate fwd [_v_] horizontal [_{_] shrink vertically [_U_] restore next layout - [_w_]^^ other window [_R_]^^ rotate bwd [_V_] horiz & follow [_}_] enlarge vertically [_d_] close current - [_o_]^^ other frame ^^^^ ^^ ^^ [_D_] close other" + Select^^^^ Move^^^^ Split^^ Resize^^ Other^^ + ──────^^^^───────────── ────^^^^──────────── ─────^^───────────── ──────^^─────────── ─────^^────────────────── + [_j_/_k_] down/up [_J_/_K_] down/up [_s_] vertical [_[_] shrink horiz [_u_] restore prev layout + [_h_/_l_] left/right [_H_/_L_] left/right [_S_] verti & follow [_]_] enlarge horiz [_U_] restore next layout + [_0_.._9_] window 0..9 [_r_]^^ rotate fwd [_v_] horizontal [_{_] shrink verti [_d_] close current + [_w_]^^ other window [_R_]^^ rotate bwd [_V_] horiz & follow [_}_] enlarge verti [_D_] close other + [_o_]^^ other frame ^^^^ ^^ ^^ " (if (configuration-layer/package-usedp 'golden-ratio) - "\n ^^^^ ^^^^ ^^ ^^ [_g_] golden-ratio %`golden-ratio-mode" - "")) + "[_g_] golden-ratio %`golden-ratio-mode" + "") + "\n ^^^^ ^^^^ ^^ ^^ [_q_] quit") :bindings ("q" nil :exit t) - ("0" select-window-0) - ("1" select-window-1) - ("2" select-window-2) - ("3" select-window-3) - ("4" select-window-4) - ("5" select-window-5) - ("6" select-window-6) - ("7" select-window-7) - ("8" select-window-8) - ("9" select-window-9) + ("0" winum-select-window-0) + ("1" winum-select-window-1) + ("2" winum-select-window-2) + ("3" winum-select-window-3) + ("4" winum-select-window-4) + ("5" winum-select-window-5) + ("6" winum-select-window-6) + ("7" winum-select-window-7) + ("8" winum-select-window-8) + ("9" winum-select-window-9) ("-" split-window-below-and-focus) ("/" split-window-right-and-focus) ("[" spacemacs/shrink-window-horizontally) @@ -528,7 +580,7 @@ ("L" evil-window-move-far-right) ("" evil-window-move-far-right) ("o" other-frame) - ("r" spacemacs/rotate-windows) + ("r" spacemacs/rotate-windows-forward) ("R" spacemacs/rotate-windows-backward) ("s" split-window-below) ("S" split-window-below-and-focus) @@ -589,20 +641,37 @@ otherwise it is scaled down." "Toggle between transparent and opaque state for FRAME. If FRAME is nil, it defaults to the selected frame." (interactive) - (let* ((alpha (frame-parameter frame 'alpha)) - (dotfile-setting (cons dotspacemacs-active-transparency - dotspacemacs-inactive-transparency))) - (set-frame-parameter - frame 'alpha - (if (not (equal alpha dotfile-setting)) - dotfile-setting - '(100 . 100))))) + (let ((alpha (frame-parameter frame 'alpha)) + (dotfile-setting (cons dotspacemacs-active-transparency + dotspacemacs-inactive-transparency))) + (if (equal alpha dotfile-setting) + (spacemacs/disable-transparency frame) + (spacemacs/enable-transparency frame dotfile-setting)))) + +(defun spacemacs/enable-transparency (&optional frame alpha) + "Enable transparency for FRAME. +If FRAME is nil, it defaults to the selected frame. +ALPHA is a pair of active and inactive transparency values. The +default value for ALPHA is based on +`dotspacemacs-active-transparency' and +`dotspacemacs-inactive-transparency'." + (interactive) + (let ((alpha-setting (or alpha + (cons dotspacemacs-active-transparency + dotspacemacs-inactive-transparency)))) + (set-frame-parameter frame 'alpha alpha-setting))) + +(defun spacemacs/disable-transparency (&optional frame) + "Disable transparency for FRAME. +If FRAME is nil, it defaults to the selected frame." + (interactive) + (set-frame-parameter frame 'alpha '(100 . 100))) (defun spacemacs/increase-transparency (&optional frame) "Increase transparency for FRAME. If FRAME is nil, it defaults to the selected frame." (interactive) - (let* ((current-alpha (car (frame-parameter frame 'alpha))) + (let* ((current-alpha (or (car (frame-parameter frame 'alpha)) 100)) (increased-alpha (- current-alpha 5))) (when (>= increased-alpha frame-alpha-lower-limit) (set-frame-parameter frame 'alpha @@ -612,7 +681,7 @@ If FRAME is nil, it defaults to the selected frame." "Decrease transparency for FRAME. If FRAME is nil, it defaults to the selected frame." (interactive) - (let* ((current-alpha (car (frame-parameter frame 'alpha))) + (let* ((current-alpha (or (car (frame-parameter frame 'alpha)) 100)) (decreased-alpha (+ current-alpha 5))) (when (<= decreased-alpha 100) (set-frame-parameter frame 'alpha diff --git a/layers/+distributions/spacemacs-base/local/centered-buffer-mode/centered-buffer-mode.el b/layers/+distributions/spacemacs-base/local/centered-buffer-mode/centered-buffer-mode.el index 3682cb5..5ec2203 100644 --- a/layers/+distributions/spacemacs-base/local/centered-buffer-mode/centered-buffer-mode.el +++ b/layers/+distributions/spacemacs-base/local/centered-buffer-mode/centered-buffer-mode.el @@ -41,7 +41,7 @@ that differed modifications won't cause an overflow." :type 'integer :group 'spacemacs-centered-buffer-mode) -(defcustom spacemacs-centered-buffer-mode-fringe-color "black" +(defcustom spacemacs-centered-buffer-mode-fringe-color (face-background 'default) "Color of the fringes." :type 'color :group 'spacemacs-centered-buffer-mode) diff --git a/layers/+distributions/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el b/layers/+distributions/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el index 2e1d127..8348e34 100644 --- a/layers/+distributions/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el +++ b/layers/+distributions/spacemacs-base/local/evil-evilified-state/evil-evilified-state.el @@ -1,6 +1,6 @@ ;;; evil-evilified-state.el --- A minimalistic evil state ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; Keywords: convenience editing evil spacemacs @@ -30,14 +30,14 @@ ;; The shadowed original mode key bindings are automatically reassigned ;; following a set of rules: -;; Keys such as -;; /,:,h,j,k,l,n,N,v,V,gg,G,C-f,C-b,C-d,C-e,C-u,C-y and C-z +;; Keys such as +;; /,:,h,j,k,l,n,N,v,V,gg,G,C-f,C-b,C-d,C-e,C-u,C-y and C-z ;; are working as in Evil. ;; Other keys will be moved according to this pattern: ;; a -> A -> C-a -> C-A -;; The first unreserved key will be used. +;; The first unreserved key will be used. ;; There is an exception for g, which will be directly -;; bound to C-G, since G and C-g (latest being an important escape key in Emacs) +;; bound to C-G, since G and C-g (latest being an important escape key in Emacs) ;; are already being used. ;;; Code: @@ -275,8 +275,8 @@ Each pair KEYn FUNCTIONn is defined in MAP after the evilification of it." (evilified-state--find-new-event event) nil processed pending-funcs))) (when pending-funcs - (spacemacs-buffer/warning - (concat (format (concat "Auto-evilication could not remap these " + (message + (concat (format (concat "Auto-evilification could not remap these " "functions in map `%s':\n") map-symbol) (mapconcat (lambda (x) diff --git a/layers/+distributions/spacemacs-base/local/holy-mode/holy-mode.el b/layers/+distributions/spacemacs-base/local/holy-mode/holy-mode.el index c5ece18..886d5fb 100644 --- a/layers/+distributions/spacemacs-base/local/holy-mode/holy-mode.el +++ b/layers/+distributions/spacemacs-base/local/holy-mode/holy-mode.el @@ -1,6 +1,6 @@ ;;; holy-mode.el --- Enter the church of Emacs -;; Copyright (C) 2014-2015 syl20bnr +;; Copyright (c) 2015-2017 Sylvain Benner ;; ;; Author: Sylvain Benner ;; Keywords: convenience editing diff --git a/layers/+distributions/spacemacs-base/local/hybrid-mode/hybrid-mode.el b/layers/+distributions/spacemacs-base/local/hybrid-mode/hybrid-mode.el index 4d61798..3bce64a 100644 --- a/layers/+distributions/spacemacs-base/local/hybrid-mode/hybrid-mode.el +++ b/layers/+distributions/spacemacs-base/local/hybrid-mode/hybrid-mode.el @@ -108,7 +108,7 @@ ;; This code is from evil insert state definition, any change upstream ;; should be reflected here -;; see https://bitbucket.org/lyro/evil/src/a25b848c90c7942fe89d9ec283c6bb44fb7b3cf4/evil-states.el?fileviewer=file-view-default#evil-states.el-74 +;; see https://github.com/emacs-evil/evil/blob/56e92f7cb4e04e665670460093b41f58446b7a2b/evil-states.el#L108 (evil-define-state hybrid "Hybrid state for hybrid mode." :tag " " diff --git a/layers/+distributions/spacemacs-base/packages.el b/layers/+distributions/spacemacs-base/packages.el index af212ec..59ea8f0 100644 --- a/layers/+distributions/spacemacs-base/packages.el +++ b/layers/+distributions/spacemacs-base/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Base Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -45,7 +45,7 @@ (recentf :location built-in) (savehist :location built-in) (saveplace :location built-in) - spacemacs-theme + (spacemacs-theme :location built-in) (subword :location built-in) (tar-mode :location built-in) (uniquify :location built-in) @@ -240,16 +240,25 @@ :init (spacemacs/set-leader-keys "ji" 'imenu))) (defun spacemacs-base/init-linum () - (when dotspacemacs-line-numbers - (add-hook 'prog-mode-hook 'linum-mode) - (add-hook 'text-mode-hook 'linum-mode)) - (setq linum-format "%4d") - (spacemacs|add-toggle line-numbers - :mode linum-mode - :documentation "Show the line numbers." - :evil-leader "tn") - (advice-add #'linum-update-window - :after #'spacemacs/linum-update-window-scale-fix)) + (use-package linum + :init + (progn + (setq linum-format "%4d") + (spacemacs|add-toggle line-numbers + :mode linum-mode + :documentation "Show the line numbers." + :evil-leader "tn") + (advice-add #'linum-update-window + :after #'spacemacs//linum-update-window-scale-fix) + (advice-add #'linum-on + :around #'spacemacs//linum-on)) + :config + (progn + (when (spacemacs//linum-backward-compabitility) + (add-hook 'prog-mode-hook 'linum-mode) + (add-hook 'text-mode-hook 'linum-mode)) + (when dotspacemacs-line-numbers + (global-linum-mode))))) (defun spacemacs-base/init-occur-mode () (evilified-state-evilify-map occur-mode-map @@ -345,7 +354,7 @@ "pc" 'projectile-compile-project "pD" 'projectile-dired "pg" 'projectile-find-tag - "p C-g" 'projectile-regenerate-tags + "pG" 'projectile-regenerate-tags "pI" 'projectile-invalidate-cache "pk" 'projectile-kill-buffers "pR" 'projectile-replace diff --git a/layers/+distributions/spacemacs-bootstrap/config.el b/layers/+distributions/spacemacs-bootstrap/config.el index c18890a..b25617b 100644 --- a/layers/+distributions/spacemacs-bootstrap/config.el +++ b/layers/+distributions/spacemacs-bootstrap/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Spacemacs Bootstrap Layer configuration File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+distributions/spacemacs-bootstrap/funcs.el b/layers/+distributions/spacemacs-bootstrap/funcs.el index f186f77..0e23391 100644 --- a/layers/+distributions/spacemacs-bootstrap/funcs.el +++ b/layers/+distributions/spacemacs-bootstrap/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Bootstrap Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+distributions/spacemacs-bootstrap/packages.el b/layers/+distributions/spacemacs-bootstrap/packages.el index 5ac841d..2144a0e 100644 --- a/layers/+distributions/spacemacs-bootstrap/packages.el +++ b/layers/+distributions/spacemacs-bootstrap/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Mandatory Bootstrap Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -135,6 +135,7 @@ (define-key evil-normal-state-map (kbd "K") 'spacemacs/evil-smart-doc-lookup) (define-key evil-normal-state-map (kbd "gd") 'spacemacs/jump-to-definition) + (define-key evil-normal-state-map (kbd "gD") 'spacemacs/jump-to-definition-other-window) ;; scrolling transient state (spacemacs|define-transient-state scroll @@ -275,13 +276,14 @@ (spacemacs/set-leader-keys "hk" 'which-key-show-top-level) + ;; Needed to avoid nil variable error before update to recent which-key + (defvar which-key-replacement-alist nil) ;; Replace rules for better naming of functions (let ((new-descriptions ;; being higher in this list means the replacement is applied later '( ("spacemacs/\\(.+\\)" . "\\1") ("spacemacs/toggle-\\(.+\\)" . "\\1") - ("select-window-\\([0-9]\\)" . "window \\1") ("spacemacs/alternate-buffer" . "last buffer") ("spacemacs/toggle-mode-line-\\(.+\\)" . "\\1") ("avy-goto-word-or-subword-1" . "avy word") @@ -300,12 +302,20 @@ ("spacemacs/toggle-hybrid-mode" . "hybrid (hybrid-mode)") ("spacemacs/toggle-holy-mode" . "emacs (holy-mode)") ("evil-lisp-state-\\(.+\\)" . "\\1") - ("\\(.+\\)-transient-state/\\(.+\\)" . "\\2") - ("\\(.+\\)-transient-state/body" . "\\1-transient-state")))) + ("spacemacs/\\(.+\\)-transient-state/\\(.+\\)" . "\\2") + ("spacemacs/\\(.+\\)-transient-state/body" . "\\1-transient-state")))) (dolist (nd new-descriptions) ;; ensure the target matches the whole string - (push (cons (concat "\\`" (car nd) "\\'") (cdr nd)) - which-key-description-replacement-alist))) + (push (cons (cons nil (concat "\\`" (car nd) "\\'")) (cons nil (cdr nd))) + which-key-replacement-alist))) + + (push '(("\\(.*\\) 0" . "select-window-0") . ("\\1 0..9" . "window 0..9")) + which-key-replacement-alist) + (push '((nil . "select-window-[1-9]") . t) which-key-replacement-alist) + + (push '(("\\(.*\\) 1" . "buffer-to-window-1") . ("\\1 1..9" . "buffer to window 1..9")) + which-key-replacement-alist) + (push '((nil . "buffer-to-window-[2-9]") . t) which-key-replacement-alist) (dolist (leader-key `(,dotspacemacs-leader-key ,dotspacemacs-emacs-leader-key)) (which-key-add-key-based-replacements diff --git a/layers/+distributions/spacemacs/layers.el b/layers/+distributions/spacemacs/layers.el index eb652d8..f51e40b 100644 --- a/layers/+distributions/spacemacs/layers.el +++ b/layers/+distributions/spacemacs/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Spacemacs Layer layers File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -26,3 +26,8 @@ (unless (or (configuration-layer/layer-usedp 'ivy) (configuration-layer/layer-usedp 'helm)) (configuration-layer/declare-layers '(helm))) + +(when (and (configuration-layer/layer-usedp 'ivy) + (configuration-layer/layer-usedp 'helm)) + (spacemacs-buffer/warning (concat "Both the `helm' and `ivy' layers are enabled. " + "This may lead to unexpected behaviour."))) diff --git a/layers/+emacs/better-defaults/config.el b/layers/+emacs/better-defaults/config.el index 8741cc8..12f204d 100644 --- a/layers/+emacs/better-defaults/config.el +++ b/layers/+emacs/better-defaults/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Better Emacs Defaults Layer configuration variables File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Thomas de Beauchêne ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/better-defaults/funcs.el b/layers/+emacs/better-defaults/funcs.el index b46ae55..6cf2c92 100644 --- a/layers/+emacs/better-defaults/funcs.el +++ b/layers/+emacs/better-defaults/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Better Emacs Defaults Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -19,14 +19,3 @@ ;; correctly (see https://github.com/syl20bnr/spacemacs/issues/3278) (call-interactively #'kill-region) (backward-kill-word arg))) - -;; http://endlessparentheses.com/fill-and-unfill-paragraphs-with-a-single-key.html -(defun spacemacs/fill-or-unfill () - "Like `fill-paragraph', but unfill if used twice." - (interactive) - (let ((fill-column - (if (eq last-command 'spacemacs/fill-or-unfill) - (progn (setq this-command nil) - (point-max)) - fill-column))) - (call-interactively #'fill-paragraph))) diff --git a/layers/+emacs/better-defaults/keybindings.el b/layers/+emacs/better-defaults/keybindings.el index 68c6862..371eca4 100644 --- a/layers/+emacs/better-defaults/keybindings.el +++ b/layers/+emacs/better-defaults/keybindings.el @@ -1,6 +1,6 @@ ;;; keybindings.el --- Better Emacs Defaults Layer key bindings File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -10,4 +10,3 @@ ;;; License: GPLv3 (global-set-key (kbd "C-w") 'spacemacs/backward-kill-word-or-region) -(global-set-key [remap fill-paragraph] #'spacemacs/fill-or-unfill) diff --git a/layers/+emacs/better-defaults/packages.el b/layers/+emacs/better-defaults/packages.el index ef7fb2b..cd2bb00 100644 --- a/layers/+emacs/better-defaults/packages.el +++ b/layers/+emacs/better-defaults/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Better Emacs Defaults Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Thomas de Beauchêne ;; URL: https://github.com/syl20bnr/spacemacs @@ -10,7 +10,8 @@ ;;; License: GPLv3 (defconst better-defaults-packages - '(mwim) + '(mwim + unfill) "The list of Lisp packages required by the mwim layer.") (defun better-defaults/init-mwim () @@ -25,3 +26,10 @@ (if better-defaults-move-to-end-of-code-first (global-set-key (kbd "C-e") 'mwim-end-of-code-or-line) (global-set-key (kbd "C-e") 'mwim-end-of-line-or-code))))) + +(defun better-defaults/init-unfill () + (use-package unfill + :defer t + :commands (unfill-region unfill-paragraph unfill-toggle) + :init + (global-set-key [remap fill-paragraph] #'unfill-toggle))) diff --git a/layers/+emacs/ibuffer/README.org b/layers/+emacs/ibuffer/README.org index b351f37..484254e 100644 --- a/layers/+emacs/ibuffer/README.org +++ b/layers/+emacs/ibuffer/README.org @@ -6,10 +6,12 @@ - [[#layer][Layer]] - [[#grouping-buffers][Grouping buffers]] - [[#key-bindings][Key bindings]] + - [[#global][Global]] + - [[#ibuffer][IBuffer]] * Description -This layer configures Emacs ibuffer for Spacemacs. +This layer configures Emacs IBuffer for Spacemacs. * Install ** Layer @@ -36,9 +38,18 @@ Example: #+END_SRC * Key bindings +** Global -| Key Binding | Description | -|-------------+-------------------| -| ~SPC b B~ | open ibuffer menu | +| Key Binding | Description | +|-------------+-------------------------------| +| ~SPC b B~ | open IBuffer menu (global) | -*Note:* The layer will also replace regular ~C-x C-b~ by ibuffer. +*Note:* The layer will also replace regular ~C-x C-b~ with =ibuffer=. + +** IBuffer + +| Key Binding | Description | +|-------------+-------------------------------| +| ~g r~ | update IBuffer ("refresh") | +| ~g j~ | move to next filter group | +| ~g k~ | move to previous filter group | diff --git a/layers/+emacs/ibuffer/config.el b/layers/+emacs/ibuffer/config.el index ec0a67f..74be502 100644 --- a/layers/+emacs/ibuffer/config.el +++ b/layers/+emacs/ibuffer/config.el @@ -1,6 +1,6 @@ ;;; config.el --- ibuffer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Aleksandr Guljajev ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/ibuffer/funcs.el b/layers/+emacs/ibuffer/funcs.el index 0ded243..db4cd01 100644 --- a/layers/+emacs/ibuffer/funcs.el +++ b/layers/+emacs/ibuffer/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- ibuffer Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Aleksandr Guljajev ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/ibuffer/packages.el b/layers/+emacs/ibuffer/packages.el index 944f229..dd291a9 100644 --- a/layers/+emacs/ibuffer/packages.el +++ b/layers/+emacs/ibuffer/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- ibuffer Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Aleksandr Guljajev ;; URL: https://github.com/syl20bnr/spacemacs @@ -32,7 +32,11 @@ (evil-ex-define-cmd "buffers" 'ibuffer)) :config (evilified-state-evilify-map ibuffer-mode-map - :mode ibuffer-mode))) + :mode ibuffer-mode + :bindings + "gr" 'ibuffer-update + "gj" 'ibuffer-forward-filter-group + "gk" 'ibuffer-backward-filter-group))) (defun ibuffer/init-ibuffer-projectile() (use-package ibuffer-projectile diff --git a/layers/+emacs/org/README.org b/layers/+emacs/org/README.org index 0b64c02..58ae8af 100644 --- a/layers/+emacs/org/README.org +++ b/layers/+emacs/org/README.org @@ -199,7 +199,7 @@ To permanently enable mode line display of org clock, add this snippet to your | ~SPC m C~ | evil-org-recompute-clocks | | ~SPC m d~ | org-deadline | | ~SPC m D~ | org-insert-drawer | -| ~SPC m e~ | org-export-dispatch | +| ~SPC m e e~ | org-export-dispatch | | ~SPC m f~ | org-set-effort | | ~SPC m I~ | org-clock-in | | ~SPC m l~ | org-open-at-point | @@ -302,6 +302,7 @@ To permanently enable mode line display of org clock, add this snippet to your | ~SPC m h s~ | org-insert-subheading | | ~SPC m i f~ | org-insert-footnote | | ~SPC m i l~ | org-insert-link | +| ~SPC m i a~ | org-attach | *** Links diff --git a/layers/+emacs/org/config.el b/layers/+emacs/org/config.el index 72dfc32..f2c5c33 100644 --- a/layers/+emacs/org/config.el +++ b/layers/+emacs/org/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Org configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/org/funcs.el b/layers/+emacs/org/funcs.el index 38669ea..7a6e821 100644 --- a/layers/+emacs/org/funcs.el +++ b/layers/+emacs/org/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Org Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/org/local/evil-org/evil-org.el b/layers/+emacs/org/local/evil-org/evil-org.el index ea8e419..2d7adf3 100644 --- a/layers/+emacs/org/local/evil-org/evil-org.el +++ b/layers/+emacs/org/local/evil-org/evil-org.el @@ -53,7 +53,7 @@ (defun evil-org-eol-call (fun) "Go to end of line and call provided function. FUN function callback" - (end-of-line) + (end-of-visible-line) (funcall fun) (evil-append nil) ) diff --git a/layers/+emacs/org/packages.el b/layers/+emacs/org/packages.el index 4963f4a..06d7319 100644 --- a/layers/+emacs/org/packages.el +++ b/layers/+emacs/org/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Org Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -133,7 +133,7 @@ (with-eval-after-load 'org-src (spacemacs/set-leader-keys-for-minor-mode 'org-src-mode - "'" 'org-edit-src-exit + dotspacemacs-major-mode-leader-key 'org-edit-src-exit "c" 'org-edit-src-exit "a" 'org-edit-src-abort "k" 'org-edit-src-abort)) @@ -158,7 +158,8 @@ Will work on both org-mode and any mode that accepts plain html." (insert (format tag "")) (forward-char -8)))) - (dolist (prefix '(("mx" . "text") + (dolist (prefix '(("me" . "export") + ("mx" . "text") ("mh" . "headings") ("mi" . "insert") ("mS" . "subtrees") @@ -172,7 +173,7 @@ Will work on both org-mode and any mode that accepts plain html." "c" 'org-capture "d" 'org-deadline "D" 'org-insert-drawer - "e" 'org-export-dispatch + "ee" 'org-export-dispatch "f" 'org-set-effort "P" 'org-set-property ":" 'org-set-tags @@ -254,6 +255,7 @@ Will work on both org-mode and any mode that accepts plain html." "s" 'org-schedule ;; insertion of common elements + "ia" 'org-attach "il" 'org-insert-link "if" 'org-footnote-new "ik" 'spacemacs/insert-keybinding-org diff --git a/layers/+emacs/semantic/README.org b/layers/+emacs/semantic/README.org index c14b9fb..0802a0b 100644 --- a/layers/+emacs/semantic/README.org +++ b/layers/+emacs/semantic/README.org @@ -38,6 +38,10 @@ To use this configuration layer, add it to your =~/.spacemacs=. You will need to add =semantic= to the existing =dotspacemacs-configuration-layers= list in this file. +By default, Spacemacs sets Semantic to parse only file, local and project scope. +For a different parsing scope, you can customize the variable +=semanticdb-find-default-throttle=. + * Key Bindings | Key Binding | Description | diff --git a/layers/+emacs/semantic/config.el b/layers/+emacs/semantic/config.el index f82430f..725bdc8 100644 --- a/layers/+emacs/semantic/config.el +++ b/layers/+emacs/semantic/config.el @@ -1,6 +1,6 @@ ;;; config.el --- semantic Layer configuration ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sebastian Wiesner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/smex/funcs.el b/layers/+emacs/smex/funcs.el index c46a801..1517fa9 100644 --- a/layers/+emacs/smex/funcs.el +++ b/layers/+emacs/smex/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Smex Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/smex/packages.el b/layers/+emacs/smex/packages.el index 5ccf28b..28b4a2e 100644 --- a/layers/+emacs/smex/packages.el +++ b/layers/+emacs/smex/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- smex Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+emacs/typography/config.el b/layers/+emacs/typography/config.el index 2e57daf..050b69e 100644 --- a/layers/+emacs/typography/config.el +++ b/layers/+emacs/typography/config.el @@ -1,6 +1,6 @@ ;;; config.el --- typography Layer configuration ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sebastian Wiesner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+email/gnus/packages.el b/layers/+email/gnus/packages.el index 2cb717f..9c04877 100644 --- a/layers/+email/gnus/packages.el +++ b/layers/+email/gnus/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- gnus Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+email/mu4e/README.org b/layers/+email/mu4e/README.org index 40965d7..fdd9bd0 100644 --- a/layers/+email/mu4e/README.org +++ b/layers/+email/mu4e/README.org @@ -45,23 +45,23 @@ existing =dotspacemacs-configuration-layers= list in this file. | Keybinding | Command | |------------+------------| -| SPC a M | Start mu4e | +| ~SPC a M~ | Start mu4e | ** Headers mode | Keybinding | Command | |------------+-------------------------------------------------------------| -| J | Go to next unread thread marking other mail read on the way | -| C-j | Next header | -| C-k | Previous header | +| ~J~ | Go to next unread thread marking other mail read on the way | +| ~C-j~ | Next header | +| ~C-k~ | Previous header | ** View mode | Keybinding | Command | |------------+-------------------------------------------------------------| -| J | Go to next unread thread marking other mail read on the way | -| C-j | Next header | -| C-k | Previous header | +| ~J~ | Go to next unread thread marking other mail read on the way | +| ~C-j~ | Next header | +| ~C-k~ | Previous header | * Configuration Configuration varies too much to give precise instructions. What follows is one diff --git a/layers/+email/mu4e/config.el b/layers/+email/mu4e/config.el index 89fc8ac..d52ee52 100644 --- a/layers/+email/mu4e/config.el +++ b/layers/+email/mu4e/config.el @@ -1,6 +1,6 @@ ;;; config.el --- mu4e Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+email/mu4e/funcs.el b/layers/+email/mu4e/funcs.el index b70da44..c18bcc7 100644 --- a/layers/+email/mu4e/funcs.el +++ b/layers/+email/mu4e/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- mu4e Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+email/mu4e/packages.el b/layers/+email/mu4e/packages.el index 86b5f34..957533c 100644 --- a/layers/+email/mu4e/packages.el +++ b/layers/+email/mu4e/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- mu4e Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+frameworks/django/layers.el b/layers/+frameworks/django/layers.el index 93b6323..94c96d4 100644 --- a/layers/+frameworks/django/layers.el +++ b/layers/+frameworks/django/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Django Layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Andrea Moretti ;; URL: https://github.com/axyz diff --git a/layers/+frameworks/django/packages.el b/layers/+frameworks/django/packages.el index 6ddb736..6d39dbe 100644 --- a/layers/+frameworks/django/packages.el +++ b/layers/+frameworks/django/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Django Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+frameworks/react/config.el b/layers/+frameworks/react/config.el index f510019..b511015 100644 --- a/layers/+frameworks/react/config.el +++ b/layers/+frameworks/react/config.el @@ -1,6 +1,6 @@ ;;; config.el --- react Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Andrea Moretti ;; URL: https://github.com/axyz diff --git a/layers/+frameworks/react/funcs.el b/layers/+frameworks/react/funcs.el new file mode 100644 index 0000000..b8b9993 --- /dev/null +++ b/layers/+frameworks/react/funcs.el @@ -0,0 +1,40 @@ +;;; funcs.el --- React Layer functions File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Muneeb Shaikh +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + + +;; react mode + +(defun spacemacs//setup-react-mode () + "Adjust web-mode to accommodate react-mode" + (emmet-mode 0) + ;; See https://github.com/CestDiego/emmet-mode/commit/3f2904196e856d31b9c95794d2682c4c7365db23 + (setq-local emmet-expand-jsx-className? t) + ;; Enable js-mode snippets + (yas-activate-extra-mode 'js-mode) + ;; Force jsx content type + (web-mode-set-content-type "jsx") + ;; Don't auto-quote attribute values + (setq-local web-mode-enable-auto-quoting nil)) + + +;; flycheck + +(defun spacemacs//react-use-eslint-from-node-modules () + (let* ((root (locate-dominating-file + (or (buffer-file-name) default-directory) + "node_modules")) + (global-eslint (executable-find "eslint")) + (local-eslint (expand-file-name "node_modules/.bin/eslint" + root)) + (eslint (if (file-executable-p local-eslint) + local-eslint + global-eslint))) + (setq-local flycheck-javascript-eslint-executable eslint))) diff --git a/layers/+frameworks/react/layers.el b/layers/+frameworks/react/layers.el index e071ef2..baba012 100644 --- a/layers/+frameworks/react/layers.el +++ b/layers/+frameworks/react/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- react Layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Andrea Moretti ;; URL: https://github.com/axyz diff --git a/layers/+frameworks/react/packages.el b/layers/+frameworks/react/packages.el index 4dd354e..2c6f9f8 100644 --- a/layers/+frameworks/react/packages.el +++ b/layers/+frameworks/react/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- react Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Andrea Moretti ;; URL: https://github.com/axyz @@ -34,28 +34,16 @@ (defun react/post-init-evil-matchit () (with-eval-after-load 'evil-matchit - (plist-put evilmi-plugins 'react-mode '((evilmi-simple-get-tag evilmi-simple-jump) - (evilmi-javascript-get-tag evilmi-javascript-jump) - (evilmi-html-get-tag evilmi-html-jump))))) + (plist-put evilmi-plugins 'react-mode + '((evilmi-simple-get-tag evilmi-simple-jump) + (evilmi-javascript-get-tag evilmi-javascript-jump) + (evilmi-html-get-tag evilmi-html-jump))))) (defun react/post-init-flycheck () (with-eval-after-load 'flycheck (dolist (checker '(javascript-eslint javascript-standard)) (flycheck-add-mode checker 'react-mode))) - (defun react/use-eslint-from-node-modules () - (let* ((root (locate-dominating-file - (or (buffer-file-name) default-directory) - "node_modules")) - (global-eslint (executable-find "eslint")) - (local-eslint (expand-file-name "node_modules/.bin/eslint" - root)) - (eslint (if (file-executable-p local-eslint) - local-eslint - global-eslint))) - (setq-local flycheck-javascript-eslint-executable eslint))) - - (add-hook 'react-mode-hook #'react/use-eslint-from-node-modules) - + (add-hook 'react-mode-hook #'spacemacs//react-use-eslint-from-node-modules) (spacemacs/add-flycheck-hook 'react-mode)) (defun react/post-init-js-doc () @@ -82,15 +70,4 @@ (add-to-list 'auto-mode-alist '("\\index.ios.js\\'" . react-mode)) (add-to-list 'magic-mode-alist '("/\\*\\* @jsx React\\.DOM \\*/" . react-mode)) (add-to-list 'magic-mode-alist '("^import React" . react-mode)) - (defun spacemacs//setup-react-mode () - "Adjust web-mode to accommodate react-mode" - (emmet-mode 0) - ;; See https://github.com/CestDiego/emmet-mode/commit/3f2904196e856d31b9c95794d2682c4c7365db23 - (setq-local emmet-expand-jsx-className? t) - ;; Enable js-mode snippets - (yas-activate-extra-mode 'js-mode) - ;; Force jsx content type - (web-mode-set-content-type "jsx") - ;; Don't auto-quote attribute values - (setq-local web-mode-enable-auto-quoting nil)) (add-hook 'react-mode-hook 'spacemacs//setup-react-mode)) diff --git a/layers/+frameworks/ruby-on-rails/layers.el b/layers/+frameworks/ruby-on-rails/layers.el index 0f04e4b..76935c0 100644 --- a/layers/+frameworks/ruby-on-rails/layers.el +++ b/layers/+frameworks/ruby-on-rails/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Ruby on Rails Layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Andrea Moretti ;; URL: https://github.com/axyz diff --git a/layers/+frameworks/ruby-on-rails/packages.el b/layers/+frameworks/ruby-on-rails/packages.el index 860c7f8..f5db048 100644 --- a/layers/+frameworks/ruby-on-rails/packages.el +++ b/layers/+frameworks/ruby-on-rails/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Ruby on Rails Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -18,12 +18,9 @@ (defun ruby-on-rails/init-projectile-rails () (use-package projectile-rails - :defer t - :init - (progn - (add-hook 'projectile-mode-hook 'projectile-rails-on)) :config (progn + (projectile-rails-global-mode) (spacemacs|diminish projectile-rails-mode " ⇋" " RoR") ;; Find files @@ -85,5 +82,5 @@ :mode (("\\.feature\\'" . feature-mode)))) (defun ruby-on-rails/post-init-which-key () - (push '("projectile-rails-\\(.+\\)" . "\\1") - which-key-description-replacement-alist)) + (push '((nil . "projectile-rails-\\(.+\\)") . (nil . "\\1")) + which-key-replacement-alist)) diff --git a/layers/+fun/emoji/packages.el b/layers/+fun/emoji/packages.el index 50e584a..87906b2 100644 --- a/layers/+fun/emoji/packages.el +++ b/layers/+fun/emoji/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- emoji Layer Packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+fun/games/README.org b/layers/+fun/games/README.org index efe8ba2..360b962 100644 --- a/layers/+fun/games/README.org +++ b/layers/+fun/games/README.org @@ -8,6 +8,7 @@ - [[#games-instructions][Games instructions]] - [[#2048][2048]] - [[#pacmacs][Pacmacs]] + - [[#sudoku][Sudoku]] - [[#tetris][Tetris]] - [[#typit][Typit]] - [[#create-a-new-dictionary][Create a new dictionary]] @@ -18,6 +19,7 @@ This layer allows you to play evilified games in spacemacs. The games available now are: - 2048-game - Pacmacs (Pacman for Emacs) +- Sudoku - Tetris - Typit @@ -57,6 +59,20 @@ Possible helm actions: | ~l~ | Move right | | | | +** Sudoku + +| Key Bindings | Description | +| ~h~ | Move left | +| ~j~ | Move down | +| ~k~ | Move up | +| ~l~ | Move right | +| ~1 ... 9~ | Insert value | +| ~0~ | Remove value | +| ~N~ | New puzzle | +| ~, h~ | Hint | +| ~, s~ | Save puzzle | +| ~, l~ | Load puzzle | + ** Tetris | Key Binding | Description | diff --git a/layers/+fun/games/config.el b/layers/+fun/games/config.el index a78697c..d495ce1 100644 --- a/layers/+fun/games/config.el +++ b/layers/+fun/games/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Games Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+fun/games/funcs.el b/layers/+fun/games/funcs.el index 91faea6..6414bb6 100644 --- a/layers/+fun/games/funcs.el +++ b/layers/+fun/games/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Games Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+fun/games/packages.el b/layers/+fun/games/packages.el index ee9fdb7..519b426 100644 --- a/layers/+fun/games/packages.el +++ b/layers/+fun/games/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- games Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,6 +16,7 @@ :toggle (configuration-layer/package-usedp 'helm)) pacmacs (tetris :location built-in) + sudoku typit )) @@ -72,6 +73,52 @@ "l" 'tetris-move-right "q" 'spacemacs/tetris-quit-game)))) +(defun games/init-sudoku () + (use-package sudoku + :defer t + :init + (progn + (push '("sudoku" . (sudoku :quit (kill-buffer-ask (get-buffer "*Sudoku*")) + :reset sudoku-restart)) helm-games-list) + (evilified-state-evilify sudoku-mode sudoku-mode-map + ;; Movement + "j" 'sudoku-move-point-down + "J" 'sudoku-move-point-downmost + "k" 'sudoku-move-point-up + "K" 'sudoku-move-point-upmost + "h" 'sudoku-move-point-left + "H" 'sudoku-move-point-leftmost + "l" 'sudoku-move-point-right + "L" 'sudoku-move-point-rightmost + + ;; Start/quit/print game + "N" 'sudoku + "q" 'sudoku-quit + "Q" 'sudoku-quit-immediately + "P" 'sudoku-print + + ;; Undo/redo + "u" 'sudoku-undo + "\C-r" 'sudoku-redo + + ;; Inserting values + "1" 'sudoku-change-point + "2" 'sudoku-change-point + "3" 'sudoku-change-point + "4" 'sudoku-change-point + "5" 'sudoku-change-point + "6" 'sudoku-change-point + "7" 'sudoku-change-point + "8" 'sudoku-change-point + "9" 'sudoku-change-point) + + (spacemacs/set-leader-keys-for-major-mode 'sudoku-mode + "c" 'sudoku-comment-puzzle + "h" 'sudoku-hint + "l" 'sudoku-load-puzzle + "L" 'sudoku-load-puzzle-collection + "s" 'sudoku-save-puzzle)))) + (defun games/init-typit () (use-package typit :defer t diff --git a/layers/+fun/selectric/packages.el b/layers/+fun/selectric/packages.el index 90ae8d4..a175039 100644 --- a/layers/+fun/selectric/packages.el +++ b/layers/+fun/selectric/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- selectric Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Gergely Nagy ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+fun/xkcd/packages.el b/layers/+fun/xkcd/packages.el index 0e76e3c..928c1f4 100644 --- a/layers/+fun/xkcd/packages.el +++ b/layers/+fun/xkcd/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- xkcd Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -25,4 +25,5 @@ "h" 'xkcd-prev "j" 'xkcd-next "k" 'xkcd-prev - "l" 'xkcd-next)))) + "l" 'xkcd-next) + (push "*xkcd*" spacemacs-useful-buffers-regexp)))) diff --git a/layers/+intl/chinese/config.el b/layers/+intl/chinese/config.el index fc79f55..1079ffb 100644 --- a/layers/+intl/chinese/config.el +++ b/layers/+intl/chinese/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Chinese Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+intl/chinese/packages.el b/layers/+intl/chinese/packages.el index 0737600..ac76750 100644 --- a/layers/+intl/chinese/packages.el +++ b/layers/+intl/chinese/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Chinese Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -65,9 +65,10 @@ :init (progn (setq pyim-use-tooltip t - pyim-dicts-directory spacemacs-cache-directory - pyim-personal-file (concat spacemacs-cache-directory - "pyim-personal.txt") + pyim-directory (expand-file-name "pyim/" spacemacs-cache-directory) + pyim-dicts-directory (expand-file-name "dicts/" pyim-directory) + pyim-dcache-directory (expand-file-name "dcache/" pyim-directory) + pyim-personal-file (expand-file-name "pyim-personal.txt" pyim-directory) default-input-method "chinese-pyim") (evilified-state-evilify pyim-dicts-manager-mode pyim-dicts-manager-mode-map)))) diff --git a/layers/+intl/keyboard-layout/config.el b/layers/+intl/keyboard-layout/config.el index c2be535..5a710b8 100644 --- a/layers/+intl/keyboard-layout/config.el +++ b/layers/+intl/keyboard-layout/config.el @@ -1,6 +1,6 @@ ;;; config.el --- keyboard-layout Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Fabien Dubosson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+intl/keyboard-layout/funcs.el b/layers/+intl/keyboard-layout/funcs.el index 7928801..e7719b2 100644 --- a/layers/+intl/keyboard-layout/funcs.el +++ b/layers/+intl/keyboard-layout/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- keyboard-layout Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Fabien Dubosson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+intl/keyboard-layout/packages.el b/layers/+intl/keyboard-layout/packages.el index 5708ff3..db888e3 100644 --- a/layers/+intl/keyboard-layout/packages.el +++ b/layers/+intl/keyboard-layout/packages.el @@ -1,6 +1,6 @@ ;;; config.el --- keyboard-layout Layer Packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Fabien Dubosson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/agda/config.el b/layers/+lang/agda/config.el index 6e0ab3d..6bb69b9 100644 --- a/layers/+lang/agda/config.el +++ b/layers/+lang/agda/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Agda2 Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: FreeSalad ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/agda/packages.el b/layers/+lang/agda/packages.el index 5f26af3..2dffa93 100644 --- a/layers/+lang/agda/packages.el +++ b/layers/+lang/agda/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Agda2 Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Oliver Charles ;; URL: https://github.com/syl20bnr/spacemacs @@ -83,7 +83,7 @@ "xq" 'agda2-quit "xr" 'agda2-restart))))) -(defun idris/pre-init-golden-ratio () +(defun agda/pre-init-golden-ratio () (spacemacs|use-package-add-hook golden-ratio :post-config (add-to-list 'golden-ratio-exclude-buffer-names diff --git a/layers/+lang/asciidoc/packages.el b/layers/+lang/asciidoc/packages.el index 390f6f5..986ad57 100644 --- a/layers/+lang/asciidoc/packages.el +++ b/layers/+lang/asciidoc/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Asciidoc Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Mark Safronov ;; Author: Torben Hoffmann diff --git a/layers/+lang/asm/config.el b/layers/+lang/asm/config.el index ed2f59f..c88e7b4 100644 --- a/layers/+lang/asm/config.el +++ b/layers/+lang/asm/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Asm Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Tu, Do Hoang ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/asm/funcs.el b/layers/+lang/asm/funcs.el index cbcba6a..b868d87 100644 --- a/layers/+lang/asm/funcs.el +++ b/layers/+lang/asm/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Asm Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Tu, Do Hoang ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/asm/packages.el b/layers/+lang/asm/packages.el index b378985..32dd9f1 100644 --- a/layers/+lang/asm/packages.el +++ b/layers/+lang/asm/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Asm Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Tu, Do Hoang ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/autohotkey/packages.el b/layers/+lang/autohotkey/packages.el index 3392377..d50f047 100644 --- a/layers/+lang/autohotkey/packages.el +++ b/layers/+lang/autohotkey/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- autohotkey Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; Author: Rich Alesi @@ -11,7 +11,7 @@ ;;; License: GPLv3 (setq autohotkey-packages - '(ahk-mode)) + '(ahk-mode)) (defun autohotkey/init-ahk-mode () (use-package ahk-mode diff --git a/layers/+lang/bibtex/packages.el b/layers/+lang/bibtex/packages.el index 867fc59..18d9dfe 100644 --- a/layers/+lang/bibtex/packages.el +++ b/layers/+lang/bibtex/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- BibTeX Layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Joshua Ellis ;; URL: https://github.com/JP-Ellis diff --git a/layers/+lang/c-c++/config.el b/layers/+lang/c-c++/config.el index cec7c97..12345e0 100644 --- a/layers/+lang/c-c++/config.el +++ b/layers/+lang/c-c++/config.el @@ -1,6 +1,6 @@ ;;; config.el --- C/C++ Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/c-c++/funcs.el b/layers/+lang/c-c++/funcs.el index 62149d9..322c0f3 100644 --- a/layers/+lang/c-c++/funcs.el +++ b/layers/+lang/c-c++/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- C/C++ Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/c-c++/packages.el b/layers/+lang/c-c++/packages.el index e6ffffc..970ddfb 100644 --- a/layers/+lang/c-c++/packages.el +++ b/layers/+lang/c-c++/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- C/C++ Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/clojure/README.org b/layers/+lang/clojure/README.org index f36f124..80f0acb 100644 --- a/layers/+lang/clojure/README.org +++ b/layers/+lang/clojure/README.org @@ -200,10 +200,10 @@ As this state works the same for all files, the documentation is in global | Key Binding | Description | |-------------+--------------------------------| -| ~SPC m d r~ | reload namepspaces | | ~SPC m d b~ | instrument expression at point | | ~SPC m d e~ | display last stacktrace | -| ~SPC m d i~ | inspect expression at point | +| ~SPC m d r~ | reload namespaces | +| ~SPC m d v~ | inspect expression at point | *** Refactoring @@ -216,7 +216,11 @@ As this state works the same for all files, the documentation is in global | ~SPC m r a p~ | add project dependency | | ~SPC m r a r~ | add require to ns | | ~SPC m r a u~ | add use to ns | -| ~SPC m r c c~ | cycle coll | +| ~SPC m r c (~ | convert coll to list | +| ~SPC m r c '~ | convert coll to quoted list | +| ~SPC m r c {~ | convert coll to map | +| ~SPC m r c #~ | convert coll to set | +| ~SPC m r c [~ | convert coll to vector | | ~SPC m r c i~ | cycle if | | ~SPC m r c n~ | clean ns | | ~SPC m r c p~ | cycle privacy | @@ -296,16 +300,16 @@ In general, ~q~ should always quit the popped up buffer. *** test-report-mode -| Key Binding | Description | -|-------------+-------------------| -| ~C-j~ | next result | -| ~C-k~ | previous result | -| ~RET~ | jump to test | -| ~d~ | ediff test result | -| ~e~ | show stacktrace | -| ~r~ | rerun tests | -| ~t~ | run test | -| ~T~ | run tests | +| Key Binding | Description | +|-------------+--------------------| +| ~C-j~ | next result | +| ~C-k~ | previous result | +| ~RET~ | jump to test | +| ~d~ | ediff test result | +| ~e~ | show stacktrace | +| ~r~ | rerun failed tests | +| ~t~ | run test | +| ~T~ | run tests | * Development Notes ** Indentation diff --git a/layers/+lang/clojure/config.el b/layers/+lang/clojure/config.el index 86a5564..efac449 100644 --- a/layers/+lang/clojure/config.el +++ b/layers/+lang/clojure/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Clojure Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/clojure/funcs.el b/layers/+lang/clojure/funcs.el index 8759827..0fcbb9a 100644 --- a/layers/+lang/clojure/funcs.el +++ b/layers/+lang/clojure/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Clojure Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -124,19 +124,19 @@ the focus." "Run loaded tests." (interactive) (cider-load-buffer) - (cider-test-run-loaded-tests nil)) + (cider-test-run-loaded-tests)) (defun spacemacs/cider-test-run-project-tests () "Run project tests." (interactive) (cider-load-buffer) - (cider-test-run-project-tests nil)) + (cider-test-run-project-tests)) -(defun spacemacs/cider-test-rerun-tests () - "Run previous tests again." +(defun spacemacs/cider-test-rerun-failed-tests () + "Rerun failed tests." (interactive) (cider-load-buffer) - (cider-test-rerun-tests)) + (cider-test-rerun-failed-tests)) (defun spacemacs/cider-display-error-buffer (&optional arg) "Displays the *cider-error* buffer in the current window. diff --git a/layers/+lang/clojure/packages.el b/layers/+lang/clojure/packages.el index 6744b82..0b7f867 100644 --- a/layers/+lang/clojure/packages.el +++ b/layers/+lang/clojure/packages.el @@ -165,12 +165,19 @@ "tl" 'spacemacs/cider-test-run-loaded-tests "tp" 'spacemacs/cider-test-run-project-tests "tn" 'spacemacs/cider-test-run-ns-tests - "tr" 'spacemacs/cider-test-rerun-tests + "tr" 'spacemacs/cider-test-rerun-failed-tests "tt" 'spacemacs/cider-test-run-focused-test "db" 'cider-debug-defun-at-point "de" 'spacemacs/cider-display-error-buffer - "di" 'cider-inspect)) + "dv" 'cider-inspect + + ;; refactorings from clojure-mode + "rc{" 'clojure-convert-collection-to-map + "rc(" 'clojure-convert-collection-to-list + "rc'" 'clojure-convert-collection-to-quoted-list + "rc#" 'clojure-convert-collection-to-set + "rc[" 'clojure-convert-collection-to-vector)) ;; cider-repl-mode only (spacemacs/set-leader-keys-for-major-mode 'cider-repl-mode @@ -206,7 +213,7 @@ (setq clj-refactor--key-binding-prefixes '(("mr" . "refactor") ("mra" . "add") - ("mrc" . "cycle/clean") + ("mrc" . "cycle/clean/convert") ("mrd" . "destructure") ("mre" . "extract/expand") ("mrf" . "find/function") diff --git a/layers/+lang/common-lisp/README.org b/layers/+lang/common-lisp/README.org index d49267a..a591f68 100644 --- a/layers/+lang/common-lisp/README.org +++ b/layers/+lang/common-lisp/README.org @@ -53,6 +53,7 @@ As this state works the same for all files, the documentation is in global | ~SPC m h a~ | SLIME apropos | | ~SPC m h d~ | Disassemble symbol at point | | ~SPC m h h~ | Describe symbol at point | +| ~SPC m h i~ | Inspect definition | | ~SPC m h H~ | Hyperspec lookup symbol at point | | ~SPC m h p~ | Browse apropos results for a package's exported symbols | | ~SPC m h t~ | Toggle tracing of the function at point | @@ -96,7 +97,7 @@ As this state works the same for all files, the documentation is in global | Key Binding | Description | |---------------------------+--------------------| -| ~SPC m g g~ | Inspect definition | +| ~SPC m g g~ | Go to definition | | ~SPC m g b~ | Go back | | ~SPC m g n~ | Next note | | ~SPC m g N~ or ~SPC m g p | Previous note | diff --git a/layers/+lang/common-lisp/config.el b/layers/+lang/common-lisp/config.el index 1bb0a5b..65582b7 100644 --- a/layers/+lang/common-lisp/config.el +++ b/layers/+lang/common-lisp/config.el @@ -1,6 +1,6 @@ ;;; config.el --- common-lisp Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,5 +9,5 @@ ;; ;;; License: GPLv3 -(spacemacs|define-jump-handlers lisp-mode slime-inspect-definition) +(spacemacs|define-jump-handlers lisp-mode slime-edit-definition) (spacemacs|define-jump-handlers common-lisp-mode) diff --git a/layers/+lang/common-lisp/funcs.el b/layers/+lang/common-lisp/funcs.el index 5027c02..c5df355 100644 --- a/layers/+lang/common-lisp/funcs.el +++ b/layers/+lang/common-lisp/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Slime Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/common-lisp/packages.el b/layers/+lang/common-lisp/packages.el index 26211d9..999a665 100644 --- a/layers/+lang/common-lisp/packages.el +++ b/layers/+lang/common-lisp/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Common Lisp Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -89,6 +89,7 @@ "hd" 'slime-disassemble-symbol "hh" 'slime-describe-symbol "hH" 'slime-hyperspec-lookup + "hi" 'slime-inspect-definition "hp" 'slime-apropos-package "ht" 'slime-toggle-trace-fdefinition "hT" 'slime-untrace-all diff --git a/layers/+lang/csharp/config.el b/layers/+lang/csharp/config.el index b6b974f..d9cbfd8 100644 --- a/layers/+lang/csharp/config.el +++ b/layers/+lang/csharp/config.el @@ -1,6 +1,6 @@ -;;; packages.el --- C# Layer packages File for Spacemacs +;;; packages.el --- C# Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/csharp/packages.el b/layers/+lang/csharp/packages.el index ed48aae..828b64c 100644 --- a/layers/+lang/csharp/packages.el +++ b/layers/+lang/csharp/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- csharp Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -33,7 +33,7 @@ (setq omnisharp-auto-complete-want-documentation nil)) (push 'company-omnisharp company-backends-csharp-mode) (add-to-list 'spacemacs-jump-handlers-csharp-mode - 'omnisharp-go-to-definition)) + '(omnisharp-go-to-definition :async t))) :config (progn (spacemacs/declare-prefix-for-mode 'csharp-mode "mc" "csharp/compile") diff --git a/layers/+lang/csv/packages.el b/layers/+lang/csv/packages.el index 88b6221..e048cfe 100644 --- a/layers/+lang/csv/packages.el +++ b/layers/+lang/csv/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- csharp Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: William Casarin ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/d/config.el b/layers/+lang/d/config.el index d92def0..336ebbd 100644 --- a/layers/+lang/d/config.el +++ b/layers/+lang/d/config.el @@ -1,6 +1,6 @@ ;;; config.el --- d Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/d/packages.el b/layers/+lang/d/packages.el index 1a38df7..a282b9e 100644 --- a/layers/+lang/d/packages.el +++ b/layers/+lang/d/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- d Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/elixir/README.org b/layers/+lang/elixir/README.org index 095d52b..61f8330 100644 --- a/layers/+lang/elixir/README.org +++ b/layers/+lang/elixir/README.org @@ -8,6 +8,7 @@ - [[#configuration][Configuration]] - [[#flycheck][Flycheck]] - [[#credo][Credo]] + - [[#dogma][Dogma]] - [[#mix-compile][mix compile]] - [[#key-bindings][Key bindings]] - [[#refcard][Refcard]] @@ -24,8 +25,9 @@ * Description This layer adds support for [[http://elixir-lang.org/][Elixir]] . -[[https://github.com/tonini/alchemist.el][Alchemist]] brings the Elixir tooling to Emacs and comes with a bunch of -features like: +[[https://github.com/tonini/alchemist.el][Alchemist]] brings the Elixir tooling to Emacs and comes with a bunch of features +like: + - Powerful IEx integration - Mix integration - Compile & Execution of Elixir code @@ -50,30 +52,48 @@ file. time. *** Credo -A flycheck checker for [[https://github.com/rrrene/credo][credo]] is installed. The check needs both =bunt= and -=credo= to be available, you can install them like this: +You need to install [[https://github.com/rrrene/credo][credo]] into your project. For this, add the following snippet +to dependencies of your project (in file =mix.exs=): + +#+BEGIN_SRC +{:credo, "~> 0.5", only: [:dev, :test]} +#+END_SRC + +Then run in your shell: #+BEGIN_SRC shell -git clone https://github.com/rrrene/bunt -cd bunt -mix archive.build -mix archive.install +$ mix deps.get +#+END_SRC + +For more info about mix [[http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html][see]]. + +You can tell flycheck-credo to call credo with the '--strict' argument. + +#+BEGIN_SRC elisp +(setq flycheck-elixir-credo-strict t) #+END_SRC +*** Dogma +In order to lint your code, you also need to install [[https://github.com/lpil/dogma][dogma]] into your project. +For this, add the following snippet to the dependencies in your =mix.exs= file: + +#+BEGIN_SRC +{:dogma, "~> 0.1", only: [:dev]} +#+END_SRC + +Then run in your shell: + #+BEGIN_SRC shell -git clone https://github.com/rrrene/credo -cd credo -mix deps.get -mix archive.build -mix archive.install +$ mix deps.get #+END_SRC *** mix compile *Important:* + Elixir compiler is based on macros and can execute arbitrary during compilation. Therefore Spacemacs disable flycheck compilation checker by default. -To enable flycheck support for compilation errors *globally* the variable +To enable flycheck support for compilation errors *globally* the variable =elixir-enable-compilation-checking= can be set explicitly to =t= in your dotfile but it is not recommended to do so because of the limitation described above. @@ -82,8 +102,8 @@ Instead you should use directory local variables in order to enable the flycheck checker only for certain projects. Directory local variables are stored in a file named =.dir-local.el= usually at the root of a project. To easily add a directory local variable use the key binding ~SPC f v d~ then choose the -=elixir-mode= and the variable name =elixir-enable-compilation-checking= with -a value of t. The result is a new file =.dir-local.el= with the following +=elixir-mode= and the variable name =elixir-enable-compilation-checking= with a +value of t. The result is a new file =.dir-local.el= with the following contents: #+BEGIN_SRC elisp diff --git a/layers/+lang/elixir/config.el b/layers/+lang/elixir/config.el index a109c1a..9141b37 100644 --- a/layers/+lang/elixir/config.el +++ b/layers/+lang/elixir/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Elixir Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/elixir/funcs.el b/layers/+lang/elixir/funcs.el index 979e070..a1ded72 100644 --- a/layers/+lang/elixir/funcs.el +++ b/layers/+lang/elixir/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Elixir Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,13 +9,31 @@ ;; ;;; License: GPLv3 +(defun spacemas//elixir-looking-back-special-p (expr) + (save-excursion + (when (or (looking-back " ") + (looking-back "-")) (backward-char)) + (looking-back expr))) + +(defun spacemacs//elixir-point-after-fn-p (id action context) + (save-excursion + (when (looking-back id) (backward-char)) + (looking-back "fn"))) + (defun spacemacs//elixir-do-end-close-action (id action context) (when (eq action 'insert) - (newline-and-indent) - (forward-line -1) - (indent-according-to-mode))) + (cond ((spacemas//elixir-looking-back-special-p id) + (insert " ") (backward-char)) + ((looking-back "(") + (insert ") ") (backward-char) (backward-char)) + (t + (newline-and-indent) + (forward-line -1) + (indent-according-to-mode))))) (defun spacemacs//elixir-enable-compilation-checking () "Enable compile checking if `elixir-enable-compilation-checking' is non nil." (when (or elixir-enable-compilation-checking) - (flycheck-mix-setup))) + (flycheck-mix-setup) + ;; enable credo only if there are no compilation errors + (flycheck-add-next-checker 'elixir-mix '(warning . elixir-credo)))) diff --git a/layers/+lang/elixir/packages.el b/layers/+lang/elixir/packages.el index a84df8c..61ce473 100644 --- a/layers/+lang/elixir/packages.el +++ b/layers/+lang/elixir/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Elixir Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,6 +16,7 @@ elixir-mode flycheck flycheck-mix + flycheck-credo ggtags helm-gtags ob-elixir @@ -131,6 +132,11 @@ (add-hook 'elixir-mode-local-vars-hook 'spacemacs//elixir-enable-compilation-checking)))) +(defun elixir/init-flycheck-credo () + (use-package flycheck-credo + :defer t + :init (add-hook 'flycheck-mode-hook #'flycheck-credo-setup))) + (defun elixir/init-elixir-mode () (use-package elixir-mode :defer t)) @@ -160,8 +166,11 @@ (progn (sp-with-modes '(elixir-mode) (sp-local-pair - "->" "end" - :when '(("RET")) + "(" ")" + :unless '(:add spacemacs//elixir-point-after-fn-p)) + (sp-local-pair + "fn" "end" + :when '(("SPC" "RET" "-" "(")) :post-handlers '(:add spacemacs//elixir-do-end-close-action) :actions '(insert))) (sp-with-modes '(elixir-mode) diff --git a/layers/+lang/elm/funcs.el b/layers/+lang/elm/funcs.el index 722a844..d997a02 100644 --- a/layers/+lang/elm/funcs.el +++ b/layers/+lang/elm/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Elm Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/elm/packages.el b/layers/+lang/elm/packages.el index c0a46ac..8727e32 100644 --- a/layers/+lang/elm/packages.el +++ b/layers/+lang/elm/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- elm Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/emacs-lisp/README.org b/layers/+lang/emacs-lisp/README.org index 358e38f..c9542eb 100644 --- a/layers/+lang/emacs-lisp/README.org +++ b/layers/+lang/emacs-lisp/README.org @@ -6,10 +6,12 @@ - [[#description][Description]] - [[#install][Install]] - [[#auto-compile][Auto-compile]] + - [[#working-with-lisp-files-barfage-slurpage--more][Working with lisp files (barfage, slurpage & more)]] + - [[#debugging-elisp][Debugging Elisp]] - [[#key-bindings][Key bindings]] - - [[#working-with-lisp-files-barfage-slurpage--more][Working with lisp files (barfage, slurpage & more)]] - - [[#leader][Leader]] - - [[#srefactor][srefactor]] + - [[#additional-evaluation-functions][Additional evaluation functions]] + - [[#format-code][Format code]] + - [[#debugging][Debugging]] * Description This layer gathers all the configuration related to emacs-lisp. This should @@ -34,8 +36,7 @@ feature use this line in your =dotspacemacs/user-config= function. You can also exclude the =auto-compile= package. -* Key bindings -** Working with lisp files (barfage, slurpage & more) +* Working with lisp files (barfage, slurpage & more) Spacemacs comes with a special ~lisp-state~ for working with lisp code that supports slurpage, barfage and more tools you'll likely want when working with lisp. @@ -43,26 +44,74 @@ lisp. As this state works the same for all files, the documentation is in global [[https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.org#lisp-key-bindings][DOCUMENTATION.org]]. In general, use ~SPC k~ to interact with the lisp-state. -** Leader - -| Key Binding | Description | -|----------------------------+------------------------------------------------------------| -| ~SPC m g g~ | go to definition of symbol under point | -| ~SPC m h h~ | describe symbol at point | -| ~SPC m c c~ | byte compile the current file | -| ~SPC m c l~ | popup compile-log buffer | -| ~SPC m e $~ or ~SPC m e l~ | go to end of current line and evaluate | -| ~SPC m e b~ | evaluate current buffer | -| ~SPC m e c~ | evaluate current form (start with =defun=, =setq=, etc...) | -| ~SPC m e e~ | evaluate sexp before point | -| ~SPC m e r~ | evaluate current region | -| ~SPC m e f~ | evaluation current function | -| ~SPC m ​,​~ | toggle =lisp state= | -| ~SPC m t b~ | run tests of current buffer | -| ~SPC m t q~ | run =ert= | -| ~SPC m d m~ | open [[https://github.com/joddie/macrostep][macrostep]] transient-state | - -** srefactor +* Debugging Elisp +Here is an interactive quick start to debug Emacs Lisp. + +First you need to read this file in Emacs in order to have the following code +block to be interactively opened as Emacs Lisp. + +#+BEGIN_SRC elisp +(defun helloworld (name) + (let ((n (subroutine name))) + (message (format "Hello world, %s!" name)))) + +(defun subroutine (s) + (concat "my dear " s)) + +(helloworld "Spacemacs") +#+END_SRC + +1) To start the tutorial put your point in the source block above and press ~, '~ +it will open a new buffer in =emacs-lisp-mode=. + +2) Evaluate each sexp by putting your point in each of them and press ~, e f~. + +3) To debug the =helloworld= function, put your cursor on the =defun= keyword and +press ~SPC m d f~ (or ~, d f~), it will put a breakpoint on the function (we say +that we instrumentalise this function) so whenever the Lisp interpreter +encounters this function it will start the debugger. + +4) Then go to the closing parenthesis of =(helloworld "Spacemacs")= and press +~, e e~ to evaluate it, if you are using =vim= editing style you end up in +evilified state otherwise you end up in emacs state and =*Debugging*= is +displayed in the mode line. + +5) Press ~s~ to go to next step up to the opening parenthesis of + =(subroutine name)=, + +6) Press ~i~ to go into the =subroutine= where you can press ~s~ to step in +function or press ~o~ to go out of it. + +7) Press ~a~ to stop debugging. + +* Key bindings + +| Key Binding | Description | +|----------------------------+----------------------------------------| +| ~SPC m g g~ | go to definition of symbol under point | +| ~SPC m h h~ | describe symbol at point | +| ~SPC m c c~ | byte compile the current file | +| ~SPC m c l~ | popup compile-log buffer | +| ~SPC m e $~ or ~SPC m e l~ | go to end of current line and evaluate | +| ~SPC m e b~ | evaluate current buffer | +| ~SPC m e C~ | evaluate current =defun= or =setq= | +| ~SPC m e e~ | evaluate sexp before point | +| ~SPC m e f~ | evaluation current function | +| ~SPC m e r~ | evaluate current region | +| ~SPC m ​,​~ | toggle =lisp state= | +| ~SPC m t b~ | run tests of current buffer | +| ~SPC m t q~ | run =ert= | +| ~SPC m d m~ | open [[https://github.com/joddie/macrostep][macrostep]] transient-state | + +** Additional evaluation functions +If =smartparens= is used the following additional key bindings are available: + +| Key Binding | Description | +|-------------+------------------------------| +| ~SPC m e c~ | evaluate sexp around point | +| ~SPC m e s~ | evaluate symbol around point | + +** Format code The [[file:../../semantic/README.org][semantic]] layer should be installed for these key bindings to become active. | Key Binding | Description | @@ -71,3 +120,22 @@ The [[file:../../semantic/README.org][semantic]] layer should be installed for t | ~SPC m = f~ | format current function | | ~SPC m = o~ | format all on one line | | ~SPC m = s~ | format current sexp | + +** Debugging +To start debugging: + +| Key Binding | Description | +|-------------+------------------------------------------------------------------------| +| ~SPC m d f~ | on a =defun= symbol toggle on the instrumentalisation of the function | +| ~SPC m d F~ | on a =defun= symbol toggle off the instrumentalisation of the function | +| ~SPC m d t~ | insert =(debug)= to print the stack trace and re-evaluate the function | + +In =edebug-mode= (=*Debugging*= is displayed in the minor modes segment of the +mode line) + +TODO + +In =debugger-mode= (=Debugger= is displayed in major mode segment of the mode +line) + +TODO diff --git a/layers/+lang/emacs-lisp/config.el b/layers/+lang/emacs-lisp/config.el index 2404f5e..630dad7 100644 --- a/layers/+lang/emacs-lisp/config.el +++ b/layers/+lang/emacs-lisp/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Emacs Lisp Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/emacs-lisp/funcs.el b/layers/+lang/emacs-lisp/funcs.el index 4b07d98..0729cc0 100644 --- a/layers/+lang/emacs-lisp/funcs.el +++ b/layers/+lang/emacs-lisp/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Emacs Lisp functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -29,3 +29,78 @@ (not (fboundp symb))) (find-variable-other-window symb) (find-function-at-point)))) + + +;; edebug + +(defun spacemacs/edebug-instrument-defun-on () + "Toggle on instrumentalisation for the function under `defun'." + (interactive) + (eval-defun 'edebugit)) + +(defun spacemacs/edebug-instrument-defun-off () + "Toggle on instrumentalisation for the function under `defun'." + (interactive) + (eval-defun)) + +(defun spacemacs/elisp-toggle-debug-expr-and-eval-func () + "Insert or remove debug expression, evaluate function and save buffer." + (interactive) + (let ((trace "(debug)") + (line (thing-at-point 'line))) + (if (and line (string-match trace line)) + (kill-whole-line) + (progn + (back-to-indentation) + (insert trace) + (newline-and-indent)))) + (eval-defun nil) + (save-buffer)) + +(defun spacemacs//edebug-mode (&rest args) + "Additional processing when `edebug-mode' is activated or deactivated." + (let ((evilified (or (eq 'vim dotspacemacs-editing-style) + (and (eq 'hybrid dotspacemacs-editing-style) + hybrid-mode-enable-evilified-state)))) + (if (not edebug-mode) + ;; disable edebug-mode + (when evilified (evil-normal-state)) + ;; enable edebug-mode + (when evilified (evil-evilified-state)) + (evil-normalize-keymaps) + (when (and (fboundp 'golden-ratio-mode) + golden-ratio-mode) + (golden-ratio))))) + + +;; smartparens integration + +(defun spacemacs/eval-current-form-sp (&optional arg) + "Call `eval-last-sexp' after moving out of one level of +parentheses. Will exit any strings and/or comments first. +An optional ARG can be used which is passed to `sp-up-sexp' to move out of more +than one sexp. +Requires smartparens because all movement is done using `sp-up-sexp'." + (interactive "p") + (require 'smartparens) + (let ((evil-move-beyond-eol t)) + ;; evil-move-beyond-eol disables the evil advices around eval-last-sexp + (save-excursion + (let ((max 10)) + (while (and (> max 0) + (sp-point-in-string-or-comment)) + (decf max) + (sp-up-sexp))) + (sp-up-sexp arg) + (call-interactively 'eval-last-sexp)))) + +(defun spacemacs/eval-current-symbol-sp () + "Call `eval-last-sexp' on the symbol around point. +Requires smartparens because all movement is done using `sp-forward-symbol'." + (interactive) + (require 'smartparens) + (let ((evil-move-beyond-eol t)) + ;; evil-move-beyond-eol disables the evil advices around eval-last-sexp + (save-excursion + (sp-forward-symbol) + (call-interactively 'eval-last-sexp)))) diff --git a/layers/+lang/emacs-lisp/packages.el b/layers/+lang/emacs-lisp/packages.el index 277b042..81eaa5c 100644 --- a/layers/+lang/emacs-lisp/packages.el +++ b/layers/+lang/emacs-lisp/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Emacs Lisp Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -13,6 +13,8 @@ '( auto-compile company + (debug :location built-in) + (edebug :location built-in) eldoc elisp-slime-nav (emacs-lisp :location built-in) @@ -49,13 +51,55 @@ (spacemacs|add-company-hook ielm-mode) (push '(company-files company-capf) company-backends-ielm-mode)) +(defun emacs-lisp/init-debug () + (use-package debug + :defer t + :init (dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) + (spacemacs/declare-prefix-for-mode mode "md" "debug") + (spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode + "dt" 'spacemacs/elisp-toggle-debug-expr-and-eval-func)) + :config (evilified-state-evilify-map debugger-mode-map + :mode debugger-mode))) + +(defun emacs-lisp/init-edebug () + (use-package edebug + :defer t + :init + (progn + ;; key bindings + (dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) + (spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode + "df" 'spacemacs/edebug-instrument-defun-on + "dF" 'spacemacs/edebug-instrument-defun-off)) + ;; since we evilify `edebug-mode-map' we don't need to intercept it to + ;; make it work with evil + (evil-set-custom-state-maps + 'evil-intercept-maps + 'evil-pending-intercept-maps + 'intercept-state + 'evil-make-intercept-map + (delq (assq 'edebug-mode-map evil-intercept-maps) + evil-intercept-maps)) + (evilified-state-evilify-map edebug-mode-map + :eval-after-load edebug + :bindings + "a" 'edebug-stop + "s" 'edebug-step-mode + "S" 'edebug-next-mode) + (evilified-state-evilify-map edebug-eval-mode-map + :eval-after-load edebug + :bindings + "a" 'edebug-stop + "s" 'edebug-step-mode + "S" 'edebug-next-mode) + (advice-add 'edebug-mode :after 'spacemacs//edebug-mode)))) + (defun emacs-lisp/post-init-eldoc () (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)) (defun emacs-lisp/init-auto-compile () (use-package auto-compile :defer t - :diminish (auto-compile-mode . "") :init (progn (setq auto-compile-display-buffer nil @@ -65,6 +109,7 @@ (add-hook 'emacs-lisp-mode-hook 'auto-compile-mode)) :config (progn + (spacemacs|hide-lighter auto-compile-mode) (spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode "cl" 'auto-compile-display-log)))) @@ -72,7 +117,6 @@ ;; Elisp go-to-definition with M-. and back again with M-, (use-package elisp-slime-nav :defer t - :diminish elisp-slime-nav-mode :init (progn (add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode) @@ -82,7 +126,10 @@ (spacemacs/set-leader-keys-for-major-mode mode "hh" 'elisp-slime-nav-describe-elisp-thing-at-point) (let ((jumpl (intern (format "spacemacs-jump-handlers-%S" mode)))) - (add-to-list jumpl 'elisp-slime-nav-find-elisp-thing-at-point)))))) + (add-to-list jumpl 'elisp-slime-nav-find-elisp-thing-at-point)))) + :config (spacemacs|hide-lighter elisp-slime-nav-mode) + + )) (defun emacs-lisp/init-emacs-lisp () (dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) @@ -93,6 +140,7 @@ "cc" 'emacs-lisp-byte-compile "e$" 'lisp-state-eval-sexp-end-of-line "eb" 'eval-buffer + "eC" 'spacemacs/eval-current-form "ee" 'eval-last-sexp "er" 'eval-region "ef" 'eval-defun @@ -167,35 +215,6 @@ "=s" 'srefactor-lisp-format-sexp)))) (defun emacs-lisp/post-init-smartparens () - (advice-remove 'elisp--preceding-sexp 'evil--preceding-sexp) - - (defun spacemacs/eval-current-form-sp (&optional arg) - "Call `eval-last-sexp' after moving out of one level of -parentheses. Will exit any strings and/or comments first. -Requires smartparens because all movement is done using -`sp-up-sexp'. An optional ARG can be used which is passed to -`sp-up-sexp' to move out of more than one sexp." - (interactive "p") - (require 'smartparens) - (save-excursion - (let ((max 10)) - (while (and (> max 0) - (sp-point-in-string-or-comment)) - (decf max) - (sp-up-sexp))) - (sp-up-sexp arg) - (call-interactively 'eval-last-sexp))) - - (defun spacemacs/eval-current-symbol-sp () - "Call `eval-last-sexp' on the symbol around point. Requires -smartparens because all movement is done using -`sp-forward-symbol'." - (interactive) - (require 'smartparens) - (save-excursion - (sp-forward-symbol) - (call-interactively 'eval-last-sexp))) - (dolist (mode '(emacs-lisp-mode lisp-interaction-mode)) (spacemacs/set-leader-keys-for-major-mode mode "ec" 'spacemacs/eval-current-form-sp diff --git a/layers/+lang/erlang/config.el b/layers/+lang/erlang/config.el index b47e5df..fc14a7a 100644 --- a/layers/+lang/erlang/config.el +++ b/layers/+lang/erlang/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Erlang Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/erlang/packages.el b/layers/+lang/erlang/packages.el index 646f03a..bfad39a 100644 --- a/layers/+lang/erlang/packages.el +++ b/layers/+lang/erlang/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Erlang Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ess/config.el b/layers/+lang/ess/config.el index a599c3f..5d33842 100644 --- a/layers/+lang/ess/config.el +++ b/layers/+lang/ess/config.el @@ -1,6 +1,6 @@ ;;; config.el --- ESS Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ess/packages.el b/layers/+lang/ess/packages.el index 2278af4..5f32dbd 100644 --- a/layers/+lang/ess/packages.el +++ b/layers/+lang/ess/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- ESS (R) Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/extra-langs/packages.el b/layers/+lang/extra-langs/packages.el index 2cd85d0..7dd784b 100644 --- a/layers/+lang/extra-langs/packages.el +++ b/layers/+lang/extra-langs/packages.el @@ -36,8 +36,10 @@ (defun extra-langs/init-thrift () (use-package thrift :defer t)) -;; no associated extension because conflicts with more common Objective-C, manually invoke for .m files. +;; .m files are not associated because conflict with more common Objective-C and +;; MATLAB/Octave, manually invoke for .m files. (defun extra-langs/init-wolfram-mode () (use-package wolfram-mode :defer t - :interpreter "\\(Wolfram\\|Mathematica\\)Script\\( -script\\)?")) + :interpreter "\\(Wolfram\\|Mathematica\\)Script\\( -script\\)?" + :mode "\\.wl\\'")) diff --git a/layers/+lang/faust/config.el b/layers/+lang/faust/config.el index 7d20f68..b3c22e5 100644 --- a/layers/+lang/faust/config.el +++ b/layers/+lang/faust/config.el @@ -1,6 +1,6 @@ ;;; config.el --- faust Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Bart Brouns ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/faust/funcs.el b/layers/+lang/faust/funcs.el index 2accd4f..6cff414 100644 --- a/layers/+lang/faust/funcs.el +++ b/layers/+lang/faust/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el -- Faust Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/faust/packages.el b/layers/+lang/faust/packages.el index e4d3192..90a5ee8 100644 --- a/layers/+lang/faust/packages.el +++ b/layers/+lang/faust/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- faust layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Bart Brouns ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/fsharp/config.el b/layers/+lang/fsharp/config.el index 1930d03..9fdaae2 100644 --- a/layers/+lang/fsharp/config.el +++ b/layers/+lang/fsharp/config.el @@ -1,6 +1,6 @@ ;;; config.el --- fsharp Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/fsharp/packages.el b/layers/+lang/fsharp/packages.el index da951ca..07a1a67 100644 --- a/layers/+lang/fsharp/packages.el +++ b/layers/+lang/fsharp/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- F# Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/go/config.el b/layers/+lang/go/config.el index 0332cb1..76777f9 100644 --- a/layers/+lang/go/config.el +++ b/layers/+lang/go/config.el @@ -1,6 +1,6 @@ -;;; packages.el --- Go Layer packages File for Spacemacs +;;; config.el --- Go Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/go/funcs.el b/layers/+lang/go/funcs.el index 8142536..47ecba2 100644 --- a/layers/+lang/go/funcs.el +++ b/layers/+lang/go/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Go Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/go/local/go-rename/go-rename.el b/layers/+lang/go/local/go-rename/go-rename.el index c871b1c..8d87ea2 100644 --- a/layers/+lang/go/local/go-rename/go-rename.el +++ b/layers/+lang/go/local/go-rename/go-rename.el @@ -37,7 +37,7 @@ the `gorename' tool." (string= (file-name-extension (buffer-file-name)) ".go")))) (let* ((posflag (format "-offset=%s:#%d" (expand-file-name buffer-file-truename) - (1- (go--position-bytes (point))))) + (1- (position-bytes (point))))) (env-vars (go-root-and-paths)) (goroot-env (concat "GOROOT=" (car env-vars))) (gopath-env (concat "GOPATH=" (mapconcat #'identity (cdr env-vars) ":"))) diff --git a/layers/+lang/go/packages.el b/layers/+lang/go/packages.el index bb32f88..9b627ff 100644 --- a/layers/+lang/go/packages.el +++ b/layers/+lang/go/packages.el @@ -1,3 +1,14 @@ +;;; packages.el --- Go Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + (setq go-packages '( company diff --git a/layers/+lang/graphviz/packages.el b/layers/+lang/graphviz/packages.el index d123d49..8a5c9e5 100644 --- a/layers/+lang/graphviz/packages.el +++ b/layers/+lang/graphviz/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- graphviz layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: luxbock ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/haskell/README.org b/layers/+lang/haskell/README.org index 6054f09..1a2dfed 100644 --- a/layers/+lang/haskell/README.org +++ b/layers/+lang/haskell/README.org @@ -218,10 +218,10 @@ Debug commands are prefixed by ~SPC m d~: | ~b~ | break on function | | ~c~ | continue the current computation | | ~d~ | delete object at the point | -| ~n~ | go to next step to inspect bindings | -| ~N~ or ~p~ | go to previous step to inspect the bindings | +| ~i~ | step into the next function | | ~r~ | refresh the debugger buffer | -| ~s~ | step into the next function | +| ~s~ | go to next step to inspect bindings | +| ~S~ | go to previous step to inspect the bindings | | ~t~ | trace the expression | ** REPL diff --git a/layers/+lang/haskell/config.el b/layers/+lang/haskell/config.el index 2a1a107..8884ac4 100644 --- a/layers/+lang/haskell/config.el +++ b/layers/+lang/haskell/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Haskell Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Bjarke Vad Andersen ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/haskell/funcs.el b/layers/+lang/haskell/funcs.el index 065e812..4bef53b 100644 --- a/layers/+lang/haskell/funcs.el +++ b/layers/+lang/haskell/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Haskell Layer funcs File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/haskell/packages.el b/layers/+lang/haskell/packages.el index 919be6c..37fa339 100644 --- a/layers/+lang/haskell/packages.el +++ b/layers/+lang/haskell/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Haskell Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -188,11 +188,10 @@ "b" 'haskell-debug/break-on-function "c" 'haskell-debug/continue "d" 'haskell-debug/delete - "n" 'haskell-debug/next - "N" 'haskell-debug/previous - "p" 'haskell-debug/previous + "i" 'haskell-debug/step + "s" 'haskell-debug/next + "S" 'haskell-debug/previous "r" 'haskell-debug/refresh - "s" 'haskell-debug/step "t" 'haskell-debug/trace) ;; configure C-c C-l so it doesn't throw any errors @@ -252,8 +251,9 @@ (defun haskell/init-haskell-snippets () ;; manually load the package since the current implementation is not lazy ;; loading friendly (funny coming from the haskell mode :-)) - (setq haskell-snippets-dir (spacemacs//get-package-directory - 'haskell-snippets)) + (setq haskell-snippets-dir + (configuration-layer/get-elpa-package-install-directory + 'haskell-snippets)) (defun haskell-snippets-initialize () (let ((snip-dir (expand-file-name "snippets" haskell-snippets-dir))) diff --git a/layers/+lang/html/funcs.el b/layers/+lang/html/funcs.el index 52faddb..0a54491 100644 --- a/layers/+lang/html/funcs.el +++ b/layers/+lang/html/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- HTML Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -14,3 +14,8 @@ (if (bound-and-true-p yas-minor-mode) (call-interactively 'emmet-expand-yas) (call-interactively 'emmet-expand-line))) + +;; see https://github.com/osv/company-web/issues/4 +(defun spacemacs//company-web-minimum-prefix-length () + "Set company minimum prefix length to 0 for the current buffer only." + (set (make-local-variable 'company-minimum-prefix-length) 0)) diff --git a/layers/+lang/html/packages.el b/layers/+lang/html/packages.el index fe595ed..e5b7c73 100644 --- a/layers/+lang/html/packages.el +++ b/layers/+lang/html/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- HTML Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -30,15 +30,18 @@ yasnippet )) -;;TODO: whenever company-web makes a backend for haml-mode it should be added here. -- @robbyoconnor (defun html/post-init-company () - (spacemacs|add-company-hook css-mode) - (spacemacs|add-company-hook jade-mode) - (spacemacs|add-company-hook slim-mode) - (spacemacs|add-company-hook web-mode)) + (spacemacs|add-company-hook css-mode)) +;;TODO: whenever company-web makes a backend for haml-mode it should be added here. -- @robbyoconnor (defun html/init-company-web () - (use-package company-web)) + (use-package company-web + :defer t + :init + (progn + (spacemacs|add-company-hook jade-mode) + (spacemacs|add-company-hook slim-mode) + (spacemacs|add-company-hook web-mode)))) (defun html/init-css-mode () (use-package css-mode @@ -132,7 +135,8 @@ (defun html/init-pug-mode () (use-package pug-mode :defer t - :mode ("\\.pug$" . pug-mode))) + :mode ("\\.pug$" . pug-mode) + :init (push 'company-web-jade company-backends-jade-mode))) (defun html/init-sass-mode () (use-package sass-mode @@ -146,7 +150,8 @@ (defun html/init-slim-mode () (use-package slim-mode - :defer t)) + :defer t + :init (push 'company-web-slim company-backends-slim-mode))) (defun html/post-init-smartparens () (spacemacs/add-to-hooks @@ -170,7 +175,9 @@ (use-package web-mode :defer t :init - (push '(company-web-html company-css) company-backends-web-mode) + (progn + (push '(company-web-html company-css) company-backends-web-mode) + (add-hook 'web-mode-hook 'spacemacs//company-web-minimum-prefix-length)) :config (progn (spacemacs/declare-prefix-for-mode 'web-mode "me" "errors") diff --git a/layers/+lang/idris/packages.el b/layers/+lang/idris/packages.el index 7a9d9e5..d5e0162 100644 --- a/layers/+lang/idris/packages.el +++ b/layers/+lang/idris/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Idris Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Timothy Jones ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ipython-notebook/matplotlibrc b/layers/+lang/ipython-notebook/matplotlibrc index ae7f4e7..3477756 100644 --- a/layers/+lang/ipython-notebook/matplotlibrc +++ b/layers/+lang/ipython-notebook/matplotlibrc @@ -9,7 +9,7 @@ axes.facecolor : 383838 # axes background color axes.edgecolor : bcbcbc # axes edge color axes.grid : True # display grid or not axes.labelcolor : dcdccc -axes.prop_cycle : 8cd0d3, 7f9f7f, cc9393, 93e0e3, dc8cc3, f0dfaf, dcdccc +axes.prop_cycle : cycler('color', ['8cd0d3', '7f9f7f', 'cc9393', '93e0e3', 'dc8cc3', 'f0dfaf', 'dcdccc']) # (system default) blue, green, red, cyan, magenta, yellow, black xtick.color : dcdccc # color of the tick labels diff --git a/layers/+lang/ipython-notebook/packages.el b/layers/+lang/ipython-notebook/packages.el index 7bfe162..1578c0c 100644 --- a/layers/+lang/ipython-notebook/packages.el +++ b/layers/+lang/ipython-notebook/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- ipython Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/java/README.org b/layers/+lang/java/README.org index 17d676b..0a0c8a7 100644 --- a/layers/+lang/java/README.org +++ b/layers/+lang/java/README.org @@ -42,7 +42,7 @@ Then set the =Eclipse= and =Eclim= paths in =dotspacemacs/user-config=, for instance: #+BEGIN_SRC elisp - (setq eclim-eclipse-dirs "~/opt/eclipse" + (setq eclim-eclipse-dirs '("~/opt/eclipse") eclim-executable "~/opt/eclipse/eclim") #+END_SRC diff --git a/layers/+lang/java/config.el b/layers/+lang/java/config.el index 170fc00..d0c9979 100644 --- a/layers/+lang/java/config.el +++ b/layers/+lang/java/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Java configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Lukasz Klich ;; diff --git a/layers/+lang/java/funcs.el b/layers/+lang/java/funcs.el index 4f10940..2c1d154 100644 --- a/layers/+lang/java/funcs.el +++ b/layers/+lang/java/funcs.el @@ -1,6 +1,6 @@ ;;; packages.el --- Java functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Lukasz Klich ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/java/packages.el b/layers/+lang/java/packages.el index b15ff46..c624f2e 100644 --- a/layers/+lang/java/packages.el +++ b/layers/+lang/java/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Java Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Lukasz Klich ;; URL: https://github.com/syl20bnr/spacemacs @@ -30,13 +30,13 @@ (defun java/init-eclim () (use-package eclim :defer t - :diminish eclim-mode :init (progn (add-hook 'java-mode-hook 'eclim-mode) (add-to-list 'spacemacs-jump-handlers-java-mode 'eclim-java-find-declaration)) :config (progn + (spacemacs|hide-lighter eclim-mode) (require 'eclimd) (setq help-at-pt-display-when-idle t help-at-pt-timer-delay 0.1) diff --git a/layers/+lang/javascript/config.el b/layers/+lang/javascript/config.el index 184e760..4ea6c27 100644 --- a/layers/+lang/javascript/config.el +++ b/layers/+lang/javascript/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Javascript Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/javascript/funcs.el b/layers/+lang/javascript/funcs.el index f1b2a60..1df7d78 100644 --- a/layers/+lang/javascript/funcs.el +++ b/layers/+lang/javascript/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Javascript Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Muneeb Shaikh ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,13 +9,82 @@ ;; ;;; License: GPLv3 + +;; js-doc + +(defun spacemacs/js-doc-require () + "Lazy load js-doc" + (require 'js-doc)) +(add-hook 'js2-mode-hook 'spacemacs/js-doc-require) + +(defun spacemacs/js-doc-set-key-bindings (mode) + "Setup the key bindings for `js2-doc' for the given MODE." + (spacemacs/declare-prefix-for-mode mode "mrd" "documentation") + (spacemacs/set-leader-keys-for-major-mode mode + "rdb" 'js-doc-insert-file-doc + "rdf" 'js-doc-insert-function-doc + "rdt" 'js-doc-insert-tag + "rdh" 'js-doc-describe-tag)) + +;; js-refactor + +(defun spacemacs/js2-refactor-require () + "Lazy load js2-refactor" + (require 'js2-refactor)) + + +;; coffee + +(defun javascript/coffee-indent () + (if (coffee-line-wants-indent) + ;; We need to insert an additional tab because + ;; the last line was special. + (coffee-insert-spaces (+ (coffee-previous-indent) coffee-tab-width)) + ;; otherwise keep at the same indentation level + (coffee-insert-spaces (coffee-previous-indent)))) + + +;; skewer + +(defun spacemacs/skewer-start-repl () + "Attach a browser to Emacs and start a skewer REPL." + (interactive) + (run-skewer) + (skewer-repl)) + +(defun spacemacs/skewer-load-buffer-and-focus () + "Execute whole buffer in browser and switch to REPL in insert state." + (interactive) + (skewer-load-buffer) + (skewer-repl) + (evil-insert-state)) + +(defun spacemacs/skewer-eval-defun-and-focus () + "Execute function at point in browser and switch to REPL in insert state." + (interactive) + (skewer-eval-defun) + (skewer-repl) + (evil-insert-state)) + +(defun spacemacs/skewer-eval-region (beg end) + "Execute the region as JavaScript code in the attached browser." + (interactive "r") + (skewer-eval (buffer-substring beg end) #'skewer-post-minibuffer)) + +(defun spacemacs/skewer-eval-region-and-focus (beg end) + "Execute the region in browser and swith to REPL in insert state." + (interactive "r") + (spacemacs/skewer-eval-region beg end) + (skewer-repl) + (evil-insert-state)) + ;; tern (defun spacemacs//set-tern-key-bindings (mode) "Set the key bindings for tern and the given MODE." (add-to-list (intern (format "spacemacs-jump-handlers-%S" mode)) - 'tern-find-definition) + '(tern-find-definition :async t)) (spacemacs/set-leader-keys-for-major-mode mode "rrV" 'tern-rename-variable "hd" 'tern-get-docs diff --git a/layers/+lang/javascript/packages.el b/layers/+lang/javascript/packages.el index ba1d102..105aeeb 100644 --- a/layers/+lang/javascript/packages.el +++ b/layers/+lang/javascript/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Javascript Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -34,13 +34,6 @@ :defer t :init (progn - (defun javascript/coffee-indent () - (if (coffee-line-wants-indent) - ;; We need to insert an additional tab because the last line was special. - (coffee-insert-spaces (+ (coffee-previous-indent) coffee-tab-width)) - ;; otherwise keep at the same indentation level - (coffee-insert-spaces (coffee-previous-indent))) - ) ;; indent to right position after `evil-open-below' and `evil-open-above' (add-hook 'coffee-mode-hook '(lambda () (setq indent-line-function 'javascript/coffee-indent @@ -70,21 +63,7 @@ (defun javascript/init-js-doc () (use-package js-doc :defer t - :init - (progn - (defun spacemacs/js-doc-require () - "Lazy load js-doc" - (require 'js-doc)) - (add-hook 'js2-mode-hook 'spacemacs/js-doc-require) - - (defun spacemacs/js-doc-set-key-bindings (mode) - "Setup the key bindings for `js2-doc' for the given MODE." - (spacemacs/declare-prefix-for-mode mode "mrd" "documentation") - (spacemacs/set-leader-keys-for-major-mode mode "rdb" 'js-doc-insert-file-doc) - (spacemacs/set-leader-keys-for-major-mode mode "rdf" 'js-doc-insert-function-doc) - (spacemacs/set-leader-keys-for-major-mode mode "rdt" 'js-doc-insert-tag) - (spacemacs/set-leader-keys-for-major-mode mode "rdh" 'js-doc-describe-tag)) - (spacemacs/js-doc-set-key-bindings 'js2-mode)))) + :init (spacemacs/js-doc-set-key-bindings 'js2-mode))) (defun javascript/init-js2-mode () (use-package js2-mode @@ -96,10 +75,12 @@ (add-hook 'js2-mode-hook 'js2-imenu-extras-mode)) :config (progn + ;; prefixes (spacemacs/declare-prefix-for-mode 'js2-mode "mh" "documentation") (spacemacs/declare-prefix-for-mode 'js2-mode "mg" "goto") (spacemacs/declare-prefix-for-mode 'js2-mode "mr" "refactor") (spacemacs/declare-prefix-for-mode 'js2-mode "mz" "folding") + ;; key bindings (spacemacs/set-leader-keys-for-major-mode 'js2-mode "w" 'js2-mode-toggle-warnings-and-errors "zc" 'js2-mode-hide-element @@ -117,73 +98,55 @@ :defer t :init (progn - (defun spacemacs/js2-refactor-require () - "Lazy load js2-refactor" - (require 'js2-refactor)) (add-hook 'js2-mode-hook 'spacemacs/js2-refactor-require) - - (defun spacemacs/js2-refactor-set-key-bindings (mode) - (spacemacs/declare-prefix-for-mode mode "mr3" "ternary") - (spacemacs/set-leader-keys-for-major-mode mode "r3i" 'js2r-ternary-to-if) - - (spacemacs/declare-prefix-for-mode mode "mra" "add/args") - (spacemacs/set-leader-keys-for-major-mode mode "rag" 'js2r-add-to-globals-annotation) - (spacemacs/set-leader-keys-for-major-mode mode "rao" 'js2r-arguments-to-object) - - (spacemacs/declare-prefix-for-mode mode "mrb" "barf") - (spacemacs/set-leader-keys-for-major-mode mode "rba" 'js2r-forward-barf) - - (spacemacs/declare-prefix-for-mode mode "mrc" "contract") - (spacemacs/set-leader-keys-for-major-mode mode "rca" 'js2r-contract-array) - (spacemacs/set-leader-keys-for-major-mode mode "rco" 'js2r-contract-object) - (spacemacs/set-leader-keys-for-major-mode mode "rcu" 'js2r-contract-function) - - (spacemacs/declare-prefix-for-mode mode "mre" "expand/extract") - (spacemacs/set-leader-keys-for-major-mode mode "rea" 'js2r-expand-array) - (spacemacs/set-leader-keys-for-major-mode mode "ref" 'js2r-extract-function) - (spacemacs/set-leader-keys-for-major-mode mode "rem" 'js2r-extract-method) - (spacemacs/set-leader-keys-for-major-mode mode "reo" 'js2r-expand-object) - (spacemacs/set-leader-keys-for-major-mode mode "reu" 'js2r-expand-function) - (spacemacs/set-leader-keys-for-major-mode mode "rev" 'js2r-extract-var) - - (spacemacs/declare-prefix-for-mode mode "mri" "inline/inject/introduct") - (spacemacs/set-leader-keys-for-major-mode mode "rig" 'js2r-inject-global-in-iife) - (spacemacs/set-leader-keys-for-major-mode mode "rip" 'js2r-introduce-parameter) - (spacemacs/set-leader-keys-for-major-mode mode "riv" 'js2r-inline-var) - - (spacemacs/declare-prefix-for-mode mode "mrl" "localize/log") - (spacemacs/set-leader-keys-for-major-mode mode "rlp" 'js2r-localize-parameter) - (spacemacs/set-leader-keys-for-major-mode mode "rlt" 'js2r-log-this) - - (spacemacs/declare-prefix-for-mode mode "mrr" "rename") - (spacemacs/set-leader-keys-for-major-mode mode "rrv" 'js2r-rename-var) - - (spacemacs/declare-prefix-for-mode mode "mrs" "split/slurp") - (spacemacs/set-leader-keys-for-major-mode mode "rsl" 'js2r-forward-slurp) - (spacemacs/set-leader-keys-for-major-mode mode "rss" 'js2r-split-string) - (spacemacs/set-leader-keys-for-major-mode mode "rsv" 'js2r-split-var-declaration) - - (spacemacs/declare-prefix-for-mode mode "mrt" "toggle") - (spacemacs/set-leader-keys-for-major-mode mode "rtf" 'js2r-toggle-function-expression-and-declaration) - - (spacemacs/declare-prefix-for-mode mode "mru" "unwrap") - (spacemacs/set-leader-keys-for-major-mode mode "ruw" 'js2r-unwrap) - - (spacemacs/declare-prefix-for-mode mode "mrv" "var") - (spacemacs/set-leader-keys-for-major-mode mode "rvt" 'js2r-var-to-this) - - (spacemacs/declare-prefix-for-mode mode "mrw" "wrap") - (spacemacs/set-leader-keys-for-major-mode mode "rwi" 'js2r-wrap-buffer-in-iife) - (spacemacs/set-leader-keys-for-major-mode mode "rwl" 'js2r-wrap-in-for-loop) - - (spacemacs/set-leader-keys-for-major-mode mode "k" 'js2r-kill) - - (spacemacs/declare-prefix-for-mode mode "mx" "text") - (spacemacs/declare-prefix-for-mode mode "mxm" "move") - (spacemacs/set-leader-keys-for-major-mode mode "xmj" 'js2r-move-line-down) - (spacemacs/set-leader-keys-for-major-mode mode "xmk" 'js2r-move-line-up)) - - (spacemacs/js2-refactor-set-key-bindings 'js2-mode)))) + ;; prefixes + (spacemacs/declare-prefix-for-mode 'js2-mode "mr3" "ternary") + (spacemacs/declare-prefix-for-mode 'js2-mode "mra" "add/args") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrb" "barf") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrc" "contract") + (spacemacs/declare-prefix-for-mode 'js2-mode "mre" "expand/extract") + (spacemacs/declare-prefix-for-mode 'js2-mode "mri" "inline/inject/introduct") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrl" "localize/log") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrr" "rename") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrs" "split/slurp") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrt" "toggle") + (spacemacs/declare-prefix-for-mode 'js2-mode "mru" "unwrap") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrv" "var") + (spacemacs/declare-prefix-for-mode 'js2-mode "mrw" "wrap") + (spacemacs/declare-prefix-for-mode 'js2-mode "mx" "text") + (spacemacs/declare-prefix-for-mode 'js2-mode "mxm" "move") + ;; key bindings + (spacemacs/set-leader-keys-for-major-mode 'js2-mode + "r3i" 'js2r-ternary-to-if + "rag" 'js2r-add-to-globals-annotation + "rao" 'js2r-arguments-to-object + "rba" 'js2r-forward-barf + "rca" 'js2r-contract-array + "rco" 'js2r-contract-object + "rcu" 'js2r-contract-function + "rea" 'js2r-expand-array + "ref" 'js2r-extract-function + "rem" 'js2r-extract-method + "reo" 'js2r-expand-object + "reu" 'js2r-expand-function + "rev" 'js2r-extract-var + "rig" 'js2r-inject-global-in-iife + "rip" 'js2r-introduce-parameter + "riv" 'js2r-inline-var + "rlp" 'js2r-localize-parameter + "rlt" 'js2r-log-this + "rrv" 'js2r-rename-var + "rsl" 'js2r-forward-slurp + "rss" 'js2r-split-string + "rsv" 'js2r-split-var-declaration + "rtf" 'js2r-toggle-function-expression-and-declaration + "ruw" 'js2r-unwrap + "rvt" 'js2r-var-to-this + "rwi" 'js2r-wrap-buffer-in-iife + "rwl" 'js2r-wrap-in-for-loop + "k" 'js2r-kill + "xmj" 'js2r-move-line-down + "xmk" 'js2r-move-line-up)))) (defun javascript/init-json-mode () (use-package json-mode @@ -194,16 +157,15 @@ :defer t :config (spacemacs/set-leader-keys-for-major-mode 'json-mode - "hp" 'jsons-print-path) - )) + "hp" 'jsons-print-path))) (defun javascript/init-tern () (use-package tern :defer t - :diminish tern-mode :init (add-hook 'js2-mode-hook 'tern-mode) :config (progn + (spacemacs|hide-lighter tern-mode) (when javascript-disable-tern-port-files (add-to-list 'tern-command "--no-port-file" 'append)) (spacemacs//set-tern-key-bindings 'js2-mode)))) @@ -213,53 +175,27 @@ :defer t :init (progn - (spacemacs/set-leader-keys-for-major-mode 'js2-mode "=" 'web-beautify-js) - (spacemacs/set-leader-keys-for-major-mode 'json-mode "=" 'web-beautify-js) - (spacemacs/set-leader-keys-for-major-mode 'web-mode "=" 'web-beautify-html) - (spacemacs/set-leader-keys-for-major-mode 'css-mode "=" 'web-beautify-css)))) + (spacemacs/set-leader-keys-for-major-mode 'js2-mode + "=" 'web-beautify-js) + (spacemacs/set-leader-keys-for-major-mode 'json-mode + "=" 'web-beautify-js) + (spacemacs/set-leader-keys-for-major-mode 'web-mode + "=" 'web-beautify-html) + (spacemacs/set-leader-keys-for-major-mode 'css-mode + "=" 'web-beautify-css)))) (defun javascript/init-skewer-mode () (use-package skewer-mode :defer t - :diminish skewer-mode :init (progn - (spacemacs/register-repl 'skewer-mode 'spacemacs/skewer-start-repl "skewer") + (spacemacs/register-repl 'skewer-mode + 'spacemacs/skewer-start-repl + "skewer") (add-hook 'js2-mode-hook 'skewer-mode)) :config (progn - (defun spacemacs/skewer-start-repl () - "Attach a browser to Emacs and start a skewer REPL." - (interactive) - (run-skewer) - (skewer-repl)) - - (defun spacemacs/skewer-load-buffer-and-focus () - "Execute whole buffer in browser and switch to REPL in insert state." - (interactive) - (skewer-load-buffer) - (skewer-repl) - (evil-insert-state)) - - (defun spacemacs/skewer-eval-defun-and-focus () - "Execute function at point in browser and switch to REPL in insert state." - (interactive) - (skewer-eval-defun) - (skewer-repl) - (evil-insert-state)) - - (defun spacemacs/skewer-eval-region (beg end) - "Execute the region as JavaScript code in the attached browser." - (interactive "r") - (skewer-eval (buffer-substring beg end) #'skewer-post-minibuffer)) - - (defun spacemacs/skewer-eval-region-and-focus (beg end) - "Execute the region in browser and swith to REPL in insert state." - (interactive "r") - (spacemacs/skewer-eval-region beg end) - (skewer-repl) - (evil-insert-state)) - + (spacemacs|hide-lighter skewer-mode) (spacemacs/declare-prefix-for-mode 'js2-mode "ms" "skewer") (spacemacs/declare-prefix-for-mode 'js2-mode "me" "eval") (spacemacs/set-leader-keys-for-major-mode 'js2-mode diff --git a/layers/+lang/latex/config.el b/layers/+lang/latex/config.el index 68f1ac4..af14b6d 100644 --- a/layers/+lang/latex/config.el +++ b/layers/+lang/latex/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Latex Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/latex/funcs.el b/layers/+lang/latex/funcs.el index 84649de..a2c22dc 100644 --- a/layers/+lang/latex/funcs.el +++ b/layers/+lang/latex/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Auctex Layer Functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/latex/packages.el b/layers/+lang/latex/packages.el index ab970d5..1302857 100644 --- a/layers/+lang/latex/packages.el +++ b/layers/+lang/latex/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Latex Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -82,11 +82,19 @@ dotspacemacs-major-mode-leader-key 'TeX-command-master)) (when latex-enable-folding (spacemacs/set-leader-keys-for-major-mode mode + ;; the following commands are mostly not autoloaded, but that's fine + ;; because `TeX-fold-mode' is added to `LaTeX-mode-hook' "z=" 'TeX-fold-math "zb" 'TeX-fold-buffer + "zB" 'TeX-fold-clearout-buffer "ze" 'TeX-fold-env + "zI" 'TeX-fold-clearout-item "zm" 'TeX-fold-macro - "zr" 'TeX-fold-region)) + "zp" 'TeX-fold-paragraph + "zP" 'TeX-fold-clearout-paragraph + "zr" 'TeX-fold-region + "zR" 'TeX-fold-clearout-region + "zz" 'TeX-fold-dwim)) (spacemacs/declare-prefix-for-mode mode "mh" "help") (spacemacs/declare-prefix-for-mode mode "mx" "text/fonts") (spacemacs/declare-prefix-for-mode mode "mz" "fold")) @@ -192,5 +200,5 @@ (add-hook 'LaTeX-mode-hook 'spacemacs/load-yasnippet)) (defun latex/post-init-which-key () - (push '("\\`latex/font-\\(.+\\)\\'" . "\\1") - which-key-description-replacement-alist)) + (push '((nil . "\\`latex/font-\\(.+\\)\\'") . (nil . "\\1")) + which-key-replacement-alist)) diff --git a/layers/+lang/lua/config.el b/layers/+lang/lua/config.el index c13d28d..f0ba84d 100644 --- a/layers/+lang/lua/config.el +++ b/layers/+lang/lua/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Lua Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/lua/packages.el b/layers/+lang/lua/packages.el index f48b106..cc8467a 100644 --- a/layers/+lang/lua/packages.el +++ b/layers/+lang/lua/packages.el @@ -1,11 +1,22 @@ +;;; packages.el --- Lua Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + (setq lua-packages - '( - company - flycheck - ggtags - helm-gtags - lua-mode - )) + '( + company + flycheck + ggtags + helm-gtags + lua-mode + )) (defun lua/post-init-flycheck () (spacemacs/add-flycheck-hook 'lua-mode)) diff --git a/layers/+lang/markdown/README.org b/layers/+lang/markdown/README.org index e955ae9..41fa475 100644 --- a/layers/+lang/markdown/README.org +++ b/layers/+lang/markdown/README.org @@ -61,6 +61,10 @@ And install the executable with: npm install -g vmd #+END_SRC +Additionally there is =flymd= package in =chrome= layer that allows to preview +markdown buffer in Chrome. Please refer to =chrome= layer documentation for more +information. + * Usage ** Generate a TOC To generate a table of contents type on top of the buffer: @@ -89,6 +93,7 @@ To generate a table of contents type on top of the buffer: | ~SPC m i w~ | insert wiki link | | ~SPC m i i~ | insert image | | ~SPC m i I~ | insert reference image | +| ~SPC m i t~ | insert Table of Contents (toc) | | ~SPC m x b~ | make region bold or insert bold | | ~SPC m x i~ | make region italic or insert italic | | ~SPC m x c~ | make region code or insert code | diff --git a/layers/+lang/markdown/config.el b/layers/+lang/markdown/config.el index 3326b8e..cc37a18 100644 --- a/layers/+lang/markdown/config.el +++ b/layers/+lang/markdown/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Markdown Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/markdown/funcs.el b/layers/+lang/markdown/funcs.el new file mode 100644 index 0000000..85b1cf9 --- /dev/null +++ b/layers/+lang/markdown/funcs.el @@ -0,0 +1,14 @@ +;;; funcs.el --- Markdown Layer Functions File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun spacemacs/activate-mmm-mode () + ;; Enable `mmm-mode'. + (mmm-mode 1)) diff --git a/layers/+lang/markdown/packages.el b/layers/+lang/markdown/packages.el index 4048317..d6a5253 100644 --- a/layers/+lang/markdown/packages.el +++ b/layers/+lang/markdown/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Markdown Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -156,17 +156,22 @@ Will work on both org-mode and any mode that accepts plain html." (defun markdown/init-markdown-toc () (use-package markdown-toc - :defer t)) + :defer t + :init (spacemacs/set-leader-keys-for-major-mode 'markdown-mode + "it" 'markdown-toc-generate-toc))) (defun markdown/init-mmm-mode () (use-package mmm-mode - :commands mmm-parse-buffer - :init - (spacemacs/set-leader-keys-for-major-mode 'markdown-mode - ;; Highlight code blocks - "cs" 'mmm-parse-buffer) + :commands mmm-mode + :init (add-hook 'markdown-mode-hook 'spacemacs/activate-mmm-mode) :config (progn + (spacemacs|hide-lighter mmm-mode) + (mmm-add-classes '((markdown-ini + :submode conf-unix-mode + :face mmm-declaration-submode-face + :front "^```ini[\n\r]+" + :back "^```$"))) (mmm-add-classes '((markdown-python :submode python-mode :face mmm-declaration-submode-face @@ -217,7 +222,6 @@ Will work on both org-mode and any mode that accepts plain html." :face mmm-declaration-submode-face :front "^```rust[\n\r]+" :back "^```$"))) - (setq mmm-global-mode t) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-python) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-java) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-ruby) @@ -227,7 +231,8 @@ Will work on both org-mode and any mode that accepts plain html." (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-html) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-javascript) (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-ess) - (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-rust)))) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-rust) + (mmm-add-mode-ext-class 'markdown-mode nil 'markdown-ini)))) (defun markdown/init-vmd-mode () (use-package vmd-mode diff --git a/layers/+lang/nim/config.el b/layers/+lang/nim/config.el index ac78366..c15580e 100644 --- a/layers/+lang/nim/config.el +++ b/layers/+lang/nim/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Nim Configuration Layer for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Max Gonzih ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ocaml/config.el b/layers/+lang/ocaml/config.el index 845829a..1a138d6 100644 --- a/layers/+lang/ocaml/config.el +++ b/layers/+lang/ocaml/config.el @@ -1,6 +1,6 @@ ;;; config.el --- ocaml Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ocaml/funcs.el b/layers/+lang/ocaml/funcs.el index 88ed66d..380691a 100644 --- a/layers/+lang/ocaml/funcs.el +++ b/layers/+lang/ocaml/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- ocaml Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ocaml/packages.el b/layers/+lang/ocaml/packages.el index 311e599..3f62a8a 100644 --- a/layers/+lang/ocaml/packages.el +++ b/layers/+lang/ocaml/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- ocaml Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/octave/config.el b/layers/+lang/octave/config.el index d49504c..dde0dd9 100644 --- a/layers/+lang/octave/config.el +++ b/layers/+lang/octave/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Octave Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/octave/packages.el b/layers/+lang/octave/packages.el index 648fc47..422e03b 100644 --- a/layers/+lang/octave/packages.el +++ b/layers/+lang/octave/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Octave Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/php/config.el b/layers/+lang/php/config.el index 6cfefb4..4755927 100644 --- a/layers/+lang/php/config.el +++ b/layers/+lang/php/config.el @@ -1,6 +1,6 @@ ;;; config.el --- PHP Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Kosta Harlan ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/php/packages.el b/layers/+lang/php/packages.el index 3fa6b42..7cf0bfb 100644 --- a/layers/+lang/php/packages.el +++ b/layers/+lang/php/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- PHP Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/plantuml/packages.el b/layers/+lang/plantuml/packages.el index 9972389..2eafe83 100644 --- a/layers/+lang/plantuml/packages.el +++ b/layers/+lang/plantuml/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- plantuml layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Robert O'Connor ;; Contributor: Carlo Sciolla diff --git a/layers/+lang/purescript/config.el b/layers/+lang/purescript/config.el index 0eaeea0..c1bd765 100644 --- a/layers/+lang/purescript/config.el +++ b/layers/+lang/purescript/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Purescript Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Ryan L. Bell ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/purescript/packages.el b/layers/+lang/purescript/packages.el index 55c9e88..760a82b 100644 --- a/layers/+lang/purescript/packages.el +++ b/layers/+lang/purescript/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Purescript Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Ryan L. Bell ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/python/README.org b/layers/+lang/python/README.org index 9827c20..0708ecb 100644 --- a/layers/+lang/python/README.org +++ b/layers/+lang/python/README.org @@ -179,6 +179,12 @@ the pyenv version. The behavior can be set with the variable - =on-project-switch= set the version when you switch projects, - =nil= to disable. +The same is also possible on pyvenv with a file called =.venv=. The behavior +can be set with the variable =python-auto-set-local-pyvenv-virtualenv== to: +- =on-visit= (default) set the virtualenv when you visit a python buffer, +- =on-project-switch= set the virtualenv when you switch projects, +- =nil= to disable. + * Key Bindings ** Inferior REPL process diff --git a/layers/+lang/python/config.el b/layers/+lang/python/config.el index 3185c07..3e94de5 100644 --- a/layers/+lang/python/config.el +++ b/layers/+lang/python/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Python Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -35,5 +35,10 @@ Possible values are `on-visit', `on-project-switch' or `nil'.") +(defvar python-auto-set-local-pyvenv-virtualenv 'on-visit + "Automatically set pyvenv virtualenv from \".venv\". + +Possible values are `on-visit', `on-project-switch' or `nil'.") + (defvar python-sort-imports-on-save nil "If non-nil, automatically sort imports on save.") diff --git a/layers/+lang/python/funcs.el b/layers/+lang/python/funcs.el index f0aea5c..de94417 100644 --- a/layers/+lang/python/funcs.el +++ b/layers/+lang/python/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Python Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -41,14 +41,16 @@ (let ((trace (cond ((spacemacs/pyenv-executable-find "wdb") "import wdb; wdb.set_trace()") ((spacemacs/pyenv-executable-find "ipdb") "import ipdb; ipdb.set_trace()") ((spacemacs/pyenv-executable-find "pudb") "import pudb; pudb.set_trace()") + ((spacemacs/pyenv-executable-find "ipdb3") "import ipdb; ipdb.set_trace()") + ((spacemacs/pyenv-executable-find "pudb3") "import pudb; pudb.set_trace()") (t "import pdb; pdb.set_trace()"))) (line (thing-at-point 'line))) (if (and line (string-match trace line)) (kill-whole-line) (progn (back-to-indentation) - (insert-string trace) - (insert-string "\n") + (insert trace) + (insert "\n") (python-indent-line))))) ;; from https://www.snip2code.com/Snippet/127022/Emacs-auto-remove-unused-import-statemen @@ -80,6 +82,20 @@ (message "pyenv: version `%s' is not installed (set by %s)" version file-path)))))) +(defun spacemacs//pyvenv-mode-set-local-virtualenv () + "Set pyvenv virtualenv from \".venv\" by looking in parent directories." + (interactive) + (let ((root-path (locate-dominating-file default-directory + ".venv"))) + (when root-path + (let* ((file-path (expand-file-name ".venv" root-path)) + (virtualenv + (with-temp-buffer + (insert-file-contents-literally file-path) + (buffer-substring-no-properties (line-beginning-position) + (line-end-position))))) + (pyvenv-workon virtualenv))))) + ;; Tests @@ -115,10 +131,14 @@ when this mode is enabled since the minibuffer is cleared all the time." ARG is the universal-argument which chooses between the main and the secondary test runner. FUNCALIST is an alist of the function to be called for each testrunner. " - (let ((test-runner (if arg - (spacemacs//python-get-secondary-testrunner) - (spacemacs//python-get-main-testrunner)))) - (funcall (cdr (assoc test-runner funcalist))))) + (let* ((test-runner (if arg + (spacemacs//python-get-secondary-testrunner) + (spacemacs//python-get-main-testrunner))) + (test-function (assq test-runner funcalist))) + (if test-function + (funcall (cdr (assoc test-runner funcalist))) + (user-error "This test function is not available with the `%S' runner." + test-runner)))) (defun spacemacs/python-test-all (arg) "Run all tests." @@ -146,6 +166,16 @@ to be called for each testrunner. " '((pytest . pytest-pdb-module) (nose . nosetests-pdb-module)))) +(defun spacemacs/python-test-suite (arg) + "Run all tests in the current suite." + (interactive "P") + (spacemacs//python-call-correct-test-function arg '((nose . nosetests-suite)))) + +(defun spacemacs/python-test-pdb-suite (arg) + "Run all tests in the current suite in debug mode." + (interactive "P") + (spacemacs//python-call-correct-test-function arg '((nose . nosetests-pdb-suite)))) + (defun spacemacs/python-test-one (arg) "Run current test." (interactive "P") @@ -169,7 +199,9 @@ to be called for each testrunner. " "tT" 'spacemacs/python-test-pdb-one "tt" 'spacemacs/python-test-one "tM" 'spacemacs/python-test-pdb-module - "tm" 'spacemacs/python-test-module)) + "tm" 'spacemacs/python-test-module + "tS" 'spacemacs/python-test-pdb-suite + "ts" 'spacemacs/python-test-suite)) (defun spacemacs//python-sort-imports () ;; py-isort-before-save checks the major mode as well, however we can prevent diff --git a/layers/+lang/python/local/nose/README.md b/layers/+lang/python/local/nose/README.md index 0f1da73..3527d8c 100644 --- a/layers/+lang/python/local/nose/README.md +++ b/layers/+lang/python/local/nose/README.md @@ -65,7 +65,7 @@ For instance (typical example to make `PyDev` *and* `nose.el` happy): import unittest - ALL_TESTS = unittest.TestSuite([my_suites_go_here]) + ALL_TESTS = unittest.TestSuite([my_suites_go_here]) def load_tests(loader=None, tests=None, pattern=None): return ALL_TESTS diff --git a/layers/+lang/python/local/nose/nose.el b/layers/+lang/python/local/nose/nose.el index 5afaf1a..b2a3a19 100644 --- a/layers/+lang/python/local/nose/nose.el +++ b/layers/+lang/python/local/nose/nose.el @@ -95,7 +95,9 @@ For more details: http://pswinkels.blogspot.ca/2010/04/debugging-python-code-fro (defun nosetests-nose-command () (let ((nose "python -u -c \"import nose; nose.run()\"")) (if python-shell-virtualenv-path - (format "%s/bin/%s" python-shell-virtualenv-path nose) + (if (spacemacs/system-is-mswindows) + (format "%s/Scripts/%s" python-shell-virtualenv-path nose) + (format "%s/bin/%s" python-shell-virtualenv-path nose)) nose))) (defun nosetests-all (&optional debug failed) diff --git a/layers/+lang/python/local/pylookup/README.md b/layers/+lang/python/local/pylookup/README.md index 9f90178..88b8ee4 100644 --- a/layers/+lang/python/local/pylookup/README.md +++ b/layers/+lang/python/local/pylookup/README.md @@ -8,13 +8,13 @@ # README - Pylookup stole idea from 'http://furius.ca/haddoc', one of my favorite - emacs mode for python documentation lookup. I reimplemented python code and - elisp code not just to support new version of python 2.7 but also to extend - it for other documentation lookup interfaces with easy. Importantly, pylookup + Pylookup stole idea from 'http://furius.ca/haddoc', one of my favorite + emacs mode for python documentation lookup. I reimplemented python code and + elisp code not just to support new version of python 2.7 but also to extend + it for other documentation lookup interfaces with easy. Importantly, pylookup mode is much faster and supports fancy highlighting. - Please check, + Please check, Web : http://taesoo.org/proj/pylookup.html Repo : https://github.com/tsgates/pylookup @@ -24,9 +24,9 @@ You can browse python documents from either online or offline. Since I prefer offline, here is an easy step: - + make download - + It will download python document, and construct database for you. If you get in any trouble, follow the below steps manually: @@ -37,11 +37,11 @@ 4. Test : './pylookup.py -l ljust' (see updateing database section for more options) - + ## Elisp Here is lisp part for emacs. - + - [PATH] parameter depends on your environment (i.e. "~/.emacs.d/pylookup") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cl} @@ -63,7 +63,7 @@ (autoload 'pylookup-lookup "pylookup" "Lookup SEARCH-TERM in the Python HTML indexes." t) -(autoload 'pylookup-update "pylookup" +(autoload 'pylookup-update "pylookup" "Run pylookup-update and create the database at `pylookup-db-file'." t) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -71,18 +71,18 @@ You can easily accumulate many sources into single database. For example, you can index python and scipy at the same time. Here are the examples: - + - Single source ./pylookup.py -u http://docs.python.org - Multiple sources, remote and local ./pylookup.py -u http://docs.python.org -u ~/doc/python2.7 - Adding local source to existing database (duplicate entries are not checked) ./pylookup.py -a -u ~/doc/python - - Example online documents of python, scipy, numpy, and matplotlib + - Example online documents of python, scipy, numpy, and matplotlib (you can append new indexes into the current db with '-a' option) ./pylookup.py -u http://docs.python.org ./pylookup.py -u http://docs.scipy.org/doc/numpy/genindex.html ./pylookup.py -u http://docs.scipy.org/doc/scipy/reference/genindex.html ./pylookup.py -u http://matplotlib.sourceforge.net/genindex.html - + You probably like to type './pylookup.py -h' to see more options. diff --git a/layers/+lang/python/local/pylookup/pylookup.el b/layers/+lang/python/local/pylookup/pylookup.el index 310e3dd..f71dc84 100644 --- a/layers/+lang/python/local/pylookup/pylookup.el +++ b/layers/+lang/python/local/pylookup/pylookup.el @@ -18,7 +18,7 @@ ;; 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 . @@ -69,13 +69,13 @@ (define-key map "<" 'beginning-of-buffer) (define-key map ">" 'end-of-buffer) (define-key map "v" 'scroll-down) - + map) "Keymap for `pylookup-mode-mode'.") (put 'pylookup-mode 'mode-class 'special) -(defvar pylookup-completing-read +(defvar pylookup-completing-read (if (null ido-mode) 'completing-read 'ido-completing-read) "Ido support with convenience") @@ -93,7 +93,7 @@ (defun pylookup-mode () "Major mode for output from \\[pylookup-lookup]." (interactive) - + (kill-all-local-variables) (use-local-map pylookup-mode-map) (setq major-mode 'pylookup-mode) @@ -104,14 +104,14 @@ (defun pylookup-move-prev-line () "Move to previous entry" (interactive) - + (when (< 3 (line-number-at-pos)) (call-interactively 'previous-line))) (defun pylookup-mode-next-line () "Move to next entry" (interactive) - + (when (< (line-number-at-pos) (- (line-number-at-pos (point-max)) 1)) (call-interactively 'next-line))) @@ -119,14 +119,14 @@ (defun pylookup-mode-lookup-and-leave () "Lookup the current line in a browser and leave the completions window." (interactive) - + (call-interactively 'pylookup-mode-lookup) (pylookup-mode-quit-window)) (defun pylookup-mode-lookup () "Lookup the current line in a browser." (interactive) - + (let ((url (get-text-property (point) 'pylookup-target-url))) (if url (progn @@ -150,7 +150,7 @@ (split-string (with-output-to-string - (call-process pylookup-program nil standard-output nil + (call-process pylookup-program nil standard-output nil "-d" (expand-file-name pylookup-db-file) "-c")))) @@ -176,12 +176,12 @@ (defun pylookup-lookup (search-term) "Lookup SEARCH-TERM in the Python HTML indexes." (interactive - (list + (list (let ((initial (thing-at-point 'word))) (funcall pylookup-completing-read "Search: " - (if pylookup-cache - pylookup-cache + (if pylookup-cache + pylookup-cache (setq pylookup-cache (pylookup-exec-get-cache))) nil nil initial 'pylookup-history)) )) @@ -194,7 +194,7 @@ (message "No matches for \"%s\"." search-term)) ;; 1. A single result. - ((= (length matches) 1) + ((= (length matches) 1) ;; Point the browser at the unique result and get rid of the buffer (let ((data (car matches))) (message "Browsing: \"%s\"" (car data)) @@ -207,7 +207,7 @@ (let* ((cur-window-conf (current-window-configuration)) (tmpbuf (get-buffer-create pylookup-temp-buffer-name)) (index 0)) - + (display-buffer tmpbuf) (pop-to-buffer tmpbuf) @@ -236,8 +236,8 @@ (setq iter (cdr iter))) (incf index) - (insert (format " %03d) %-25s %-30s %10s" - index + (insert (format " %03d) %-25s %-30s %10s" + index (pylookup-trim api 25) (pylookup-trim module 30) (pylookup-trim type 10)))) @@ -254,8 +254,8 @@ (pylookup-mode) ;; highlighting - (font-lock-add-keywords nil `((,(format "\\(%s\\|%s\\|%s\\)" - search-term + (font-lock-add-keywords nil `((,(format "\\(%s\\|%s\\|%s\\)" + search-term (upcase search-term) (upcase-initials search-term)) 1 @@ -286,11 +286,11 @@ ;;;###autoload (defun pylookup-update (src &optional append) "Run pylookup-update and create the database at `pylookup-db-file'." - (interactive + (interactive (list (funcall pylookup-completing-read "Python Html Documentation source: " pylookup-html-locations))) - + ;; pylookup.py -d /home/myuser/.pylookup/pylookup.db -l (message (with-output-to-string (call-process pylookup-program nil standard-output nil diff --git a/layers/+lang/python/packages.el b/layers/+lang/python/packages.el index f134cb0..2c06f15 100644 --- a/layers/+lang/python/packages.el +++ b/layers/+lang/python/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Python Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -145,8 +145,6 @@ (defun python/init-nose () (use-package nose - :if (or (eq 'nose python-test-runner) - (if (listp python-test-runner) (member 'nose python-test-runner))) :commands (nosetests-one nosetests-pdb-one nosetests-all @@ -155,12 +153,7 @@ nosetests-pdb-module nosetests-suite nosetests-pdb-suite) - :init - (progn - (spacemacs//bind-python-testing-keys) - (spacemacs/set-leader-keys-for-major-mode 'python-mode - "tS" 'nosetests-pdb-suite - "ts" 'nosetests-suite)) + :init (spacemacs//bind-python-testing-keys) :config (progn (add-to-list 'nose-project-root-files "setup.cfg") @@ -214,6 +207,14 @@ :defer t :init (progn + (pcase python-auto-set-local-pyvenv-virtualenv + (`on-visit + (spacemacs/add-to-hooks 'spacemacs//pyvenv-mode-set-local-virtualenv + '(python-mode-hook + hy-mode-hook))) + (`on-project-switch + (add-hook 'projectile-after-switch-project-hook + 'spacemacs//pyvenv-mode-set-local-virtualenv))) (dolist (mode '(python-mode hy-mode)) (spacemacs/set-leader-keys-for-major-mode mode "Va" 'pyvenv-activate @@ -241,9 +242,6 @@ (defun python/init-pytest () (use-package pytest - :if (or (eq 'pytest python-test-runner) - (if (listp python-test-runner) (member 'pytest python-test-runner))) - :defer t :commands (pytest-one pytest-pdb-one pytest-all @@ -442,7 +440,9 @@ fix this issue." (defun python/init-yapfify () (use-package yapfify :defer t - :init (spacemacs/set-leader-keys-for-major-mode 'python-mode - "=" 'yapfify-buffer) - :config (when python-enable-yapf-format-on-save - (add-hook 'python-mode-hook 'yapf-mode)))) + :init + (progn + (spacemacs/set-leader-keys-for-major-mode 'python-mode + "=" 'yapfify-buffer) + (when python-enable-yapf-format-on-save + (add-hook 'python-mode-hook 'yapf-mode))))) diff --git a/layers/+lang/racket/config.el b/layers/+lang/racket/config.el index 3b3b7b4..9e6beb9 100644 --- a/layers/+lang/racket/config.el +++ b/layers/+lang/racket/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Racket Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ruby/config.el b/layers/+lang/ruby/config.el index 617d97b..7a8234f 100644 --- a/layers/+lang/ruby/config.el +++ b/layers/+lang/ruby/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Ruby Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ruby/funcs.el b/layers/+lang/ruby/funcs.el index 6a67eec..7b07bd1 100644 --- a/layers/+lang/ruby/funcs.el +++ b/layers/+lang/ruby/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Ruby Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/ruby/packages.el b/layers/+lang/ruby/packages.el index aa681be..d5004f2 100644 --- a/layers/+lang/ruby/packages.el +++ b/layers/+lang/ruby/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Ruby Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/rust/README.org b/layers/+lang/rust/README.org index 9ef12bc..829821f 100644 --- a/layers/+lang/rust/README.org +++ b/layers/+lang/rust/README.org @@ -61,4 +61,5 @@ To enable automatic buffer formatting on save, set the variable =rust-format-on- | ~SPC m c u~ | update dependencies with Cargo | | ~SPC m c x~ | execute a project with Cargo | | ~SPC m g g~ | jump to definition | +| ~SPC m h h~ | describe symbol at point | | ~SPC m t~ | run tests with Cargo | diff --git a/layers/+lang/rust/config.el b/layers/+lang/rust/config.el index d81f7e3..5048e86 100644 --- a/layers/+lang/rust/config.el +++ b/layers/+lang/rust/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Rust Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Chris Hoeppner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/rust/funcs.el b/layers/+lang/rust/funcs.el new file mode 100755 index 0000000..3b2908e --- /dev/null +++ b/layers/+lang/rust/funcs.el @@ -0,0 +1,33 @@ +;;; funcs.el --- rust Layer functions File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: NJBS +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun spacemacs/racer-describe () + "Show a *Racer Help* buffer for the function or type at point. +If `help-window-select' is non-nil, also select the help window." + (interactive) + (let ((window (racer-describe))) + (when help-window-select + (select-window window)))) + +(defun spacemacs/rust-quick-run () + "Quickly run a Rust file using rustc. +Meant for a quick-prototype flow only - use `spacemacs/open-junk-file' to +open a junk Rust file, type in some code and quickly run it. +If you want to use third-party crates, create a a new project using `cargo-process-new' and run +using `cargo-process-run'." + (interactive) + (let ((input-file-name (buffer-file-name)) + (output-file-name (concat temporary-file-directory (make-temp-name "rustbin")))) + (compile + (format "rustc -o %s %s && %s" + (shell-quote-argument output-file-name) + (shell-quote-argument input-file-name) + (shell-quote-argument output-file-name))))) diff --git a/layers/+lang/rust/packages.el b/layers/+lang/rust/packages.el index 4bb4682..0e743b9 100644 --- a/layers/+lang/rust/packages.el +++ b/layers/+lang/rust/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Rust Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Chris Hoeppner ;; URL: https://github.com/syl20bnr/spacemacs @@ -65,7 +65,8 @@ :init (progn (spacemacs/set-leader-keys-for-major-mode 'rust-mode - "=" 'rust-format-buffer)))) + "=" 'rust-format-buffer + "q" 'spacemacs/rust-quick-run)))) (defun rust/init-toml-mode () (use-package toml-mode @@ -88,10 +89,17 @@ (exec-path-from-shell-copy-env "RUST_SRC_PATH")) (use-package racer - :diminish racer-mode :defer t :init (progn (spacemacs/add-to-hook 'rust-mode-hook '(racer-mode eldoc-mode)) (spacemacs/declare-prefix-for-mode 'rust-mode "mg" "goto") - (add-to-list 'spacemacs-jump-handlers-rust-mode 'racer-find-definition)))) + (add-to-list 'spacemacs-jump-handlers-rust-mode 'racer-find-definition) + (spacemacs/declare-prefix-for-mode 'rust-mode "mh" "help") + (spacemacs/set-leader-keys-for-major-mode 'rust-mode + "hh" 'spacemacs/racer-describe)) + :config + (progn + (spacemacs|hide-lighter racer-mode) + (evilified-state-evilify-map racer-help-mode-map + :mode racer-help-mode)))) diff --git a/layers/+lang/scala/README.org b/layers/+lang/scala/README.org index 6bf9464..65f285a 100644 --- a/layers/+lang/scala/README.org +++ b/layers/+lang/scala/README.org @@ -107,7 +107,7 @@ variable =scala-enable-eldoc= to =t=. #+BEGIN_SRC emacs-lisp (setq-default dotspacemacs-configuration-layers '( - (scala :variables scala-use-java-doc-style t))) + (scala :variables scala-enable-eldoc t))) #+END_SRC Enabling this option can cause slow editor performance. @@ -180,13 +180,13 @@ with | ~SPC m d B~ | clear breakpoint | | ~SPC m d C~ | clear all breakpoints | | ~SPC m d c~ | continue | -| ~SPC m d i~ | inspect value at point | +| ~SPC m d i~ | step | | ~SPC m d n~ | next | | ~SPC m d o~ | step out | | ~SPC m d q~ | quit | | ~SPC m d r~ | run | -| ~SPC m d s~ | step | | ~SPC m d t~ | backtrace | +| ~SPC m d v~ | inspect value at point | *Note:* These key bindings need a transient-state, PR welcome :-) diff --git a/layers/+lang/scala/config.el b/layers/+lang/scala/config.el index ad98b83..a82a4f3 100644 --- a/layers/+lang/scala/config.el +++ b/layers/+lang/scala/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Scala Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/scala/funcs.el b/layers/+lang/scala/funcs.el index e9870cf..d459925 100644 --- a/layers/+lang/scala/funcs.el +++ b/layers/+lang/scala/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Scala Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -112,8 +112,3 @@ point to the position of the join." "Yank to kill ring and print full type name at point to the minibuffer." (interactive) (ensime-type-at-point t t)) - -(defun sbt-hydra () - "Wrapper to rename sbt-hydra:hydra to sbt-hydra" - (interactive) - (sbt-hydra:hydra)) diff --git a/layers/+lang/scala/packages.el b/layers/+lang/scala/packages.el index 31112f4..a0394f0 100644 --- a/layers/+lang/scala/packages.el +++ b/layers/+lang/scala/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Scala Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -38,7 +38,7 @@ (add-to-list 'spacemacs-jump-handlers-scala-mode 'ensime-edit-definition)) :config (progn - (setq user-emacs-ensime-directory ".cache/ensime") + (setq ensime-startup-dirname (expand-file-name "ensime" spacemacs-cache-directory)) (evil-define-key 'insert ensime-mode-map (kbd ".") 'scala/completing-dot @@ -123,13 +123,13 @@ "dB" 'ensime-db-clear-break "dC" 'ensime-db-clear-all-breaks "dc" 'ensime-db-continue - "di" 'ensime-db-inspect-value-at-point + "di" 'ensime-db-step "dn" 'ensime-db-next "do" 'ensime-db-step-out "dq" 'ensime-db-quit "dr" 'ensime-db-run - "ds" 'ensime-db-step "dt" 'ensime-db-backtrace + "dv" 'ensime-db-inspect-value-at-point "ee" 'ensime-print-errors-at-point "el" 'ensime-show-all-errors-and-warnings diff --git a/layers/+lang/scheme/config.el b/layers/+lang/scheme/config.el index 5e51dee..ffdfc6d 100644 --- a/layers/+lang/scheme/config.el +++ b/layers/+lang/scheme/config.el @@ -1,6 +1,6 @@ ;;; config.el --- scheme Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -10,3 +10,5 @@ ;;; License: GPLv3 (spacemacs|define-jump-handlers scheme-mode geiser-edit-symbol-at-point) + +(spacemacs|defvar-company-backends scheme-mode) diff --git a/layers/+lang/scheme/packages.el b/layers/+lang/scheme/packages.el index 23b62c7..be5b2df 100644 --- a/layers/+lang/scheme/packages.el +++ b/layers/+lang/scheme/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Scheme Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/shaders/README.org b/layers/+lang/shaders/README.org index dd64475..4fca428 100644 --- a/layers/+lang/shaders/README.org +++ b/layers/+lang/shaders/README.org @@ -16,6 +16,11 @@ provide highlighting for files ending in: - =.frag= - =.geom= +Also this layer provides completion for =.vert=, =.tesc=, =.tese=, =.geom=, +=.frag= and =.comp= shaders via =company-glsl= when [[https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/][=glslangValidator=]] can be +found on your system and =auto-completion= layer is enabled. Note that +completion is [[https://github.com/Kaali/company-glsl][rather simple]]. + * Install To use this configuration layer, add it to your =~.spacemacs=. You will need to add =shaders= to the existing =dotspacemacs-configuration-layers= list in this diff --git a/layers/+lang/shaders/config.el b/layers/+lang/shaders/config.el new file mode 100644 index 0000000..1272172 --- /dev/null +++ b/layers/+lang/shaders/config.el @@ -0,0 +1,14 @@ +;;; config.el --- Shaders Layer configuration File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Boris Buliga +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +;; Variables + +(spacemacs|defvar-company-backends glsl-mode) diff --git a/layers/+lang/shaders/packages.el b/layers/+lang/shaders/packages.el index afdd475..12013f2 100644 --- a/layers/+lang/shaders/packages.el +++ b/layers/+lang/shaders/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- shaders layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Alan Love ;; URL: https://github.com/ell @@ -8,7 +8,25 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GLPv3 -(setq shaders-packages '(glsl-mode)) +(setq shaders-packages + '(glsl-mode + company + (company-glsl + :location (recipe + :fetcher github + :repo "Kaali/company-glsl") + :toggle (and (configuration-layer/package-usedp 'company) + (executable-find "glslangValidator"))))) + +(defun shaders/post-init-company () + (spacemacs|add-company-hook glsl-mode)) + +(defun shaders/init-company-glsl () + (use-package company-glsl + :defer t + :init + (push 'company-glsl + company-backends-glsl-mode))) (defun shaders/init-glsl-mode () "Initialize GLSL mode" diff --git a/layers/+lang/shell-scripts/config.el b/layers/+lang/shell-scripts/config.el index e27a985..f209ffa 100644 --- a/layers/+lang/shell-scripts/config.el +++ b/layers/+lang/shell-scripts/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Shell Scripts Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/shell-scripts/funcs.el b/layers/+lang/shell-scripts/funcs.el index 3ee1f44..e923481 100644 --- a/layers/+lang/shell-scripts/funcs.el +++ b/layers/+lang/shell-scripts/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Shell Scripts Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/shell-scripts/packages.el b/layers/+lang/shell-scripts/packages.el index 04c189b..2990653 100644 --- a/layers/+lang/shell-scripts/packages.el +++ b/layers/+lang/shell-scripts/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Shell Scripts Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/sml/packages.el b/layers/+lang/sml/packages.el index 92785cd..91afceb 100644 --- a/layers/+lang/sml/packages.el +++ b/layers/+lang/sml/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- sml Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Keith Simmons ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/sql/packages.el b/layers/+lang/sql/packages.el index 45c4e8f..9313518 100644 --- a/layers/+lang/sql/packages.el +++ b/layers/+lang/sql/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- sql Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/swift/packages.el b/layers/+lang/swift/packages.el index 4d5ecdf..6b7bf9e 100644 --- a/layers/+lang/swift/packages.el +++ b/layers/+lang/swift/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- swift Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Uri Sharf ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/typescript/README.org b/layers/+lang/typescript/README.org index be12e75..8b66a91 100644 --- a/layers/+lang/typescript/README.org +++ b/layers/+lang/typescript/README.org @@ -69,7 +69,7 @@ Default is 'tide . This layer uses: - [[https://github.com/ananthakumaran/tide][tide]] -- [[https://github.com/Simplify/flycheck-typescript-tslint][flycheck-typescript-tslint]] +- [[https://github.com/flycheck/flycheck][flycheck]] - [[https://github.com/vvakame/typescript-formatter][typescript-formatter]] - optional. *The tools use configuration files. You can learn more in their documentation.* diff --git a/layers/+lang/typescript/config.el b/layers/+lang/typescript/config.el index 06af5b7..522b198 100644 --- a/layers/+lang/typescript/config.el +++ b/layers/+lang/typescript/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Typescript Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/typescript/funcs.el b/layers/+lang/typescript/funcs.el index 0348884..16bbcb3 100644 --- a/layers/+lang/typescript/funcs.el +++ b/layers/+lang/typescript/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- TypeScript Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/typescript/packages.el b/layers/+lang/typescript/packages.el index 313cb36..6377fc3 100644 --- a/layers/+lang/typescript/packages.el +++ b/layers/+lang/typescript/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- typescript Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Chris Bowdon ;; URL: https://github.com/syl20bnr/spacemacs @@ -12,6 +12,7 @@ (setq typescript-packages '( company + eldoc flycheck tide typescript-mode @@ -21,6 +22,9 @@ (defun typescript/post-init-company () (spacemacs|add-company-hook typescript-mode)) +(defun typescript/post-init-eldoc () + (add-hook 'typescript-mode-hook 'eldoc-mode)) + (defun typescript/post-init-flycheck () (spacemacs/add-flycheck-hook 'typescript-mode)) @@ -34,12 +38,7 @@ (kbd "C-k") 'tide-find-previous-reference (kbd "C-j") 'tide-find-next-reference (kbd "C-l") 'tide-goto-reference) - (add-hook 'typescript-mode-hook 'tide-setup) - (add-hook 'typescript-mode-hook 'eldoc-mode) - - (add-to-list 'spacemacs-jump-handlers-typescript-mode 'tide-jump-to-definition) - (push 'company-tide company-backends-typescript-mode)) :config (progn diff --git a/layers/+lang/vimscript/config.el b/layers/+lang/vimscript/config.el index 08a0956..0ec7e99 100644 --- a/layers/+lang/vimscript/config.el +++ b/layers/+lang/vimscript/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Vimscript Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/vimscript/packages.el b/layers/+lang/vimscript/packages.el index 2a344bb..6334b75 100644 --- a/layers/+lang/vimscript/packages.el +++ b/layers/+lang/vimscript/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- vimscript Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/windows-scripts/config.el b/layers/+lang/windows-scripts/config.el index c73132f..4419e5b 100644 --- a/layers/+lang/windows-scripts/config.el +++ b/layers/+lang/windows-scripts/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- Windows Scripts Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+lang/windows-scripts/packages.el b/layers/+lang/windows-scripts/packages.el index 61060cb..e129dd6 100644 --- a/layers/+lang/windows-scripts/packages.el +++ b/layers/+lang/windows-scripts/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Windows Scripts Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -71,5 +71,5 @@ ;; TODO ;; - split out powershell ;; - get help output with mgg (Get-Help) or Get-Help -online - ;; - + ;; - ))) diff --git a/layers/+lang/yaml/packages.el b/layers/+lang/yaml/packages.el index de5fe74..270890e 100644 --- a/layers/+lang/yaml/packages.el +++ b/layers/+lang/yaml/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- YAML Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+misc/nlinum/funcs.el b/layers/+misc/nlinum/funcs.el new file mode 100644 index 0000000..3fc451c --- /dev/null +++ b/layers/+misc/nlinum/funcs.el @@ -0,0 +1,20 @@ +;;; packages.el --- nlinum Layer packages File +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Thomas de Beauchêne +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun spacemacs/nlinum-maybe-on () + (when (spacemacs/enable-line-numbers-p) + (nlinum-mode))) + +(defun spacemacs/nlinum-relative-toggle () + (interactive) + (if (not (bound-and-true-p nlinum-relative-mode)) + (nlinum-mode)) + (nlinum-relative-toggle)) diff --git a/layers/+misc/nlinum/packages.el b/layers/+misc/nlinum/packages.el index 651e70f..cefab2c 100644 --- a/layers/+misc/nlinum/packages.el +++ b/layers/+misc/nlinum/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- nlinum Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -20,15 +20,19 @@ (defun nlinum/init-nlinum () (use-package nlinum :init + (spacemacs|add-toggle line-numbers + :mode nlinum-mode + :documentation "Show the line numbers." + :evil-leader "tn") + :config (progn - (when dotspacemacs-line-numbers - (add-hook 'prog-mode-hook 'nlinum-mode) - (add-hook 'text-mode-hook 'nlinum-mode)) - (setq nlinum-format "%4d") - (spacemacs|add-toggle line-numbers - :mode nlinum-mode - :documentation "Show the line numbers." - :evil-leader "tn")))) + (if (or (eq dotspacemacs-line-numbers t) + (eq dotspacemacs-line-numbers 'relative)) + (progn + (add-hook 'prog-mode-hook 'nlinum-mode) + (add-hook 'text-mode-hook 'nlinum-mode)) + (add-hook 'after-change-major-mode-hook 'spacemacs/nlinum-maybe-on)) + (setq nlinum-format "%4d")))) (defun nlinum/init-nlinum-relative () (use-package nlinum-relative @@ -37,7 +41,10 @@ (progn (setq nlinum-relative-current-symbol "" nlinum-relative-redisplay-delay 0) - (when (eq dotspacemacs-line-numbers 'relative) + (when (or (eq dotspacemacs-line-numbers 'relative) + (and (listp dotspacemacs-line-numbers) + (car (spacemacs/mplist-get dotspacemacs-line-numbers + :relative)))) (nlinum-relative-setup-evil) (add-hook 'nlinum-mode-hook 'nlinum-relative-on)) - (spacemacs/set-leader-keys "tr" 'nlinum-relative-toggle)))) + (spacemacs/set-leader-keys "tr" 'spacemacs/nlinum-relative-toggle)))) diff --git a/layers/+os/osx/config.el b/layers/+os/osx/config.el index bcc27df..691e726 100644 --- a/layers/+os/osx/config.el +++ b/layers/+os/osx/config.el @@ -1,6 +1,6 @@ ;;; config.el --- OSX Layer config File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+os/osx/funcs.el b/layers/+os/osx/funcs.el index 305e4a2..5630e6d 100644 --- a/layers/+os/osx/funcs.el +++ b/layers/+os/osx/funcs.el @@ -1,6 +1,6 @@ ;;; config.el --- OSX Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Boris Buliga ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+os/osx/keybindings.el b/layers/+os/osx/keybindings.el index a1fe684..0453c6b 100644 --- a/layers/+os/osx/keybindings.el +++ b/layers/+os/osx/keybindings.el @@ -1,6 +1,6 @@ ;;; config.el --- OSX Layer keybindings File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+os/osx/packages.el b/layers/+os/osx/packages.el index 318ea59..8fae0e6 100644 --- a/layers/+os/osx/packages.el +++ b/layers/+os/osx/packages.el @@ -1,6 +1,6 @@ ;;; config.el --- OSX Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+pair-programming/floobits/packages.el b/layers/+pair-programming/floobits/packages.el index 5a3f839..3de189b 100644 --- a/layers/+pair-programming/floobits/packages.el +++ b/layers/+pair-programming/floobits/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- floobits Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Rodolfo Hansen ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/git/README.org b/layers/+source-control/git/README.org index 85a6bd4..9d54660 100644 --- a/layers/+source-control/git/README.org +++ b/layers/+source-control/git/README.org @@ -36,7 +36,7 @@ This layers adds extensive support for [[http://git-scm.com/][git]]. - gitignore generator with [[https://github.com/jupl/helm-gitignore][helm-gitignore]] - org integration with magit via [[https://github.com/magit/orgit][orgit]] -New to Magit? Checkout the [[http://magit.vc/about.html][official intro]]. +New to Magit? Checkout the [[https://magit.vc/about/][official intro]]. * Install ** Layer @@ -176,8 +176,8 @@ intended. To work around this, you can use =v= instead (since Magit only stages whole lines, in any case). ** Commit message editing buffer -In a commit message buffer press ~,c~ (if =dotspacemacs-major-mode-leader-key= is ~​,​~) -or ~C-c C-c~ to commit the changes with the entered message. Pressing ~,a~ or ~C-c C-k~ +In a commit message buffer press ~​,​c~ (if =dotspacemacs-major-mode-leader-key= is ~​,​~) +or ~C-c C-c~ to commit the changes with the entered message. Pressing ~​,​a~ or ~C-c C-k~ will discard the commit message. | Key Binding | Description | @@ -209,14 +209,14 @@ will discard the commit message. - Amend a commit: - ~l l~ to open =log buffer= - ~c a~ on the commit you want to amend - - ~,c~ or ~C-c C-c~ to submit the changes + - ~​,​c~ or ~C-c C-c~ to submit the changes - Squash last commit: - ~l l~ to open =log buffer= - ~r e~ on the second to last commit, it opens the =rebase buffer= - ~j~ to put point on last commit - ~s~ to squash it - - ~,c~ or ~C-c C-c~ to continue to the =commit message buffer= - - ~,c~ or ~C-c C-c~ again when you have finished to edit the commit message + - ~​,​c~ or ~C-c C-c~ to continue to the =commit message buffer= + - ~​,​c~ or ~C-c C-c~ again when you have finished to edit the commit message - Force push a squashed commit: - in the =status buffer= you should see the new commit unpushed and the old commit unpulled diff --git a/layers/+source-control/git/config.el b/layers/+source-control/git/config.el index 2aafb69..632bc3d 100644 --- a/layers/+source-control/git/config.el +++ b/layers/+source-control/git/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Git Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/git/funcs.el b/layers/+source-control/git/funcs.el index 58190a7..40491c4 100644 --- a/layers/+source-control/git/funcs.el +++ b/layers/+source-control/git/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Colors Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/git/packages.el b/layers/+source-control/git/packages.el index 3107f0b..14dbb78 100644 --- a/layers/+source-control/git/packages.el +++ b/layers/+source-control/git/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Git Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -398,8 +398,8 @@ Press [_b_] again to blame further in the history, [_q_] to go up or quit." ("smeargle-clear" . "clear")))) (dolist (nd descr) ;; ensure the target matches the whole string - (push (cons (concat "\\`" (car nd) "\\'") (cdr nd)) - which-key-description-replacement-alist)))) + (push (cons (cons nil (concat "\\`" (car nd) "\\'")) (cons nil (cdr nd))) + which-key-replacement-alist)))) (spacemacs/set-leader-keys "gHc" 'smeargle-clear "gHh" 'smeargle-commits diff --git a/layers/+source-control/github/funcs.el b/layers/+source-control/github/funcs.el new file mode 100644 index 0000000..f2e31ef --- /dev/null +++ b/layers/+source-control/github/funcs.el @@ -0,0 +1,16 @@ +;;; funcs.el --- GitHub layer functions File +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun spacemacs/load-gh-pulls-mode () + "Start `magit-gh-pulls-mode'." + (interactive) + (magit-gh-pulls-mode) + (magit-gh-pulls-popup)) diff --git a/layers/+source-control/github/packages.el b/layers/+source-control/github/packages.el index 68b23b6..43b8866 100644 --- a/layers/+source-control/github/packages.el +++ b/layers/+source-control/github/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Github Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -71,15 +71,7 @@ :pre-config (progn (use-package magit-gh-pulls - :init - (progn - (defun spacemacs/load-gh-pulls-mode () - "Start `magit-gh-pulls-mode' only after a manual request." - (interactive) - (magit-gh-pulls-mode) - (magit-gh-pulls-popup)) - - (define-key magit-mode-map "#" 'spacemacs/load-gh-pulls-mode)) + :init (define-key magit-mode-map "#" 'spacemacs/load-gh-pulls-mode) :config (spacemacs|diminish magit-gh-pulls-mode "Github-PR"))))) diff --git a/layers/+source-control/perforce/packages.el b/layers/+source-control/perforce/packages.el index c2c1e20..93b486e 100644 --- a/layers/+source-control/perforce/packages.el +++ b/layers/+source-control/perforce/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Perforce Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/version-control/README.org b/layers/+source-control/version-control/README.org index 3bb2bfc..008ef8f 100644 --- a/layers/+source-control/version-control/README.org +++ b/layers/+source-control/version-control/README.org @@ -9,6 +9,7 @@ - [[#differences-between-margin-programs][Differences between margin programs]] - [[#key-bindings][Key Bindings]] - [[#version-control-transient-state][Version Control Transient-state]] + - [[#smerge-mode-transient-state][Smerge Mode Transient-state]] * Description This layers adds general configuration for [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html][Emacs VC]]. @@ -35,6 +36,13 @@ by setting =version-control-diff-tool= version-control-diff-tool 'diff-hl) #+END_SRC +You can choose the side on which the diff appears (by default it's the right side) + +#+BEGIN_SRC emacs-lisp +'(version-control :variables + version-control-diff-side 'left) +#+END_SRC + To automatically enable diff margins in all buffers, set =version-control-global-margin= @@ -62,6 +70,7 @@ one over the other: | Key Binding | Description | |-------------+---------------------------------| | ~SPC g .~ | version control transient-state | +| ~SPC g r~ | smerge mode transient-state | | ~SPC T d~ | toggle diff margins | | ~SPC T C-d~ | toggle diff margins globally | @@ -86,3 +95,23 @@ one over the other: | ~SPC g . f~ | Fetch for repo with popup | | ~SPC g . F~ | Pull repo with popup | | ~SPC g . l~ | Show repo log | + + +** Smerge Mode Transient-state + +| Key Binding | Description | +|-------------+--------------------------| +| ~SPC g r n~ | Next hunk | +| ~SPC g r N~ | Previous hunk | +| ~SPC g r p~ | Previous hunk | +| ~SPC g r j~ | Go to next line | +| ~SPC g r k~ | Go to previous line | +| ~SPC g r b~ | Smerge keep base | +| ~SPC g r m~ | Smerge keep mine | +| ~SPC g r a~ | Smerge keep all | +| ~SPC g r o~ | Smerge keep other | +| ~SPC g r c~ | Smerge keep current | +| ~SPC g r C~ | Smerge combine with next | +| ~SPC g r u~ | Undo | +| ~SPC g r r~ | Smerge refine | +| ~SPC g r q~ | Quit transient state | diff --git a/layers/+source-control/version-control/config.el b/layers/+source-control/version-control/config.el index 25f5903..6732e54 100644 --- a/layers/+source-control/version-control/config.el +++ b/layers/+source-control/version-control/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Version Control configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,6 +16,10 @@ "Options are `git-gutter', `git-gutter+', and `diff-hl' to show version-control markers.") +(defvar version-control-diff-side 'right + "Side on which to show version-control markers. +Options are `left' and `right'.") + ;; unchanged face (defface git-gutter+-unchanged '((t (:background "yellow"))) diff --git a/layers/+source-control/version-control/funcs.el b/layers/+source-control/version-control/funcs.el index 9cd72c8..4473e23 100644 --- a/layers/+source-control/version-control/funcs.el +++ b/layers/+source-control/version-control/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Version control functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/version-control/keybindings.el b/layers/+source-control/version-control/keybindings.el index c903506..3395b9f 100644 --- a/layers/+source-control/version-control/keybindings.el +++ b/layers/+source-control/version-control/keybindings.el @@ -1,6 +1,6 @@ ;;; keybindings.el --- Version control keybindings ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+source-control/version-control/packages.el b/layers/+source-control/version-control/packages.el index 8951882..370409e 100644 --- a/layers/+source-control/version-control/packages.el +++ b/layers/+source-control/version-control/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Source Control Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -18,6 +18,7 @@ git-gutter+ git-gutter-fringe git-gutter-fringe+ + (smerge-mode :location built-in) )) (defun version-control/init-diff-mode () @@ -40,7 +41,8 @@ (global-diff-hl-mode)) (diff-hl-margin-mode) (spacemacs|do-after-display-system-init - (setq diff-hl-side 'right) + (setq diff-hl-side (if (eq version-control-diff-side 'left) + 'left 'right)) (diff-hl-margin-mode -1)))))) (defun version-control/post-init-evil-unimpaired () @@ -80,7 +82,8 @@ (spacemacs|do-after-display-system-init (with-eval-after-load 'git-gutter (require 'git-gutter-fringe))) - (setq git-gutter-fr:side 'right-fringe)) + (setq git-gutter-fr:side (if (eq version-control-diff-side 'left) + 'left-fringe 'right-fringe))) :config (progn ;; custom graphics that works nice with half-width fringes @@ -141,7 +144,8 @@ (spacemacs|do-after-display-system-init (with-eval-after-load 'git-gutter+ (require 'git-gutter-fringe+))) - (setq git-gutter-fr+-side 'right-fringe)) + (setq git-gutter-fr+-side (if (eq version-control-diff-side 'left) + 'left-fringe 'right-fringe))) :config (progn ;; custom graphics that works nice with half-width fringes @@ -166,3 +170,41 @@ ".XXX..." "..X...." )))) + + +(defun version-control/init-smerge-mode () + (use-package smerge-mode + :defer t + :diminish smerge-mode + :commands spacemacs/smerge-transient-state/body + :init + (spacemacs/set-leader-keys + "gr" 'spacemacs/smerge-transient-state/body) + :config + (progn + (spacemacs|define-transient-state smerge + :title "smerge transient state" + :doc " + movement^^^^ merge action^^ other + ---------------------^^^^ -------------------^^ ----------- + [_n_]^^ next hunk [_b_] keep base [_u_] undo + [_N_/_p_] prev hunk [_m_] keep mine [_r_] refine + [_j_/_k_] move up/down [_a_] keep all [_q_] quit + ^^^^ [_o_] keep other + ^^^^ [_c_] keep current + ^^^^ [_C_] combine with next" + :bindings + ("n" smerge-next) + ("p" smerge-prev) + ("N" smerge-prev) + ("j" evil-next-line) + ("k" evil-previous-line) + ("a" smerge-keep-all) + ("b" smerge-keep-base) + ("m" smerge-keep-mine) + ("o" smerge-keep-other) + ("c" smerge-keep-current) + ("C" smerge-combine-with-next) + ("r" smerge-refine) + ("u" undo-tree-undo) + ("q" nil :exit t))))) diff --git a/layers/+spacemacs/spacemacs-completion/config.el b/layers/+spacemacs/spacemacs-completion/config.el index faa3128..0692f5e 100644 --- a/layers/+spacemacs/spacemacs-completion/config.el +++ b/layers/+spacemacs/spacemacs-completion/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Spacemacs Completion Layer configuration File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-completion/funcs.el b/layers/+spacemacs/spacemacs-completion/funcs.el index 1d14f28..8466865 100644 --- a/layers/+spacemacs/spacemacs-completion/funcs.el +++ b/layers/+spacemacs/spacemacs-completion/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Completion Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -212,3 +212,103 @@ See https://github.com/syl20bnr/spacemacs/issues/3700" (define-key ivy-minibuffer-map (kbd "C-k") 'ivy-kill-line) (define-key ivy-minibuffer-map (kbd "C-h") nil) (define-key ivy-minibuffer-map (kbd "C-l") nil)))) + + +;; Ido + +(defun spacemacs//ido-minibuffer-setup () + "Setup the minibuffer." + ;; Since ido is implemented in a while loop where each + ;; iteration setup a whole new minibuffer, we have to keep + ;; track of any activated ido navigation transient-state and force + ;; the reactivation at each iteration. + (when spacemacs--ido-navigation-ms-enabled + (spacemacs/ido-navigation-micro-state))) + +(defun spacemacs//ido-setup () + (when spacemacs--ido-navigation-ms-face-cookie-minibuffer + (face-remap-remove-relative + spacemacs--ido-navigation-ms-face-cookie-minibuffer)) + ;; be sure to wipe any previous transient-state flag + (setq spacemacs--ido-navigation-ms-enabled nil) + ;; overwrite the key bindings for ido vertical mode only + (define-key ido-completion-map (kbd "C-") 'ido-select-text) + ;; use M-RET in terminal + (define-key ido-completion-map "\M-\r" 'ido-select-text) + (define-key ido-completion-map (kbd "C-h") 'ido-delete-backward-updir) + (define-key ido-completion-map (kbd "C-j") 'ido-next-match) + (define-key ido-completion-map (kbd "C-k") 'ido-prev-match) + (define-key ido-completion-map (kbd "C-l") 'ido-exit-minibuffer) + (define-key ido-completion-map (kbd "C-n") 'ido-next-match) + (define-key ido-completion-map (kbd "C-p") 'ido-prev-match) + (define-key ido-completion-map (kbd "C-S-h") 'ido-prev-match-dir) + (define-key ido-completion-map (kbd "C-S-j") 'next-history-element) + (define-key ido-completion-map (kbd "C-S-k") 'previous-history-element) + (define-key ido-completion-map (kbd "C-S-l") 'ido-next-match-dir) + (define-key ido-completion-map (kbd "C-S-n") 'next-history-element) + (define-key ido-completion-map (kbd "C-S-p") 'previous-history-element) + ;; ido-other window maps + (define-key ido-completion-map (kbd "C-o") 'spacemacs/ido-invoke-in-other-window) + (define-key ido-completion-map (kbd "C-s") 'spacemacs/ido-invoke-in-vertical-split) + (define-key ido-completion-map (kbd "C-t") 'spacemacs/ido-invoke-in-new-frame) + (define-key ido-completion-map (kbd "C-v") 'spacemacs/ido-invoke-in-horizontal-split) + ;; initiate transient-state + (define-key ido-completion-map (kbd "M-SPC") 'spacemacs/ido-navigation-micro-state) + (define-key ido-completion-map (kbd "s-M-SPC") 'spacemacs/ido-navigation-micro-state)) + +(defun spacemacs/ido-invoke-in-other-window () + "signals ido mode to switch to (or create) another window after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'other) + (ido-exit-minibuffer)) + +(defun spacemacs/ido-invoke-in-horizontal-split () + "signals ido mode to split horizontally and switch after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'horizontal) + (ido-exit-minibuffer)) + +(defun spacemacs/ido-invoke-in-vertical-split () + "signals ido mode to split vertically and switch after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'vertical) + (ido-exit-minibuffer)) + +(defun spacemacs/ido-invoke-in-new-frame () + "signals ido mode to create a new frame after exiting" + (interactive) + (setq ido-exit-minibuffer-target-window 'frame) + (ido-exit-minibuffer)) + +(defun spacemacs//ido-navigation-ms-set-face () + "Set faces for ido navigation transient-state." + (setq spacemacs--ido-navigation-ms-face-cookie-minibuffer + (face-remap-add-relative + 'minibuffer-prompt + 'spacemacs-ido-navigation-ms-face))) + +(defun spacemacs//ido-navigation-ms-on-enter () + "Initialization of ido transient-state." + (setq spacemacs--ido-navigation-ms-enabled t) + (spacemacs//ido-navigation-ms-set-face)) + +(defun spacemacs//ido-navigation-ms-on-exit () + "Action to perform when exiting ido transient-state." + (face-remap-remove-relative + spacemacs--ido-navigation-ms-face-cookie-minibuffer)) + +(defun spacemacs//ido-navigation-ms-full-doc () + "Full documentation for ido navigation transient-state." + " + [?] display this help + [e] enter dired + [j] [k] next/previous match + [J] [K] sub/parent directory + [h] delete backward or parent directory + [l] select match + [n] [p] next/previous directory in history + [o] open in other window + [s] open in a new horizontal split + [t] open in other frame + [v] open in a new vertical split + [q] quit") diff --git a/layers/+spacemacs/spacemacs-completion/packages.el b/layers/+spacemacs/spacemacs-completion/packages.el index fff2ecb..ccde7df 100644 --- a/layers/+spacemacs/spacemacs-completion/packages.el +++ b/layers/+spacemacs/spacemacs-completion/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Completion Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -14,7 +14,7 @@ (default-helm-config :location built-in) (default-ivy-config :location built-in) (ido :location built-in) - ido-vertical-mode + (ido-vertical-mode :location built-in) )) (defun spacemacs-completion/init-default-helm-config () @@ -194,80 +194,9 @@ Current Action: %s(ivy-action-name) :init (progn (ido-vertical-mode t) - (defun spacemacs//ido-minibuffer-setup () - "Setup the minibuffer." - ;; Since ido is implemented in a while loop where each - ;; iteration setup a whole new minibuffer, we have to keep - ;; track of any activated ido navigation transient-state and force - ;; the reactivation at each iteration. - (when spacemacs--ido-navigation-ms-enabled - (spacemacs/ido-navigation-micro-state))) (add-hook 'ido-minibuffer-setup-hook 'spacemacs//ido-minibuffer-setup) - - (defun spacemacs//ido-setup () - (when spacemacs--ido-navigation-ms-face-cookie-minibuffer - (face-remap-remove-relative - spacemacs--ido-navigation-ms-face-cookie-minibuffer)) - ;; be sure to wipe any previous transient-state flag - (setq spacemacs--ido-navigation-ms-enabled nil) - ;; overwrite the key bindings for ido vertical mode only - (define-key ido-completion-map (kbd "C-") 'ido-select-text) - ;; use M-RET in terminal - (define-key ido-completion-map "\M-\r" 'ido-select-text) - (define-key ido-completion-map (kbd "C-h") 'ido-delete-backward-updir) - (define-key ido-completion-map (kbd "C-j") 'ido-next-match) - (define-key ido-completion-map (kbd "C-k") 'ido-prev-match) - (define-key ido-completion-map (kbd "C-l") 'ido-exit-minibuffer) - (define-key ido-completion-map (kbd "C-n") 'ido-next-match) - (define-key ido-completion-map (kbd "C-p") 'ido-prev-match) - (define-key ido-completion-map (kbd "C-S-h") 'ido-prev-match-dir) - (define-key ido-completion-map (kbd "C-S-j") 'next-history-element) - (define-key ido-completion-map (kbd "C-S-k") 'previous-history-element) - (define-key ido-completion-map (kbd "C-S-l") 'ido-next-match-dir) - (define-key ido-completion-map (kbd "C-S-n") 'next-history-element) - (define-key ido-completion-map (kbd "C-S-p") 'previous-history-element) - ;; ido-other window maps - (define-key ido-completion-map (kbd "C-o") 'spacemacs/ido-invoke-in-other-window) - (define-key ido-completion-map (kbd "C-s") 'spacemacs/ido-invoke-in-vertical-split) - (define-key ido-completion-map (kbd "C-t") 'spacemacs/ido-invoke-in-new-frame) - (define-key ido-completion-map (kbd "C-v") 'spacemacs/ido-invoke-in-horizontal-split) - ;; more natural navigation keys: up, down to change current item - ;; left to go up dir - ;; right to open the selected item - (define-key ido-completion-map (kbd "") 'ido-prev-match) - (define-key ido-completion-map (kbd "") 'ido-next-match) - (define-key ido-completion-map (kbd "") 'ido-delete-backward-updir) - (define-key ido-completion-map (kbd "") 'ido-exit-minibuffer) - ;; initiate transient-state - (define-key ido-completion-map (kbd "M-SPC") 'spacemacs/ido-navigation-micro-state) - (define-key ido-completion-map (kbd "s-M-SPC") 'spacemacs/ido-navigation-micro-state) - ) (add-hook 'ido-setup-hook 'spacemacs//ido-setup) - (defun spacemacs/ido-invoke-in-other-window () - "signals ido mode to switch to (or create) another window after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'other) - (ido-exit-minibuffer)) - - (defun spacemacs/ido-invoke-in-horizontal-split () - "signals ido mode to split horizontally and switch after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'horizontal) - (ido-exit-minibuffer)) - - (defun spacemacs/ido-invoke-in-vertical-split () - "signals ido mode to split vertically and switch after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'vertical) - (ido-exit-minibuffer)) - - (defun spacemacs/ido-invoke-in-new-frame () - "signals ido mode to create a new frame after exiting" - (interactive) - (setq ido-exit-minibuffer-target-window 'frame) - (ido-exit-minibuffer)) - (defadvice ido-read-internal (around ido-read-internal-with-minibuffer-other-window activate) (let* (ido-exit-minibuffer-target-window @@ -303,39 +232,6 @@ Current Action: %s(ivy-action-name) "Face for ido minibuffer prompt when ido transient-state is activated." :group 'spacemacs) - (defun spacemacs//ido-navigation-ms-set-face () - "Set faces for ido navigation transient-state." - (setq spacemacs--ido-navigation-ms-face-cookie-minibuffer - (face-remap-add-relative - 'minibuffer-prompt - 'spacemacs-ido-navigation-ms-face))) - - (defun spacemacs//ido-navigation-ms-on-enter () - "Initialization of ido transient-state." - (setq spacemacs--ido-navigation-ms-enabled t) - (spacemacs//ido-navigation-ms-set-face)) - - (defun spacemacs//ido-navigation-ms-on-exit () - "Action to perform when exiting ido transient-state." - (face-remap-remove-relative - spacemacs--ido-navigation-ms-face-cookie-minibuffer)) - - (defun spacemacs//ido-navigation-ms-full-doc () - "Full documentation for ido navigation transient-state." - " - [?] display this help - [e] enter dired - [j] [k] next/previous match - [J] [K] sub/parent directory - [h] delete backward or parent directory - [l] select match - [n] [p] next/previous directory in history - [o] open in other window - [s] open in a new horizontal split - [t] open in other frame - [v] open in a new vertical split - [q] quit") - (spacemacs|define-transient-state ido-navigation :title "ido Transient State" :foreign-keys run diff --git a/layers/+spacemacs/spacemacs-editing-visual/packages.el b/layers/+spacemacs/spacemacs-editing-visual/packages.el index 05eabf7..733fd18 100644 --- a/layers/+spacemacs/spacemacs-editing-visual/packages.el +++ b/layers/+spacemacs/spacemacs-editing-visual/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Editing Visual Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -91,10 +91,11 @@ (defun spacemacs/integrate-evil-search (forward) ;; isearch-string is last searched item. Next time ;; "n" is hit we will use this. - (setq isearch-string - (concat "\\<" (evil-find-thing forward 'symbol) "\\>") - isearch-regexp - (concat "\\<" (evil-find-thing forward 'symbol) "\\>")) + (let* ((symbol (evil-find-thing forward 'symbol)) + (regexp (concat "\\<" symbol "\\>"))) + (setq isearch-string regexp + isearch-regexp regexp + evil-ex-search-pattern (evil-ex-make-search-pattern regexp))) ;; Next time "n" is hit, go the correct direction. (setq isearch-forward forward) ;; ahs does a case sensitive search. We could set diff --git a/layers/+spacemacs/spacemacs-editing/funcs.el b/layers/+spacemacs/spacemacs-editing/funcs.el index dc4a806..d92b571 100644 --- a/layers/+spacemacs/spacemacs-editing/funcs.el +++ b/layers/+spacemacs/spacemacs-editing/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs editing Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-editing/packages.el b/layers/+spacemacs/spacemacs-editing/packages.el index 4907c15..076c1c0 100644 --- a/layers/+spacemacs/spacemacs-editing/packages.el +++ b/layers/+spacemacs/spacemacs-editing/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Editing Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-evil/funcs.el b/layers/+spacemacs/spacemacs-evil/funcs.el index 78f0235..d221e83 100644 --- a/layers/+spacemacs/spacemacs-evil/funcs.el +++ b/layers/+spacemacs/spacemacs-evil/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Evil Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-evil/packages.el b/layers/+spacemacs/spacemacs-evil/packages.el index 19a4c15..34c5b99 100644 --- a/layers/+spacemacs/spacemacs-evil/packages.el +++ b/layers/+spacemacs/spacemacs-evil/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Evil Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -192,7 +192,7 @@ ("+" evil-numbers/inc-at-pt) ("=" evil-numbers/inc-at-pt) ("-" evil-numbers/dec-at-pt) - ("q" nil :exit t)) + ("q" nil :exit t)) (spacemacs/set-leader-keys "n+" 'spacemacs/evil-numbers-transient-state/evil-numbers/inc-at-pt "n=" 'spacemacs/evil-numbers-transient-state/evil-numbers/inc-at-pt @@ -259,12 +259,14 @@ :commands (linum-relative-toggle linum-relative-on) :init (progn - (when (eq dotspacemacs-line-numbers 'relative) - (linum-relative-on)) + (when (or (eq dotspacemacs-line-numbers 'relative) + (and (listp dotspacemacs-line-numbers) + (car (spacemacs/mplist-get dotspacemacs-line-numbers + :relative)))) + (add-hook 'spacemacs-post-user-config-hook 'linum-relative-on)) (spacemacs/set-leader-keys "tr" 'spacemacs/linum-relative-toggle)) :config - (progn - (setq linum-relative-current-symbol "")))) + (setq linum-relative-current-symbol ""))) (defun spacemacs-evil/init-vi-tilde-fringe () (spacemacs|do-after-display-system-init diff --git a/layers/+spacemacs/spacemacs-language/packages.el b/layers/+spacemacs/spacemacs-language/packages.el index a12874d..b943763 100644 --- a/layers/+spacemacs/spacemacs-language/packages.el +++ b/layers/+spacemacs/spacemacs-language/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Language Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-layouts/config.el b/layers/+spacemacs/spacemacs-layouts/config.el index 43d5b89..09f3274 100644 --- a/layers/+spacemacs/spacemacs-layouts/config.el +++ b/layers/+spacemacs/spacemacs-layouts/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Spacemacs Layouts Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-layouts/funcs.el b/layers/+spacemacs/spacemacs-layouts/funcs.el index 93816a1..58f4c09 100644 --- a/layers/+spacemacs/spacemacs-layouts/funcs.el +++ b/layers/+spacemacs/spacemacs-layouts/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Layouts Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-layouts/packages.el b/layers/+spacemacs/spacemacs-layouts/packages.el index 2559a7c..678ecde 100644 --- a/layers/+spacemacs/spacemacs-layouts/packages.el +++ b/layers/+spacemacs/spacemacs-layouts/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Layouts Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -31,12 +31,12 @@ "\n\n Go to^^^^^^ Actions^^ ─────^^^^^^─────────────────────── ───────^^────────────────────── - [_0_,_9_]^^ nth/new workspace [_d_] close current workspace - [_C-0_,_C-9_]^^ nth/new workspace [_R_] rename current workspace - [__]^^^^ last workspace [_?_] toggle help\n - [_l_]^^^^ layouts - [_n_/_C-l_]^^ next workspace - [_N_/_p_/_C-h_] prev workspace\n") + [_0_.._9_]^^ nth/new workspace [_d_] close current workspace + [_C-0_.._C-9_]^^ nth/new workspace [_R_] rename current workspace + [__]^^^^ last workspace [_?_] toggle help\n + [_l_]^^^^ layouts + [_n_/_C-l_]^^ next workspace + [_N_/_p_/_C-h_] prev workspace\n") (spacemacs|define-transient-state workspaces :title "Workspaces Transient State" @@ -108,7 +108,6 @@ (defun spacemacs-layouts/init-persp-mode () (use-package persp-mode - :diminish persp-mode :init (progn (setq persp-auto-resume-time (if (or dotspacemacs-auto-resume-layouts @@ -129,24 +128,22 @@ (spacemacs/defer-until-after-user-config #'spacemacs//activate-persp-mode) ;; layouts transient state - ;; TODO move helm specific key bindings to helm layer - ;; (see ivy for how to do it) (spacemacs|transient-state-format-hint layouts spacemacs--layouts-ts-full-hint "\n\n Go to^^^^^^ Actions^^ - ─────^^^^^^────────────────────────────── ───────^^────────────────────────────────────────────────── - [_0_,_9_]^^ nth/new layout [_a_]^^ add buffer - [_C-0_,_C-9_]^^ nth/new layout [_A_]^^ add all from layout - [__]^^^^ last layout [_d_]^^ close current layout - [_b_]^^^^ buffer in layout [_D_]^^ close other layout - [_h_]^^^^ default layout [_r_]^^ remove current buffer - [_l_]^^^^ layout w/helm/ivy [_R_]^^ rename current layout - [_L_]^^^^ layouts in file [_s_/_S_] save all layouts/save by names - [_n_/_C-l_]^^ next layout [_t_]^^ show a buffer without adding it to current layout - [_N_/_p_/_C-h_] prev layout [_x_]^^ kill current w/buffers - [_o_]^^^^ custom layout [_X_]^^ kill other w/buffers - [_w_]^^^^ workspaces transient state [_?_]^^ toggle help\n") + ─────^^^^^^──────────────────────────────── ───────^^────────────────────────────────────────────────── + [_0_.._9_]^^ nth/new layout [_a_]^^ add buffer + [_C-0_.._C-9_]^^ nth/new layout [_A_]^^ add all from layout + [__]^^^^ last layout [_d_]^^ close current layout + [_b_]^^^^ buffer in layout [_D_]^^ close other layout + [_h_]^^^^ default layout [_r_]^^ remove current buffer + [_l_]^^^^ layout w/helm/ivy [_R_]^^ rename current layout + [_L_]^^^^ layouts in file [_s_/_S_] save all layouts/save by names + [_n_/_C-l_]^^ next layout [_t_]^^ show a buffer without adding it to current layout + [_N_/_p_/_C-h_] prev layout [_x_]^^ kill current w/buffers + [_o_]^^^^ custom layout [_X_]^^ kill other w/buffers + [_w_]^^^^ workspaces transient state [_?_]^^ toggle help\n") (spacemacs|define-transient-state layouts :title "Layouts Transient State" @@ -181,11 +178,9 @@ ("C-l" persp-next) ("a" persp-add-buffer :exit t) ("A" persp-import-buffers :exit t) - ("b" spacemacs/persp-helm-mini :exit t) ("d" spacemacs/layouts-ts-close) ("D" spacemacs/layouts-ts-close-other :exit t) ("h" spacemacs/layout-goto-default :exit t) - ("l" spacemacs/helm-perspectives :exit t) ("L" persp-load-state-from-file :exit t) ("n" persp-next) ("N" persp-prev) @@ -207,6 +202,7 @@ (spacemacs/find-dotfile))) :config (progn + (spacemacs|hide-lighter persp-mode) (defadvice persp-activate (before spacemacs//save-toggle-layout activate) (setq spacemacs--last-selected-layout persp-last-persp-name)) (add-hook 'persp-mode-hook 'spacemacs//layout-autosave) diff --git a/layers/+spacemacs/spacemacs-misc/packages.el b/layers/+spacemacs/spacemacs-misc/packages.el index 31aa5f2..e5a076e 100644 --- a/layers/+spacemacs/spacemacs-misc/packages.el +++ b/layers/+spacemacs/spacemacs-misc/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs Misc. Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -25,6 +25,14 @@ ;; https://github.com/syl20bnr/spacemacs/issues/7107) (spacemacs/set-leader-keys "jq" #'dumb-jump-quick-look) + + ;; Use Helm or Ivy as the selector for dumb-jump. + (cond + ((configuration-layer/layer-usedp 'ivy) + (setq dumb-jump-selector 'ivy)) + ((configuration-layer/layer-usedp 'helm) + (setq dumb-jump-selector 'helm))) + ;; Since it's dumb, we add it to the end of the default jump handlers. At ;; the time of writing it is the only default jump handler. (gtags remains ;; mode-local) diff --git a/layers/+spacemacs/spacemacs-org/local/space-doc/space-doc.el b/layers/+spacemacs/spacemacs-org/local/space-doc/space-doc.el index 8463fe8..bbb9f85 100644 --- a/layers/+spacemacs/spacemacs-org/local/space-doc/space-doc.el +++ b/layers/+spacemacs/spacemacs-org/local/space-doc/space-doc.el @@ -1,6 +1,6 @@ ;;; space-doc.el --- Spacemacs documentation minor mode. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -304,6 +304,10 @@ This functions is aimed to be used with `spacemacs-space-doc-modificators'." "\\([ \t]*\\#\\+TITLE\\:\[ \t]*\\)" ;; Hide CAPTION logo meta line. "\\(\n.*\\#\\+CAPTION\\:.*\\)" + ;; Hide PROPERTIES lines. + "\\(\n.*\\:PROPERTIES\\:.*\\)" + "\\(\n.*\\:CUSTOM_ID\\:.*\\)" + "\\(\n.*\\:END\\:.*\\)" ;; Hide TOC-ORG tag and spaces before it. ;; Use modified `toc-org-toc-org-regexp' because ;; the original one matches whole string. diff --git a/layers/+spacemacs/spacemacs-org/packages.el b/layers/+spacemacs/spacemacs-org/packages.el index c8310f6..28fc35a 100644 --- a/layers/+spacemacs/spacemacs-org/packages.el +++ b/layers/+spacemacs/spacemacs-org/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- spacemacs-org layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Boris Buliga ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-ui-visual/funcs.el b/layers/+spacemacs/spacemacs-ui-visual/funcs.el index 7389e05..1d8c022 100644 --- a/layers/+spacemacs/spacemacs-ui-visual/funcs.el +++ b/layers/+spacemacs/spacemacs-ui-visual/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Spacemacs Visual UI Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/frame-cmds.el b/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/frame-cmds.el index 61810c6..4c056aa 100644 --- a/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/frame-cmds.el +++ b/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/frame-cmds.el @@ -151,7 +151,7 @@ ;; ;; `font-too-small', `font-size'. ;; -;; +;; ;; ***** NOTE: The following EMACS PRIMITIVE has been ADVISED HERE: ;; ;; `delete-window' - If only one window in frame, `delete-frame'. @@ -317,7 +317,7 @@ ;; tile-frames to frcmds-tile-frames. ;; rename-non-minibuffer-frame: Pass OLD-NAME and NEW-NAME to rename-frame. ;; Group Frame-Commands: Added :prefix frcmds-. -;; +;; ;; 2014/02/24 dadams ;; rename-frame, rename-non-minibuffer-frame: Fixed default buffer name for non-interactive. ;; 2013/09/21 dadams @@ -1351,7 +1351,7 @@ With a prefix arg, create that many new frames. The same character size is used for the new frames." (interactive "p") (frcmds-split-frame-1 'horizontal num)) - + ;;;###autoload (defun split-frame-vertically (num) "Vertically split the selected frame. diff --git a/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/zoom-frm.el b/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/zoom-frm.el index 91eac33..1ab9e03 100644 --- a/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/zoom-frm.el +++ b/layers/+spacemacs/spacemacs-ui-visual/local/zoom-frm/zoom-frm.el @@ -336,7 +336,7 @@ Buffer zooming uses command `text-scale-decrease'." (when (or (fboundp 'set-transient-map) ; Emacs 24.4+ (fboundp 'set-temporary-overlay-map)) ; Emacs 24.3 - + (defun zoom-in/out (arg) "Zoom current frame or buffer in or out. A prefix arg determines the behavior, as follows: @@ -366,7 +366,7 @@ plain `C-u' with this command then it acts like `text-scale-adjust'." (setq zoom-frame/buffer (if (eq zoom-frame/buffer 'frame) 'buffer 'frame) arg 1) (message "Zooming %sS from now on" (upcase (symbol-name zoom-frame/buffer))) - (sit-for 1)) + (sit-for 1)) (let* ((ev last-command-event) (echo-keystrokes nil) (base (event-basic-type ev)) diff --git a/layers/+spacemacs/spacemacs-ui-visual/packages.el b/layers/+spacemacs/spacemacs-ui-visual/packages.el index 4695bf1..7ef8066 100644 --- a/layers/+spacemacs/spacemacs-ui-visual/packages.el +++ b/layers/+spacemacs/spacemacs-ui-visual/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs UI Visual Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -126,16 +126,16 @@ evil-window-move-far-right evil-window-move-very-bottom quit-window - select-window-0 - select-window-1 - select-window-2 - select-window-3 - select-window-4 - select-window-5 - select-window-6 - select-window-7 - select-window-8 - select-window-9 + winum-select-window-0-or-10 + winum-select-window-1 + winum-select-window-2 + winum-select-window-3 + winum-select-window-4 + winum-select-window-5 + winum-select-window-6 + winum-select-window-7 + winum-select-window-8 + winum-select-window-9 windmove-left windmove-right windmove-up @@ -184,13 +184,14 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ ───────^^^^─────────────── ───────^^──────── ───────^^^──────────────── [_L_] next sibling^^ [_c_] create [_TAB_] shrink/enlarge -[_H_] previous sibling^^ [_d_] delete [_|_] vertical split -[_J_] goto child^^ [_r_] rename [_-_] horizonatal split -[_K_] goto parent^^ [_R_] change root [_gr_] refresh^ -[_l_] open/expand^^ ^^ [_s_] hidden:^^^ %s(if neo-buffer--show-hidden-file-p \"on\" \"off\") +[_H_] previous sibling^^ [_C_] copy [_|_] vertical split +[_J_] goto child^^ [_d_] delete [_-_] horizonatal split +[_K_] goto parent^^ [_r_] rename [_gr_] refresh^ +[_l_] open/expand^^ [_R_] change root [_s_] hidden:^^^ %s(if neo-buffer--show-hidden-file-p \"on\" \"off\") [_h_] up/collapse^^ ^^ ^^^ [_j_] line down^^ ^^ ^^^ [_k_] line up^^ ^^ ^^ +[_'_] quick look ^^ ^^ [_RET_] open ^^^^ [_?_] close hints " :bindings @@ -199,7 +200,9 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ ("|" neotree-enter-vertical-split) ("-" neotree-enter-horizontal-split) ("?" nil :exit t) + ("'" neotree-quick-look) ("c" neotree-create-node) + ("C" neotree-copy-node) ("d" neotree-delete-node) ("gr" neotree-refresh) ("h" spacemacs/neotree-collapse-or-up) @@ -223,7 +226,9 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ (kbd "RET") 'neotree-enter (kbd "|") 'neotree-enter-vertical-split (kbd "-") 'neotree-enter-horizontal-split + (kbd "'") 'neotree-quick-look (kbd "c") 'neotree-create-node + (kbd "C") 'neotree-copy-node (kbd "d") 'neotree-delete-node (kbd "gr") 'neotree-refresh (kbd "h") 'spacemacs/neotree-collapse-or-up @@ -242,6 +247,7 @@ Navigation^^^^ Actions^^ Visual actions/config^^^ (spacemacs/set-leader-keys "ft" 'neotree-toggle + "fT" 'neotree-show "pt" 'neotree-find-project-root)) :config (spacemacs//neotree-key-bindings))) diff --git a/layers/+spacemacs/spacemacs-ui/local/centered-cursor/centered-cursor-mode.el b/layers/+spacemacs/spacemacs-ui/local/centered-cursor/centered-cursor-mode.el index 1b69985..4afc8f0 100644 --- a/layers/+spacemacs/spacemacs-ui/local/centered-cursor/centered-cursor-mode.el +++ b/layers/+spacemacs/spacemacs-ui/local/centered-cursor/centered-cursor-mode.el @@ -94,7 +94,7 @@ ;; This file is *NOT* part of GNU Emacs. ;;; Code: - + (defgroup centered-cursor nil "Makes the cursor stay vertically in a defined position (usually centered). Instead the cursor the text moves around the cursor." @@ -194,7 +194,7 @@ to successively recenter to") ccm-map) "Keymap used in centered-cursor-mode.") - + (defun ccm-mwheel-scroll (event) "Very similar to `mwheel-scroll', but does not use `scroll-down' and `scroll-up' but `previous-line' and `next-line', that is, the @@ -251,7 +251,7 @@ the movement appears as page up." next-screen-context-lines)))) (forward-line amt))) - + (defun ccm-vpos-down (arg) "Adjust the value of the screen line (where the cursor stays) by arg. Negative values for arg are possible. Just the variable ccm-vpos @@ -413,9 +413,9 @@ position (usually centered)." ;; (info "(elisp)Hooks") ;; (info "(elisp)Customization") ;; (find-function 'mwheel-scroll) - + ;; Local Variables: ;; coding: utf-8 ;; End: - + ;;; centered-cursor-mode.el ends here diff --git a/layers/+spacemacs/spacemacs-ui/packages.el b/layers/+spacemacs/spacemacs-ui/packages.el index f08937e..d33a9e6 100644 --- a/layers/+spacemacs/spacemacs-ui/packages.el +++ b/layers/+spacemacs/spacemacs-ui/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Spacemacs UI Layer packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -19,9 +19,7 @@ open-junk-file paradox restart-emacs - window-numbering)) - -;; Initialization of packages + winum)) (defun spacemacs-ui/init-ace-link () (use-package ace-link @@ -268,41 +266,46 @@ debug-init and load the given list of packages." "qr" 'spacemacs/restart-emacs-resume-layouts "qR" 'spacemacs/restart-emacs))) -(defun spacemacs-ui/init-window-numbering () - (use-package window-numbering +(defun spacemacs-ui/init-winum () + (use-package winum :config (progn - (when (configuration-layer/package-usedp 'spaceline) - (defun window-numbering-install-mode-line (&optional position) - "Do nothing, the display is handled by the powerline.")) - (setq window-numbering-auto-assign-0-to-minibuffer nil) + (defun spacemacs//winum-assign-func () + "Custom number assignment for neotree." + (when (and (boundp 'neo-buffer-name) + (string= (buffer-name) neo-buffer-name) + ;; in case there are two neotree windows. Example: when + ;; invoking a transient state from neotree window, the new + ;; window will show neotree briefly before displaying the TS, + ;; causing an error message. the error is eliminated by + ;; assigning 0 only to the top-left window + (eq (selected-window) (frame-first-window))) + 0)) + (setq winum-auto-assign-0-to-minibuffer nil + winum-assign-func 'spacemacs//winum-assign-func + winum-auto-setup-mode-line nil + winum-ignored-buffers '(" *which-key*")) (spacemacs/set-leader-keys - "0" 'select-window-0 - "1" 'select-window-1 - "2" 'select-window-2 - "3" 'select-window-3 - "4" 'select-window-4 - "5" 'select-window-5 - "6" 'select-window-6 - "7" 'select-window-7 - "8" 'select-window-8 - "9" 'select-window-9) - (window-numbering-mode 1)) - - ;; make sure neotree is always 0 - (defun spacemacs//window-numbering-assign () - "Custom number assignment for neotree." - (when (and (boundp 'neo-buffer-name) - (string= (buffer-name) neo-buffer-name) - ;; in case there are two neotree windows. Example: when - ;; invoking a transient state from neotree window, the new - ;; window will show neotree briefly before displaying the TS, - ;; causing an error message. the error is eliminated by - ;; assigning 0 only to the top-left window - (eq (selected-window) (window-at 0 0))) - 0)) - - ;; using lambda to work-around a bug in window-numbering, see - ;; https://github.com/nschum/window-numbering.el/issues/10 - (setq window-numbering-assign-func - (lambda () (spacemacs//window-numbering-assign))))) + "`" 'winum-select-window-by-number + "²" 'winum-select-window-by-number + "0" 'winum-select-window-0-or-10 + "1" 'winum-select-window-1 + "2" 'winum-select-window-2 + "3" 'winum-select-window-3 + "4" 'winum-select-window-4 + "5" 'winum-select-window-5 + "6" 'winum-select-window-6 + "7" 'winum-select-window-7 + "8" 'winum-select-window-8 + "9" 'winum-select-window-9) + (define-key winum-keymap (kbd "M-0") 'winum-select-window-0-or-10) + (define-key winum-keymap (kbd "M-1") 'winum-select-window-1) + (define-key winum-keymap (kbd "M-2") 'winum-select-window-2) + (define-key winum-keymap (kbd "M-3") 'winum-select-window-3) + (define-key winum-keymap (kbd "M-4") 'winum-select-window-4) + (define-key winum-keymap (kbd "M-5") 'winum-select-window-5) + (define-key winum-keymap (kbd "M-6") 'winum-select-window-6) + (define-key winum-keymap (kbd "M-7") 'winum-select-window-7) + (define-key winum-keymap (kbd "M-8") 'winum-select-window-8) + (define-key winum-keymap (kbd "M-9") 'winum-select-window-9) + (winum-mode)))) diff --git a/layers/+tags/cscope/packages.el b/layers/+tags/cscope/packages.el index a73ed9d..2da241f 100644 --- a/layers/+tags/cscope/packages.el +++ b/layers/+tags/cscope/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- cscope Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tags/gtags/config.el b/layers/+tags/gtags/config.el index 1829136..b08a802 100644 --- a/layers/+tags/gtags/config.el +++ b/layers/+tags/gtags/config.el @@ -1,6 +1,6 @@ ;;; config.el --- gtags configuration File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tags/gtags/funcs.el b/layers/+tags/gtags/funcs.el index de37953..cc69b10 100644 --- a/layers/+tags/gtags/funcs.el +++ b/layers/+tags/gtags/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- gtags functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tags/gtags/packages.el b/layers/+tags/gtags/packages.el index 2a35884..6d995ff 100644 --- a/layers/+tags/gtags/packages.el +++ b/layers/+tags/gtags/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- gtags Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; and: Christian E. Hopps diff --git a/layers/+themes/colors/config.el b/layers/+themes/colors/config.el index c165af0..d479699 100644 --- a/layers/+themes/colors/config.el +++ b/layers/+themes/colors/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Colors Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+themes/colors/funcs.el b/layers/+themes/colors/funcs.el index 99f52d4..1f2307d 100644 --- a/layers/+themes/colors/funcs.el +++ b/layers/+themes/colors/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Colors Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+themes/colors/packages.el b/layers/+themes/colors/packages.el index baed236..c7d5a3f 100644 --- a/layers/+themes/colors/packages.el +++ b/layers/+themes/colors/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Colors Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+themes/themes-megapack/packages.el b/layers/+themes/themes-megapack/packages.el index e36c942..f584cf1 100644 --- a/layers/+themes/themes-megapack/packages.el +++ b/layers/+themes/themes-megapack/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Themes Mega-Pack Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -54,6 +54,7 @@ jbeans-theme light-soap-theme lush-theme + madhat2r-theme majapahit-theme material-theme minimal-theme @@ -83,6 +84,7 @@ soft-charcoal-theme soft-morning-theme soft-stone-theme + solarized-theme soothe-theme spacegray-theme subatomic-theme diff --git a/layers/+themes/theming/config.el b/layers/+themes/theming/config.el index 8784457..93b6d4d 100644 --- a/layers/+themes/theming/config.el +++ b/layers/+themes/theming/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Theming Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+themes/theming/funcs.el b/layers/+themes/theming/funcs.el index 1472f9a..2aa2674 100644 --- a/layers/+themes/theming/funcs.el +++ b/layers/+themes/theming/funcs.el @@ -1,6 +1,6 @@ ;;; config.el --- Theming Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+themes/theming/packages.el b/layers/+themes/theming/packages.el index bf17153..725b93d 100644 --- a/layers/+themes/theming/packages.el +++ b/layers/+themes/theming/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Theming Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/ansible/README.org b/layers/+tools/ansible/README.org index ff57bec..d413626 100644 --- a/layers/+tools/ansible/README.org +++ b/layers/+tools/ansible/README.org @@ -5,6 +5,10 @@ * Table of Contents :TOC_4_gh:noexport: - [[#description][Description]] - [[#install][Install]] + - [[#configuration][Configuration]] + - [[#ansible-vault][ansible-vault]] + - [[#password][Password]] + - [[#automatic-encryption-and-descryption][Automatic encryption and descryption]] - [[#key-bindings][Key bindings]] * Description @@ -15,8 +19,35 @@ To use this configuration layer, add it to your =~/.spacemacs=. You will need to add =ansible= to the existing =dotspacemacs-configuration-layers= list in this file. +* Configuration +** ansible-vault +*** Password +To use =ansible-vault= you have to provide the path to a file containing the +password to use somewhere in you =dotspacemacs/user-config= function. +For instance: + +#+BEGIN_SRC emacs-lisp +(setq ansible::vault-password-file "path/to/pwd/file") +#+END_SRC + +The default value is the ansible-vault default value: =~/.vault_pass.txt=. + +*** Automatic encryption and descryption +This layer comes preconfigured with automatic encryption/decryption of +encrypted files using =ansible-vault= so it is possible to edit seamlessly +any encrypted files. + +If you want to disable this feature then set the layer variable +=ansible-auto-encrypt-descrypt= to =nil=. + +#+BEGIN_SRC emacs-lisp +(ansible :variables ansible-auto-encrypt-descrypt t) +#+END_SRC + * Key bindings | Key Binding | Description | |-------------+------------------------------------------| +| ~SPC m b d~ | encrypt the buffer using =ansible-vault= | +| ~SPC m b e~ | decrypt the buffer using =ansible-vault= | | ~SPC m h a~ | looks up documentation using [[https://github.com/lunaryorn/ansible-doc.el][ansible-doc]] | diff --git a/layers/+tools/ansible/config.el b/layers/+tools/ansible/config.el index e859943..5da0559 100644 --- a/layers/+tools/ansible/config.el +++ b/layers/+tools/ansible/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Ansible Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,7 +9,14 @@ ;; ;;; License: GPLv3 +;; variables + +(defvar ansible-auto-encrypt-descrypt t + "Set it to non-nil to seamlessly edit `ansible-vault' encrypted files. +If non-nil then encrypted files are automatically decrypted when opened and + encrypted when saved.") + ;; detect filenames compatible with Ansible's recommended layout. ;; http://docs.ansible.com/playbooks_best_practices.html#directory-layout -(setq ansible/ansible-filename-re - "\\(site\.yml\\|roles/.+\.yml\\|group_vars/.+\\|host_vars/.+\\)") +(setq spacemacs--ansible-filename-re + ".*\\(main\.yml\\|site\.yml\\|encrypted\.yml\\|roles/.+\.yml\\|group_vars/.+\\|host_vars/.+\\)") diff --git a/layers/+tools/ansible/funcs.el b/layers/+tools/ansible/funcs.el index 5c7a0fe..206041e 100644 --- a/layers/+tools/ansible/funcs.el +++ b/layers/+tools/ansible/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Ansible Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs @@ -8,12 +8,24 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 -(defun ansible/ansible-should-enable? () + +(defun spacemacs//ansible-should-enable? () (and (stringp buffer-file-name) - (string-match ansible/ansible-filename-re buffer-file-name))) + (string-match spacemacs--ansible-filename-re buffer-file-name))) + +(defun spacemacs/ansible-maybe-enable () + (when (spacemacs//ansible-should-enable?) + (ansible 1))) + +(defun spacemacs/ansible-company-maybe-enable () + "Add the ansible company backend only for when ansible mode is active." + (when (spacemacs//ansible-should-enable?) + (add-to-list 'company-backends 'company-ansible))) -(defun ansible/ansible-maybe-enable () - (when (ansible/ansible-should-enable?) (ansible 1))) +(defun spacemacs/ansible-doc-maybe-enable () + (when (spacemacs//ansible-should-enable?) + (ansible-doc-mode 1))) -(defun ansible/ansible-doc-maybe-enable () - (when (ansible/ansible-should-enable?) (ansible-doc-mode 1))) +(defun spacemacs//ansible-reset-buffer-modified () + "Force the modified buffer flag to nil." + (set-buffer-modified-p nil)) diff --git a/layers/+tools/ansible/layers.el b/layers/+tools/ansible/layers.el index c14d396..174bea3 100644 --- a/layers/+tools/ansible/layers.el +++ b/layers/+tools/ansible/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Ansible Layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/ansible/packages.el b/layers/+tools/ansible/packages.el index 5494c28..d24e579 100644 --- a/layers/+tools/ansible/packages.el +++ b/layers/+tools/ansible/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Ansible Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs @@ -12,17 +12,36 @@ '(ansible ansible-doc company + (company-ansible :toggle (configuration-layer/package-usedp 'company)) jinja2-mode yaml-mode)) (defun ansible/init-ansible () (use-package ansible :defer t - :init (add-to-list 'auto-mode-alist - '("\\(group_vars/.+\\|host_vars/.+\\)" . yaml-mode)))) + :init + (progn + (add-hook 'yaml-mode-hook 'spacemacs/ansible-maybe-enable) + (if ansible-auto-encrypt-descrypt + (add-hook 'ansible-hook 'ansible::auto-decrypt-encrypt) + (remove-hook 'ansible-hook 'ansible::auto-decrypt-encrypt)) + (spacemacs/set-leader-keys-for-minor-mode 'ansible + "bd" 'ansible::decrypt-buffer + "be" 'ansible::encrypt-buffer)) + :config + ;; TODO to remove when fixed upstream + (advice-add 'ansible::decrypt-buffer + :after 'spacemacs//ansible-reset-buffer-modified))) (defun ansible/init-ansible-doc () - (use-package ansible-doc :defer t)) + (use-package ansible-doc + :defer t + :init + (progn + (add-hook 'yaml-mode-hook 'spacemacs/ansible-doc-maybe-enable) + (spacemacs/set-leader-keys-for-minor-mode 'ansible-doc-mode + "ha" 'ansible-doc)) + :config (spacemacs|hide-lighter ansible-doc-mode))) (defun ansible/post-init-company () ;; ansible-mode requires ac-user-dictionary-files. If the @@ -33,12 +52,22 @@ ;; https://github.com/k1LoW/emacs-ansible/issues/2 (defvar ac-user-dictionary-files nil)) +(defun ansible/init-company-ansible () + (use-package company-ansible + :defer t + :init + ;; append this hook at the end to execute it last so `company-backends' + ;; variable is buffer local + (add-hook 'yaml-mode-hook 'spacemacs/ansible-company-maybe-enable t))) + (defun ansible/init-jinja2-mode () (use-package jinja2-mode :mode ("\\.j2\\'" . jinja2-mode) :defer t)) (defun ansible/post-init-yaml-mode () - (spacemacs/set-leader-keys-for-major-mode 'yaml-mode "ha" 'ansible-doc) - (spacemacs/add-to-hook 'yaml-mode-hook '(ansible/ansible-maybe-enable - ansible/ansible-doc-maybe-enable))) + ;; maybe move it to the layer owning `yaml-mode' at some point + (spacemacs/declare-prefix-for-mode 'yaml-mode "mh" "help") + (spacemacs/declare-prefix-for-mode 'yaml-mode "mb" "buffer") + (add-to-list 'auto-mode-alist + '("\\(group_vars/.+\\|host_vars/.+\\)" . yaml-mode))) diff --git a/layers/+tools/cfengine/config.el b/layers/+tools/cfengine/config.el index 39d6d7e..a810437 100644 --- a/layers/+tools/cfengine/config.el +++ b/layers/+tools/cfengine/config.el @@ -1,6 +1,6 @@ ;;; config.el --- CFEgine Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Nick Anderson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/cfengine/packages.el b/layers/+tools/cfengine/packages.el index 7ccba0f..531fa1f 100644 --- a/layers/+tools/cfengine/packages.el +++ b/layers/+tools/cfengine/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- cfengine layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Nick Anderson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/chrome/README.org b/layers/+tools/chrome/README.org index 60d8eca..e9a0b5f 100644 --- a/layers/+tools/chrome/README.org +++ b/layers/+tools/chrome/README.org @@ -9,12 +9,15 @@ - [[#layer][Layer]] - [[#chrome-extension][Chrome extension]] - [[#configuration][Configuration]] + - [[#key-bindings][Key bindings]] * Description This layer provides some integration with the Google Chrome browser. ** Features - Edit text boxes with Emacs using [[http://melpa.org/#/edit-server][edit-server]] +- Write markdown in Emacs and realtime show in chrome using [[https://github.com/mola-T/flymd][flymd]] + * Install ** Layer @@ -27,6 +30,7 @@ file. Google Chrome extension [[https://chrome.google.com/webstore/detail/edit-with-emacs/ljobjlafonikaiipfkggjbhkghgicgoh][Edit with Emacs]]. You have to install this extension. More information can be found on [[http://www.emacswiki.org/emacs/Edit_with_Emacs][Emacs Wiki]]. + The edit server is configured to start automatically when Spacemacs starts. * Configuration @@ -49,10 +53,22 @@ To change frame defaults (width, height, etc. use =edit-server-new-frame-alist=) (add-to-list 'edit-server-new-frame-alist '(height . 60)) #+END_SRC -If you want Emacs to switch focus to Chrome after done editing, you can utilize =edit-server-done-hook=. -Emacs cannot control focus of windows for external apps, so you need to use some sort of command line window manager like =wmctrl=. +If you want Emacs to switch focus to Chrome after done editing, you can utilize +=edit-server-done-hook=. + +Emacs cannot control focus of windows for external apps, so you need to use some +sort of command line window manager like =wmctrl=. + The following example works on OS X: #+BEGIN_SRC emacs-lisp (add-hook 'edit-server-done-hook (lambda () (shell-command "open -a \"Google Chrome\""))) #+END_SRC + +* Key bindings + +| Key Binding | Description | +|-------------+-------------| +| ~SPC a F~ | flymd-flyit | + +*Note:* You need to kill all google chrome process before using =flymd-flyit=. diff --git a/layers/+tools/chrome/config.el b/layers/+tools/chrome/config.el new file mode 100644 index 0000000..a0d0f5b --- /dev/null +++ b/layers/+tools/chrome/config.el @@ -0,0 +1,2 @@ +(defvar chrome-exec-path nil + "The chrome browser installation directory") diff --git a/layers/+tools/chrome/keybindings.el b/layers/+tools/chrome/keybindings.el new file mode 100644 index 0000000..2fbce6e --- /dev/null +++ b/layers/+tools/chrome/keybindings.el @@ -0,0 +1 @@ +(spacemacs/set-leader-keys "aF" 'flymd-flyit) diff --git a/layers/+tools/chrome/packages.el b/layers/+tools/chrome/packages.el index 592a8d0..01cc773 100644 --- a/layers/+tools/chrome/packages.el +++ b/layers/+tools/chrome/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Chrome Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Ben Hayden ;; URL: https://github.com/syl20bnr/spacemacs @@ -12,6 +12,7 @@ (setq chrome-packages '( edit-server gmail-message-mode + flymd )) (defun chrome/init-edit-server () @@ -26,3 +27,26 @@ (defun chrome/init-gmail-message-mode ( ) (use-package gmail-message-mode)) + +(defun chrome/init-flymd () + (use-package flymd + :defer t + :init + (progn + (defun start-browser(browser url) + (let ((process-environment (browse-url-process-environment))) + (apply 'start-process + "flymd" nil + browser + (list "--new-window" "--allow-file-access-from-files" url)))) + + (defun my-flymd-browser-function (url) + (cond + (chrome-exec-path (start-browser chrome-exec-path url)) + ((executable-find "chromium") (start-browser (executable-find "chromium") url)) + ((executable-find "google-chrome") (start-browser (executable-find "google-chrome") url)) + ((executable-find "google-chrome-stable") (start-browser (executable-find "google-chrome-stable") url)) + (t (message "no useful browser")))) + + (setq flymd-browser-open-function 'my-flymd-browser-function) + ))) diff --git a/layers/+tools/command-log/packages.el b/layers/+tools/command-log/packages.el index 9e42073..2bef1a5 100644 --- a/layers/+tools/command-log/packages.el +++ b/layers/+tools/command-log/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- command-log Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/dash/README.org b/layers/+tools/dash/README.org index e022ce6..ea67342 100644 --- a/layers/+tools/dash/README.org +++ b/layers/+tools/dash/README.org @@ -40,6 +40,9 @@ You have to install [[http://kapeli.com/dash][dash]] on your machine. It is recommended to set the =HUD mode= in your Dash application preferences when using this layer. +** Sqlite3 +Helm Dash [[https://github.com/areina/helm-dash#requirements][requires]] sqlite3 to be installed to function properly. + ** Zeal (Linux & Windows) You have to install [[http://zealdocs.org/][zeal]] on your machine. diff --git a/layers/+tools/dash/config.el b/layers/+tools/dash/config.el index e139c2e..9c4c647 100644 --- a/layers/+tools/dash/config.el +++ b/layers/+tools/dash/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Dash Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/dash/funcs.el b/layers/+tools/dash/funcs.el index 101acb2..14ab7c9 100644 --- a/layers/+tools/dash/funcs.el +++ b/layers/+tools/dash/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Dash Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; URL: https://github.com/syl20bnr/spacemacs ;; diff --git a/layers/+tools/deft/packages.el b/layers/+tools/deft/packages.el index 39e3d04..bfc45dd 100644 --- a/layers/+tools/deft/packages.el +++ b/layers/+tools/deft/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- deft Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/docker/packages.el b/layers/+tools/docker/packages.el index 1592564..cd19598 100644 --- a/layers/+tools/docker/packages.el +++ b/layers/+tools/docker/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- docker Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2015 Sylvain Benner +;; Copyright (c) 2012-2017 Sylvain Benner ;; Copyright (c) 2015 Alan Zimmerman & Contributors ;; ;; Author: Alan Zimmerman diff --git a/layers/+tools/finance/README.org b/layers/+tools/finance/README.org index 20a1043..79cb1bb 100644 --- a/layers/+tools/finance/README.org +++ b/layers/+tools/finance/README.org @@ -7,7 +7,8 @@ - [[#configuration][Configuration]] - [[#ledger][Ledger]] - [[#key-bindings][Key bindings]] - - [[#ledger][Ledger]] + - [[#ledger-1][Ledger]] + - [[#ledger-reconcile][Ledger-Reconcile]] * Description @@ -53,3 +54,13 @@ your =dotspacemacs/user-config=. The default value, set in the layer, is =62=. | ~SPC m t~ | append an effective date to a post | | ~SPC m y~ | set the year for quicker entry | | ~SPC m RET~ | set the month for quicker entry | + +** Ledger-Reconcile + +| Key Binding | Description | +|-------------+---------------------------------------------------------------------------| +| ~SPC m ,~ | toggle the current transaction pending | +| ~SPC m a~ | quickly add a transaction, without exiting the reconciliation buffer | +| ~SPC m t~ | change the target amount for the selected account | +| ~SPC m q~ | quit reconciliation | +| ~SPC m RET~ | finalize the reconciliation, changing all pending transactions to cleared | diff --git a/layers/+tools/finance/packages.el b/layers/+tools/finance/packages.el index 53876a2..6beb954 100644 --- a/layers/+tools/finance/packages.el +++ b/layers/+tools/finance/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Finance Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -43,8 +43,14 @@ "t" 'ledger-insert-effective-date "y" 'ledger-set-year "RET" 'ledger-set-month) + (spacemacs/set-leader-keys-for-major-mode 'ledger-reconcile-mode + (or dotspacemacs-major-mode-leader-key ",") 'ledger-reconcile-toggle + "a" 'ledger-reconcile-add + "q" 'ledger-reconcile-quit + "t" 'ledger-reconcile-change-target + "RET" 'ledger-reconcile-finish) ;; temporary hack to work-around an issue with evil-define-key - ;; more info: https://bitbucket.org/lyro/evil/issues/301/evil-define-key-for-minor-mode-does-not + ;; more info: https://github.com/emacs-evil/evil/issues/301 ;; TODO remove this hack if the limitation is removed upstream (add-hook 'ledger-mode-hook 'evil-normalize-keymaps) (evilified-state-evilify ledger-report-mode ledger-report-mode-map)))) diff --git a/layers/+tools/geolocation/config.el b/layers/+tools/geolocation/config.el index a5bd9c4..93db40e 100644 --- a/layers/+tools/geolocation/config.el +++ b/layers/+tools/geolocation/config.el @@ -1,6 +1,6 @@ ;;; config.el --- geolocation configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/geolocation/extensions.el b/layers/+tools/geolocation/extensions.el index 924e9d6..62fec4e 100644 --- a/layers/+tools/geolocation/extensions.el +++ b/layers/+tools/geolocation/extensions.el @@ -1,7 +1,6 @@ ;;; extensions.el --- geolocation configuration File for Spacemacs ;; -;; Copyright (c) 2012-2014 Sylvain Benner -;; Copyright (c) 2014-2015 Uri Sharf & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Uri Sharf ;; URL: https://github.com/usharf/spacemacs diff --git a/layers/+tools/geolocation/extensions/theme-changer/theme-changer.el b/layers/+tools/geolocation/extensions/theme-changer/theme-changer.el index 2cf4a73..e43ef18 100644 --- a/layers/+tools/geolocation/extensions/theme-changer/theme-changer.el +++ b/layers/+tools/geolocation/extensions/theme-changer/theme-changer.el @@ -1,7 +1,6 @@ ;;; theme-changer.el --- geolocation configuration File for Spacemacs ;; -;; Copyright (c) 2012-2014 Sylvain Benner -;; Copyright (c) 2014-2015 Uri Sharf & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Uri Sharf ;; URL: https://github.com/usharf/spacemacs diff --git a/layers/+tools/geolocation/packages.el b/layers/+tools/geolocation/packages.el index 4135f76..183fd37 100644 --- a/layers/+tools/geolocation/packages.el +++ b/layers/+tools/geolocation/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- geolocation configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Uri Sharf ;; URL: https://github.com/usharf/spacemacs diff --git a/layers/+tools/imenu-list/packages.el b/layers/+tools/imenu-list/packages.el index 53ebf3e..ca37436 100644 --- a/layers/+tools/imenu-list/packages.el +++ b/layers/+tools/imenu-list/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- imenu-list Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/nginx/packages.el b/layers/+tools/nginx/packages.el index 8e43d5f..9858450 100644 --- a/layers/+tools/nginx/packages.el +++ b/layers/+tools/nginx/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- nginx layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Nathaniel Waisbrot ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/pandoc/funcs.el b/layers/+tools/pandoc/funcs.el index 13c27b1..66ce432 100644 --- a/layers/+tools/pandoc/funcs.el +++ b/layers/+tools/pandoc/funcs.el @@ -1,6 +1,6 @@ ;;; packages.el --- pandoc Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Christoph Paulik ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/pandoc/packages.el b/layers/+tools/pandoc/packages.el index f85ca37..5f3c06e 100644 --- a/layers/+tools/pandoc/packages.el +++ b/layers/+tools/pandoc/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- pandoc Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Christoph Paulik ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/pdf-tools/packages.el b/layers/+tools/pdf-tools/packages.el index 7fc5235..9ab90b0 100644 --- a/layers/+tools/pdf-tools/packages.el +++ b/layers/+tools/pdf-tools/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- pdf-tools Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2012-2017 Sylvain Benner ;; Copyright (c) 2014-2016 Sylvain Benner & Contributors ;; ;; Author: André Peric Tavares diff --git a/layers/+tools/prodigy/README.org b/layers/+tools/prodigy/README.org index 331b55e..8bd766d 100644 --- a/layers/+tools/prodigy/README.org +++ b/layers/+tools/prodigy/README.org @@ -46,6 +46,7 @@ You start prodigy with this: | ~L~ | Start prodigy | | ~S~ | Stop prodigy | | ~r~ | restart prodigy | +| ~R~ | revert buffer (refresh list) | | ~d~ | Jump to the dired of service | | ~g~ | Jump to magit-status of service | | ~Y~ | Copy prodigy command | diff --git a/layers/+tools/prodigy/packages.el b/layers/+tools/prodigy/packages.el index 369d794..adf1f20 100644 --- a/layers/+tools/prodigy/packages.el +++ b/layers/+tools/prodigy/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Prodigy Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -27,4 +27,6 @@ "L" 'prodigy-start "d" 'prodigy-jump-dired "g" 'prodigy-jump-magit - "Y" 'prodigy-copy-cmd))) + "Y" 'prodigy-copy-cmd + "R" 'revert-buffer) + (evil-define-key 'motion prodigy-view-mode-map (kbd "gf") 'find-file-at-point))) diff --git a/layers/+tools/puppet/layers.el b/layers/+tools/puppet/layers.el index e140753..5aa3bbe 100644 --- a/layers/+tools/puppet/layers.el +++ b/layers/+tools/puppet/layers.el @@ -1,6 +1,6 @@ ;;; layers.el --- Puppet layer layers File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/puppet/packages.el b/layers/+tools/puppet/packages.el index 4a3f8f8..6261ce5 100644 --- a/layers/+tools/puppet/packages.el +++ b/layers/+tools/puppet/packages.el @@ -1,6 +1,6 @@ ;;; layers.el --- Puppet layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/ranger/README.org b/layers/+tools/ranger/README.org index e9bf155..ec9077e 100644 --- a/layers/+tools/ranger/README.org +++ b/layers/+tools/ranger/README.org @@ -47,7 +47,7 @@ dired buffer. You can choose to show dotfiles at ranger startup, toggled by =zh= #+BEGIN_SRC elisp -(setq ranger-show-dotfiles t) +(setq ranger-show-hidden t) #+END_SRC Define custom function used to output header of primary ranger window. Must @@ -84,7 +84,7 @@ frame size to prevent filling up entire frame with parents. You can choose to show previews literally, or through find-file, toggled by =zi= #+BEGIN_SRC elisp -(setq ranger-show-dotfiles t) +(setq ranger-show-literal t) #+END_SRC You can set the size of the preview windows as a fraction of the frame size diff --git a/layers/+tools/ranger/packages.el b/layers/+tools/ranger/packages.el index 0e70239..c799e1f 100644 --- a/layers/+tools/ranger/packages.el +++ b/layers/+tools/ranger/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- ranger Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Rich Alesi ;; Author: Sylvain Benner diff --git a/layers/+tools/rebox/config.el b/layers/+tools/rebox/config.el index 5b70423..2fa135b 100644 --- a/layers/+tools/rebox/config.el +++ b/layers/+tools/rebox/config.el @@ -1,6 +1,6 @@ ;;; packages.el --- rebox layer configuration file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Christian E. Hopps ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/rebox/funcs.el b/layers/+tools/rebox/funcs.el index c22d9d4..1fa0249 100644 --- a/layers/+tools/rebox/funcs.el +++ b/layers/+tools/rebox/funcs.el @@ -1,6 +1,6 @@ ;;; packages.el --- rebox layer function file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Christian E. Hopps ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/rebox/packages.el b/layers/+tools/rebox/packages.el index 44b59a7..172acea 100644 --- a/layers/+tools/rebox/packages.el +++ b/layers/+tools/rebox/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- rebox layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Christian E. Hopps ;; URL: https://github.com/syl20bnr/spacemacs @@ -14,7 +14,6 @@ (defun rebox/init-rebox2 () (use-package rebox2 :defer t - :diminish rebox-mode :init (progn (when rebox-enable-in-text-mode @@ -39,6 +38,7 @@ "xbc" 'spacemacs/rebox-transient-state/rebox-center)) :config (progn + (spacemacs|hide-lighter rebox-mode) (rebox-register-template 71 176 ["?" "? box123456" "?"]) diff --git a/layers/+tools/restclient/README.org b/layers/+tools/restclient/README.org index d2523c2..8913358 100644 --- a/layers/+tools/restclient/README.org +++ b/layers/+tools/restclient/README.org @@ -9,8 +9,8 @@ - [[#ob-http][ob-http]] * Description -This is a package that lets you have a REPL-like interface for http requests -using a [[http://pashky/restclient.el][restclient]] buffer or an =org= buffer. +This layer lets you have a REPL-like interface for http requests using a +[[https://github.com/pashky/restclient.el][restclient]] buffer or an =org= buffer. * Install To use this configuration layer, add it to your =~/.spacemacs=. You will need to @@ -18,18 +18,31 @@ add =restclient= to the existing =dotspacemacs-configuration-layers= list in thi file. * Configuration -By default the layer enables [[http://pashky/restclient.el][restclient]]. It is possible to use =org= via [[http://github.com/zweifisch/ob-http][ob-http]] -by setting the layer variable =restclient-use-org= to =t=. +By default the layer uses [[https://github.com/pashky/restclient.el][restclient]]. To use =org= via [[http://github.com/zweifisch/ob-http][ob-http]] by default set +the layer variable =restclient-use-org= to =t=. + +Note that both =restclient= and =ob-http= are always installed so you can +choose the mode at any time. * Restclient Any file with an =.http= extension is opened in a =restclient= buffer. Full documentation and examples can be found in the package's [[https://github.com/pashky/restclient.el][GitHub Page]]. Also there is an [[http://emacsrocks.com/e15.html][Emacs Rocks!]] episode of it. +There is support for =org-babel= and =restclient= code blocks, for instance: + +#+BEGIN_EXAMPLE +#+BEGIN_SRC restclient + GET http://example.com +#+END_SRC +#+END_EXAMPLE + ** Keybindings | Key Binding | Description | |-------------+-------------------------------------------------------------| +| ~SPC m n~ | Jump to next request | +| ~SPC m p~ | Jump to previous request | | ~SPC m s~ | Send and stay in window (pretty-print response if possible) | | ~SPC m S~ | Send and switch window (pretty-print response if possible) | | ~SPC m r~ | Send and stay in window (do not attempt to pretty-print) | diff --git a/layers/+tools/restclient/config.el b/layers/+tools/restclient/config.el index 68b469e..5863653 100644 --- a/layers/+tools/restclient/config.el +++ b/layers/+tools/restclient/config.el @@ -1,6 +1,6 @@ ;;; config.el --- restclient configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -11,3 +11,5 @@ (defvar restclient-use-org nil "If non-nil use `ob-http' instead of `restclient'.") + +(spacemacs|defvar-company-backends restclient-mode) diff --git a/layers/+tools/restclient/funcs.el b/layers/+tools/restclient/funcs.el index 7384e80..72549c4 100644 --- a/layers/+tools/restclient/funcs.el +++ b/layers/+tools/restclient/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- restclient Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -10,6 +10,6 @@ ;;; License: GPLv3 -(defun restclient-http-send-current-raw-stay-in-window () +(defun spacemacs/restclient-http-send-current-raw-stay-in-window () (interactive) (restclient-http-send-current t t)) diff --git a/layers/+tools/restclient/packages.el b/layers/+tools/restclient/packages.el index ff900c1..9b4364b 100644 --- a/layers/+tools/restclient/packages.el +++ b/layers/+tools/restclient/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- restclient Layer Packages File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -10,9 +10,13 @@ ;;; License: GPLv3 (setq restclient-packages '( + company + (company-restclient :toggle (configuration-layer/package-usedp 'company)) golden-ratio ob-http + ob-restclient restclient + (restclient-helm :toggle (configuration-layer/package-usedp 'helm)) )) (defun restclient/pre-init-golden-ratio () @@ -27,6 +31,12 @@ (use-package ob-http :init (add-to-list 'org-babel-load-languages '(http . t))))) +(defun restclient/init-ob-restclient () + (spacemacs|use-package-add-hook org + :post-config + (use-package ob-restclient + :init (add-to-list 'org-babel-load-languages '(restclient . t))))) + (defun restclient/init-restclient () (use-package restclient :defer t @@ -35,8 +45,23 @@ (unless restclient-use-org (add-to-list 'auto-mode-alist '("\\.http\\'" . restclient-mode))) (spacemacs/set-leader-keys-for-major-mode 'restclient-mode + "n" 'restclient-jump-next + "p" 'restclient-jump-prev "s" 'restclient-http-send-current-stay-in-window "S" 'restclient-http-send-current - "r" 'restclient-http-send-current-raw-stay-in-window + "r" 'spacemacs/restclient-http-send-current-raw-stay-in-window "R" 'restclient-http-send-current-raw "y" 'restclient-copy-curl-command)))) + +(defun restclient/post-init-company () + (spacemacs|add-company-hook restclient-mode)) + +(defun restclient/init-company-restclient () + (use-package company-restclient + :defer t + :init (push 'company-restclient company-backends-restclient-mode))) + +(defun restclient/init-restclient-helm () + (use-package restclient-helm + :init (spacemacs/set-leader-keys-for-major-mode 'restclient-mode + "ji" 'helm-restclient))) diff --git a/layers/+tools/salt/packages.el b/layers/+tools/salt/packages.el index 8ff849e..274708c 100644 --- a/layers/+tools/salt/packages.el +++ b/layers/+tools/salt/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Salt Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Ben Hayden ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/shell/config.el b/layers/+tools/shell/config.el index 2180aa8..4662870 100644 --- a/layers/+tools/shell/config.el +++ b/layers/+tools/shell/config.el @@ -1,6 +1,6 @@ ;;; config.el --- shell configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/shell/funcs.el b/layers/+tools/shell/funcs.el index c56e147..ffc1a6c 100644 --- a/layers/+tools/shell/funcs.el +++ b/layers/+tools/shell/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- Shell Layer functions File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/shell/packages.el b/layers/+tools/shell/packages.el index 825f846..740dcfd 100644 --- a/layers/+tools/shell/packages.el +++ b/layers/+tools/shell/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- shell packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/speed-reading/packages.el b/layers/+tools/speed-reading/packages.el index 1fe646b..93560e0 100644 --- a/layers/+tools/speed-reading/packages.el +++ b/layers/+tools/speed-reading/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- speed-reading Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -39,5 +39,5 @@ (define-key spray-mode-map (kbd "q") 'spray-quit)))) (defun speed-reading/post-init-which-key () - (push '("\\`speed-reading/\\(.+\\)\\'" . "\\1") - which-key-description-replacement-alist)) + (push '((nil . "\\`speed-reading/\\(.+\\)\\'") . (nil . "\\1")) + which-key-replacement-alist)) diff --git a/layers/+tools/systemd/packages.el b/layers/+tools/systemd/packages.el index e6e8784..9bd7b19 100644 --- a/layers/+tools/systemd/packages.el +++ b/layers/+tools/systemd/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- systemd layer packages file for Spacemacs. ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Fabien Dubosson ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/terraform/packages.el b/layers/+tools/terraform/packages.el index 1ed8567..dc10865 100644 --- a/layers/+tools/terraform/packages.el +++ b/layers/+tools/terraform/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- terraform Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/tmux/packages.el b/layers/+tools/tmux/packages.el index cc2f7f3..9368064 100644 --- a/layers/+tools/tmux/packages.el +++ b/layers/+tools/tmux/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- tmux Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/vagrant/packages.el b/layers/+tools/vagrant/packages.el index 3be9784..277d114 100644 --- a/layers/+tools/vagrant/packages.el +++ b/layers/+tools/vagrant/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Vagrant Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/ycmd/README.org b/layers/+tools/ycmd/README.org index 95d37d9..25e14d3 100644 --- a/layers/+tools/ycmd/README.org +++ b/layers/+tools/ycmd/README.org @@ -13,7 +13,8 @@ * Description -This layer adds [[https://github.com/abingham/emacs-ycmd][emacs-ycmd]] support. +This layer adds [[https://github.com/abingham/emacs-ycmd][emacs-ycmd]] support, including its integrations with company, +flycheck, and eldoc. * Install ** Layer diff --git a/layers/+tools/ycmd/global_conf.py b/layers/+tools/ycmd/global_conf.py index d348949..0fc6007 100644 --- a/layers/+tools/ycmd/global_conf.py +++ b/layers/+tools/ycmd/global_conf.py @@ -1,6 +1,6 @@ # global_conf.py --- ycmd global configuration file for Spacemacs # -# Copyright (c) 2012-2016 Sylvain Benner & Contributors +# Copyright (c) 2012-2017 Sylvain Benner & Contributors # # Author: Thomas de Beauchene # URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+tools/ycmd/packages.el b/layers/+tools/ycmd/packages.el index 560414c..cb95c06 100644 --- a/layers/+tools/ycmd/packages.el +++ b/layers/+tools/ycmd/packages.el @@ -1,7 +1,19 @@ +;;; packages.el --- Ycmd Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors +;; +;; Author: Brian Hicks +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + (setq ycmd-packages '( (company-ycmd :toggle (configuration-layer/package-usedp 'company)) (flycheck-ycmd :toggle (configuration-layer/package-usedp 'flycheck)) + eldoc ycmd )) @@ -19,6 +31,9 @@ :defer t :init (add-hook 'ycmd-mode-hook 'flycheck-ycmd-setup))) +(defun ycmd/post-init-eldoc () + (add-hook 'ycmd-mode-hook 'ycmd-eldoc-setup)) + (defun ycmd/init-ycmd () (use-package ycmd :defer t diff --git a/layers/+vim/evil-cleverparens/packages.el b/layers/+vim/evil-cleverparens/packages.el index fec9f2d..ca8f4bd 100644 --- a/layers/+vim/evil-cleverparens/packages.el +++ b/layers/+vim/evil-cleverparens/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- evil-cleverparens Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -15,10 +15,10 @@ (defun evil-cleverparens/init-evil-cleverparens () (use-package evil-cleverparens :defer t - :diminish evil-cleverparens-mode :init (progn (setq evil-cleverparens-use-regular-insert t) (spacemacs|add-toggle evil-cleverparens :mode evil-cleverparens-mode - :documentation "Enable evil-cleverparens.")))) + :documentation "Enable evil-cleverparens.")) + :config (spacemacs|hide-lighter evil-cleverparens-mode))) diff --git a/layers/+vim/evil-commentary/packages.el b/layers/+vim/evil-commentary/packages.el index ededb1a..11ad304 100644 --- a/layers/+vim/evil-commentary/packages.el +++ b/layers/+vim/evil-commentary/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- evil-commentary Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -16,8 +16,8 @@ (defun evil-commentary/init-evil-commentary () (use-package evil-commentary - :diminish evil-commentary-mode :init (progn (evil-commentary-mode) - (spacemacs/set-leader-keys ";" 'evil-commentary)))) + (spacemacs/set-leader-keys ";" 'evil-commentary)) + :config (spacemacs|hide-lighter evil-commentary-mode))) diff --git a/layers/+vim/evil-snipe/config.el b/layers/+vim/evil-snipe/config.el index 837744c..109e85e 100644 --- a/layers/+vim/evil-snipe/config.el +++ b/layers/+vim/evil-snipe/config.el @@ -1,6 +1,6 @@ ;;; config.el --- evil-snipe Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+vim/evil-snipe/packages.el b/layers/+vim/evil-snipe/packages.el index 9926840..bc6d158 100644 --- a/layers/+vim/evil-snipe/packages.el +++ b/layers/+vim/evil-snipe/packages.el @@ -7,7 +7,6 @@ (defun evil-snipe/init-evil-snipe () (use-package evil-snipe - :diminish evil-snipe-local-mode :init (setq evil-snipe-scope 'whole-buffer evil-snipe-enable-highlight t @@ -17,6 +16,7 @@ evil-snipe-smart-case t) :config (progn + (spacemacs|hide-lighter evil-snipe-local-mode) (if evil-snipe-enable-alternate-f-and-t-behaviors (progn (setq evil-snipe-repeat-scope 'whole-buffer) diff --git a/layers/+vim/vim-empty-lines/packages.el b/layers/+vim/vim-empty-lines/packages.el index 252dc6f..9ba94dc 100644 --- a/layers/+vim/vim-empty-lines/packages.el +++ b/layers/+vim/vim-empty-lines/packages.el @@ -6,7 +6,6 @@ (defun vim-empty-lines/init-vim-empty-lines-mode () (use-package vim-empty-lines-mode - :diminish vim-empty-lines-mode :init (spacemacs/add-to-hooks (lambda () (vim-empty-lines-mode -1)) '(comint-mode-hook @@ -16,6 +15,7 @@ term-mode-hook)) :config (progn + (spacemacs|hide-lighter vim-empty-lines-mode) (global-vim-empty-lines-mode) (spacemacs|add-toggle vim-empty-lines-mode :mode global-vim-empty-lines-mode diff --git a/layers/+vim/vim-powerline/local/vim-powerline/vim-colors.el b/layers/+vim/vim-powerline/local/vim-powerline/vim-colors.el index dd25693..814b32b 100644 --- a/layers/+vim/vim-powerline/local/vim-powerline/vim-colors.el +++ b/layers/+vim/vim-powerline/local/vim-powerline/vim-colors.el @@ -1,4 +1,4 @@ -;; The colors in this file are from the original vim-powerline +;; The colors in this file are from the original vim-powerline ;; repository at https://github.com/Lokaltog/vim-powerline/blob/develop/autoload/Powerline/Colorschemes/default.vim (defun powerline--expand-alist (alist) @@ -29,31 +29,31 @@ (setf powerline-vim-colors-alist (let ((black "#000000") ; 16 (white "#FFFFFF") ; 231 - + (darkestgreen "#005F00") ; 22 (darkgreen "#008700") ; 28 (mediumgreen "#5faf00") ; 70 (brightgreen "#afd700") ; 148 - + (darkestcyan "#005f5f") ; 23 (mediumcyan "#87d7ff") ; 117 - + (darkestblue "#005f87") ; 24 (darkblue "#0087af") ; 31 - + (darkestred "#5f0000") ; 52 (darkred "#870000") ; 88 (mediumred "#af0000") ; 124 (brightred "#d70000") ; 160 (brightestred "#ff0000") ; 196 - + (darkestpurple "#5f00af") ; 55 (mediumpurple "#875fd7") ; 98 (brightpurple "#d7d7ff") ; 189 - + (brightorange "#ff8700") ; 208 (brightestorange "#ffaf00") ; 214 - + (gray0 "#121212") ; 233 (gray1 "#262626") ; 235 (gray2 "#303030") ; 236 @@ -71,7 +71,7 @@ (normal ,white ,gray2) (inactive ,white ,gray0) (insert ,white ,darkestblue)) - + (("state_indicator") (normal ,darkestgreen ,brightgreen t) ;;(inactive ,gray6 ,gray2 t) @@ -83,93 +83,93 @@ (emacs ,darkestcyan ,white t) (iedit ,darkred ,brightestred t) (lisp ,brightpurple ,mediumpurple t)) - + (("branch" "scrollpercent" "raw" "filesize") (normal ,gray9 ,gray4) (inactive ,gray4 ,gray1) (insert ,mediumcyan ,darkblue)) - + (("fileinfo" "filename") (normal ,white ,gray4 t) (inactive ,gray7 ,gray1 t) (insert ,white ,darkblue t)) - + (("fileinfo.filepath") (normal ,gray10) (inactive ,gray5) (insert ,mediumcyan)) - + (("static_str") (normal ,white ,gray4) (inactive ,gray7 ,gray1) (insert ,white ,darkblue)) - + (("fileinfo.flags") (normal ,brightestred nil t) (inactive ,darkred) (insert ,brightestred nil t)) - + (("currenttag" "fullcurrenttag" "fileformat" "fileencoding" "pwd" "filetype" "rvm.string" "rvm.statusline" "virtualenv.statusline" "charcode" "currhigroup") (normal ,gray8 ,gray2) (inactive ,gray3 ,gray0) (insert ,mediumcyan ,darkestblue)) - + (("lineinfo") (normal ,gray2 ,gray10 t) (inactive ,gray7 ,gray1 t) (insert ,darkestcyan ,mediumcyan t)) - + (("errors") (normal ,brightestorange ,gray2 t) (insert ,brightestorange ,darkestblue t)) - + (("lineinfo.line.tot") (normal ,gray6) (inactive ,gray5) (insert ,darkestcyan)) - + (("paste_indicator" "ws_marker") (normal ,white ,brightred t)) - + (("gundo.static_str.name" "command_t.static_str.name") (normal ,white ,mediumred t) (inactive ,brightred ,darkestred t)) - + (("gundo.static_str.buffer" "command_t.raw.line") (normal ,white ,darkred) (inactive ,brightred ,darkestred)) - + (("gundo.SPLIT" "command_t.SPLIT") (normal ,white ,darkred) (inactive ,white ,darkestred)) - + (("lustyexplorer.static_str.name" "minibufexplorer.static_str.name" "nerdtree.raw.name" "tagbar.static_str.name") (normal ,white ,mediumgreen t) (inactive ,mediumgreen ,darkestgreen t)) - + (("lustyexplorer.static_str.buffer" "tagbar.static_str.buffer") (normal ,brightgreen ,darkgreen) (inactive ,mediumgreen ,darkestgreen)) - + (("lustyexplorer.SPLIT" "minibufexplorer.SPLIT" "nerdtree.SPLIT" "tagbar.SPLIT") (normal ,white ,darkgreen) (inactive ,white ,darkestgreen)) - + (("ctrlp.focus" "ctrlp.byfname") (normal ,brightpurple ,darkestpurple)) (("ctrlp.prev" "ctrlp.next" "ctrlp.pwd") (normal ,white ,mediumpurple)) - + (("ctrlp.item") (normal ,darkestpurple ,white t)) - + (("ctrlp.marked") (normal ,brightestred ,darkestpurple t)) diff --git a/layers/+vim/vim-powerline/local/vim-powerline/vim-powerline-theme.el b/layers/+vim/vim-powerline/local/vim-powerline/vim-powerline-theme.el index 57f5baa..cf6c5bb 100644 --- a/layers/+vim/vim-powerline/local/vim-powerline/vim-powerline-theme.el +++ b/layers/+vim/vim-powerline/local/vim-powerline/vim-powerline-theme.el @@ -39,7 +39,7 @@ ;; desired feature. Defaults to "powerline-FEATURE-normal" (defun pl/get-vim-face (face) "Find whether or not FACE is a valid face, -and if not, try to get the corresponding +and if not, try to get the corresponding '-normal' face " (let* ((face (replace-regexp-in-string "iedit-insert" "iedit" face)) (split-face-name nil) (concat-face-name nil) ; some variables we'll use later on @@ -47,14 +47,14 @@ and if not, try to get the corresponding (lambda () (let ((prefix (subseq (or split-face-name (split-string face "-")) 0 2))) (error "There's no vim face with the prefix: %s" (mapconcat 'identity prefix "-")))))) - + (cond ((facep face) ; If our face is a FACE (even if it's not a powerline face) (intern face)) ; just intern the string and send it back ;; Otherwise. - ;; Are we a list of only three items? - ;; Is the first item a string that is 'powerline'? - ;; Is the last element not 'normal'? (If it was valid, it would have already passed) + ;; Are we a list of only three items? + ;; Is the first item a string that is 'powerline'? + ;; Is the last element not 'normal'? (If it was valid, it would have already passed) ((and (setf split-face-name (split-string face "-")) (string-equal (cl-first split-face-name) "powerline") (not (string-equal (cl-third split-face-name) "normal"))) @@ -84,7 +84,7 @@ and if not, try to get the corresponding (require 'vim-colors) (defun powerline-vimish-theme () "Setup the default mode-line." - ;; Populate our faces + ;; Populate our faces (mapcar 'eval (powerline--generate-facedefs powerline-vim-colors-alist)) (set-face-attribute 'mode-line-inactive nil :background (face-background (pl/vim-face "SPLIT" "inactive")) :underline nil @@ -125,11 +125,11 @@ and if not, try to get the corresponding (scrollpercent-face (pl/vim-face "scrollpercent" editor-state)) (lineinfo-face (pl/vim-face "lineinfo" editor-state)) - + (input (split-string (symbol-name buffer-file-coding-system) "-")) (platform (check-in-list input '("mac" "unix" "dos"))) (encoding (mapconcat 'identity (delete platform input) "-")) - + ;; Left hand side (lhs (list (powerline-raw (format " %s " (upcase editor-state)) state-indicator-face) diff --git a/layers/+vim/vinegar/config.el b/layers/+vim/vinegar/config.el index 0e87cd7..b5cf476 100644 --- a/layers/+vim/vinegar/config.el +++ b/layers/+vim/vinegar/config.el @@ -1,6 +1,6 @@ ;;; config.el --- Vinegar Layer Configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+vim/vinegar/funcs.el b/layers/+vim/vinegar/funcs.el index 7d72d40..a7a8b14 100644 --- a/layers/+vim/vinegar/funcs.el +++ b/layers/+vim/vinegar/funcs.el @@ -95,7 +95,7 @@ (dired-omit-mode t) ;; allow selection with mouse - (make-local-variable 'mouse-1-click-follows-link) + (make-local-variable 'mouse-1-click-follows-link) (setq mouse-1-click-follows-link nil) (local-set-key (kbd "") 'vinegar/dired-mouse-click) diff --git a/layers/+vim/vinegar/packages.el b/layers/+vim/vinegar/packages.el index 2916d6d..beeba72 100644 --- a/layers/+vim/vinegar/packages.el +++ b/layers/+vim/vinegar/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- vinegar Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/elfeed/config.el b/layers/+web-services/elfeed/config.el index 6c12f3d..3b798b1 100644 --- a/layers/+web-services/elfeed/config.el +++ b/layers/+web-services/elfeed/config.el @@ -1,6 +1,6 @@ ;;; config.el --- elfeed Layer configuration File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/elfeed/packages.el b/layers/+web-services/elfeed/packages.el index 5e31d5c..4eb72ac 100644 --- a/layers/+web-services/elfeed/packages.el +++ b/layers/+web-services/elfeed/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- elfeed Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/evernote/packages.el b/layers/+web-services/evernote/packages.el index 84e8f60..e5defe8 100644 --- a/layers/+web-services/evernote/packages.el +++ b/layers/+web-services/evernote/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- Evernote Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/search-engine/funcs.el b/layers/+web-services/search-engine/funcs.el index 6830bb4..3faf603 100644 --- a/layers/+web-services/search-engine/funcs.el +++ b/layers/+web-services/search-engine/funcs.el @@ -1,6 +1,6 @@ ;;; funcs.el --- search-engine Layer functions File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/search-engine/packages.el b/layers/+web-services/search-engine/packages.el index f6c622e..86caf5d 100644 --- a/layers/+web-services/search-engine/packages.el +++ b/layers/+web-services/search-engine/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- search-engine Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/spotify/packages.el b/layers/+web-services/spotify/packages.el index a85be8f..f7c2d13 100644 --- a/layers/+web-services/spotify/packages.el +++ b/layers/+web-services/spotify/packages.el @@ -1,6 +1,6 @@ ;;; packages.el --- spotify Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Brian Hicks ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/+web-services/twitter/packages.el b/layers/+web-services/twitter/packages.el index 928a033..81c10bc 100644 --- a/layers/+web-services/twitter/packages.el +++ b/layers/+web-services/twitter/packages.el @@ -1,7 +1,7 @@ ;;; packages.el --- twitter Layer packages File for Spacemacs ;; -;; Copyright (c) 2012-2014 Sylvain Benner -;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/layers/auto-layer.el b/layers/auto-layer.el index ab60d67..078dab7 100644 --- a/layers/auto-layer.el +++ b/layers/auto-layer.el @@ -1,6 +1,6 @@ ;;; auto-layer.el --- auto-mode-alist entries for layer installation ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -87,7 +87,7 @@ (configuration-layer/lazy-install 'python :extensions '("\\(\\.pyx\\'\\|\\.pxd\\'\\|\\.pxi\\'\\)" cython-mode)) (configuration-layer/lazy-install 'python :extensions '("\\(\\.hy\\'\\)" hy-mode)) (configuration-layer/lazy-install 'python :extensions '("\\(\\.pip\\'\\|requirements\\(?:.\\|\n\\)*\\.txt\\'\\)" pip-requirements-mode)) -(configuration-layer/lazy-install 'python :extensions '("\\(\\.py\\'\\)" python-mode)) +(configuration-layer/lazy-install 'python :extensions '("\\(\\.py\\'\\)" python-mode) :interpreter '("python[0-9.]*" python-mode)) (configuration-layer/lazy-install 'racket :extensions '("\\(\\.rkt[dl]?\\'\\)" racket-mode)) diff --git a/spacemacs.mk b/spacemacs.mk index a9b5993..23352bd 100644 --- a/spacemacs.mk +++ b/spacemacs.mk @@ -1,6 +1,6 @@ ## Makefile --- Spacemacs master makefile ## -## Copyright (c) 2012-2016 Sylvain Benner & Contributors +## Copyright (c) 2012-2017 Sylvain Benner & Contributors ## ## Author: Sylvain Benner ## URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/core/Makefile b/tests/core/Makefile index b3d0dff..02de907 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -1,6 +1,6 @@ ## Makefile --- Spacemacs Core ## -## Copyright (c) 2012-2016 Sylvain Benner & Contributors +## Copyright (c) 2012-2017 Sylvain Benner & Contributors ## ## Author: Sylvain Benner ## URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/core/core-configuration-layer-ftest.el b/tests/core/core-configuration-layer-ftest.el index 1f34585..a576fee 100644 --- a/tests/core/core-configuration-layer-ftest.el +++ b/tests/core/core-configuration-layer-ftest.el @@ -1,6 +1,6 @@ ;;; core-configuration-layer-ftest.el --- Spacemacs Functional Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -34,3 +34,7 @@ (configuration-layer/discover-layers) (configuration-layer//declare-used-layers dotspacemacs-configuration-layers) (should (eq 'spacemacs-base (second configuration-layer--used-layers))))) + +;; --------------------------------------------------------------------------- +;; Lazy installation of layers +;; --------------------------------------------------------------------------- diff --git a/tests/core/core-configuration-layer-utest.el b/tests/core/core-configuration-layer-utest.el index 2f451c8..b87c0e8 100644 --- a/tests/core/core-configuration-layer-utest.el +++ b/tests/core/core-configuration-layer-utest.el @@ -1,6 +1,6 @@ ;;; core-configuration-layer-utest.el --- Spacemacs Unit Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -28,10 +28,13 @@ ;; method: cfgl-layer-owned-packages -(ert-deftest test-cfgl-layer-owned-packages--owns-packages () +(ert-deftest test-cfgl-layer-owned-packages--owns-packages-without-props () (let ((layer1 (cfgl-layer "layer1" :name 'layer1 - :packages '(pkg1 pkg2 pkg3 pkg4))) + :packages '(pkg1 + (pkg2 :location foo) + (pkg3 :toggle (eq 1 2)) + (pkg4 :toggle (eq 1 1))))) configuration-layer--used-packages (configuration-layer--indexed-packages (make-hash-table :size 2048))) (helper--set-packages @@ -39,13 +42,35 @@ (cfgl-package "pkg2" :name 'pkg2 :owners '(layer1)) (cfgl-package "pkg3" :name 'pkg3 :owners '(layer1)) (cfgl-package "pkg4" :name 'pkg4 :owners '(layer2))) t) - (should (equal (list (cfgl-package "pkg2" :name 'pkg2 :owners '(layer1)) - (cfgl-package "pkg3" :name 'pkg3 :owners '(layer1))) + (should (equal '(pkg2 pkg3) (cfgl-layer-owned-packages layer1))))) +(ert-deftest test-cfgl-layer-owned-packages--owns-packages-with-props () + (let ((layer1 (cfgl-layer "layer1" + :name 'layer1 + :packages '(pkg1 + (pkg2 :location foo) + (pkg3 :toggle (eq 1 2)) + (pkg4 :toggle (eq 1 1)) + pkg5))) + configuration-layer--used-packages + (configuration-layer--indexed-packages (make-hash-table :size 2048))) + (helper--set-packages + (list (cfgl-package "pkg1" :name 'pkg1 :owners '(layer1)) + (cfgl-package "pkg2" :name 'pkg2 :owners '(layer1)) + (cfgl-package "pkg3" :name 'pkg3 :owners '(layer1)) + (cfgl-package "pkg4" :name 'pkg4 :owners '(layer2)) + (cfgl-package "pkg5" :name 'pkg5 :owners '(layer2))) t) + (should (equal '(pkg1 (pkg2 :location foo) + (pkg3 :toggle (eq 1 2))) + (cfgl-layer-owned-packages layer1 'with-props))))) + (ert-deftest test-cfgl-layer-owned-packages--nil-layer-returns-nil () (should (null (cfgl-layer-owned-packages nil)))) +(ert-deftest test-cfgl-layer-owned-packages--nil-layer-returns-nil-with-props () + (should (null (cfgl-layer-owned-packages nil 'with-props)))) + ;; method: cfgl-layer-get-packages (ert-deftest test-cfgl-layer-get-packages--all-packages-selected-default () @@ -54,9 +79,18 @@ :packages '((pkg1 :location local) pkg2 (pkg3 :location built-in))))) - (should (equal '((pkg1 :location local) pkg2 (pkg3 :location built-in)) + (should (equal '(pkg1 pkg2 pkg3) (cfgl-layer-get-packages layer))))) +(ert-deftest test-cfgl-layer-get-packages--all-packages-selected-default-with-props () + (let ((layer (cfgl-layer "layer" + :name 'layer + :packages '((pkg1 :location local) + pkg2 + (pkg3 :location built-in))))) + (should (equal '((pkg1 :location local) pkg2 (pkg3 :location built-in)) + (cfgl-layer-get-packages layer 'with-props))))) + (ert-deftest test-cfgl-layer-get-packages--all-packages-selected-explicitly () (let ((layer (cfgl-layer "layer" :name 'layer @@ -64,9 +98,19 @@ pkg2 (pkg3 :location built-in)) :selected-packages 'all))) - (should (equal '((pkg1 :location local) pkg2 (pkg3 :location built-in)) + (should (equal '(pkg1 pkg2 pkg3) (cfgl-layer-get-packages layer))))) +(ert-deftest test-cfgl-layer-get-packages--all-packages-selected-explicitly-with-props () + (let ((layer (cfgl-layer "layer" + :name 'layer + :packages '((pkg1 :location local) + pkg2 + (pkg3 :location built-in)) + :selected-packages 'all))) + (should (equal '((pkg1 :location local) pkg2 (pkg3 :location built-in)) + (cfgl-layer-get-packages layer 'with-props))))) + (ert-deftest test-cfgl-layer-get-packages--selected-packages () (let ((layer (cfgl-layer "layer" :name 'layer @@ -74,9 +118,19 @@ pkg2 (pkg3 :location built-in)) :selected-packages '(pkg1 pkg2)))) - (should (equal '((pkg1 :location local) pkg2) + (should (equal '(pkg1 pkg2) (cfgl-layer-get-packages layer))))) +(ert-deftest test-cfgl-layer-get-packages--selected-packages-with-props () + (let ((layer (cfgl-layer "layer" + :name 'layer + :packages '((pkg1 :location local) + pkg2 + (pkg3 :location built-in)) + :selected-packages '(pkg1 pkg2)))) + (should (equal '((pkg1 :location local) pkg2) + (cfgl-layer-get-packages layer 'with-props))))) + (ert-deftest test-cfgl-layer-get-packages--selected-packages-ignore-unknown () (let ((layer (cfgl-layer "layer" :name 'layer @@ -84,9 +138,19 @@ pkg2 (pkg3 :location built-in)) :selected-packages '(pkg1 pkg2 pkg-unknown)))) - (should (equal '((pkg1 :location local) pkg2) + (should (equal '(pkg1 pkg2) (cfgl-layer-get-packages layer))))) +(ert-deftest test-cfgl-layer-get-packages--selected-packages-ignore-unknown-with-props () + (let ((layer (cfgl-layer "layer" + :name 'layer + :packages '((pkg1 :location local) + pkg2 + (pkg3 :location built-in)) + :selected-packages '(pkg1 pkg2 pkg-unknown)))) + (should (equal '((pkg1 :location local) pkg2) + (cfgl-layer-get-packages layer 'with-props))))) + (ert-deftest test-cfgl-layer-get-packages--nil-packages-return-nil () (let ((layer (cfgl-layer "layer" :name 'layer @@ -153,6 +217,62 @@ (helper--set-layers `(,(cfgl-layer "layer2" :name 'layer2)) t) (should (eq 'layer2 (cfgl-package-get-safe-owner pkg))))) +;; --------------------------------------------------------------------------- +;; configuration-layer//package-archive-absolute-pathp +;; --------------------------------------------------------------------------- + +(ert-deftest test-package-archive-absolute-pathp--http-absolute-path () + (let ((input '("melpa" . "http://melpa.org/packages/"))) + (should (configuration-layer//package-archive-absolute-pathp input)))) + +(ert-deftest test-package-archive-absolute-pathp--https-absolute-path () + (let ((input '("melpa" . "https://melpa.org/packages/"))) + (should (configuration-layer//package-archive-absolute-pathp input)))) + +(ert-deftest test-package-archive-absolute-pathp--user-home-tilde-absolute-path () + (let ((input '("spacelpa" . "~/.elpa/spacelpa"))) + (should (configuration-layer//package-archive-absolute-pathp input)))) + +(ert-deftest test-package-archive-absolute-pathp--user-home-slash-absolute-path () + (let ((input '("spacelpa" . "/home/rms/.elpa/spacelpa"))) + (should (configuration-layer//package-archive-absolute-pathp input)))) + +(ert-deftest test-package-archive-absolute-pathp--relative-path-local () + (let ((input '("melpa" . "../.elpa/spacelpa"))) + (should (not (configuration-layer//package-archive-absolute-pathp input))))) + +(ert-deftest test-package-archive-absolute-pathp--not-absolute-path-remote () + (let ((input '("melpa" . "melpa.org/spacelpa"))) + (should (not (configuration-layer//package-archive-absolute-pathp input))))) + +;; --------------------------------------------------------------------------- +;; configuration-layer//package-archive-local-pathp +;; --------------------------------------------------------------------------- + +(ert-deftest test-package-archive-local-pathp--http-not-local-path () + (let ((input '("melpa" . "http://melpa.org/packages/"))) + (should (not (configuration-layer//package-archive-local-pathp input))))) + +(ert-deftest test-package-archive-local-pathp--https-not-local-path () + (let ((input '("melpa" . "https://melpa.org/packages/"))) + (should (not (configuration-layer//package-archive-local-pathp input))))) + +(ert-deftest test-package-archive-local-pathp--user-home-tilde-local-path () + (let ((input '("spacelpa" . "~/.elpa/spacelpa"))) + (should (configuration-layer//package-archive-local-pathp input)))) + +(ert-deftest test-package-archive-local-pathp--user-home-slash-local-path () + (let ((input '("spacelpa" . "/home/rms/.elpa/spacelpa"))) + (should (configuration-layer//package-archive-local-pathp input)))) + +(ert-deftest test-package-archive-local-pathp--relative-local-path-local () + (let ((input '("melpa" . "../.elpa/spacelpa"))) + (should (configuration-layer//package-archive-local-pathp input)))) + +(ert-deftest test-package-archive-local-pathp--default-not-local-path-remote () + (let ((input '("melpa" . "melpa.org/spacelpa"))) + (should (not (configuration-layer//package-archive-local-pathp input))))) + ;; --------------------------------------------------------------------------- ;; configuration-layer//resolve-package-archives ;; --------------------------------------------------------------------------- @@ -1291,7 +1411,8 @@ (let* (configuration-layer--used-layers (configuration-layer--indexed-layers (make-hash-table :size 1024)) configuration-layer--used-packages - (configuration-layer--indexed-packages (make-hash-table :size 2048))) + (configuration-layer--indexed-packages (make-hash-table :size 2048)) + (mocker-mock-default-record-cls 'mocker-stub-record)) (helper--set-layers `(,(cfgl-layer "layerall1" :name 'layerall1 @@ -1322,18 +1443,24 @@ (defun layerall4/init-pkg8 nil) (defun layerall5/init-pkg5 nil) (defun layerall5/init-pkg9 nil) - (configuration-layer/make-all-packages) - (should (null configuration-layer--used-packages)) - (should (equal '(pkg1 - pkg6 - pkg2 - pkg3 - pkg8 - pkg7 - pkg4 - pkg9 - pkg5) - (ht-keys configuration-layer--indexed-packages))))) + (mocker-let + ;; skip layer declaration since we manually set + ;; the variable `configuration-layer--indexed-layers' + ;; Moreover `configuration-layer/declare-layers' requires a valid + ;; path on disk etc... + ((configuration-layer/declare-layers (layers-specs) ((:output nil)))) + (configuration-layer/make-all-packages 'no-discovery) + (should (null configuration-layer--used-packages)) + (should (equal '(pkg1 + pkg6 + pkg2 + pkg3 + pkg8 + pkg7 + pkg4 + pkg9 + pkg5) + (ht-keys configuration-layer--indexed-packages)))))) ;; --------------------------------------------------------------------------- ;; configuration-layer//configure-package @@ -2192,3 +2319,123 @@ (cadr (assq 'recipe stats)) (cadr (assq 'local stats)) (cadr (assq 'built-in stats))))))) + +;; --------------------------------------------------------------------------- +;; configuration-layer//package-install-org +;; --------------------------------------------------------------------------- + +(defun --test-package-install-org--symbol-name (pkg-name) + (mocker-let + ((package-installed-p (org-plus-contrib) + ((:record-cls 'mocker-stub-record + :output nil :occur 1))) + (identity (x) ((:input '(org-plus-contrib) :output nil :occur 1)))) + (configuration-layer//package-install-org 'identity pkg-name))) + +(defun --package-install-org--symbol-name-already-installed (pkg-name) + (mocker-let + ((package-installed-p (org-plus-contrib) + ((:record-cls 'mocker-stub-record + :output t :occur 1)))) + (configuration-layer//package-install-org 'identity pkg-name))) + +(defun --test-package-install-org--package-desc-name (pkg-desc) + (mocker-let + ((package-installed-p (org-plus-contrib) + ((:record-cls 'mocker-stub-record + :output nil :occur 1))) + (identity (x) ((:input `(,pkg-desc) :output nil :occur 1)))) + (configuration-layer//package-install-org 'identity pkg-desc))) + +(defun --package-install-org--package-desc-name-already-installed (pkg-desc) + (mocker-let + ((package-installed-p (org-plus-contrib) + ((:record-cls 'mocker-stub-record + :output t :occur 1)))) + (configuration-layer//package-install-org 'identity pkg-desc))) + +(defun --test-package-install-org--package-desc-reqs (pkg-desc) + (mocker-let + ((package-installed-p (x) ((:record-cls 'mocker-stub-record + :output nil :occur 1)))) + (configuration-layer//package-install-org 'identity pkg-desc))) + +(ert-deftest test-package-install-org--symbol-name-org () + (--test-package-install-org--symbol-name 'org)) + +(ert-deftest test-package-install-org--symbol-name-org-plus-contrib () + (--test-package-install-org--symbol-name 'org-plus-contrib)) + +(ert-deftest test-package-install-org--symbol-name-org-already-installed () + (should (null (--package-install-org--symbol-name-already-installed 'org)))) + +(ert-deftest + test-package-install-org--symbol-name-org-plus-contrib-already-installed () + (should (null (--package-install-org--symbol-name-already-installed + 'org-plus-contrib)))) + +(ert-deftest test-package-install-org--no-effect-on-symbol-name-other-packages () + (let ((pkg (configuration-layer//package-install-org 'identity 'foo))) + (should (eq 'foo pkg )))) + +(ert-deftest test-package-install-org--package-desc-name-org () + (let ((pkg (package-desc-create :name 'org + :version '(7) + :summary "Dummy Org package desc" + :reqs nil))) + (--test-package-install-org--package-desc-name pkg))) + +(ert-deftest test-package-install-org--package-desc-name-org-already-installed () + (let ((pkg (package-desc-create :name 'org + :version '(7) + :summary "Dummy Org package desc" + :reqs nil))) + (--package-install-org--package-desc-name-already-installed pkg))) + +(ert-deftest test-package-install-org--package-desc-name-org-plus-contrib () + (let ((pkg (package-desc-create :name 'org-plus-contrib + :version '(7) + :summary "Dummy org-plus-contrib package desc" + :reqs nil))) + (--test-package-install-org--package-desc-name pkg))) + +(ert-deftest + test-package-install-org--package-desc-name-org-plus-contrib-already-installed () + (let ((pkg (package-desc-create :name 'org-plus-contrib + :version '(7) + :summary "Dummy org-plus-contrib package desc" + :reqs nil))) + (--package-install-org--package-desc-name-already-installed pkg))) + +(ert-deftest test-package-install-org--package-desc-reqs-org () + (let ((pkg (package-desc-create :name 'dummy + :version '(7) + :summary "Dummy package desc" + :reqs '((org 7))))) + (mocker-let + ((package-installed-p (x) ((:record-cls 'mocker-stub-record + :output nil :occur 1)))) + (let ((patched-pkg (configuration-layer//package-install-org + 'identity pkg))) + (should (equal + (package-desc-create :name 'dummy + :version '(7) + :summary "Dummy package desc" + :reqs '((org-plus-contrib 7))) + patched-pkg)))))) + +(ert-deftest test-package-install-org--package-desc-reqs-org-contrib-plus () + (let ((pkg (package-desc-create :name 'dummy + :version '(7) + :summary "Dummy package desc" + :reqs '((org-plus-contrib 7))))) + (let ((patched-pkg (configuration-layer//package-install-org 'identity pkg))) + (should (equal pkg patched-pkg))))) + +(ert-deftest test-package-install-org--no-effect-on-package-desc-other-packages () + (let ((pkg (package-desc-create :name 'dummy + :version '(7) + :summary "Dummy package desc" + :reqs '((foo 7))))) + (let ((patched-pkg (configuration-layer//package-install-org 'identity pkg))) + (should (equal pkg patched-pkg))))) diff --git a/tests/core/core-funcs-utest.el b/tests/core/core-funcs-utest.el index 117f3e8..eebe071 100644 --- a/tests/core/core-funcs-utest.el +++ b/tests/core/core-funcs-utest.el @@ -1,6 +1,6 @@ ;;; core-funcs-utest.el --- Spacemacs Unit Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/core/core-release-management-ftest.el b/tests/core/core-release-management-ftest.el index a484861..41f0228 100644 --- a/tests/core/core-release-management-ftest.el +++ b/tests/core/core-release-management-ftest.el @@ -1,6 +1,6 @@ ;;; core-release-management-ftest.el --- Spacemacs Functional Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Alberto Zaccagni ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/core/core-spacemacs-buffer-ftest.el b/tests/core/core-spacemacs-buffer-ftest.el index bfcdc68..5c0ec7c 100644 --- a/tests/core/core-spacemacs-buffer-ftest.el +++ b/tests/core/core-spacemacs-buffer-ftest.el @@ -1,6 +1,6 @@ ;;; core-spacemacs-buffer-ftest.el --- Spacemacs Unit Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs @@ -9,113 +9,117 @@ ;; (require 'core-spacemacs-buffer) -(setq-default fill-column 80) +(setq-default fill-column 80 + spacemacs-buffer--window-width 75) ;; --------------------------------------------------------------------------- -;; spacemacs//render-framed-text +;; spacemacs-buffer//notes-render-framed-text ;; --------------------------------------------------------------------------- (defvar test-text "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") (ert-deftest test-render-framed-text--msg-width-caption-and-padding () - (should (equal (spacemacs//render-framed-text test-text 32 "Caption" 4) - "╭─Caption──────────────────────╮ + (should (equal (spacemacs-buffer//notes-render-framed-text test-text "Caption" "Botcaption" 4 32 32) + "╭─ Caption ────────────────────╮ │ │ -│ Lorem ipsum dolor sit │ -│ amet, consectetur │ -│ adipiscing elit, sed │ -│ do eiusmod tempor │ -│ incididunt ut labore │ -│ et dolore magna │ +│ Lorem ipsum dolor sit │ +│ amet, consectetur │ +│ adipiscing elit, sed │ +│ do eiusmod tempor │ +│ incididunt ut labore │ +│ et dolore magna │ │ aliqua. │ │ │ -╰──────────────────────────────╯" +╰─ Botcaption ─────────────────╯ +" ))) (ert-deftest test-render-framed-text--msg-width-caption-no-padding () - (should (equal (spacemacs//render-framed-text test-text 32 "Caption") - "╭─Caption──────────────────────╮ + (should (equal (spacemacs-buffer//notes-render-framed-text test-text "Caption" "Botcaption" nil 32 32) + "╭─ Caption ────────────────────╮ │ │ -│ Lorem ipsum dolor sit amet, │ +│ Lorem ipsum dolor sit amet, │ │ consectetur adipiscing elit, │ -│ sed do eiusmod tempor │ -│ incididunt ut labore et │ +│ sed do eiusmod tempor │ +│ incididunt ut labore et │ │ dolore magna aliqua. │ │ │ -╰──────────────────────────────╯" +╰─ Botcaption ─────────────────╯ +" ))) (ert-deftest test-render-framed-text--msg-width-no-caption-no-padding () - (should (equal (spacemacs//render-framed-text test-text 32) + (should (equal (spacemacs-buffer//notes-render-framed-text test-text nil nil nil 32 32) "╭──────────────────────────────╮ │ │ -│ Lorem ipsum dolor sit amet, │ +│ Lorem ipsum dolor sit amet, │ │ consectetur adipiscing elit, │ -│ sed do eiusmod tempor │ -│ incididunt ut labore et │ +│ sed do eiusmod tempor │ +│ incididunt ut labore et │ │ dolore magna aliqua. │ │ │ ╰──────────────────────────────╯" ))) (ert-deftest test-render-framed-text--msg-no-width-no-caption-no-padding () - (should (equal (spacemacs//render-framed-text test-text) - "╭──────────────────────────────────────────────────────────────────────────────────╮ -│ │ -│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor │ -│ incididunt ut labore et dolore magna aliqua. │ -│ │ -╰──────────────────────────────────────────────────────────────────────────────────╯" + (should (equal (spacemacs-buffer//notes-render-framed-text test-text) + "╭─────────────────────────────────────────────────────────────────────────╮ +│ │ +│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │ +│ tempor incididunt ut labore et dolore magna aliqua. │ +│ │ +╰─────────────────────────────────────────────────────────────────────────╯" ))) (ert-deftest test-render-framed-text--msg-short-text () - (should (equal (spacemacs//render-framed-text "Short content.") - "╭──────────────────────────────────────────────────────────────────────────────────╮ -│ │ -│ Short content. │ -│ │ -╰──────────────────────────────────────────────────────────────────────────────────╯" + (should (equal (spacemacs-buffer//notes-render-framed-text "Short content.") + "╭────────────────╮ +│ │ +│ Short content. │ +│ │ +╰────────────────╯" ))) (ert-deftest test-render-framed-text--msg-several-paragraphs () - (should (equal (spacemacs//render-framed-text + (should (equal (spacemacs-buffer//notes-render-framed-text (concat "\n" test-text "\n\n\n" test-text "\n\n" - test-text "\n")) - "╭──────────────────────────────────────────────────────────────────────────────────╮ -│ │ -│ │ -│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor │ -│ incididunt ut labore et dolore magna aliqua. │ -│ │ -│ │ -│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor │ -│ incididunt ut labore et dolore magna aliqua. │ -│ │ -│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor │ -│ incididunt ut labore et dolore magna aliqua. │ -│ │ -│ │ -╰──────────────────────────────────────────────────────────────────────────────────╯" + test-text "\n")) + "╭─────────────────────────────────────────────────────────────────────────╮ +│ │ +│ │ +│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │ +│ tempor incididunt ut labore et dolore magna aliqua. │ +│ │ +│ │ +│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │ +│ tempor incididunt ut labore et dolore magna aliqua. │ +│ │ +│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │ +│ tempor incididunt ut labore et dolore magna aliqua. │ +│ │ +│ │ +╰─────────────────────────────────────────────────────────────────────────╯" ))) (ert-deftest test-render-framed-text--file-caption-and-padding () - (should (equal (spacemacs//render-framed-text + (should (equal (spacemacs-buffer//notes-render-framed-text (concat spacemacs-test-directory "core/data/framed-text.txt") - 62 "Caption" 4) - "╭─Caption────────────────────────────────────────────────────╮ + "Caption" "Botcaption" 4 62 62) + "╭─ Caption ──────────────────────────────────────────────────╮ │ │ -│ Lorem ipsum dolor sit amet, consectetur adipiscing │ -│ elit, sed do eiusmod tempor incididunt ut labore et │ -│ dolore magna aliqua. Ut enim ad minim veniam, quis │ +│ Lorem ipsum dolor sit amet, consectetur adipiscing │ +│ elit, sed do eiusmod tempor incididunt ut labore et │ +│ dolore magna aliqua. Ut enim ad minim veniam, quis │ │ nostrud exercitation ullamco laboris nisi ut aliquip │ -│ ex ea commodo consequat. Duis aute irure dolor in │ -│ reprehenderit in voluptate velit esse cillum dolore │ -│ eu fugiat nulla pariatur. Excepteur sint occaecat │ -│ cupidatat non proident, sunt in culpa qui officia │ +│ ex ea commodo consequat. Duis aute irure dolor in │ +│ reprehenderit in voluptate velit esse cillum dolore │ +│ eu fugiat nulla pariatur. Excepteur sint occaecat │ +│ cupidatat non proident, sunt in culpa qui officia │ │ deserunt mollit anim id est laborum. │ │ │ -╰────────────────────────────────────────────────────────────╯" +╰─ Botcaption ───────────────────────────────────────────────╯ +" ))) diff --git a/tests/core/core-spacemacs-ftest.el b/tests/core/core-spacemacs-ftest.el index 2678609..2acf8e4 100644 --- a/tests/core/core-spacemacs-ftest.el +++ b/tests/core/core-spacemacs-ftest.el @@ -1,6 +1,6 @@ ;;; core-spacemacs-ftest.el --- Spacemacs Functional Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Alberto Zaccagni ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/layers/+distribution/spacemacs-base/Makefile b/tests/layers/+distribution/spacemacs-base/Makefile index 78606df..cf8a2fe 100644 --- a/tests/layers/+distribution/spacemacs-base/Makefile +++ b/tests/layers/+distribution/spacemacs-base/Makefile @@ -1,6 +1,6 @@ ## Makefile --- Spacemacs Core ## -## Copyright (c) 2012-2016 Sylvain Benner & Contributors +## Copyright (c) 2012-2017 Sylvain Benner & Contributors ## ## Author: Sylvain Benner ## URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/layers/+distribution/spacemacs-base/evil-evilified-state-ftest.el b/tests/layers/+distribution/spacemacs-base/evil-evilified-state-ftest.el index 0e36833..7d4fdcf 100644 --- a/tests/layers/+distribution/spacemacs-base/evil-evilified-state-ftest.el +++ b/tests/layers/+distribution/spacemacs-base/evil-evilified-state-ftest.el @@ -1,6 +1,6 @@ ;;; core-evilified-state-ftest.el --- Spacemacs Functional Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/layers/+distribution/spacemacs-base/evil-evilified-state-utest.el b/tests/layers/+distribution/spacemacs-base/evil-evilified-state-utest.el index 0281c8a..71a5166 100644 --- a/tests/layers/+distribution/spacemacs-base/evil-evilified-state-utest.el +++ b/tests/layers/+distribution/spacemacs-base/evil-evilified-state-utest.el @@ -1,6 +1,6 @@ ;;; evil-evilified-state-utest.el --- Spacemacs Unit Test File ;; -;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; Copyright (c) 2012-2017 Sylvain Benner & Contributors ;; ;; Author: Sylvain Benner ;; URL: https://github.com/syl20bnr/spacemacs diff --git a/tests/layers/+distribution/spacemacs/Makefile b/tests/layers/+distribution/spacemacs/Makefile index 6caf657..b2ea565 100644 --- a/tests/layers/+distribution/spacemacs/Makefile +++ b/tests/layers/+distribution/spacemacs/Makefile @@ -1,6 +1,6 @@ ## Makefile --- Spacemacs Core ## -## Copyright (c) 2012-2016 Sylvain Benner & Contributors +## Copyright (c) 2012-2017 Sylvain Benner & Contributors ## ## Author: Sylvain Benner ## URL: https://github.com/syl20bnr/spacemacs