diff --git a/README.md b/README.md index 4dbb7272b29c..22c51c4248b7 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ - [Install](#install) - [Update](#update) - [Update notification](#update-notification) + - [Rollback](#rollback) - [Configuration](#configuration) - [Configuration layers](#configuration-layers) - [Dotfile (.spacemacs)](#dotfile-spacemacs) @@ -178,13 +179,8 @@ See the [troubleshooting][troubleshoot] guide if you have any issues. Spacemacs currently requires manual updates using the following procedure: -1. Update Emacs packages. - 1. Open the package list using ` a P` or `M-x paradox-list-packages` - 2. Mark all packages for updating by pressing `U`, and - 3. install them with `x`. - - [See the documentation][using_package_buf] for more information about how to use - the package list. +1. Update Emacs packages by clicking (press `RET`) on the `[Update]` link of +the starting page 2. Close Emacs and update the git repository: @@ -209,6 +205,18 @@ version of `Spacemacs` is available. **Note:** Update of `Spacemacs` by clicking on the indicator will be implemented _soon_. +## Rollback + +You can rollback ELPA packages to a previous version if anything went wrong +during an update. + +To rollback to a previous state click (press `RET`) on the `[Rollback]` +link of the startup page and choose a rollback slot. + +Rollback slot names are dates with the following format `YYYY-MM-DD_HH.MM.SS`. +The date corresponds to the date of an update. The most recent slots are +listed first. + # Configuration `Spacemacs` divides its configuration into self-contained units called diff --git a/contrib/colors/README.md b/contrib/colors/README.md index 7d05b6cc6a04..42a6d59ac432 100644 --- a/contrib/colors/README.md +++ b/contrib/colors/README.md @@ -9,6 +9,7 @@ - [Description](#description) - [Install](#install) - [Enable rainbow-identifiers](#enable-rainbow-identifiers) + - [Enable Nyan cat](#enable-nyan-cat) - [Key bindings](#key-bindings) - [Rainbow Identifiers](#rainbow-identifiers) - [Rainbow Mode](#rainbow-mode) @@ -20,6 +21,7 @@ This layer colors your life with: - [rainbow identifiers][] - [rainbow mode][] +- [nyan mode][] [rainbow identifiers][] mode will colorize each variables and functions with an almost unique color. The keywords and the declaration of function colors are @@ -28,6 +30,8 @@ disabled in order to make the colorized variables and functions stand out. [rainbow mode][] displays strings representing colors with the color they represent as background. +[nyan mode][] display a Nyan cat progress bar in the mode-line. + ## Install To use this contribution add it to your `~/.spacemacs` @@ -45,8 +49,30 @@ To enable the package `rainbow-identifiers` set the variable ```elisp (setq-default dotspacemacs-configuration-layers '( - (colors :variables - colors-enable-rainbow-identifiers t)) + (colors :variables colors-enable-rainbow-identifiers t)) + "List of contribution to load." +) +``` + +### Enable Nyan cat + +To enable the package `nyan-mode` set the variable +`colors-enable-nyan-cat-progress-bar` to `t`: + +```elisp +(setq-default dotspacemacs-configuration-layers '( + (colors :variables colors-enable-nyan-cat-progress-bar t)) + "List of contribution to load." +) +``` + +It may be handy to enable it only in a GUI, you can do it by using +a quasi-quoted list: + +```elisp +(setq-default dotspacemacs-configuration-layers + `((colors :variables + colors-enable-nyan-cat-progress-bar ,(display-graphic-p))) "List of contribution to load." ) ``` @@ -85,6 +111,12 @@ Any other key | leave the change mini-mode t C c +### Nyan Mode + +`nyan-mode` mode can be toggled on and off with: + + t m n + Note that the toggle is local to the current buffer. [rainbow identifiers]: https://github.com/Fanael/rainbow-identifiers diff --git a/contrib/colors/config.el b/contrib/colors/config.el index 57e5e30fe574..9e729da510ae 100644 --- a/contrib/colors/config.el +++ b/contrib/colors/config.el @@ -17,7 +17,10 @@ ;; Variables (defvar colors-enable-rainbow-identifiers nil - "If non nil the `rainbow-identifers' package is enabled.") + "if non nil the `rainbow-identifers' package is enabled.") + +(defvar colors-enable-nyan-cat-progress-bar nil + "if non nil all nyan cat packges are enabled (for now only `nyan-mode').") ;; Command prefixes diff --git a/contrib/colors/extensions.el b/contrib/colors/extensions.el new file mode 100644 index 000000000000..c0c8bf532286 --- /dev/null +++ b/contrib/colors/extensions.el @@ -0,0 +1,38 @@ +(defvar colors-post-extensions '(nyan-mode)) + +(defun colors/init-nyan-mode () + (use-package nyan-mode + :if colors-enable-nyan-cat-progress-bar + :init + (progn + (setq nyan-wavy-trail t) + (setq nyan-animate-nyancat t) + (nyan-mode) + + (spacemacs|add-toggle nyan-cat-progress-bar + :status nyan-mode + :on (nyan-mode) + :off (nyan-mode -1) + :documentation "Show a nyan cat progress bar in the mode-line." + :evil-leader "tmn") + + (defun spacemacs/powerline-nyan-cat () + "Construct a powerline segment for nyan cat." + (let* ((active (powerline-selected-window-active)) + (l (1+ (truncate (powerline-width lhs)))) + (r (1+ (truncate (powerline-width rhs)))) + (face1 (if active 'powerline-active1 'powerline-inactive1)) + (face2 (if active 'powerline-active2 'powerline-inactive2)) + (separator-left + (intern (format "powerline-%s-%s" + powerline-default-separator + (car powerline-default-separator-dir)))) + (separator-right + (intern (format "powerline-%s-%s" + powerline-default-separator + (cdr powerline-default-separator-dir))))) + (setq nyan-bar-length (min 32 (/ (- (window-total-width) l r) 2))) + (list + (funcall separator-right face2 face1) + (powerline-raw (nyan-create) face1) + (funcall separator-left face1 face2))))))) diff --git a/contrib/colors/extensions/nyan-mode/README.org b/contrib/colors/extensions/nyan-mode/README.org new file mode 100644 index 000000000000..52a8d17994ef --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/README.org @@ -0,0 +1,63 @@ +* Nyan Mode - Turn your Emacs into Nyanmacs! :) + +** Fork modifications +- the starting nyan cat image has no rainbow behind it, +- the starting rainbow image has zigzags, +- the animation loop is not endless and occurs only when nyan cat moves. + +** Introduction + + *WARNING, MIND DUMBING CONTENT INSIDE.* + +"Nyan-mode. It's things like this that make me proud to be an emacs user." - [[http://twitter.com/#!/mitchellh/status/104931263479156736][mitchellh]] + +Nyanmacs is expanding!! [[http://temporal.pr0.pl/devblog/2011/08/25/introducing-nyan-mode-el-turn-your-emacs-into-nyanmacs/][Read the story so far]]! :). + +[[file:screenshot.png]] + +Nyan Mode is an analog indicator of your position in the buffer. The +Cat should go from left to right in your mode-line, as you move your +point from 0% to 100%. + +** Features + - Mind dumbing content included, + - Experimental animation (M-x nyan-start-animation, M-x nyan-stop-animation), + - Wavy rainbow (M-x set-variable nyan-wavy-trail t), + - Music, mplayer is needed (M-x nyan-start-music, M-x nyan-stop-music), + - Customizable properties. + +** Using Nyan Mode with custom modeline +For those who were asking, or are planning to, [[http://friendfeed.com/amitp/b4097da0/nyan-mode-turn-your-emacs-into-nyanmacs][Amit Patel shared]] +some tips on how to make nyan-mode work with custom modeline. + +He basically changed the mode-line-format to include: +#+begin_src emacs-lisp + (:eval (list (nyan-create))) +#+end_src + +** Known issues +It's my second attempt to write a minor mode in Emacs, so there will +definiely be some bugs. + +This version uses XPM images, which should be supported by default by +most Emacs 23 installations, Windows included. In case it doesn't +work, try switching to master-png branch. This branch, however, may +have it's own issues: + +There was a problem with displaying PNG images, which require libpng +to be available for Emacs. The lib is sometimes missing (e.g. some +Windows installation). To make it work on Windows, one needs to +download a proper DLL and put it into emacs bin/ folder. To see which +DLL is needed, do: M-x describe-variable image-library-alist +. + +Customizing nyan-animate-nyancat is broken; don't do it. + +** Credits + +Code and idea inspired by sml-modeline.el, written by Lennart Borgman. +See: http://bazaar.launchpad.net/~nxhtml/nxhtml/main/annotate/head%3A/util/sml-modeline.el + +For animated Nyan Cat, I used frames [[http://media.photobucket.com/image/nyan%20cat%20sprites/DryBowser455/th_NyanCatSprite.png?t=1304659408][by DryBowser455]]. + +Nyanyanyanyanyanyanya! diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-1.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-1.xpm new file mode 100644 index 000000000000..00196af4dc8d --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-1.xpm @@ -0,0 +1,170 @@ +/* XPM */ +static char *nyan_frame_1[] = { +/* columns rows colors chars-per-pixel */ +"25 15 149 2 ", +" c black", +". c #070B0F", +"X c #0C0C0C", +"o c #041C0C", +"O c #000810", +"+ c #070917", +"@ c #0F1011", +"# c #02191F", +"$ c #111111", +"% c #161616", +"& c #082903", +"* c #142700", +"= c #083919", +"- c #292B00", +"; c #3C3400", +": c #120B2D", +"> c #001020", +", c #3F1E31", +"< c #172635", +"1 c #222222", +"2 c gray15", +"3 c #2B2525", +"4 c #2A2A2A", +"5 c gray18", +"6 c #3E2525", +"7 c #2C2F32", +"8 c gray22", +"9 c #3A3C3E", +"0 c gray24", +"q c #490C00", +"w c #7C0B10", +"e c #4C2400", +"r c #4C3100", +"t c #483F00", +"y c #403326", +"u c #4B3C2D", +"i c #423B34", +"p c #3D4100", +"a c #615600", +"s c #09264A", +"d c #1D2877", +"f c #322E75", +"g c #522244", +"h c #434343", +"j c #464646", +"k c #4C4646", +"l c gray29", +"z c gray30", +"x c #514C51", +"c c gray34", +"v c #54575A", +"b c #5D5D5D", +"n c #745D46", +"m c #775E5E", +"M c #614C61", +"N c #6D4C6D", +"B c #625962", +"V c gray38", +"C c #646464", +"Z c #686868", +"A c #7B6C6C", +"S c gray45", +"D c #767676", +"F c #7B7B7B", +"G c gray50", +"H c #BF1119", +"J c #F52A02", +"K c #FC7800", +"L c #947256", +"P c #26B210", +"I c #438500", +"U c #2CCB13", +"Y c #20D15C", +"T c #889000", +"R c #C4AC00", +"E c #FBA500", +"W c #F0D300", +"Q c #BF9973", +"! c #202C81", +"~ c #263498", +"^ c #432AAB", +"/ c #5536D9", +"( c #1E7FF7", +") c #4D43E9", +"_ c #5247F7", +"` c #885788", +"' c #A261A2", +"] c #AA66AA", +"[ c #AE68AE", +"{ c #FF5FC5", +"} c #C576C5", +"| c #D17DD1", +" . c #FF66CC", +".. c #F069C9", +"X. c #FF68CE", +"o. c #E073CD", +"O. c #FF6BD1", +"+. c #FF72D8", +"@. c #FF77DD", +"#. c #FF7CE2", +"$. c #0A819C", +"%. c #0EA7CB", +"&. c #1E80F7", +"*. c #868686", +"=. c #888888", +"-. c gray56", +";. c gray59", +":. c gray60", +">. c #A68F8F", +",. c #A09999", +"<. c #A89999", +"1. c #B09999", +"2. c #B59999", +"3. c #A0A0A0", +"4. c gray65", +"5. c #D79999", +"6. c #F69999", +"7. c #FF9999", +"8. c #D8AD82", +"9. c #F0BB99", +"0. c #F0B6A2", +"q. c #FFBBBB", +"w. c #FFBCB9", +"e. c #F0C090", +"r. c #FFCC99", +"t. c #FFC7A2", +"y. c #FFC7A4", +"u. c #D882D8", +"i. c #FF95D5", +"p. c #FFB3CC", +"a. c #E086E0", +"s. c #FF80E6", +"d. c #FF85EB", +"f. c #FF86EC", +"g. c #FF8AF0", +"h. c #FF8DF3", +"j. c #FF8FF5", +"k. c #F794F7", +"l. c #FF90F6", +"z. c #FF9DF7", +"x. c #FF92F8", +"c. c #FF94FA", +"v. c #FF97FD", +"b. c #FF99FF", +"n. c #FFA6E6", +"m. c #FFA8E0", +"M. c #FFA8E2", +"N. c gray81", +"B. c None", +/* pixels */ +"g g g g g g , y y y y y y y y y y y y 7 B.B.B.B.B.", +"H H H H H w L r.w.p.p.p.p.p.p.p.p.p.y.8.8 B.B.B.B.", +"J J J J J q e.w.b.b.b.b.{ b. .x.b.b.m.r.n B.B.B.B.", +"K K K K K e 0.b. .x.b.b.b.b.u.} x.h.x.m.n B.B.B.B.", +"E E E E E r 0.b.b.b.b.b.b.| M z ] #.x.m.n B.l B.B.", +"R ; ; a W t 0.b.b.b.b. .x.' b ;.B [ b.m.n V :.l B.", +"T 8 -.1 p - 0.b.b.f.b.b.b.' b :.:.b 1 4 V :.:.l B.", +"I * 8 *.4 0.b.b.+.b.b...N F :.:.:.:.:.:.:.:.S B.", +"U P & 8 =.1 0.#.s.b.b.b.o.8 :.3.4.Z :.:.:.N.j :.4 ", +"Y Y Y = o 0.b.b.b.h.x.a.8 <.>.2 V :.D Z 8 k 2.3 ", +"%.%.%.%.$.# 9.m.@.x.f.f.a.8 5.6.*.F :.V :.b 2.7.6 ", +"&.&.&.&.&.s 9.y.i.b.b.b.k.` A 1.V % 1 X 4 X ,.m B.", +"_ _ _ ) f 1 i Q Q Q Q Q Q Q u V S S S S S S v B.B.", +"/ / / ^ l :.j : O l 4 > B.B.B.. l 1 B.% l % B.B.B.", +"~ ~ ~ d % 1 O ! > 1 < B.B.B.B.B.2 % B.B.1 B.B.B.B." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-2.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-2.xpm new file mode 100644 index 000000000000..f768df7e5c63 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-2.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static char *nyan_frame_2[] = { +/* columns rows colors chars-per-pixel */ +"25 15 136 2 ", +" c #00070E", +". c #07090A", +"X c #070B0F", +"o c #0C0C0C", +"O c #000A14", +"+ c #100D1C", +"@ c #0F1011", +"# c #111111", +"$ c gray9", +"% c #152900", +"& c #083417", +"* c #180F3E", +"= c #032D37", +"- c #202020", +"; c #252525", +": c #2B2525", +"> c #2A2A2A", +", c #3E2525", +"< c #3F3127", +"1 c #3C3229", +"2 c gray20", +"3 c gray22", +"4 c #3F3F3F", +"5 c #431C38", +"6 c #403326", +"7 c #4B3C2D", +"8 c #254900", +"9 c #227C13", +"0 c #626800", +"q c #6C720A", +"w c #6F7509", +"e c #764939", +"r c #1E2974", +"t c #322E75", +"y c #522244", +"u c #075568", +"i c #414141", +"p c #464646", +"a c #4C4646", +"s c gray29", +"d c gray30", +"f c #584E44", +"g c #514C51", +"h c gray34", +"j c #54575A", +"k c #5D5D5D", +"l c #775E5E", +"z c #5B5E61", +"x c #614C61", +"c c #6D4C6D", +"v c #625962", +"b c gray38", +"n c #646464", +"m c #686868", +"M c #7B6C6C", +"N c #6F706F", +"B c gray45", +"V c #767676", +"C c #7B7B7B", +"Z c gray49", +"A c #851601", +"S c #930D13", +"D c #BF1119", +"F c #F52A02", +"G c #894100", +"H c #885900", +"J c #827300", +"K c #FC7800", +"L c #14843A", +"P c #20D15C", +"I c #B2BD00", +"U c #FBA500", +"Y c #F0D300", +"T c #B28E6B", +"R c #B6926E", +"E c #BF9973", +"W c #212E87", +"Q c #263498", +"! c #432AAB", +"~ c #104586", +"^ c #5536D9", +"/ c #1E7FF7", +"( c #4D43E9", +") c #5247F7", +"_ c #885788", +"` c #AA5599", +"' c #A261A2", +"] c #AE68AE", +"[ c #C576C5", +"{ c #D17DD1", +"} c #FF68CE", +"| c #FF6DD3", +" . c #FF77DD", +".. c #FF79DF", +"X. c #FF7BE1", +"o. c #FF7DE3", +"O. c #0EA7CB", +"+. c #1E80F7", +"@. c gray59", +"#. c gray60", +"$. c #A68F8F", +"%. c #A09999", +"&. c #A89999", +"*. c #B09999", +"=. c #B59999", +"-. c #A0A0A0", +";. c gray65", +":. c #D79999", +">. c #F69999", +",. c #FF9999", +"<. c #F7C694", +"1. c #FFCA9E", +"2. c #FFC5A7", +"3. c #FFC1AF", +"4. c #D882D8", +"5. c #E083DD", +"6. c #FFA4C8", +"7. c #FFB3CC", +"8. c #FFAFD2", +"9. c #E086E0", +"0. c #FF80E6", +"q. c #FF83E9", +"w. c #F08AE9", +"e. c #FF8EEB", +"r. c #FF88EE", +"t. c #FF8AF0", +"y. c #FF8EF4", +"u. c #F794F7", +"i. c #FF90F6", +"p. c #FF94FA", +"a. c #FF97FD", +"s. c #FF9CF9", +"d. c #FF99FF", +"f. c #FFA0F0", +"g. c gray81", +"h. c None", +/* pixels */ +"y y y y y 5 < < < < 6 6 6 6 6 6 < < < h.h.h.h.h.h.", +"D D D D S e <.3.7.7.7.7.7.7.7.7.7.3.<.f h.h.h.h.h.", +"F F F F A T 2.f.s.d.d.} y.X.X.d.s.f.2.T h.h.h.h.h.", +"K K K K G T s...0.s.d.d.s.d.4.[ i.y.s.T h.h.h.h.h.", +"U U U U H T s.d.d.d.d.d.s.{ x g ` 0.s.T h.h.d h.h.", +"Y Y Y Y J T s.d.d.d.X.X.d.' k @.v ] s.T z #.d h.", +"w ; w I 0 T s.d.0.s.d.d.d.' k #.#.k ; ; b #.#.d h.", +"; #.> 8 % T s.d...d.d...w.c C #.#.#.#.#.#.#.#.B h.", +"9 k C B 4 T y.| d.d.d.0.9.3 #.-.;.m #.#.#.g.a #.; ", +"P L & N 4 T s.s.d.d.r.d.9.3 &.$.; m #.C m 3 a *.: ", +"O.O.O.u = T 8.0.0.y.X.d.9.3 :.>.Z Z #.b #.z *.,., ", +"+.+./ / ~ T 1.6.i.d.s.d.u._ M *.b $ ; o ; o %.l h.", +") ) ) ( t ; R E E E E E E E 7 b B B B B B B j h.h.", +"^ ^ ^ ! s #.+ * 2 i X h.h.h.h.X d ; h.# d @ h.h.h.", +"Q Q Q r @ ; r W h.- h.h.h.h.h.h.; # h.h.; . h.h.h." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-3.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-3.xpm new file mode 100644 index 000000000000..288cf89b445c --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-3.xpm @@ -0,0 +1,159 @@ +/* XPM */ +static char *nyan_frame_3[] = { +/* columns rows colors chars-per-pixel */ +"25 15 138 2 ", +" c black", +". c #00070F", +"X c #0E0E0E", +"o c #0B1700", +"O c #061B02", +"+ c #030C16", +"@ c #02191F", +"# c #151515", +"$ c #1B1B1B", +"% c gray11", +"& c #0B3204", +"* c #363900", +"= c #27221C", +"- c #0B0F2D", +"; c #001122", +": c #3F1E31", +"> c #03252E", +", c #1E262E", +"< c gray15", +"1 c #2A2A2A", +"2 c #2C2C2C", +"3 c #2C2F32", +"4 c gray22", +"5 c #3A3C3E", +"6 c #3C3C3C", +"7 c #490C00", +"8 c #7C0B10", +"9 c #4C2400", +"0 c #4C3100", +"q c #483F00", +"w c #403326", +"e c #145C08", +"r c #3C7501", +"t c #191041", +"y c #18154A", +"u c #052749", +"i c #002E5D", +"p c #212646", +"a c #373E44", +"s c #522244", +"d c #643C64", +"f c #285059", +"g c #414141", +"h c #484848", +"j c gray30", +"k c #5C4242", +"l c #554755", +"z c #544C54", +"x c #5E4D5E", +"c c #5A5A5A", +"v c #5D5D5D", +"b c #745D46", +"n c #634463", +"m c #614C61", +"M c gray38", +"N c #6F6161", +"B c #6D6D6D", +"V c gray45", +"C c #777777", +"Z c gray48", +"A c gray49", +"S c #BF1119", +"D c #F52A02", +"F c #FC7800", +"G c #947256", +"H c #847373", +"J c #4D9801", +"K c #2CCB13", +"L c #189E45", +"P c #B4BF00", +"I c #FBA500", +"U c #F0D300", +"Y c #BF9973", +"T c #263498", +"R c #165FB9", +"E c #5536D9", +"W c #196ED5", +"Q c #1A70D8", +"! c #1E7FF7", +"~ c #5247F7", +"^ c #A261A2", +"/ c #B26BB2", +"( c #C95BAC", +") c #FF5FC5", +"_ c #C979C9", +"` c #D17DD1", +"' c #FF66CC", +"] c #FF68CE", +"[ c #FF6BD1", +"{ c #FF72D8", +"} c #FF77DD", +"| c #0C92B2", +" . c gray51", +".. c #848484", +"X. c #8B8B8B", +"o. c #8D8D8D", +"O. c #9D8888", +"+. c gray57", +"@. c #979797", +"#. c gray60", +"$. c #A69999", +"%. c #AA9999", +"&. c #AF9999", +"*. c #B39999", +"=. c gray70", +"-. c #CE9999", +";. c #DD9999", +":. c #F09999", +">. c #FF9999", +",. c #D8AD82", +"<. c #F0BB99", +"1. c #F0B6A2", +"2. c #FFBBBB", +"3. c #FFBCB9", +"4. c #F0C090", +"5. c #FFCC99", +"6. c #FFC7A2", +"7. c #FFC7A4", +"8. c #D580D5", +"9. c #DC84DC", +"0. c #FF95D5", +"q. c #FFB3CC", +"w. c #E88BE8", +"e. c #FF80E6", +"r. c #FF85EB", +"t. c #FF86EC", +"y. c #FF8AF0", +"u. c #FF8DF3", +"i. c #FF8FF5", +"p. c #FF90F6", +"a. c #FF9DF7", +"s. c #FF92F8", +"d. c #FF94FA", +"f. c #FF97FD", +"g. c #FF99FF", +"h. c #FFA6E6", +"j. c #FFA8E0", +"k. c None", +/* pixels */ +"s s s s s s : w w w w w w w w w w w w 3 k.k.k.k.k.", +"S S S S S 8 G 5.3.q.q.q.q.q.q.q.q.q.7.,.4 k.k.k.k.", +"D D D D D 7 4.3.g.g.g.g.) g.' s.g.g.h.5.b k.k.k.k.", +"F F F F F 9 1.g.' s.g.g.g.g.g._ ` u.s.j.b k.k.k.k.", +"I I I I I 0 1.g.g.g.g.g.g.g./ z x ( s.j.b k.k.j k.", +"U U U U U q 1.g.g.g.g.' s.g.d .o.z 9.j.b + A #.< ", +"P P P P P * 1.g.g.t.g.g.g.g.d .#.#.4 < < .#.#.< ", +"J J J J r o 1.g.g.{ g.g.{ ` m X.#.#.#.#.#.#.#.#.M ", +"K K e & O 1.} e.g.g.g.e.^ v #.=.C .#.#.#.=.c @.", +"L # Z +.B , 1.g.g.g.s.s.g.^ v &.H < .#.c A < N *.", +"| f j 4 > @ <.j.} s.t.t.g.^ v :.;.B X. .C #.M -.>.", +"! Q R R W u <.7.0.g.g.g.g.w.n O.&.g % % # < 1 $.k ", +"~ ~ ~ ~ ~ y 4 Y Y Y Y Y Y Y Y = V V V V V V V a k.", +"E E E E E t Y , ; X j % k.k.k.k.; 1 j . k.4 4 k.k.", +"T T T T T - < p i k.< X k.k.k.k.k.k.1 k.k., % k.k." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-4.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-4.xpm new file mode 100644 index 000000000000..4c2676416ddd --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-4.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static char *nyan_frame_4[] = { +/* columns rows colors chars-per-pixel */ +"25 15 136 2 ", +" c #00070E", +". c #07090A", +"X c #070B0F", +"o c #0C0C0C", +"O c #000A14", +"+ c #100D1C", +"@ c #0F1011", +"# c #111111", +"$ c gray9", +"% c #152900", +"& c #0B3204", +"* c #180F3E", +"= c #032D37", +"- c #192633", +"; c #202020", +": c gray15", +"> c #2B2525", +", c #2A2A2A", +"< c #3E2525", +"1 c #3F3127", +"2 c #3C3229", +"3 c gray20", +"4 c gray22", +"5 c #3F3F3F", +"6 c #431C38", +"7 c #403326", +"8 c #4B3C2D", +"9 c #284E00", +"0 c #1B7F3D", +"q c #626800", +"w c #764939", +"e c #1E2974", +"r c #322E75", +"t c #522244", +"y c #065062", +"u c #414141", +"i c #464646", +"p c #4C4646", +"a c gray29", +"s c gray30", +"d c #584E44", +"f c #514C51", +"g c gray34", +"h c #54575A", +"j c #5D5D5D", +"k c #775E5E", +"l c #5B5E61", +"z c #614C61", +"x c #6D4C6D", +"c c #625962", +"v c gray38", +"b c #646464", +"n c #686868", +"m c #7B6C6C", +"M c #6F706F", +"N c gray45", +"B c #767676", +"V c #7B7B7B", +"C c gray49", +"Z c #851601", +"A c #930D13", +"S c #BF1119", +"D c #F52A02", +"F c #894100", +"G c #885900", +"H c #827300", +"J c #FC7800", +"K c #1B800C", +"L c #4D9801", +"P c #2CCB13", +"I c #B4BF00", +"U c #FBA500", +"Y c #F0D300", +"T c #B28E6B", +"R c #B6926E", +"E c #BF9973", +"W c #212E87", +"Q c #263498", +"! c #432AAB", +"~ c #104586", +"^ c #1A5091", +"/ c #1A5195", +"( c #5536D9", +") c #1D7EF5", +"_ c #4D43E9", +"` c #5247F7", +"' c #885788", +"] c #AA5599", +"[ c #A261A2", +"{ c #AE68AE", +"} c #C576C5", +"| c #D17DD1", +" . c #FF68CE", +".. c #FF6DD3", +"X. c #FF77DD", +"o. c #FF79DF", +"O. c #FF7BE1", +"+. c #FF7DE3", +"@. c gray59", +"#. c gray60", +"$. c #A68F8F", +"%. c #A09999", +"&. c #A89999", +"*. c #B09999", +"=. c #B59999", +"-. c #A0A0A0", +";. c gray65", +":. c #D79999", +">. c #F69999", +",. c #FF9999", +"<. c #F7C694", +"1. c #FFCA9E", +"2. c #FFC5A7", +"3. c #FFC1AF", +"4. c #D882D8", +"5. c #E083DD", +"6. c #FFA4C8", +"7. c #FFB3CC", +"8. c #FFAFD2", +"9. c #E086E0", +"0. c #FF80E6", +"q. c #FF83E9", +"w. c #F08AE9", +"e. c #FF8EEB", +"r. c #FF88EE", +"t. c #FF8AF0", +"y. c #FF8EF4", +"u. c #F794F7", +"i. c #FF90F6", +"p. c #FF94FA", +"a. c #FF97FD", +"s. c #FF9CF9", +"d. c #FF99FF", +"f. c #FFA0F0", +"g. c gray81", +"h. c None", +/* pixels */ +"t t t t t 6 1 7 7 7 7 7 7 7 7 7 1 1 1 h.h.h.h.h.h.", +"S S S S A w <.3.7.7.7.7.7.7.7.7.7.3.<.d h.h.h.h.h.", +"D D D D Z T 2.f.d.d.d. .i.+.+.d.s.f.2.T h.h.h.h.h.", +"J J J J F T s.o.+.s.d.d.d.s.| } i.y.s.T h.h.h.h.h.", +"U U U U G T s.d.d.d.d.d.d.| z f ] 0.s.T h.h.s h.h.", +"Y Y Y Y H T s.d.d.d.+.+.d.[ j @.c { s.T l #.a h.", +"I I I I q T s.d.r.d.d.d.d.[ j #.#.j : : v #.#.s h.", +"L L L 9 % T s.s.o.d.d.o.w.x V #.#.#.#.#.#.#.#.N h.", +"P K & M 5 T e...d.d.d.r.5.4 #.-.-.v #.#.#.g.p #.: ", +"0 l C N 5 T s.d.d.y.r.d.5.4 &.$.: j #.V v 5 p *.> ", +": #.: y = T 8.r.r.y.+.d.9.4 :.>.V @.#.v #.j *.,.< ", +"/ : ^ ) ~ T 1.6.y.d.d.d.u.' m *.v $ : o : o %.k h.", +"` ` ` _ r : R E E E E E E E 8 v N N N N N N h h.h.", +"( ( ( ! i #.+ * 3 u X h.h.h.h.X s : h.# s # h.h.h.", +"Q Q Q e @ : e W - ; h.h.h.h.h.h.: # h.h.: . h.h.h." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-5.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-5.xpm new file mode 100644 index 000000000000..3841bd7f6f07 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-5.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static char *nyan_frame_5[] = { +/* columns rows colors chars-per-pixel */ +"25 15 136 2 ", +" c black", +". c #020F06", +"X c #070B0F", +"o c #08090C", +"O c #0C0C0C", +"+ c #1D1F00", +"@ c #020912", +"# c #000A14", +"$ c #131313", +"% c #161616", +"& c #191919", +"* c #251E17", +"= c #083417", +"- c #292B00", +"; c #3F1E31", +": c #04323D", +"> c #232323", +", c #222126", +"< c gray14", +"1 c gray15", +"2 c #2B2525", +"3 c #20262C", +"4 c #2A2A2A", +"5 c #3E2525", +"6 c #2C2F32", +"7 c gray20", +"8 c gray22", +"9 c #3A3C3E", +"0 c #490C00", +"q c #7C0B10", +"w c #4C2400", +"e c #4C3100", +"r c #483F00", +"t c #403326", +"y c #4B3C2D", +"u c #236119", +"i c #6F7509", +"p c #241856", +"a c #1F265A", +"s c #522244", +"d c #414141", +"f c #464646", +"g c #4C4646", +"h c #494949", +"j c gray31", +"k c #514C51", +"l c gray34", +"z c #54575A", +"x c #5D5D5D", +"c c #5F5F5F", +"v c #745D46", +"b c #614C61", +"n c #6D4C6D", +"m c gray38", +"M c #646464", +"N c gray40", +"B c #686868", +"V c #7B6C6C", +"C c #727272", +"Z c gray45", +"A c #7B7B7B", +"S c gray50", +"D c #BF1119", +"F c #F52A02", +"G c #FC7800", +"H c #947256", +"J c #20980E", +"K c #1AAF4D", +"L c #20D15C", +"P c #868F00", +"I c #FBA500", +"U c #F0D300", +"Y c #BF9973", +"T c #23308F", +"R c #263498", +"E c #39329C", +"W c #1354A2", +"Q c #5536D9", +"! c #5247F7", +"~ c #885788", +"^ c #A261A2", +"/ c #AA66AA", +"( c #AE68AE", +") c #FF5FC5", +"_ c #C576C5", +"` c #D17DD1", +"' c #FF66CC", +"] c #F069C9", +"[ c #FF68CE", +"{ c #E073CD", +"} c #FF6BD1", +"| c #FF72D8", +" . c #FF77DD", +".. c #FF79DF", +"X. c #0EA7CB", +"o. c #1E80F7", +"O. c gray59", +"+. c gray60", +"@. c #A68F8F", +"#. c #A89999", +"$. c #B09999", +"%. c #B59999", +"&. c #A0A0A0", +"*. c gray65", +"=. c #D79999", +"-. c #F69999", +";. c #FF9999", +":. c #D8AD82", +">. c #F0BB99", +",. c #F0B6A2", +"<. c #FFBBBB", +"1. c #FFBCB9", +"2. c #F0C090", +"3. c #FFCC99", +"4. c #FFC7A2", +"5. c #D882D8", +"6. c #FF95D5", +"7. c #FFB3CC", +"8. c #E086E0", +"9. c #FF80E6", +"0. c #FF85EB", +"q. c #FF86EC", +"w. c #FF8AF0", +"e. c #FF8DF3", +"r. c #FF8FF5", +"t. c #F794F7", +"y. c #FF90F6", +"u. c #FF9DF7", +"i. c #FF92F8", +"p. c #FF94FA", +"a. c #FF97FD", +"s. c #FF99FF", +"d. c #FFA6E6", +"f. c #FFA8E0", +"g. c gray81", +"h. c None", +/* pixels */ +"s s s s s s ; t t t t t t t t t t t t 6 h.h.h.h.h.", +"D D D D D q H 3.1.7.7.7.7.7.7.7.7.7.4.:.9 h.h.h.h.", +"F F F F F 0 2.1.s.s.s.s.) s.' i.s.s.d.3.v h.h.h.h.", +"G G G G G w ,.s.' i.s.s.s.s.5._ u.e.p.f.v h.h.h.h.", +"I I I I I e ,.s.s.s.s.s.s.` b j / .i.f.v h.j h.h.", +"U U U U U r ,.s.s.s.s.' i.^ x O.x ( u.f.v x O.h h.", +"i 1 1 + P - ,.s.s.0.s.s.s.^ x +.+.l 2 2 m +.+.j h.", +"$ C +.j 4 ,.s.s.| s.s.] n A +.+.+.+.+.+.+.+.C h.", +"J u 1 1 h 1 ,. .9.s.s.s.{ 8 +.&.*.m +.+.+.g.d +.1 ", +"L L L K = . ,.s.s.s.e.i.8.8 #.@., x +.A N 9 g %.2 ", +"X.X.X.X.X.: >.f. .i.0.0.8.8 =.-.H O.+.m +.m %.;.5 ", +"o.o.o.o.W # 2.4.6.s.s.s.t.~ V $.m % 1 O 3 # +.V h.", +"! ! ! E 4 1 * Y Y Y Y Y Y Y y m C C C C C C z h.h.", +"Q Q Q 1 +.m p & j X h.h.h.h.# d 7 h.# j 1 h.h.h.h.", +"R R R o 1 a T a 1 h.h.h.h.h.h.3 & h.h.1 $ h.h.h.h." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-frame-6.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-frame-6.xpm new file mode 100644 index 000000000000..7a61f0502946 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-frame-6.xpm @@ -0,0 +1,165 @@ +/* XPM */ +static char *nyan_frame_6[] = { +/* columns rows colors chars-per-pixel */ +"25 15 144 2 ", +" c black", +". c #020F06", +"X c #070B0F", +"o c #08090C", +"O c #0C0C0C", +"+ c #020912", +"@ c #000A14", +"# c #111111", +"$ c #151515", +"% c #1D1711", +"& c #251E17", +"* c #083417", +"= c #212305", +"- c #292B00", +"; c #3C3400", +": c #3F1E31", +"> c #04323D", +", c #202020", +"< c #222126", +"1 c #252525", +"2 c #2A2A2A", +"3 c gray18", +"4 c #3E2525", +"5 c #2C2F32", +"6 c #342D34", +"7 c gray20", +"8 c gray22", +"9 c #3A3C3E", +"0 c #3F3F3F", +"q c #490C00", +"w c #7C0B10", +"e c #4C2400", +"r c #4C3100", +"t c #483F00", +"y c #403326", +"u c #402A38", +"i c #24451F", +"p c #394C25", +"a c #241856", +"s c #1F265A", +"d c #1E297A", +"f c #522244", +"g c #414141", +"h c #464646", +"j c gray29", +"k c gray31", +"l c #554755", +"z c #5E4D5E", +"x c #515151", +"c c #5C5650", +"v c #5A5A5A", +"b c #5D5D5D", +"n c #745D46", +"m c #634463", +"M c #6D4C6D", +"N c #656565", +"B c #6C6C6C", +"V c gray45", +"C c #767676", +"Z c #797979", +"A c #7C7C7C", +"S c #BF1119", +"D c #F52A02", +"F c #FC7800", +"G c #947256", +"H c #9A7B7B", +"J c #A57272", +"K c #26B210", +"L c #438500", +"P c #2CCB13", +"I c #1AAF4D", +"U c #20D15C", +"Y c #868F00", +"T c #988600", +"R c #889000", +"E c #FBA500", +"W c #EACE00", +"Q c #F0D300", +"! c #BF9973", +"~ c #263498", +"^ c #39329C", +"/ c #1354A2", +"( c #5536D9", +") c #1E7FF7", +"_ c #5247F7", +"` c #885788", +"' c #A261A2", +"] c #C95BAC", +"[ c #E060B9", +"{ c #FF5FC5", +"} c #FF66CC", +"| c #FF68CE", +" . c #E073CD", +".. c #FF6BD1", +"X. c #FF72D8", +"o. c #FF77DD", +"O. c #FF79DF", +"+. c #0EA7CB", +"@. c #1E80F7", +"#. c #848484", +"$. c #888888", +"%. c gray55", +"&. c #929292", +"*. c #979797", +"=. c gray60", +"-. c gray62", +";. c #A79999", +":. c #B59999", +">. c gray63", +",. c gray74", +"<. c #C79999", +"1. c #D79999", +"2. c #F69999", +"3. c #FF9999", +"4. c #D8AD82", +"5. c #F0BB99", +"6. c #F0B6A2", +"7. c #FFBBBB", +"8. c #FFBCB9", +"9. c #F0C090", +"0. c #FFCC99", +"q. c #FFC7A2", +"w. c #FFC7A4", +"e. c #D580D5", +"r. c #FF95D5", +"t. c #FFB3CC", +"y. c #E086E0", +"u. c #E88BE8", +"i. c #FF80E6", +"p. c #FF85EB", +"a. c #FF86EC", +"s. c #FF8DF3", +"d. c #FF8FF5", +"f. c #F090F0", +"g. c #F794F7", +"h. c #FF90F6", +"j. c #FF9DF7", +"k. c #FF92F8", +"l. c #FF94FA", +"z. c #FF97FD", +"x. c #FF99FF", +"c. c #FFA6E6", +"v. c #FFA8E2", +"b. c None", +/* pixels */ +"f f f f f f : y y y y y y y y y y y y 5 b.b.b.b.b.", +"S S S S S w G 0.8.t.t.t.t.t.t.t.t.t.q.4.9 b.b.b.b.", +"D D D D D q 9.8.x.x.x.x.{ x.} k.l.x.c.0.n b.b.b.b.", +"F F F F F e 6.x.} k.x.x.x.u.m 6 e.s.l.v.n b., b.b.", +"E E E E E r 6.x.x.x.x.x.x.' b &.z ] k.c.n 6 =.j b.", +"Q T ; W Q t 6.x.x.x.x.} k.' b =.$.l 6 6 c &.=.j b.", +"R j =.= R - 6.x.x.a.x.x.g.` B =.=.=.=.=.;.>.*.b b.", +"L p #.j x $ 6.x.x.X.x.x.[ 8 =.-.-.A =.=.=.,.N =.3 ", +"P K i 0 =.3 6.o.i.x.x.x. .8 =.&.3 v *.C N k 3 *., ", +"U U U I * . 6.x.x.x.k.k.y.8 1.2.%.$.*.A =.A :.3.4 ", +"+.+.+.+.+.> 5.v.o.k.a.a.f.M H <.N 3 j $ k $ ;.J b.", +") @.) ) / @ 9.q.r.x.x.x.x.u.m #.#.C C C C V C b.b.", +"_ _ _ ^ b j & ! ! ! ! ! ! ! ! % O $ @ b.b.b.", +"( ( ( , =.B a , k X b.b.b.b.@ g 6 b.@ N h b.b.b.b.", +"~ ~ ~ X , s d # , b.b.b.b.b.b., b.b.b., $ b.b.b.b." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan-start.xpm b/contrib/colors/extensions/nyan-mode/img/nyan-start.xpm new file mode 100644 index 000000000000..3da12e5de22a --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan-start.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static char *nyan[] = { +/* columns rows colors chars-per-pixel */ +"25 15 136 2 ", +" c black", +". c #020F06", +"X c #070B0F", +"o c #08090C", +"O c #0C0C0C", +"+ c #1D1F00", +"@ c #020912", +"# c #000A14", +"$ c #131313", +"% c #161616", +"& c #191919", +"* c #251E17", +"= c #083417", +"- c #292B00", +"; c #3F1E31", +": c #04323D", +"> c #232323", +", c #222126", +"< c gray14", +"1 c gray15", +"2 c #2B2525", +"3 c #20262C", +"4 c #2A2A2A", +"5 c #3E2525", +"6 c #2C2F32", +"7 c gray20", +"8 c gray22", +"9 c #3A3C3E", +"0 c #490C00", +"q c #7C0B10", +"w c #4C2400", +"e c #4C3100", +"r c #483F00", +"t c #403326", +"y c #4B3C2D", +"u c #236119", +"i c #6F7509", +"p c #241856", +"a c #1F265A", +"s c #522244", +"d c #414141", +"f c #464646", +"g c #4C4646", +"h c #494949", +"j c gray31", +"k c #514C51", +"l c gray34", +"z c #54575A", +"x c #5D5D5D", +"c c #5F5F5F", +"v c #745D46", +"b c #614C61", +"n c #6D4C6D", +"m c gray38", +"M c #646464", +"N c gray40", +"B c #686868", +"V c #7B6C6C", +"C c #727272", +"Z c gray45", +"A c #7B7B7B", +"S c gray50", +"D c #BF1119", +"F c #F52A02", +"G c #FC7800", +"H c #947256", +"J c #20980E", +"K c #1AAF4D", +"L c #20D15C", +"P c #868F00", +"I c #FBA500", +"U c #F0D300", +"Y c #BF9973", +"T c #23308F", +"R c #263498", +"E c #39329C", +"W c #1354A2", +"Q c #5536D9", +"! c #5247F7", +"~ c #885788", +"^ c #A261A2", +"/ c #AA66AA", +"( c #AE68AE", +") c #FF5FC5", +"_ c #C576C5", +"` c #D17DD1", +"' c #FF66CC", +"] c #F069C9", +"[ c #FF68CE", +"{ c #E073CD", +"} c #FF6BD1", +"| c #FF72D8", +" . c #FF77DD", +".. c #FF79DF", +"X. c #0EA7CB", +"o. c #1E80F7", +"O. c gray59", +"+. c gray60", +"@. c #A68F8F", +"#. c #A89999", +"$. c #B09999", +"%. c #B59999", +"&. c #A0A0A0", +"*. c gray65", +"=. c #D79999", +"-. c #F69999", +";. c #FF9999", +":. c #D8AD82", +">. c #F0BB99", +",. c #F0B6A2", +"<. c #FFBBBB", +"1. c #FFBCB9", +"2. c #F0C090", +"3. c #FFCC99", +"4. c #FFC7A2", +"5. c #D882D8", +"6. c #FF95D5", +"7. c #FFB3CC", +"8. c #E086E0", +"9. c #FF80E6", +"0. c #FF85EB", +"q. c #FF86EC", +"w. c #FF8AF0", +"e. c #FF8DF3", +"r. c #FF8FF5", +"t. c #F794F7", +"y. c #FF90F6", +"u. c #FF9DF7", +"i. c #FF92F8", +"p. c #FF94FA", +"a. c #FF97FD", +"s. c #FF99FF", +"d. c #FFA6E6", +"f. c #FFA8E0", +"g. c gray81", +"h. c None", +/* pixels */ +"h.h.h.h.h.h.; t t t t t t t t t t t t 6 h.h.h.h.h.", +"h.h.h.h.h.q H 3.1.7.7.7.7.7.7.7.7.7.4.:.9 h.h.h.h.", +"h.h.h.h.h.0 2.1.s.s.s.s.) s.' i.s.s.d.3.v h.h.h.h.", +"h.h.h.h.h.w ,.s.' i.s.s.s.s.5._ u.e.p.f.v h.h.h.h.", +"h.h.h.h.h.e ,.s.s.s.s.s.s.` b j / .i.f.v h.j h.h.", +"h.h.h.h.h.r ,.s.s.s.s.' i.^ x O.x / u.f.v x O.d h.", +"h.1 1 + h.- ,.s.s.0.s.s.s.^ x +.+.x 2 2 m +.+.j h.", +"$ C +.j 4 ,.s.s.| s.s.] n A +.+.+.+.+.+.+.+.C h.", +"h.u 1 1 h 1 ,. .9.s.s.s.{ 8 +.&.&.B +.+.+.g.g +.1 ", +"h.h.h.h.= . ,.s.s.s.e.i.8.8 #.@., m +.A N 9 g $.2 ", +"h.h.h.h.h.: >.f. .i.0.0.8.8 =.-.H O.+.m +.c $.;.5 ", +"h.h.h.h.W # 2.4.6.s.s.s.t.~ V $.m $ 1 O 3 # +.V h.", +"h.h.h.E 4 1 * Y Y Y Y Y Y Y y m C C C C C C z h.h.", +"h.h.h.1 +.m p & j X h.h.h.h.# d 7 h.h.j 1 h.h.h.h.", +"h.h.h.o 1 a T a 1 h.h.h.h.h.h.3 & h.h.1 $ h.h.h.h." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/nyan.xpm b/contrib/colors/extensions/nyan-mode/img/nyan.xpm new file mode 100644 index 000000000000..45123da7eea6 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/nyan.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static char *nyan[] = { +/* columns rows colors chars-per-pixel */ +"25 15 136 2 ", +" c black", +". c #020F06", +"X c #070B0F", +"o c #08090C", +"O c #0C0C0C", +"+ c #1D1F00", +"@ c #020912", +"# c #000A14", +"$ c #131313", +"% c #161616", +"& c #191919", +"* c #251E17", +"= c #083417", +"- c #292B00", +"; c #3F1E31", +": c #04323D", +"> c #232323", +", c #222126", +"< c gray14", +"1 c gray15", +"2 c #2B2525", +"3 c #20262C", +"4 c #2A2A2A", +"5 c #3E2525", +"6 c #2C2F32", +"7 c gray20", +"8 c gray22", +"9 c #3A3C3E", +"0 c #490C00", +"q c #7C0B10", +"w c #4C2400", +"e c #4C3100", +"r c #483F00", +"t c #403326", +"y c #4B3C2D", +"u c #236119", +"i c #6F7509", +"p c #241856", +"a c #1F265A", +"s c #522244", +"d c #414141", +"f c #464646", +"g c #4C4646", +"h c #494949", +"j c gray31", +"k c #514C51", +"l c gray34", +"z c #54575A", +"x c #5D5D5D", +"c c #5F5F5F", +"v c #745D46", +"b c #614C61", +"n c #6D4C6D", +"m c gray38", +"M c #646464", +"N c gray40", +"B c #686868", +"V c #7B6C6C", +"C c #727272", +"Z c gray45", +"A c #7B7B7B", +"S c gray50", +"D c #BF1119", +"F c #F52A02", +"G c #FC7800", +"H c #947256", +"J c #20980E", +"K c #1AAF4D", +"L c #20D15C", +"P c #868F00", +"I c #FBA500", +"U c #F0D300", +"Y c #BF9973", +"T c #23308F", +"R c #263498", +"E c #39329C", +"W c #1354A2", +"Q c #5536D9", +"! c #5247F7", +"~ c #885788", +"^ c #A261A2", +"/ c #AA66AA", +"( c #AE68AE", +") c #FF5FC5", +"_ c #C576C5", +"` c #D17DD1", +"' c #FF66CC", +"] c #F069C9", +"[ c #FF68CE", +"{ c #E073CD", +"} c #FF6BD1", +"| c #FF72D8", +" . c #FF77DD", +".. c #FF79DF", +"X. c #0EA7CB", +"o. c #1E80F7", +"O. c gray59", +"+. c gray60", +"@. c #A68F8F", +"#. c #A89999", +"$. c #B09999", +"%. c #B59999", +"&. c #A0A0A0", +"*. c gray65", +"=. c #D79999", +"-. c #F69999", +";. c #FF9999", +":. c #D8AD82", +">. c #F0BB99", +",. c #F0B6A2", +"<. c #FFBBBB", +"1. c #FFBCB9", +"2. c #F0C090", +"3. c #FFCC99", +"4. c #FFC7A2", +"5. c #D882D8", +"6. c #FF95D5", +"7. c #FFB3CC", +"8. c #E086E0", +"9. c #FF80E6", +"0. c #FF85EB", +"q. c #FF86EC", +"w. c #FF8AF0", +"e. c #FF8DF3", +"r. c #FF8FF5", +"t. c #F794F7", +"y. c #FF90F6", +"u. c #FF9DF7", +"i. c #FF92F8", +"p. c #FF94FA", +"a. c #FF97FD", +"s. c #FF99FF", +"d. c #FFA6E6", +"f. c #FFA8E0", +"g. c gray81", +"h. c None", +/* pixels */ +"s s s s s s ; t t t t t t t t t t t t 6 h.h.h.h.h.", +"D D D D D q H 3.1.7.7.7.7.7.7.7.7.7.4.:.9 h.h.h.h.", +"F F F F F 0 2.1.s.s.s.s.) s.' i.s.s.d.3.v h.h.h.h.", +"G G G G G w ,.s.' i.s.s.s.s.5._ u.e.p.f.v h.h.h.h.", +"I I I I I e ,.s.s.s.s.s.s.` b j / .i.f.v h.j h.h.", +"U U U U U r ,.s.s.s.s.' i.^ x O.x / u.f.v x O.d h.", +"i 1 1 + P - ,.s.s.0.s.s.s.^ x +.+.x 2 2 m +.+.j h.", +"$ C +.j 4 ,.s.s.| s.s.] n A +.+.+.+.+.+.+.+.C h.", +"J u 1 1 h 1 ,. .9.s.s.s.{ 8 +.&.&.B +.+.+.g.g +.1 ", +"L L L K = . ,.s.s.s.e.i.8.8 #.@., m +.A N 9 g $.2 ", +"X.X.X.X.X.: >.f. .i.0.0.8.8 =.-.H O.+.m +.c $.;.5 ", +"o.o.o.o.W # 2.4.6.s.s.s.t.~ V $.m $ 1 O 3 # +.V h.", +"! ! ! E 4 1 * Y Y Y Y Y Y Y y m C C C C C C z h.h.", +"Q Q Q 1 +.m p & j X h.h.h.h.# d 7 h.h.j 1 h.h.h.h.", +"R R R o 1 a T a 1 h.h.h.h.h.h.3 & h.h.1 $ h.h.h.h." +}; diff --git a/contrib/colors/extensions/nyan-mode/img/outerspace.xpm b/contrib/colors/extensions/nyan-mode/img/outerspace.xpm new file mode 100644 index 000000000000..a487c082cce5 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/outerspace.xpm @@ -0,0 +1,142 @@ +/* XPM */ +static char *outerspace[] = { +/* columns rows colors chars-per-pixel */ +"8 15 120 2 ", +" c None", +". c black", +"X c black", +"o c black", +"O c black", +"+ c black", +"@ c black", +"# c black", +"$ c black", +"% c black", +"& c black", +"* c black", +"= c black", +"- c black", +"; c black", +": c black", +"> c black", +", c black", +"< c black", +"1 c black", +"2 c black", +"3 c black", +"4 c black", +"5 c black", +"6 c black", +"7 c black", +"8 c black", +"9 c black", +"0 c black", +"q c black", +"w c black", +"e c black", +"r c black", +"t c black", +"y c black", +"u c black", +"i c black", +"p c black", +"a c black", +"s c black", +"d c black", +"f c black", +"g c black", +"h c black", +"j c black", +"k c black", +"l c black", +"z c black", +"x c black", +"c c black", +"v c black", +"b c black", +"n c black", +"m c black", +"M c black", +"N c black", +"B c black", +"V c black", +"C c black", +"Z c black", +"A c black", +"S c black", +"D c black", +"F c black", +"G c black", +"H c black", +"J c black", +"K c black", +"L c black", +"P c black", +"I c black", +"U c black", +"Y c black", +"T c black", +"R c black", +"E c black", +"W c black", +"Q c black", +"! c black", +"~ c black", +"^ c black", +"/ c black", +"( c black", +") c black", +"_ c black", +"` c black", +"' c black", +"] c black", +"[ c black", +"{ c black", +"} c black", +"| c black", +" . c black", +".. c black", +"X. c black", +"o. c black", +"O. c black", +"+. c black", +"@. c black", +"#. c black", +"$. c black", +"%. c black", +"&. c black", +"*. c black", +"=. c black", +"-. c black", +";. c black", +":. c black", +">. c black", +",. c black", +"<. c black", +"1. c black", +"2. c black", +"3. c black", +"4. c black", +"5. c black", +"6. c black", +"7. c black", +"8. c black", +"9. c black", +/* pixels */ +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/contrib/colors/extensions/nyan-mode/img/rainbow-start.xpm b/contrib/colors/extensions/nyan-mode/img/rainbow-start.xpm new file mode 100644 index 000000000000..a8775ab4e758 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/rainbow-start.xpm @@ -0,0 +1,43 @@ +/* XPM */ +static char *rainbow[] = { +/* columns rows colors chars-per-pixel */ +"8 15 22 1 ", +" c #522244", +". c #BF1119", +"X c #F52A02", +"o c #FC7800", +"O c #FBA500", +"+ c #FCA500", +"@ c #F0D300", +"# c #B4BF00", +"$ c #B5BF00", +"% c #4D9801", +"& c #4E9802", +"* c #4E9801", +"= c #2CCB13", +"- c #20D15C", +"; c #0EA7CB", +": c #0EA6CB", +"> c #1E7FF7", +", c #1E80F7", +"< c #5247F7", +"1 c #5536D9", +"2 c #263498", +"T c None", +/* pixels */ +" ", +"TTTT....", +"TTTXXXXX", +"TToooooo", +"TTTOO+O+", +"TTTT@@@@", +"TTT##$##", +"TT&*&&&&", +"TTT=====", +"TTTT----", +"TTT:;;:;", +"TT,>,,,,", +"TTT<<<<<", +"TTTT1111", +"TTT22222" +}; diff --git a/contrib/colors/extensions/nyan-mode/img/rainbow.xpm b/contrib/colors/extensions/nyan-mode/img/rainbow.xpm new file mode 100644 index 000000000000..1ed1bc2401e1 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/img/rainbow.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static char *rainbow[] = { +/* columns rows colors chars-per-pixel */ +"8 15 21 1 ", +" c #522244", +". c #BF1119", +"X c #F52A02", +"o c #FC7800", +"O c #FBA500", +"+ c #FCA500", +"@ c #F0D300", +"# c #B4BF00", +"$ c #B5BF00", +"% c #4D9801", +"& c #4E9802", +"* c #4E9801", +"= c #2CCB13", +"- c #20D15C", +"; c #0EA7CB", +": c #0EA6CB", +"> c #1E7FF7", +", c #1E80F7", +"< c #5247F7", +"1 c #5536D9", +"2 c #263498", +/* pixels */ +" ", +"........", +"XXXXXXXX", +"oooooooo", +"OOOOO+O+", +"@@@@@@@@", +"#####$##", +"%&&*&&&&", +"========", +"--------", +";;;:;;:;", +">,,>,,,,", +"<<<<<<<<", +"11111111", +"22222222" +}; diff --git a/contrib/colors/extensions/nyan-mode/mus/nyanlooped.mp3 b/contrib/colors/extensions/nyan-mode/mus/nyanlooped.mp3 new file mode 100644 index 000000000000..fe406b8056a0 Binary files /dev/null and b/contrib/colors/extensions/nyan-mode/mus/nyanlooped.mp3 differ diff --git a/contrib/colors/extensions/nyan-mode/nyan-mode.el b/contrib/colors/extensions/nyan-mode/nyan-mode.el new file mode 100644 index 000000000000..eb4fe9f91f76 --- /dev/null +++ b/contrib/colors/extensions/nyan-mode/nyan-mode.el @@ -0,0 +1,262 @@ +;;; nyan-mode.el --- Nyan Cat shows position in current buffer in mode-line. +;;; +;;; Nyanyanyanyanyanyanya! +;;; +;;; Author: Jacek "TeMPOraL" Zlydach +;;; URL: http://nyan-mode.buildsomethingamazing.com +;;; Version: 0.2 +;;; Keywords: nyan, cat, lulz, pop tart cat, build something amazing +;;; +;;; Inspired by (and in few places copied from) sml-modeline.el, +;;; written by Lennart Borgman +;;; See: http://bazaar.launchpad.net/~nxhtml/nxhtml/main/annotate/head%3A/util/sml-modeline.el + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; LICENSE +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; 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, 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; see the file COPYING. If not, write to +;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth +;; Floor, Boston, MA 02110-1301, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; Some TODOs +;;; * Investigate why wavy rainbow didn't work on Antoszka's computer. +;;; * Refactor-out :set lambdas in customs if possible. +;;; * MAYBE add something to protect users from going to 0 with nyanbar width? +;;; * Add credits for used images. +(defgroup nyan nil + "Customization group for `nyan-mode'." + :group 'frames) + +(defun nyan-refresh () + "Refresh after option changes if loaded." + (when (featurep 'nyan-mode) + (when (and (boundp 'nyan-mode) + nyan-mode) + (nyan-mode -1) + (nyan-mode 1)))) + +(defcustom nyan-animation-frame-interval 0.2 + "Number of seconds between animation frames." + :set (lambda (sym val) + (set-default sym val) + (nyan-refresh)) + :group 'nyan) + +(defvar nyan-animation-timer nil) +(defvar nyan-animation-loop-count 0) +(defvar nyan-animation-loop-max 1) + +(defun nyan-start-animation () + (interactive) + (when (not nyan-animation-timer) + (setq nyan-animation-timer + (run-at-time "0 sec" + nyan-animation-frame-interval + 'nyan-swich-anim-frame) + nyan-animation-loop-count 0))) + +(defun nyan-stop-animation () + (interactive) + (when nyan-animation-timer + (cancel-timer nyan-animation-timer) + (setq nyan-animation-timer nil))) + +;; mplayer needs to be installed for that +(defun nyan-start-music () + (interactive) + (start-process-shell-command "nyan-music" "nyan-music" (concat "mplayer " +nyan-music+ " -loop 0"))) + +(defun nyan-stop-music () + (interactive) + (kill-process "nyan-music")) + +;;; FIXME bug, doesn't work for antoszka. +(defcustom nyan-wavy-trail nil + "If enabled, Nyan Cat's rainbow trail will be wavy." + :type '(choice (const :tag "Enabled" t) + (const :tag "Disabled" nil)) + :set (lambda (sym val) + (set-default sym val) + (nyan-refresh)) + :group 'nyan) + +(defcustom nyan-bar-length 32 + "Length of Nyan Cat bar in units; each unit is equal to an 8px + image. Minimum of 3 units are required for Nyan Cat." + :set (lambda (sym val) + (set-default sym val) + (nyan-refresh)) + :group 'nyan) + +(defcustom nyan-animate-nyancat nil + "Enable animation for Nyan Cat. +This can be t or nil." + :type '(choice (const :tag "Enabled" t) + (const :tag "Disabled" nil)) + :set (lambda (sym val) + (set-default sym val) + (if val + (nyan-start-animation) + (nyan-stop-animation)) + (nyan-refresh)) + :group 'nyan) + +(defcustom nyan-cat-face-number 1 + "Select cat face number for console." + ) + +(defconst +nyan-directory+ (file-name-directory (or load-file-name buffer-file-name))) + +(defconst +nyan-cat-size+ 3) + +(defconst +nyan-cat-image+ (concat +nyan-directory+ "img/nyan.xpm")) +(defconst +nyan-cat-start-image+ (concat +nyan-directory+ "img/nyan-start.xpm")) +(defconst +nyan-rainbow-image+ (concat +nyan-directory+ "img/rainbow.xpm")) +(defconst +nyan-rainbow-start-image+ (concat +nyan-directory+ "img/rainbow-start.xpm")) +(defconst +nyan-outerspace-image+ (concat +nyan-directory+ "img/outerspace.xpm")) + +(defconst +nyan-music+ (concat +nyan-directory+ "mus/nyanlooped.mp3")) + +;;; Load images of Nyan Cat an it's rainbow. +(defvar nyan-cat-image (create-image +nyan-cat-image+ 'xpm nil :ascent 'center)) +(defvar nyan-cat-start-image (create-image +nyan-cat-start-image+ 'xpm nil :ascent 'center)) + +(defvar nyan-animation-frames (mapcar (lambda (id) + (create-image (concat +nyan-directory+ (format "img/nyan-frame-%d.xpm" id)) + 'xpm nil :ascent 'center)) + '(1 2 3 4 5 6))) + +(defvar nyan-last-rainbow-count 0) + +(defvar nyan-current-frame 0) + +(defconst +catface+ [ + ["[]*" "[]#"] + ["(*^ー゚)" "( ^ー^)" "(^ー^ )" "(゚ー^*)"] + ["(´ω`三 )" "( ´ω三` )" "( ´三ω` )" "( 三´ω`)" + "( 三´ω`)" "( ´三ω` )" "( ´ω三` )" "(´ω`三 )"] + ["(´д`;)" "( ´д`;)" "( ;´д`)" "(;´д` )"] + ["(」・ω・)」" "(/・ω・)/" "(」・ω・)」" "(/・ω・)/" + "(」・ω・)」" "(/・ω・)/" "(」・ω・)」" "\(・ω・)/"] + ["(>ワ<三   )" "( >ワ三<  )" + "(  >三ワ< )" "(   三>ワ<)" + "(  >三ワ< )" "( >ワ三<  )"]]) + +(defun nyan-swich-anim-frame () +(when (> nyan-animation-loop-count nyan-animation-loop-max) + (nyan-stop-animation)) + (setq nyan-current-frame (% (+ 1 nyan-current-frame) 6)) + (when (equal nyan-current-frame 5) + (setq nyan-animation-loop-count (1+ nyan-animation-loop-count))) + (redraw-modeline)) + +(defun nyan-get-anim-frame (rainbows &optional start) + (if (and nyan-animation-timer (> rainbows 0)) + (nth nyan-current-frame nyan-animation-frames) + (if start nyan-cat-start-image nyan-cat-image))) + +(defun nyan-wavy-rainbow-ascent (number) + (if nyan-animation-timer + (min 100 (+ 81 + (* 3 (abs (- (/ 6 2) + (% (+ number nyan-current-frame) + 6)))))) + (if (< (% number 6) 3) 90 'center))) + +(defun nyan-number-of-rainbows () + (round (/ (* (round (* 100 + (/ (- (float (point)) + (float (point-min))) + (float (point-max))))) + (- nyan-bar-length +nyan-cat-size+)) + 100))) + +(defun catface () (aref +catface+ nyan-cat-face-number)) + +(defun catface-index () + (min (round (/ (* (round (* 100 + (/ (- (float (point)) + (float (point-min))) + (float (point-max))))) + (length (catface))) + 100)) (- (length (catface)) 1))) + +(defun nyan-create () + (let* ((rainbows (nyan-number-of-rainbows)) + (outerspaces (- nyan-bar-length rainbows +nyan-cat-size+)) + (rainbow-string "") + (rainbow-start t) + (nyancat-string (propertize + (aref (catface) (catface-index)) + 'display (nyan-get-anim-frame rainbows (eq rainbows 0)))) + (outerspace-string "")) + + (if (and nyan-animate-nyancat + (not (equal nyan-last-rainbow-count rainbows))) + (nyan-start-animation)) + (setq nyan-last-rainbow-count rainbows) + + (dotimes (number rainbows) + (setq rainbow-string + (concat rainbow-string + (propertize + "|" + 'display (create-image (if rainbow-start +nyan-rainbow-start-image+ + +nyan-rainbow-image+) + 'xpm nil + :ascent + (if (and nyan-wavy-trail + (or (not nyan-animate-nyancat) + (and nyan-animate-nyancat nyan-animation-timer))) + (nyan-wavy-rainbow-ascent number) + 'center))))) + (setq rainbow-start nil) + ) + (dotimes (number outerspaces) + (setq outerspace-string + (concat outerspace-string + (propertize + "-" + 'display (create-image +nyan-outerspace-image+ + 'xpm nil :ascent (if nyan-animation-timer 95 'center)))))) + ;; Compute Nyan Cat string. + (concat rainbow-string + nyancat-string + outerspace-string))) + +(defvar nyan-old-car-mode-line-position nil) + +;;;###autoload +(define-minor-mode nyan-mode + "Use NyanCat to show buffer size and position in mode-line. +You can customize this minor mode, see option `nyan-mode'. + +Note: If you turn this mode on then you probably want to turn off +option `scroll-bar-mode'." + :global t + :group 'nyan + (if nyan-mode + (progn + (unless nyan-old-car-mode-line-position + (setq nyan-old-car-mode-line-position (car mode-line-position))) + (setcar mode-line-position '(:eval (list (nyan-create))))) + (setcar mode-line-position nyan-old-car-mode-line-position))) + + +(provide 'nyan-mode) + +;;; nyan-mode.el ends here diff --git a/contrib/evernote/README.md b/contrib/evernote/README.md new file mode 100644 index 000000000000..e297df6b431c --- /dev/null +++ b/contrib/evernote/README.md @@ -0,0 +1,75 @@ +# Evernote contribution layer for Spacemacs + +![evernote](img/evernote.png) _with_ ![geeknote](img/geeknote.png) + + +**Table of Contents** + +- [Evernote contribution layer for Spacemacs](#evernote-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + - [Layer](#layer) + - [geeknote](#geeknote) + - [geeknote.el](#geeknoteel) + - [Key Bindings](#key-bindings) + + + +## Description + +This layer group together packages to work with [Evernote][]. + +It uses the non official Evernote command line [geeknote][] which allows +users to write notes in markdown, and sync them. + +[geeknote.el][] is a wrapper for some of the most used `geeknote` commands. +By default, `geeknote.el` doesn't have key bindings defined. This +contribution layer provides key bindings for all of geeknote.el's +exposed features. + +## Install + +### Layer + +To use this contribution add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(evernote) + "List of contribution to load." +) +``` + +### geeknote + +The command `geeknote` is expected to be present in your `$PATH`. To +obtain this utility, please refer to the official geeknote +[documentation][geeknote-doc]. + +### geeknote.el + +`geeknote.el` relies on having a correctly setup geeknote editor. To set +this up, run the following command in your terminal after successfully +installing `geeknote`: + +``` +$ geeknote settings --editor "emacsclient" +``` + +If you would prefer to customize the geeknote command to be used +such as specifying the path to the geeknote python script, please +refer to the `geeknote.el` [documentation][geeknote.el]. + +## Key Bindings + +Key Binding | Description +----------------------|------------------------------------------------ +SPC a g c | create a new note +SPC a g e | edit an existing note +SPC a g f | find a note using a keyword +SPC a g s | show an existing note +SPC a g r | remove an existing note + +[Evernote]: https://evernote.com/ +[geeknote]: http://www.geeknote.me +[geeknote-doc]: http://www.geeknote.me/documentation/ +[geeknote.el]: https://github.com/avendael/emacs-geeknote diff --git a/contrib/evernote/img/evernote.png b/contrib/evernote/img/evernote.png new file mode 100644 index 000000000000..f365d7a6dbf7 Binary files /dev/null and b/contrib/evernote/img/evernote.png differ diff --git a/contrib/evernote/img/geeknote.png b/contrib/evernote/img/geeknote.png new file mode 100644 index 000000000000..18900b830151 Binary files /dev/null and b/contrib/evernote/img/geeknote.png differ diff --git a/contrib/evernote/packages.el b/contrib/evernote/packages.el new file mode 100644 index 000000000000..4d0a602ba47e --- /dev/null +++ b/contrib/evernote/packages.el @@ -0,0 +1,27 @@ +(defvar geeknote-packages + '( + geeknote + ) + "List of all packages to install and/or initialize. Built-in packages +which require an initialization must be listed explicitly in the list.") + +(defvar geeknote-excluded-packages '() + "List of packages to exclude.") + +(defun geeknote/init-geeknote () + "Initializes geeknote and adds keybindings for its exposed functionalities." + (use-package geeknote + :commands (geeknote-create + geeknote-edit + geeknote-find + geeknote-show + geeknote-remove + ) + :init + (progn + (evil-leader/set-key + "agc" 'geeknote-create + "age" 'geeknote-edit + "agf" 'geeknote-find + "ags" 'geeknote-show + "agr" 'geeknote-remove)))) diff --git a/contrib/git/packages.el b/contrib/git/packages.el index 253ef6cb1775..0f37773bba1c 100644 --- a/contrib/git/packages.el +++ b/contrib/git/packages.el @@ -14,6 +14,7 @@ '( fringe-helper git-messenger + git-rebase-mode git-timemachine gist github-browse-file @@ -84,7 +85,6 @@ which require an initialization must be listed explicitly in the list.") "Lazy load git gutter and choose between fringe and no fringe." (when (display-graphic-p) (require 'git-gutter-fringe)) (init-git-gutter)) - (setq git-gutter-fr:side 'right-fringe) (add-to-hooks 'git/load-git-gutter '(markdown-mode-hook org-mode-hook prog-mode-hook))) @@ -129,6 +129,16 @@ which require an initialization must be listed explicitly in the list.") (evil-leader/set-key "gm" 'git-messenger:popup-message))) +(defun git/init-git-rebase-mode () + (use-package git-rebase-mode + :defer t + :init + (add-to-list 'evil-emacs-state-modes 'git-rebase-mode) + :config + (progn + (spacemacs|evilify git-rebase-mode-map "y" 'git-rebase-insert) + (spacemacs/activate-evil-leader-for-map 'git-rebase-mode-map)))) + (defun git/init-git-timemachine () (use-package git-timemachine :defer t diff --git a/contrib/lang/clojure/README.md b/contrib/lang/clojure/README.md index 6022a62fa834..d66876108e1c 100644 --- a/contrib/lang/clojure/README.md +++ b/contrib/lang/clojure/README.md @@ -47,7 +47,7 @@ To use this contribution add it to your `~/.spacemacs` ### Pretty Symbols -Pretty symbols for anonymous functions and set literals, like `(λ [a] (+ a 5))`, `ƒ(+ % 5)`, and `∈{2 4 6}`. +Pretty symbols for anonymous functions, set literals and partial, like `(λ [a] (+ a 5))`, `ƒ(+ % 5)`, `∈{2 4 6}` and `Ƥ`. To enable this feature, add the following snippet to the dotspacemacs/config section of your `~/.spacemacs` file: diff --git a/contrib/lang/clojure/packages.el b/contrib/lang/clojure/packages.el index 0dd2a041c390..6bdd8c24b734 100644 --- a/contrib/lang/clojure/packages.el +++ b/contrib/lang/clojure/packages.el @@ -10,13 +10,16 @@ "List of all packages to install and/or initialize. Built-in packages which require an initialization must be listed explicitly in the list.") -(defun clojure/fancify-symbols () +(defun clojure/fancify-symbols (mode) "Pretty symbols for Clojure's anonymous functions and sets, like (λ [a] (+ a 5)), ƒ(+ % 5), and ∈{2 4 6}." - (font-lock-add-keywords 'clojure-mode + (font-lock-add-keywords mode `(("(\\(fn\\)[\[[:space:]]" (0 (progn (compose-region (match-beginning 1) (match-end 1) "λ")))) + ("(\\(partial\\)[\[[:space:]]" + (0 (progn (compose-region (match-beginning 1) + (match-end 1) "Ƥ")))) ("\\(#\\)(" (0 (progn (compose-region (match-beginning 1) (match-end 1) "ƒ")))) @@ -24,18 +27,23 @@ which require an initialization must be listed explicitly in the list.") (0 (progn (compose-region (match-beginning 1) (match-end 1) "∈"))))))) +(defun clojure/general-mode () + "Start general modes for both clojure-mode and repl" + (progn + (subword-mode t) + (paredit-mode t) + (rainbow-delimiters-mode t))) + (defun clojure/init-clojure-mode () (use-package clojure-mode :defer t :init (progn - (add-to-hook 'clojure-mode-hook '(subword-mode - paredit-mode - rainbow-delimiters-mode))) + (add-to-hook 'clojure-mode-hook '(clojure/general-mode))) :config (progn (when clojure-enable-fancify-symbols - (clojure/fancify-symbols)) + (clojure/fancify-symbols 'clojure-mode)) (evil-leader/set-key-for-mode 'clojure-mode "mj" 'cider-jack-in)))) (defun clojure/init-cider () @@ -45,16 +53,18 @@ which require an initialization must be listed explicitly in the list.") (progn (setq cider-stacktrace-default-filters '(tooling dup) cider-repl-pop-to-buffer-on-connect nil - cider-prompt-save-file-on-load nil) + cider-prompt-save-file-on-load nil + cider-repl-use-clojure-font-lock t) (add-to-hook 'cider-mode-hook '(cider-turn-on-eldoc-mode ac-flyspell-workaround ac-cider-setup)) - (add-to-hook 'cider-repl-mode-hook '(subword-mode - rainbow-delimiters-mode + (add-to-hook 'cider-repl-mode-hook '(clojure/general-mode ac-cider-setup auto-complete-mode))) :config (progn + (add-to-list 'evil-emacs-state-modes 'cider-stacktrace-mode) + (spacemacs/activate-evil-leader-for-map 'cider-stacktrace-mode-map) (evil-leader/set-key-for-mode 'clojure-mode "meb" 'cider-eval-buffer "mer" 'cider-eval-region @@ -68,7 +78,9 @@ which require an initialization must be listed explicitly in the list.") "mgr" 'cider-jump-to-resource "mge" 'cider-jump-to-compilation-error "mgs" 'cider-jump - "mtt" 'cider-test-run-tests)))) + "mtt" 'cider-test-run-tests) + (when clojure-enable-fancify-symbols + (clojure/fancify-symbols 'cider-repl-mode))))) (defun clojure/init-ac-cider () (use-package ac-cider diff --git a/contrib/lang/csharp/README.md b/contrib/lang/csharp/README.md index ff5d026e00b3..670601e44bdd 100644 --- a/contrib/lang/csharp/README.md +++ b/contrib/lang/csharp/README.md @@ -10,7 +10,7 @@ - [Packages Included](#packages-included) - [Install](#install) - [Prerequisites](#prerequisites) - - [APS.NET 5](#apsnet-5) + - [ASP.NET 5](#aspnet-5) - [curl](#curl) - [Omnisharp server](#omnisharp-server) - [Caveats](#caveats) @@ -47,7 +47,7 @@ To use this contribution add it to your `~/.spacemacs` ### Prerequisites -#### APS.NET 5 +#### ASP.NET 5 Follow the instructions for your platform [here][aspnet]. diff --git a/contrib/lang/ess/packages.el b/contrib/lang/ess/packages.el index 057eb479bcf8..adc999ea6f5e 100644 --- a/contrib/lang/ess/packages.el +++ b/contrib/lang/ess/packages.el @@ -15,7 +15,8 @@ ess ess-R-data-view ess-R-object-popup - ess-smart-underscore + ess-smart-equals + rainbow-delimiters ) "List of all packages to install and/or initialize. Built-in packages which require an initialization must be listed explicitly in the list.") @@ -29,16 +30,73 @@ which require an initialization must be listed explicitly in the list.") ;; keybinding) (defun load-ess-on-demand () (interactive) - (use-package ess-site) - (use-package ess-smart-underscore) - (use-package ess-R-object-popup) - (use-package ess-R-data-view) - ) + (-all? '---truthy? (list + (use-package ess-site) + (use-package ess-smart-underscore) + (use-package ess-R-object-popup) + (use-package ess-R-data-view)))) + (evil-leader/set-key "ess" 'load-ess-on-demand) + (use-package ess + :defer t + :init + (progn + (setq auto-mode-alist (append + '(("\\.sp\\'" . S-mode) + ("/R/.*\\.q\\'" . R-mode) + ("\\.[qsS]\\'" . S-mode) + ("\\.ssc\\'" . S-mode) + ("\\.SSC\\'" . S-mode) + ("\\.[rR]\\'" . R-mode) + ("\\.[rR]nw\\'" . Rnw-mode) + ("\\.[sS]nw\\'" . Snw-mode) + ("\\.[rR]profile\\'" . R-mode) + ("NAMESPACE\\'" . R-mode) + ("CITATION\\'" . R-mode) + ("\\.omg\\'" . omegahat-mode) + ("\\.hat\\'" . omegahat-mode) + ("\\.lsp\\'" . XLS-mode) + ("\\.do\\'" . STA-mode) + ("\\.ado\\'" . STA-mode) + ("\\.[Ss][Aa][Ss]\\'" . SAS-mode) + ("\\.[Ss]t\\'" . S-transcript-mode) + ("\\.Sout" . S-transcript-mode) + ("\\.[Rr]out" . R-transcript-mode) + ("\\.Rd\\'" . Rd-mode) + ("\\.[Bb][Uu][Gg]\\'" . ess-bugs-mode) + ("\\.[Bb][Oo][Gg]\\'" . ess-bugs-mode) + ("\\.[Bb][Mm][Dd]\\'" . ess-bugs-mode) + ("\\.[Jj][Aa][Gg]\\'" . ess-jags-mode) + ("\\.[Jj][Oo][Gg]\\'" . ess-jags-mode) + ("\\.[Jj][Mm][Dd]\\'" . ess-jags-mode)) + auto-mode-alist)) + + (defun ess/auto-load-hack (mode-symbol) + (eval + `(defun ,mode-symbol () + "This is a function that will hijack itself with its +definition from ess. The reason this exists is that ess does +not play nicely with autoloads" + (when (load-ess-on-demand) + (,mode-symbol))))) + + (defvar ess/r-modes-list '(R-mode R-transcript-mode Rd-mode Rnw-mode S-mode S-transcript-mode + SAS-mode STA-mode Snw-mode XLS-mode ess-bugs-mode ess-jags-mode omegahat-mode) + "This is the list of modes defined by ess") + + (mapc (lambda (sym) (ess/auto-load-hack sym)) ess/r-modes-list))) + ;; R -------------------------------------------------------------------------- (eval-after-load "ess-site" '(progn + (add-to-list 'auto-mode-alist '("\\.R$" . R-mode)) + ;; Follow Hadley Wickham's R style guide + (setq ess-first-continued-statement-offset 2 + ess-continued-statement-offset 0 + ess-expression-offset 2 + ess-nuke-trailing-whitespace-p t + ess-default-style 'DEFAULT) (evil-leader/set-key-for-mode 'ess-mode "mi" 'R ;; noweb @@ -64,5 +122,13 @@ which require an initialization must be listed explicitly in the list.") "msT" 'ess-eval-function-and-go "mst" 'ess-eval-function ) + (define-key ess-mode-map (kbd "") 'ess-eval-line) (define-key inferior-ess-mode-map (kbd "C-j") 'comint-next-input) (define-key inferior-ess-mode-map (kbd "C-k") 'comint-previous-input)))) + +(defun ess/init-rainbow-delimiters () + (add-hook 'ess-mode-hook #'rainbow-delimiters-mode)) + +(defun ess/init-ess-smart-equals () + (add-hook 'ess-mode-hook 'ess-smart-equals-mode) + (add-hook 'inferior-ess-mode-hook 'ess-smart-equals-mode)) diff --git a/contrib/lang/go/extensions.el b/contrib/lang/go/extensions.el index 7d1c4713bd77..ffc447251fd1 100644 --- a/contrib/lang/go/extensions.el +++ b/contrib/lang/go/extensions.el @@ -8,6 +8,7 @@ '( ;; post extension gos go here go-oracle + go-rename ) "List of all extensions to load after the packages.") @@ -39,3 +40,8 @@ "mos" 'go-oracle-callstack "mot" 'go-oracle-describe )) + +(defun go/init-go-rename() + (use-package go-rename + :init + (evil-leader/set-key-for-mode 'go-mode "mr" 'go-rename))) diff --git a/contrib/lang/go/extensions/go-rename/go-rename.el b/contrib/lang/go/extensions/go-rename/go-rename.el new file mode 100644 index 000000000000..2b24dacc761e --- /dev/null +++ b/contrib/lang/go/extensions/go-rename/go-rename.el @@ -0,0 +1,89 @@ +;;; Copyright 2014 The Go Authors. All rights reserved. +;;; Use of this source code is governed by a BSD-style +;;; license that can be found in the LICENSE file. +;;; +;;; Integration of the 'gorename' tool into Emacs. +;;; +;;; To install: +;;; % go get golang.org/x/tools/cmd/gorename +;;; % go build golang.org/x/tools/cmd/gorename +;;; % mv gorename $HOME/bin/ # or elsewhere on $PATH +;;; +;;; The go-rename-command variable can be customized to specify an +;;; alternative location for the installed command. +(defgroup go-rename nil + "Options specific to the Go rename." + :group 'go) + +(defcustom go-rename-command "gorename" + "The `gorename' command; by the default, $PATH is searched." + :type 'string + :group 'go-rename) + +(defun go-rename (new-name) + "Rename the entity denoted by the identifier at point, using +the `gorename' tool." + (interactive (list (read-string "New name: " (thing-at-point 'symbol)))) + (if (not buffer-file-name) + (error "Cannot use go-rename on a buffer without a file name")) + ;; It's not sufficient to save the current buffer if modified, + ;; since if gofmt-before-save is on the before-save-hook, + ;; saving will disturb the selected region. + (if (buffer-modified-p) + (error "Please save the current buffer before invoking go-rename")) + ;; Prompt-save all other modified Go buffers, since they might get written. + (save-some-buffers nil #'(lambda () + (and (buffer-file-name) + (string= (file-name-extension (buffer-file-name)) ".go")))) + (let* ((posflag (format "-offset=%s:#%d" + buffer-file-name + (1- (go--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) ":"))) + success) + (with-current-buffer (get-buffer-create "*go-rename*") + (setq buffer-read-only nil) + (erase-buffer) + (let ((args (list go-rename-command nil t nil posflag "-to" new-name))) + ;; Log the command to *Messages*, for debugging. + (message "Command: %s:" args) + (message "Running gorename...") + ;; Use dynamic binding to modify/restore the environment + (setq success (zerop (let ((process-environment (list* goroot-env gopath-env process-environment))) + (apply #'call-process args)))) + (insert "\n") + (compilation-mode) + (setq compilation-error-screen-columns nil) + + ;; On success, print the one-line result in the message bar, + ;; and hide the *go-rename* buffer. + (let ((w (display-buffer (current-buffer)))) + (if success + (progn + (message "%s" (go--buffer-string-no-trailing-space)) + (delete-window w)) + ;; failure + (message "gorename exited") + (shrink-window-if-larger-than-buffer w) + (set-window-point w (point-min))))))) + + ;; Reload the modified files, saving line/col. + ;; (Don't restore the point since the text has changed.) + ;; + ;; TODO(adonovan): should we also do this for all other files + ;; that were updated (the tool can print them)? + (let ((line (line-number-at-pos)) + (col (current-column))) + (revert-buffer t t t) ; safe, because we just saved it + (goto-char (point-min)) + (forward-line (1- line)) + (forward-char col))) + + +(defun go--buffer-string-no-trailing-space () + (replace-regexp-in-string "[\t\n ]*\\'" + "" + (buffer-substring (point-min) (point-max)))) + +(provide 'go-rename) diff --git a/contrib/lang/ocaml/README.md b/contrib/lang/ocaml/README.md new file mode 100644 index 000000000000..00b87307c112 --- /dev/null +++ b/contrib/lang/ocaml/README.md @@ -0,0 +1,49 @@ +# Ocaml contribution layer for Spacemacs + +![logo](img/ocaml.png) + + +**Table of Contents** + +- [Ocaml contribution layer for Spacemacs](#ocaml-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + - [OPAM packages](#opam-packages) + - [TODO](#todo) + + + +## Description + +This is a very basic layer for editing ocaml files. + +- Syntax highlighting via `tuareg-mode` +- Error reporting, completion and type display via `merlin` + +## Install + +To use this contribution add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(ocaml) +"List of contribution to load." +) +``` + +### OPAM packages + +This layer requires some [opam](http://opam.ocaml.org) packages: + +- `merlin` + +To install them, use the following command: + +```sh +opam install merlin +``` + +## TODO + +- Add support for `flycheck` (using `flycheck-ocaml`) +- Add proper spacemacs key-bindings for basic merlin tasks + diff --git a/contrib/lang/ocaml/extensions.el b/contrib/lang/ocaml/extensions.el new file mode 100644 index 000000000000..4f842721a400 --- /dev/null +++ b/contrib/lang/ocaml/extensions.el @@ -0,0 +1,33 @@ +;;; extensions.el --- ocaml Layer extensions File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defvar ocaml-pre-extensions + '( + ;; pre extension ocamls go here + ) + "List of all extensions to load before the packages.") + +(defvar ocaml-post-extensions + '( + ;; post extension ocamls go here + ) + "List of all extensions to load after the packages.") + +;; For each extension, define a function ocaml/init- +;; +;; (defun ocaml/init-my-extension () +;; "Initialize my extension" +;; ) +;; +;; Often the body of an initialize function uses `use-package' +;; For more info on `use-package', see readme: +;; https://github.com/jwiegley/use-package diff --git a/contrib/lang/ocaml/img/ocaml.png b/contrib/lang/ocaml/img/ocaml.png new file mode 100644 index 000000000000..2b0d2ea12d03 Binary files /dev/null and b/contrib/lang/ocaml/img/ocaml.png differ diff --git a/contrib/lang/ocaml/packages.el b/contrib/lang/ocaml/packages.el new file mode 100644 index 000000000000..e31679f10f0a --- /dev/null +++ b/contrib/lang/ocaml/packages.el @@ -0,0 +1,46 @@ +;;; packages.el --- ocaml Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defvar ocaml-packages + '( + tuareg + merlin +;; flycheck +;; flycheck-ocaml + ;; package ocamls go here + ) + "List of all packages to install and/or initialize. Built-in packages +which require an initialization must be listed explicitly in the list.") + +(defvar ocaml-excluded-packages '() + "List of packages to exclude.") + +(defun ocaml/init-tuareg () + (add-hook 'tuareg-mode-hook #'merlin-mode) + ) + +;; (defun ocaml/init-flycheck-ocaml () +;; (progn +;; (setq merlin-error-after-save nil) +;; (flycheck-ocaml-setup) +;; ) +;; ) + +;; For each package, define a function ocaml/init- +;; +;; (defun ocaml/init-my-package () +;; "Initialize my package" +;; ) +;; +;; Often the body of an initialize function uses `use-package' +;; For more info on `use-package', see readme: +;; https://github.com/jwiegley/use-package diff --git a/contrib/lang/php/README.md b/contrib/lang/php/README.md new file mode 100644 index 000000000000..6f6da0281551 --- /dev/null +++ b/contrib/lang/php/README.md @@ -0,0 +1,28 @@ +#PHP contribution layer for Spacemacs + +![logo](img/php.png) + +**Table of Contents** + +- [PHP contribution layer for Spacemacs](#php-contribution-layer-for-spacemacs) + - [Description](#description) + - [Install](#install) + + + +## Description +This layer adds PHP language support to Spacemacs + +Features: +- Edit php files using [php-mode][] + +## Install + +To use this contribution add it to your `~/.spacemacs` + +```elisp +(setq-default dotspacemacs-configuration-layers '(php) +"List of contribution to load." +) +``` +[php-mode]: https://github.com/ejmr/php-mode diff --git a/contrib/lang/php/img/php.png b/contrib/lang/php/img/php.png new file mode 100644 index 000000000000..8385a08cc68d Binary files /dev/null and b/contrib/lang/php/img/php.png differ diff --git a/contrib/lang/php/packages.el b/contrib/lang/php/packages.el new file mode 100644 index 000000000000..582938c03881 --- /dev/null +++ b/contrib/lang/php/packages.el @@ -0,0 +1,21 @@ +;;; packages.el --- PHP Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defvar php-packages '(php-mode) + "A list of the pacakges to install for php-mode.") + +(defun php/init-php-mode () + (use-package php-mode + :defer t + :mode ("\\.php\\'" . php-mode) + ) +) diff --git a/contrib/lang/python/README.md b/contrib/lang/python/README.md index 41a950f66630..c47dabde58cf 100644 --- a/contrib/lang/python/README.md +++ b/contrib/lang/python/README.md @@ -110,60 +110,63 @@ Test commands (start with m t or m T): Django related key bindings uses [pony-mode][] and are behind the prefix SPC m j. +Configuration options for pony-mode are documented at +[deadpansincerity.com](http://www.deadpansincerity.com/docs/pony/configuration.html) + Manage Django with SPC m j m. #### Fabric Key Binding | Description ----------------------|------------------------------------------------------------ -mjaf | pony-fabric -mjad | pony-fabric-deploy +mjaf | Run a fabric command +mjad | Deploy project with `fab deploy` #### Files Key Binding | Description ----------------------|------------------------------------------------------------ -mjfs | pony-goto-settings -mjfc | pony-setting -mjft | pony-goto-template -mjfr | pony-resolve +mjfs | Open the `settings.py` for this project +mjfc | Interactively display a setting value in the minibuffer +mjft | Jump to template at point +mjfr | Jump to the view file that the URL resolves to (experimental) #### Interactive Key Binding | Description ----------------------|------------------------------------------------------------ -mjid | pony-db-shell -mjis | pony-shell +mjid | Run interpreter for this project's default database as an inferior process +mjis | Open a Python shell with the current pony project's context loaded. If the project has the django_extras package installed, then use the excellent `shell_plus` command. Otherwise, fall back to `manage.py shell` #### Server Key Binding | Description ----------------------|------------------------------------------------------------ -mjrd | pony-stopserver -mjro | pony-browser -mjrr | pony-restart-server -mjru | pony-runserver -mjrt | pony-temp-server +mjrd | Stop the dev server +mjro | Open a tab at the dev server +mjrr | Restart the dev server (works better with django_extras/werkzeug) +mjru | Start or open the dev server +mjrt | Open a second server with a "throwaway" host/port #### South/Syncdb Key Binding | Description ----------------------|------------------------------------------------------------ -mjsc | pony-south-convert -mjsh | pony-south-schemamigration -mjsi | pony-south-initial -mjsm | pony-south-migrate -mjss | pony-syncdb +mjsc | Convert an existing app to south +mjsh | Create migration for modification +mjsi | Run the initial south migration for an app +mjsm | Migrate an app +mjss | Run syncdb on the current project #### Test Key Binding | Description ----------------------|------------------------------------------------------------ -mjtd | go down the stack -mjte | go to test error -mjto | pony-test-open -mjtt | pony-test -mjtu | go up the stack +mjtd | Move down the traceback one level +mjte | Go to the file and line of the last stack trace in a test buffer +mjto | Open the file in a traceback at the line specified +mjtt | Run the test(s) given by `command` +mjtu | Move up the traceback one level [anaconda-mode]: https://github.com/proofit404/anaconda-mode diff --git a/contrib/lang/python/packages.el b/contrib/lang/python/packages.el index 7324abc8be03..81320ee512fe 100644 --- a/contrib/lang/python/packages.el +++ b/contrib/lang/python/packages.el @@ -34,7 +34,16 @@ which require an initialization must be listed explicitly in the list.") (use-package ac-anaconda :if (boundp 'ac-sources) :defer t - :init (add-hook 'python-mode-hook 'ac-anaconda-setup))) + :init (add-hook 'python-mode-hook 'ac-anaconda-setup) + :config + (progn + (add-to-list 'evil-emacs-state-modes 'anaconda-nav-mode) + (spacemacs/activate-evil-leader-for-map 'anaconda-nav-mode-map) + (spacemacs|evilify anaconda-nav-mode-map + (kbd "H") 'previous-error + (kbd "J") 'anaconda-nav-next-module + (kbd "K") 'anaconda-nav-previous-module + (kbd "L") 'next-error)))) (defun python/init-anaconda-mode () (use-package anaconda-mode @@ -159,6 +168,7 @@ which require an initialization must be listed explicitly in the list.") 'python-setup-shell)) :config (progn + (add-hook 'inferior-python-mode-hook 'smartparens-mode) ;; add support for `ahs-range-beginning-of-defun' for python-mode (eval-after-load 'auto-highlight-symbol '(add-to-list 'ahs-plugin-bod-modes 'python-mode)) diff --git a/contrib/lang/ruby/README.md b/contrib/lang/ruby/README.md index 043997274027..1e5ad4b8dab9 100644 --- a/contrib/lang/ruby/README.md +++ b/contrib/lang/ruby/README.md @@ -9,7 +9,10 @@ - [Description](#description) - [Install](#install) - [Ruby version manager](#ruby-version-manager) - - [Key bindings](#key-bindings) + - [Prerequisites](#prerequisites) + - [Ruby version management](#ruby-version-management) + - [Rails support](#rails-support) + - [Key bindings](#key-bindings) - [enh-ruby-mode](#enh-ruby-mode) - [ruby-test-mode](#ruby-test-mode) @@ -30,21 +33,30 @@ To use this contribution add it to your `~/.spacemacs` ) ``` -In order to take advantage of `robe-mode` you will probably need to -install the `pry` gem. -You can do that via your Gemfile: +### Prerequisites + +Some of the advanced features supported by this layer depend on external gems +that need to be installed in the context of your project (see below for guidance +based on your version manager): + +* `pry` and `pry-doc` are required for *jump to definition* and *code documentation* (`robe-mode`) +* `ruby_parser` is required for *goto-step_definition* in `feature-mode` + +You can install the gems in the context of your current project by +adding them to the `Gemfile`, e.g.: ```ruby gem 'pry' ``` -or on the command line: +or on the command line (please refer to your ruby version manager +specific documentation for details and caveats): ```shell $ gem install pry ``` -### Ruby version manager +### Ruby version management This layer supports the use of [RVM][] and [Rbenv][]. To enable it, set the `ruby-version-manager` var in your `~/.spacemacs`: @@ -57,25 +69,111 @@ To enable it, set the `ruby-version-manager` var in your `~/.spacemacs`: Possible values are `rbenv` and `rvm`. +### Rails support + +Rails support is available through [projectile-rails][]. +To enable it, set the `ruby-on-rails-support` var in your +`~/.spacemacs`: + +```elisp +(defun dotspacemacs/init () + (setq-default ruby-on-rails-support t) +) +``` + +This will also add [haml-mode][] (for templates written in [haml +language](http://haml.info) and [feature-mode][] for +[Cucumber](http://cukes.info) support. + ## Key bindings -### enh-ruby-mode +### Ruby (enh-ruby-mode, robe, inf-ruby) -SPC m i start REPL -SPC m g go to definition (robe-jump) -SPC m d go to Documentation -SPC m R reload environment (Rails) +Key binding | Description +---------------------|------------ +SPC m g g | go to definition (robe-jump) +SPC m h d | go to Documentation +SPC m s i | start REPL +SPC m s f | send function definition +SPC m s F | send function definition and switch to REPL +SPC m s r | send region +SPC m s R | send region and switch to REPL +SPC m s s | switch to REPL ### ruby-test-mode ruby-test-mode comes bundled with spacemacs, but this contribution adds a couple of useful keybindings: -SPC m t b run test file -SPC m t t run test at pointer +Key binding | Description +---------------------|------------ +SPC m t b | run test file +SPC m t t | run test at pointer + +### Rails (projectile-rails) + +#### Code Navigation + +Key binding | Description +-----------------------|------------ +SPC m r f a | find localization file +SPC m r f c | find controller +SPC m r f e | find environment file +SPC m r f f | find feature +SPC m r f h | find helper +SPC m r f i | find initializer +SPC m r f j | find javascript file +SPC m r f l | find library +SPC m r f m | find model +SPC m r f n | find migration +SPC m r f o | find log +SPC m r f p | find spec file +SPC m r f r | find rake task +SPC m r f s | find stylesheet file +SPC m r f t | find test +SPC m r f u | find fixture +SPC m r f v | find view +SPC m r f y | find layout +SPC m r f @ | find mailer +SPC m r g c | go to current controller +SPC m r g d | go to DB schema +SPC m r g e | go to DB seeds +SPC m r g h | go to current helper +SPC m r g j | go to current javascript +SPC m r g g | go to Gemfile +SPC m r g m | go to current model +SPC m r g n | go to current migration +SPC m r g p | go to current spec +SPC m r g r | go to routes +SPC m r g s | go to current stylesheet +SPC m r g t | go to current test +SPC m r g u | go to current fixture +SPC m r g v | go to current view +SPC m r g z | go to spec helper +SPC m r g . | go to file at point (faster but less powerful than SPC m g g) + +#### Refactoring + +Key binding | Description +-----------------------|------------ +SPC m r R x | extract region into partial + +#### RUN commands + +Key binding | Description +-----------------------|------------ +SPC m r c c | run rails generator +SPC m r i | start rails console +SPC m r s r | reload Rails project +SPC m r r : | run rake task +SPC m r x s | start rails server [enh-ruby-mode]: https://github.com/zenspider/enhanced-ruby-mode [robe-mode]: https://github.com/dgutov/robe [Rbenv]: https://github.com/sstephenson/rbenv [RVM]: https://rvm.io/ +[projectile-rails]: https://github.com/asok/projectile-rails +[haml-mode]: https://github.com/nex3/haml-mode +[feature-mode]: https://github.com/michaelklishin/cucumber.el +[rspec-mode]: https://github.com/pezra/rspec-mode diff --git a/contrib/lang/ruby/config.el b/contrib/lang/ruby/config.el index df57a9132516..c71c4ff905b1 100644 --- a/contrib/lang/ruby/config.el +++ b/contrib/lang/ruby/config.el @@ -15,3 +15,16 @@ (defvar ruby-version-manager nil "If non nil defines the Ruby version manager (i.e. rbenv, rvm)") +(defvar ruby-enable-ruby-on-rails-support nil + "If non nil we'll load support for Rails (haml, features, navigation)") + +(setq ruby/key-binding-prefixes + '( + ("mrg" . "goto") + ("mrf" . "find") + ("mrr" . "rake") + ("mrx" . "run") + ("mrc" . "compule/generate"))) + +(mapc (lambda (x) (spacemacs/declare-prefix (car x) (cdr x))) + ruby/key-binding-prefixes) diff --git a/contrib/lang/ruby/packages.el b/contrib/lang/ruby/packages.el index 8b3f7d8c86a1..e8703225195e 100644 --- a/contrib/lang/ruby/packages.el +++ b/contrib/lang/ruby/packages.el @@ -5,14 +5,16 @@ flycheck ruby-test-mode robe - yaml-mode - ) - "List of all packages to install and/or initialize. Built-in packages -which require an initialization must be listed explicitly in the list.") + yaml-mode)) (when ruby-version-manager (add-to-list 'ruby-packages ruby-version-manager)) +(when ruby-enable-ruby-on-rails-support + (add-to-list 'ruby-packages 'haml-mode) + (add-to-list 'ruby-packages 'feature-mode) + (add-to-list 'ruby-packages 'projectile-rails)) + (defvar ruby-excluded-packages '(ruby-mode)) (defun ruby/init-rbenv () @@ -41,15 +43,77 @@ which require an initialization must be listed explicitly in the list.") (defun ruby/init-flycheck () (add-hook 'enh-ruby-mode-hook 'flycheck-mode)) +(defun ruby/init-projectile-rails () + (use-package projectile-rails + :defer t + :init (progn + (add-hook 'projectile-mode-hook 'projectile-rails-on)) + :config (progn + (spacemacs|diminish projectile-rails-mode " ⇋" " R") + ; Code navigation + ;; Find files + (evil-leader/set-key "mrfa" 'projectile-rails-find-locale) + (evil-leader/set-key "mrfc" 'projectile-rails-find-controller) + (evil-leader/set-key "mrfe" 'projectile-rails-find-environment) + (evil-leader/set-key "mrff" 'projectile-rails-find-feature) + (evil-leader/set-key "mrfh" 'projectile-rails-find-helper) + (evil-leader/set-key "mrfi" 'projectile-rails-find-initializer) + (evil-leader/set-key "mrfj" 'projectile-rails-find-javascript) + (evil-leader/set-key "mrfl" 'projectile-rails-find-lib) + (evil-leader/set-key "mrfm" 'projectile-rails-find-model) + (evil-leader/set-key "mrfn" 'projectile-rails-find-migration) + (evil-leader/set-key "mrfo" 'projectile-rails-find-log) + (evil-leader/set-key "mrfp" 'projectile-rails-find-spec) + (evil-leader/set-key "mrfr" 'projectile-rails-find-rake-task) + (evil-leader/set-key "mrfs" 'projectile-rails-find-stylesheet) + (evil-leader/set-key "mrft" 'projectile-rails-find-test) + (evil-leader/set-key "mrfu" 'projectile-rails-find-fixture) + (evil-leader/set-key "mrfv" 'projectile-rails-find-view) + (evil-leader/set-key "mrfy" 'projectile-rails-find-layout) + (evil-leader/set-key "mrf@" 'projectile-rails-find-mailer) + ;; Goto file + (evil-leader/set-key "mrgc" 'projectile-rails-find-current-controller) + (evil-leader/set-key "mrgd" 'projectile-rails-goto-schema) + (evil-leader/set-key "mrge" 'projectile-rails-goto-seeds) + (evil-leader/set-key "mrgh" 'projectile-rails-find-current-helper) + (evil-leader/set-key "mrgj" 'projectile-rails-find-current-javascript) + (evil-leader/set-key "mrgg" 'projectile-rails-goto-gemfile) + (evil-leader/set-key "mrgm" 'projectile-rails-find-current-model) + (evil-leader/set-key "mrgn" 'projectile-rails-find-current-migration) + (evil-leader/set-key "mrgp" 'projectile-rails-find-current-spec) + (evil-leader/set-key "mrgr" 'projectile-rails-goto-routes) + (evil-leader/set-key "mrgs" 'projectile-rails-find-current-stylesheet) + (evil-leader/set-key "mrgt" 'projectile-rails-find-current-test) + (evil-leader/set-key "mrgu" 'projectile-rails-find-current-fixture) + (evil-leader/set-key "mrgv" 'projectile-rails-find-current-view) + (evil-leader/set-key "mrgz" 'projectile-rails-goto-spec-helper) + (evil-leader/set-key "mrg." 'projectile-rails-goto-file-at-point) + ;; Rails external commands + (evil-leader/set-key "mrcc" 'projectile-rails-generate) + (evil-leader/set-key "mri" 'projectile-rails-console) + (evil-leader/set-key "mrr:" 'projectile-rails-rake) + (evil-leader/set-key "mrxs" 'projectile-rails-server) + ;; Refactoring + (evil-leader/set-key "mrRx" 'projectile-rails-extract-region)))) + (defun ruby/init-robe () "Initialize Robe mode" (use-package robe :defer t :init (add-hook 'enh-ruby-mode-hook 'robe-mode) - :config (progn (evil-leader/set-key-for-mode 'enh-ruby-mode "mgg" 'robe-jump) - (evil-leader/set-key-for-mode 'enh-ruby-mode "mhd" 'robe-doc) - (evil-leader/set-key-for-mode 'enh-ruby-mode "mR" 'robe-rails-refresh) - (evil-leader/set-key-for-mode 'enh-ruby-mode "mi" 'robe-start)))) + :config (progn + (spacemacs|diminish robe-mode " ♦" " r") + ;; robe mode specific + (evil-leader/set-key-for-mode 'enh-ruby-mode "mgg" 'robe-jump) + (evil-leader/set-key-for-mode 'enh-ruby-mode "mhd" 'robe-doc) + (evil-leader/set-key-for-mode 'enh-ruby-mode "mrsr" 'robe-rails-refresh) + ;; inf-ruby-mode + (evil-leader/set-key-for-mode 'enh-ruby-mode "mi" 'robe-start) + (evil-leader/set-key-for-mode 'enh-ruby-mode "msf" 'ruby-send-definition) + (evil-leader/set-key-for-mode 'enh-ruby-mode "msF" 'ruby-send-definition-and-go) + (evil-leader/set-key-for-mode 'enh-ruby-mode "msr" 'ruby-send-region) + (evil-leader/set-key-for-mode 'enh-ruby-mode "msR" 'ruby-send-region-and-go) + (evil-leader/set-key-for-mode 'enh-ruby-mode "mss" 'ruby-switch-to-inf)))) (defun ruby/init-yaml-mode () "Initialize YAML mode" @@ -61,6 +125,11 @@ which require an initialization must be listed explicitly in the list.") :mode (("\\.\\(yml\\|yaml\\)\\'" . yaml-mode) ("Procfile\\'" . yaml-mode)))) +(defun ruby/init-feature-mode () + "Initialize Cucumber feature mode" + (use-package feature-mode + :defer t + :mode (("\\.feature\\'" . feature-mode)))) (defun ruby/init-ruby-test-mode () diff --git a/contrib/osx/packages.el b/contrib/osx/packages.el new file mode 100644 index 000000000000..cc15e22d04ee --- /dev/null +++ b/contrib/osx/packages.el @@ -0,0 +1,11 @@ +(defvar osx-packages + '( + pbcopy + ) + "List of all packages to install and/or initialize. Built-in packages +which require an initialization must be listed explicitly in the list.") + +(defun osx/init-pbcopy () + (use-package pbcopy + :if (not (display-graphic-p)) + :init (turn-on-pbcopy))) diff --git a/contrib/perspectives/README.md b/contrib/perspectives/README.md index f7ad59fcc3a6..35a40381d0ed 100644 --- a/contrib/perspectives/README.md +++ b/contrib/perspectives/README.md @@ -16,6 +16,22 @@ the macro `custom-persp` as follows: (... stuff to be done in the persp activating a major mode like twittering or whatever ...))) ``` +You can check out the layer's packages.el to see some examples of the +custom-perspectives. if you define something like this you may be able +to define a perspective with a layout. + +```elisp + (defun custom-persp/c++-project () + (interactive) + (custom-persp "c++" + (progn + (find-file "~/path/to/first/file.cpp") + (split-window-right) + (find-file "~/path/to/second/file.cpp") + (... do more stuff but be careful not to destroy the universe ...) + ))) +``` + Then you just need to add a keybinding to your custom persp, we use ` P o [your key here]` (Perspective open ) @@ -33,12 +49,17 @@ Perspective-mode defines keybindings under `C-x x` so we will take a more `spacemacsy` approach and define them under out perspective map ` P` + (projectile-persp-bridge helm-projectile) + (setq projectile-switch-project-action 'helm-projectile) + ## Persp-Projectile As the name suggests, this persp-projectile mode creates a new -perspective once you switch to a new project with ` p s` you can -enable it by putting `(require 'persp-projectile)` in your configuration files. +perspective once you switch to a new project with ` p s`. It must +be said that in the current implementation in order for this to work +you must first open a custom-perspective like `SPC P o e` to go to the +init.el in the spacemacs. If you are a helm person, and would rather use helm for projectile add this to your config as well: diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el index dc717b8c0b36..21a5fdb5c719 100644 --- a/core/core-configuration-layer.el +++ b/core/core-configuration-layer.el @@ -41,6 +41,13 @@ (expand-file-name (concat user-emacs-directory "private/")) "Spacemacs private layers base directory.") +(defconst configuration-layer-rollback-directory + (expand-file-name (concat spacemacs-cache-directory ".rollback/")) + "Spacemacs rollback directory.") + +(defconst configuration-layer-rollback-info "rollback-info" + "Spacemacs rollback information file.") + (defvar configuration-layer-layers '() "Alist of declared configuration layers.") @@ -377,9 +384,7 @@ If PRE is non nil then `layer-pre-extensions' is read instead of (spacemacs/replace-last-line-of-buffer (format "--> installing %s:%s... [%s/%s]" (ht-get configuration-layer-all-packages pkg) - pkg - installed-count - not-installed-count) t) + pkg installed-count not-installed-count) t) (unless (package-installed-p pkg) (if (not (assq pkg package-archive-contents)) (spacemacs/append-to-buffer @@ -392,6 +397,30 @@ If PRE is non nil then `layer-pre-extensions' is read instead of (redisplay)) (spacemacs/append-to-buffer "\n"))))) +(defun configuration-layer//get-packages-to-update (packages) + "Return a list of packages to update given a list of PACKAGES." + (when packages + (let (result) + (dolist (pkg packages) + ;; recursively check dependencies + (let* ((deps + (configuration-layer//get-package-dependencies-from-archive pkg)) + (update-deps + (when deps (configuration-layer//get-packages-to-update + (mapcar 'car deps))))) + (when update-deps + (setq result (append update-deps result)))) + (let ((installed-version (configuration-layer//get-package-version-string pkg)) + (newest-version (configuration-layer//get-latest-package-version-string + pkg))) + ;; (message "package - %s" pkg) + ;; (message "installed - %s" installed-version) + ;; (message "latest - %s" newest-version) + (unless (or (null installed-version) + (version<= newest-version installed-version)) + (add-to-list 'result pkg t)))) + (delete-dups result)))) + (defun configuration-layer/update-packages () "Upgrade elpa packages" (interactive) @@ -401,33 +430,122 @@ If PRE is non nil then `layer-pre-extensions' is read instead of "--> fetching new package repository indexes...\n") (redisplay) (package-refresh-contents) - (setq upgraded-count 0) - (dolist (pkg configuration-layer-all-packages-sorted) - ;; do not stop with errors on builtins and compilation fails - (ignore-errors - (let ((installed-version (configuration-layer//get-package-version pkg)) - (newest-version (configuration-layer//get-latest-package-version pkg))) - ;; (message "package - %s" pkg) - ;; (message "installed - %s" installed-version) - ;; (message "latest - %s" newest-version) - (unless (version<= newest-version installed-version) - (progn + (let* ((update-packages (configuration-layer//get-packages-to-update + configuration-layer-all-packages-sorted)) + (date (format-time-string "%y-%m-%d_%H.%M.%S")) + (rollback-dir (expand-file-name + (concat configuration-layer-rollback-directory + (file-name-as-directory date)))) + (upgrade-count (length update-packages)) + (upgraded-count 0) + (update-packages-alist)) + (if (> upgrade-count 0) + (progn + ;; (message "package to update: %s" update-packages) + (spacemacs/append-to-buffer + (format "Found %s package(s) to update...\n" upgrade-count)) + ;; backup the package directory and construct an alist + ;; variable to be cached for easy update and rollback + (spacemacs/replace-last-line-of-buffer + "--> performing backup of package to update...\n" t) + (redisplay) + (dolist (pkg update-packages) + (let* ((src-dir (configuration-layer//get-package-directory pkg)) + (dest-dir (expand-file-name + (concat rollback-dir + (file-name-as-directory + (file-name-nondirectory src-dir)))))) + (copy-directory src-dir dest-dir 'keeptime 'create 'copy-content) + (push (cons pkg (file-name-nondirectory src-dir)) + update-packages-alist))) + (spacemacs/dump-vars-to-file + '(update-packages-alist) + (expand-file-name (concat rollback-dir + configuration-layer-rollback-info))) + (dolist (pkg update-packages) (setq upgraded-count (1+ upgraded-count)) (spacemacs/replace-last-line-of-buffer - (format "--> updating packge %s:%s (%s)..." - (ht-get configuration-layer-all-packages pkg) - pkg - upgraded-count - )) + (format "--> updating package %s... [%s/%s]" + pkg upgraded-count upgrade-count) t) (redisplay) (configuration-layer//package-delete pkg) - (package-install pkg) - ))))) - (spacemacs/append-to-buffer - (format (concat (if (> upgraded-count 0) "\n" "") - "--> %s packages updated.\n") - upgraded-count)) - (redisplay)) + (condition-case err (package-install pkg) + ('error + (message (format + (concat "An error occurred during the update of " + "this package %s, retrying one more time...") + err)) + (package-install pkg))) + (when (version< emacs-version "24.3.50") + ;; explicitly force activation + (setq package-activated-list (delq pkg package-activated-list)) + (configuration-layer//activate-package pkg))) + (spacemacs/append-to-buffer + (format "\n--> %s packages updated.\n" upgraded-count)) + (spacemacs/append-to-buffer + "\nEmacs has to be restarted for the changes to take effect.\n") + (redisplay)) + (spacemacs/append-to-buffer "--> All packages are up to date.\n") + (redisplay)))) + +(defun configuration-layer//ido-candidate-rollback-slot () + "Return a list of candidates to select a rollback slot." + (let ((rolldir configuration-layer-rollback-directory)) + (when (file-exists-p rolldir) + (reverse + (delq nil (mapcar + (lambda (x) + (and (not (or (string= "." x) (string= ".." x))) x)) + (directory-files rolldir))))))) + +(defun configuration-layer/rollback (slot) + "Rollback all the packages in the given SLOT. +If called interactively and SLOT is nil then an ido buffers appears +to select one." + (interactive + (list + (if (boundp 'slot) slot + (let ((candidates (configuration-layer//ido-candidate-rollback-slot))) + (when candidates + (ido-completing-read "Rollback slots (most recent is first): " + candidates)))))) + (if slot + (let* ((rollback-dir (file-name-as-directory + (concat configuration-layer-rollback-directory + (file-name-as-directory slot)))) + (info-file (expand-file-name + (concat rollback-dir + configuration-layer-rollback-info)))) + (spacemacs/append-to-buffer + (format "\nRollbacking ELPA packages from slot %s...\n" slot)) + (load-file info-file) + (let ((rollback-count (length update-packages-alist)) + (rollbacked-count 0)) + (spacemacs/append-to-buffer + (format "Found %s package(s) to rollback...\n" rollback-count)) + (redisplay) + (dolist (apkg update-packages-alist) + (let* ((pkg (car apkg)) + (pkg-dir-name (cdr apkg)) + (elpa-dir (concat user-emacs-directory "elpa/")) + (src-dir (expand-file-name + (concat rollback-dir (file-name-as-directory + pkg-dir-name)))) + (dest-dir (expand-file-name + (concat elpa-dir (file-name-as-directory + pkg-dir-name))))) + (setq rollbacked-count (1+ rollbacked-count)) + (spacemacs/replace-last-line-of-buffer + (format "--> rollbacking package %s... [%s/%s]" + pkg rollbacked-count rollback-count) t) + (redisplay) + (configuration-layer//package-delete pkg) + (copy-directory src-dir dest-dir 'keeptime 'create 'copy-content))) + (spacemacs/append-to-buffer + (format "\n--> %s packages rollbacked.\n" rollbacked-count)) + (spacemacs/append-to-buffer + "\nEmacs has to be restarted for the changes to take effect.\n"))) + (message "No rollback slot available."))) (defun configuration-layer//initialize-packages () "Initialize all the declared packages." @@ -537,19 +655,33 @@ deleted safely." :initial-value t)) (not (ht-contains? configuration-layer-all-packages pkg))))) -(defun configuration-layer//get-package-dependencies (package) - "Return the dependencies alist for PACKAGE." - (let ((pkg (assq package package-alist))) +(defun configuration-layer//get-package-directory (pkg) + "Return the directory path for PKG." + (let ((pkg-desc (assq pkg package-alist))) + (cond + ((version< emacs-version "24.3.50") + (let* ((version (aref (cdr pkg-desc) 0)) + (elpa-dir (concat user-emacs-directory "elpa/")) + (pkg-dir-name (format "%s-%s.%s" + (symbol-name pkg) + (car version) + (cadr version)))) + (expand-file-name (concat elpa-dir pkg-dir-name)))) + (t (package-desc-dir (cadr pkg-desc)))))) + +(defun configuration-layer//get-package-dependencies (pkg) + "Return the dependencies alist for PKG." + (let ((pkg-desc (assq pkg package-alist))) (cond - ((version< emacs-version "24.3.50") (aref (cdr pkg) 1)) - (t (package-desc-reqs (cadr pkg)))))) + ((version< emacs-version "24.3.50") (aref (cdr pkg-desc) 1)) + (t (package-desc-reqs (cadr pkg-desc)))))) (defun configuration-layer//get-package-dependencies-from-archive (pkg) "Return the dependencies alist for a PKG from the archive data." - (let* ((arch (assq pkg package-archive-contents)) - (reqs (when arch (if (version< emacs-version "24.3.50") - (aref (cdr arch) 1) - (package-desc-reqs (cadr arch)))))) + (let* ((pkg-arch (assq pkg package-archive-contents)) + (reqs (when pkg-arch (if (version< emacs-version "24.3.50") + (aref (cdr pkg-arch) 1) + (package-desc-reqs (cadr pkg-arch)))))) ;; recursively get the requirements of reqs (dolist (req reqs) (let* ((pkg2 (car req)) @@ -557,28 +689,43 @@ deleted safely." (when reqs2 (setq reqs (append reqs2 reqs))))) reqs)) -(defun configuration-layer//get-package-version (package) - "Return the version string for PACKAGE." - (let ((pkg (or (assq package package-alist) - (assq package package--builtins)))) - (cond - ((version< emacs-version "24.3.50") (package-version-join (aref (cdr pkg) 0))) - (t (package-version-join (package-desc-version (cadr pkg))))))) - -(defun configuration-layer//get-latest-package-version (package) - "Return the version string for PACKAGE." - (let ((pkg (assq package package-archive-contents))) - (cond - ((version< emacs-version "24.3.50") (package-version-join (aref (cdr pkg) 0))) - (t (package-version-join (package-desc-version (cadr pkg))))))) - -(defun configuration-layer//package-delete (package) - "Delete the passed PACKAGE." +(defun configuration-layer//get-package-version-string (pkg) + "Return the version string for PKG." + (let ((pkg-desc (assq pkg package-alist))) + (when pkg-desc + (cond + ((version< emacs-version "24.3.50") (package-version-join + (aref (cdr pkg-desc) 0))) + (t (package-version-join (package-desc-version (cadr pkg-desc)))))))) + +(defun configuration-layer//get-package-version (pkg) + "Return the version list for PKG." + (let ((version-string (configuration-layer//get-package-version-string pkg))) + (unless (string-empty-p version-string) + (version-to-list version-string)))) + +(defun configuration-layer//get-latest-package-version-string (pkg) + "Return the version string for PKG." + (let ((pkg-arch (assq pkg package-archive-contents))) + (when pkg-arch + (cond + ((version< emacs-version "24.3.50") (package-version-join + (aref (cdr pkg-arch) 0))) + (t (package-version-join (package-desc-version (cadr pkg-arch)))))))) + +(defun configuration-layer//get-latest-package-version (pkg) + "Return the versio list for PKG." + (let ((version-string (configuration-layer//get-latest-package-version-string pkg))) + (unless (string-empty-p version-string) + (version-to-list version-string)))) + +(defun configuration-layer//package-delete (pkg) + "Delete the passed PKG." (cond ((version< emacs-version "24.3.50") - (package-delete (symbol-name package) - (configuration-layer//get-package-version package))) - (t (package-delete (cadr (assq package package-alist)))))) + (package-delete (symbol-name pkg) + (configuration-layer//get-package-version-string pkg))) + (t (package-delete (cadr (assq pkg package-alist)))))) (defun configuration-layer/delete-orphan-packages () "Delete all the orphan packages." diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index efe278bb1851..2d1f0c72f053 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -49,7 +49,7 @@ pressing ` m`") :weight normal :width normal :powerline-scale 1.1) - "Default font. The powerline-offset allows to quickly tweak the mode-line + "Default font. `powerline-scale' allows to quickly tweak the mode-line size to make separators look not too crappy.") (defvar dotspacemacs-command-key ":" @@ -60,6 +60,9 @@ with `:' and Emacs commands are executed with ` :'.") (defvar dotspacemacs-guide-key-delay 0.4 "Guide-key delay in seconds.") +(defvar dotspacemacs-helm-micro-state t + "Enable micro-state for helm buffer when pressing on TAB.") + (defvar dotspacemacs-fullscreen-at-startup nil "If non nil the frame is fullscreen when Emacs starts up (Emacs 24.4+ only).") diff --git a/core/core-funcs.el b/core/core-funcs.el index d80e04642082..8566d23806a0 100644 --- a/core/core-funcs.el +++ b/core/core-funcs.el @@ -46,4 +46,23 @@ and its values are removed." (push (pop tail) result)) (nreverse result))) +;; From http://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file +(defun spacemacs/dump-vars-to-file (varlist filename) + "simplistic dumping of variables in VARLIST to a file FILENAME" + (save-excursion + (let ((buf (find-file-noselect filename))) + (set-buffer buf) + (erase-buffer) + (spacemacs/dump varlist buf) + (make-directory (file-name-directory filename) t) + (save-buffer) + (kill-buffer)))) + +;; From http://stackoverflow.com/questions/2321904/elisp-how-to-save-data-in-a-file +(defun spacemacs/dump (varlist buffer) + "insert into buffer the setq statement to recreate the variables in VARLIST" + (loop for var in varlist do + (print (list 'setq var (list 'quote (symbol-value var))) + buffer))) + (provide 'core-funcs) diff --git a/core/core-load-paths.el b/core/core-load-paths.el index eb73901760ba..44d3d425d462 100644 --- a/core/core-load-paths.el +++ b/core/core-load-paths.el @@ -18,19 +18,21 @@ (defconst spacemacs-banner-directory (expand-file-name (concat spacemacs-core-directory "banners/")) "Spacemacs banners directory.") -(defconst user-home-directory - (expand-file-name "~/") - "User home directory (~/).") (defconst spacemacs-directory (expand-file-name (concat user-emacs-directory "spacemacs/")) "Spacemacs base directory.") (defconst spacemacs-cache-directory (expand-file-name (concat user-emacs-directory ".cache/")) "Spacemacs storage area for persistent files.") + +(defconst user-home-directory + (expand-file-name "~/") + "User home directory (~/).") (defconst pcache-directory (concat spacemacs-cache-directory "pcache")) (unless (file-exists-p spacemacs-cache-directory) (make-directory spacemacs-cache-directory)) + (defconst user-dropbox-directory (expand-file-name (concat user-home-directory "Dropbox/")) "Dropbox directory.") diff --git a/core/core-micro-state.el b/core/core-micro-state.el new file mode 100644 index 000000000000..67f40510554d --- /dev/null +++ b/core/core-micro-state.el @@ -0,0 +1,104 @@ +;;; -*- lexical-binding: t -*- +;;; core-micro-state.el --- Spacemacs Core File +;; +;; Copyright (c) 2012-2014 Sylvain Benner +;; Copyright (c) 2014-2015 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defmacro spacemacs|define-micro-state (name &rest props) + "Define a micro-state called NAME. + +NAME is a symbol. + +Available PROPS: + +`:on-enter BODY' + Evaluate BODY when the micro-state is switched on. + +`:on-exit BODY' + Evaluate BODDY when leaving the micro-state. + +`:bindings EXPRESSIONS' + One or several EXPRESSIONS with the form + (STRING1 SYMBOL1 :documentation STRING :exit SYMBOL) + where: + - STRING1 is a key to bound to the function SYMBOL1. + - :documentation STRING is a doc string (not used for now) + - :exit SYMBOL is either `:exit t' or `:exit nil', if non nil then + pressing this key will leave the micro-state (default is nil)." + (declare (indent 1)) + (let* ((func (spacemacs//micro-state-func-name name)) + (on-enter (spacemacs/mplist-get props :on-enter)) + (on-exit (spacemacs/mplist-get props :on-exit)) + (bindings (spacemacs/mplist-get props :bindings)) + (wrappers (spacemacs//micro-state-create-wrappers name bindings)) + (keymap-body (spacemacs//micro-state-fill-map-sexps wrappers))) + `(defun ,func () + ,(format "%s micro-state." (symbol-name name)) + (interactive) + ,@on-enter + (,(if (version< emacs-version "24.4") + 'set-temporary-overlay-map + 'set-transient-map) + (let ((map (make-sparse-keymap))) + ,@keymap-body map) ',(spacemacs//micro-state-create-exit-func + name wrappers on-exit))))) + +(defun spacemacs//micro-state-func-name (name) + "Return the name of the micro-state function." + (intern (format "spacemacs/%s-micro-state" (symbol-name name)))) + +(defun spacemacs//micro-state-create-wrappers (name bindings) + "Return an alist (key wrapper) for each binding in BINDINGS." + (mapcar (lambda (x) (spacemacs//micro-state-create-wrapper name x)) + bindings)) + +(defun spacemacs//micro-state-create-wrapper (name binding) + "Create a wrapper of FUNC and return a tuple (key wrapper BINDING)." + (let* ((wrapped (cadr binding)) + (wrapper-name (intern (format "spacemacs//%s-%s" (symbol-name name) + (symbol-name wrapped)))) + (wrapper-func (eval `(defun ,wrapper-name () + "Auto-generated function" + (interactive) + (when ',wrapped + (call-interactively ',wrapped)))))) + (append (list (car binding) wrapper-func) binding))) + +(defun spacemacs//micro-state-fill-map-sexps (wrappers) + "Return a list of `define-key' sexp to fill the micro-state temporary map." + (mapcar (lambda (x) `(define-key map ,(kbd (car x)) ',(cadr x))) + wrappers)) + +(defun spacemacs//micro-state-create-exit-func (name wrappers on-exit) + "Return a function to execute when leaving the micro-state. + +The returned function returns nil if the executed command exits the +micro-state." + (let ((func (intern (format "spacemacs//%s-on-exit" name)))) + (eval `(defun ,func () + "Function executed after each micro-state command." + (if (reduce (lambda (x y) (or x y)) + (mapcar (lambda (x) + (spacemacs//micro-state-stay? ',name x)) + ',wrappers) + :initial-value nil) + 't ,@on-exit nil))))) + +(defun spacemacs//micro-state-stay? (name wrapper) + "Return non nil if WRAPPER does not leave the micro-state." + (let ((micro-state-fun (spacemacs//micro-state-func-name name)) + (key (car wrapper)) + (func (cadr wrapper))) + (when (and (or (eq this-command micro-state-fun) + (eq this-command func)) + (equal (this-command-keys) (kbd key))) + (not (plist-get wrapper :exit))))) + +(provide 'core-micro-state) diff --git a/core/core-spacemacs-buffer.el b/core/core-spacemacs-buffer.el index 56a5229edb5a..78bbd4df2e3f 100644 --- a/core/core-spacemacs-buffer.el +++ b/core/core-spacemacs-buffer.el @@ -9,6 +9,9 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 +(defconst spacemacs-buffer-name "*spacemacs*" + "The name of the spacemacs buffer.") + (defun spacemacs//insert-banner () "Choose a banner and insert in spacemacs buffer. @@ -101,26 +104,33 @@ of size LOADING-DOTS-CHUNK-THRESHOLD." (defun spacemacs/insert-buttons () (goto-char (point-max)) - (insert " ") - (insert-button "Homepage" 'action + (insert " ") + (insert-button "[Homepage]" 'action (lambda (b) (browse-url "https://github.com/syl20bnr/spacemacs")) 'follow-link t) (insert " ") - (insert-button "Documentation" 'action + (insert-button "[Documentation]" 'action (lambda (b) (browse-url "https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.md")) 'follow-link t) (insert " ") - (insert-button "Gitter Chat" 'action + (insert-button "[Gitter Chat]" 'action (lambda (b) (browse-url "https://gitter.im/syl20bnr/spacemacs")) 'follow-link t) (insert " ") - (insert-button "Messages Buffer" 'action (lambda (b) (switch-to-buffer "*Messages*")) 'follow-link t) + (insert-button "[Update]" 'action + (lambda (b) (configuration-layer/update-packages)) 'follow-link t) (insert " ") - (insert-button "Spacemacs Folder" 'action (lambda (b) (find-file user-emacs-directory)) 'follow-link t) - (insert "\n") - (insert " ") - (insert-button "Update Spacemacs" 'action (lambda (b) (configuration-layer/update-packages)) 'follow-link t) + (insert-button "[Rollback]" 'action + (lambda (b) (call-interactively 'configuration-layer/rollback)) 'follow-link t) (insert "\n\n") ) +(defun spacemacs/goto-link-line () + "Move the point to the beginning of the link line." + (interactive) + (switch-to-buffer spacemacs-buffer-name) + (goto-char (point-min)) + (re-search-forward "Homepage") + (beginning-of-line)) + (provide 'core-spacemacs-buffer) diff --git a/core/core-spacemacs-mode.el b/core/core-spacemacs-mode.el index 0f38afbd4547..00e32e7f07c8 100644 --- a/core/core-spacemacs-mode.el +++ b/core/core-spacemacs-mode.el @@ -96,6 +96,8 @@ (car dotspacemacs-default-font))) ;; banner (spacemacs//insert-banner) + ;; dash is required to prevent a package.el bug with f on 24.3.1 + (spacemacs/load-or-install-package 'dash t) ;; bind-key is required by use-package (spacemacs/load-or-install-package 'bind-key t) (spacemacs/load-or-install-package 'use-package t) @@ -115,9 +117,11 @@ (defun spacemacs/initialize () "Create the special buffer for `spacemacs-mode' and perform startup initialization." - (require 'core-toggles) - (switch-to-buffer (get-buffer-create "*spacemacs*")) - (spacemacs-mode)) + (require 'core-toggle) + (require 'core-micro-state) + (switch-to-buffer (get-buffer-create spacemacs-buffer-name)) + (spacemacs-mode) + (add-hook 'after-init-hook 'spacemacs/goto-link-line)) (defun spacemacs//get-package-directory (pkg) "Return the directory of PKG. Return nil if not found." diff --git a/core/core-toggles.el b/core/core-toggle.el similarity index 95% rename from core/core-toggles.el rename to core/core-toggle.el index 66ef3cec4f89..c15840daf6ca 100644 --- a/core/core-toggles.el +++ b/core/core-toggle.el @@ -1,4 +1,4 @@ -;;; core-toggles.el --- Spacemacs Core File +;;; core-toggle.el --- Spacemacs Core File ;; ;; Copyright (c) 2012-2014 Sylvain Benner ;; Copyright (c) 2014-2015 Sylvain Benner & Contributors @@ -60,9 +60,9 @@ Avaiblabe PROPS: (evil-leader-for-mode (plist-get props :evil-leader-for-mode)) (global-key (plist-get props :global-key)) (def-key (plist-get props :define-key))) - (push (append (list name) (list :function wrapper-func) props) - spacemacs-toggles) `(progn + (push (append '(,name) '(:function ,wrapper-func) ',props) + spacemacs-toggles) ;; toggle function (defun ,wrapper-func () ,(format "Toggle %s on and off." (symbol-name name)) @@ -89,4 +89,4 @@ Avaiblabe PROPS: (when ,def-key (define-key (car ,def-key) (kbd ,(cdr def-key)) ',wrapper-func))))) -(provide 'core-toggles) +(provide 'core-toggle) diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index 089dfc96c6db..3a8ad5a3cfcd 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -32,7 +32,7 @@ leuven monokai zenburn) - ;; Default font. The powerline-offset allows to quickly tweak the mode-line + ;; Default font. `powerline-scale' allows to quickly tweak the mode-line ;; size to make separators look not too crappy. dotspacemacs-default-font '("Source Code Pro" :size 13 @@ -52,6 +52,8 @@ ;; Guide-key delay in seconds. The Guide-key is the popup buffer listing ;; the commands bound to the current keystrokes. dotspacemacs-guide-key-delay 0.4 + ;; Enable micro-state for helm buffer when pressing on TAB." + dotspacemacs-helm-micro-state t ;; If non nil the frame is fullscreen when Emacs starts up (Emacs 24.4+ only). dotspacemacs-fullscreen-at-startup nil ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. diff --git a/doc/DOCUMENTATION.md b/doc/DOCUMENTATION.md index ba5a23dd0d61..ebeb2ec5f5af 100644 --- a/doc/DOCUMENTATION.md +++ b/doc/DOCUMENTATION.md @@ -4,13 +4,17 @@ **Table of Contents** - [Spacemacs Documentation](#spacemacs-documentation) -- [Philosophy](#philosophy) - - [Easy](#easy) +- [Core Pillars](#core-pillars) + - [Mnemonic](#mnemonic) + - [Discoverability](#discoverability) - [Consistency](#consistency) - [Crowd-Configured](#crowd-configured) - [Goals](#goals) - [Screenshots](#screenshots) - [Who can benefit from this ?](#who-can-benefit-from-this-) +- [Update and Rollback](#update-and-rollback) + - [Update Spacemacs repository](#update-spacemacs-repository) + - [Update packages](#update-packages) - [Configuration layers](#configuration-layers) - [Structure](#structure) - [Extensions and Packages](#extensions-and-packages) @@ -33,8 +37,6 @@ - [Excluding packages](#excluding-packages) - [Hooks](#hooks) - [Custom variables](#custom-variables) -- [Using the package list buffer](#using-the-package-list-buffer) - - [Update all the packages](#update-all-the-packages) - [Main principles](#main-principles) - [Evil](#evil) - [States](#states) @@ -44,20 +46,31 @@ - [Differences between Vim, Evil and Spacemacs](#differences-between-vim-evil-and-spacemacs) - [The vim-surround case](#the-vim-surround-case) - [Evil plugins](#evil-plugins) -- [Color themes](#color-themes) -- [UI elements](#ui-elements) - - [Toggles](#toggles) - - [Mode-line](#mode-line) - - [Flycheck integration](#flycheck-integration) - - [Anzu integration](#anzu-integration) - - [Battery status integration](#battery-status-integration) - - [Powerline separators](#powerline-separators) - - [Minor Modes](#minor-modes) -- [Font](#font) +- [Spacemacs UI](#spacemacs-ui) + - [Graphical UI](#graphical-ui) + - [Color themes](#color-themes) + - [Font](#font) + - [Graphical UI Toggles](#graphical-ui-toggles) + - [Mode-line](#mode-line) + - [Flycheck integration](#flycheck-integration) + - [Anzu integration](#anzu-integration) + - [Battery status integration](#battery-status-integration) + - [Powerline separators](#powerline-separators) + - [Minor Modes](#minor-modes) - [Commands](#commands) + - [Vim key bindings](#vim-key-bindings) + - [Escaping](#escaping) + - [Executing Vim and Emacs ex/M-x commands](#executing-vim-and-emacs-exm-x-commands) + - [Leader key](#leader-key) - [Reserved prefix command for user](#reserved-prefix-command-for-user) - - [Escaping](#escaping) - - [Executing Vim, Emacs and shell commands](#executing-vim-emacs-and-shell-commands) + - [Helm](#helm) + - [Helm micro-state](#helm-micro-state) + - [Discovering](#discovering) + - [Key bindings](#key-bindings) + - [Available layers](#available-layers) + - [Available packages in Spacemacs](#available-packages-in-spacemacs) + - [New packages from ELPA repositories](#new-packages-from-elpa-repositories) + - [Toggles](#toggles) - [Navigating](#navigating) - [Point/Cursor](#pointcursor) - [Smooth scrolling](#smooth-scrolling) @@ -114,7 +127,7 @@ - [Lisp state Auto-switch commands](#lisp-state-auto-switch-commands) - [Lisp state commands](#lisp-state-commands) - [Lisp state Other commands](#lisp-state-other-commands) - - [Project management](#project-management) + - [Managing projects](#managing-projects) - [Registers](#registers) - [Errors handling](#errors-handling) - [Compiling](#compiling) @@ -140,44 +153,56 @@ -# Philosophy +# Core Pillars -Three core pillars: Easy, Consistency, "Crowd-Configured". +Four core pillars: Mnemonic, Discoverability, Consistency, "Crowd-Configured". -## Easy +If any of these core pillars is violated open an issue and we'll fix it. -`Spacemacs` organizes key bindings by mnemonic namespaces. If you are looking -for commands to operate on your buffer, they are right under SPC b, -if you want to operate on your project, then it is SPC p, etc... +## Mnemonic + +`Spacemacs` organizes key bindings by mnemonic namespaces as much as possible. +If you are looking for commands to operate on your buffer, they are right under +SPC b, if you want to operate on your project, then it is +SPC p, etc... + +## Discoverability `Spacemacs` comes with a dedicated major mode `spacemacs-mode`. Its goal is to -give useful feedbacks and perform maintenance tasks easily. +give useful feedbacks and easily perform maintenance tasks. + +It also comes with dedicated [helm][] sources to quickly find layers, packages +and more. + +[guide-key][] is enabled by default, it will display all the available key +bindings in a dedicated popup buffer. ## Consistency -Similar functionalities should have the same key binding. For instance if you are -looking for the definition of a function, the binding is SPC m g, -`m` for `major mode` and `g` for `go to`. And no matter what is the major mode it -should be the same binding. +Similar functionalities should have the same key binding no matter which major +is currently active. For instance if you are looking for the definition of a +function, the binding is SPC m g g, `m` for `major mode` and `g g` +for `go to thing at point`. No matter what is the major mode it is the same +binding to perform this action. -## Crowd-Configured +This is also true for the documentation, each configuration layer comes with +an associated `README.md` file with the same base layout. -This term does not really exist but I'm sure you know what it means. +The consistency core pillar is supported by a convention file: +[CONVENTIONS.md][] -This is the most powerful feature of `Spacemacs`. Anybody can submit upstream -his or her configuration layer and anybody can use it in a second by adding it -in a dotfile and by optionally filtering it (ie. removing unwanted packages). +## Crowd-Configured -So by cloning this repository you have a centralized place of configured -packages tuned by expert in their domain. And most importantly it should be -consistent with the whole experience provided by `Spacemacs`. +By defining an very light structure called `configuration layer` which is easy +to understand, `Spacemacs` makes it easy to contribute additional support. -If some packages are missing from core `Spacemacs` but they are present in -several contribution layers, chances are that they should be in core and we -can easily move them there. +The conventions in [CONVENTIONS.md][] make it easy to get the spacemacs way +and keep consistency even if there are a lot of contributions. -If any of this core pillars are violated open an issue and we'll try to fix -this. +`Crowd-configuration` is the most powerful pillar of `Spacemacs`. Anybody can +submit upstream improvements to configuration layers or a whole new one. Any +user can easily and directly use this layer by adding it to a list in a +dotfile. It is even possible to exclude _any_ unwanted packages. # Goals @@ -187,18 +212,18 @@ this. **keep your fingers on the home row** as much as possible, no matter the mode you are in. -- **Crowed-configured**: Contribute your own personal layer upstream and -everybody can use it. +- **Crowed-configured**: Contribute easily your improvements and new +configuration layers. -- **Minimalistic and nice UI**, keep your available screen space for what -matters: your text files. +- **Minimalistic and nice graphical UI**, keep your available screen space for +what matters: your text files. - **Mnemonic and consistent key bindings** which should be easier to learn -and remember. +and remember and be the same in all major modes. -- **Fast boot time**. +- **Fast boot time**, everything is lazy-loaded. -- **Lower the risk of RSI**. +- **Lower the risk of RSI** by heavily using the space bar instead of modifiers. - Hopefully, if it's not already the case: @@ -225,7 +250,8 @@ project.* next level by using Emacs. It is also a good fit for people wanting to **lower the [risk of RSI][RSI]** -induced by the default Emacs key bindings. +induced by the default Emacs key bindings (this is an assumption, there is no +official studies to prove this). Emacs users wanting to learn **a different way to edit files** or wanting to learn Vim key bindings. @@ -234,10 +260,31 @@ As a side note, if you are a programmer and you don't know Vim key bindings yet, I deeply recommend you to learn the basics as recommended in [Sacha Chua's one-page guide][sacha_guide] about how to learn Emacs. -# Configuration layers +# Update and Rollback + +For now it is still needed to update the `Spacemacs` repository manually. -_This part of Spacemacs is still in beta, the structure can change over -time. Refer to commit messages for more information in case of big changes._ +## Update Spacemacs repository + +Close Emacs and update the git repository: + + ```sh + git pull --rebase + git submodule sync; git submodule update + ``` + +**Note** It is recommended to update the packages first, see next session. + +## Update packages + +To update `Spacemacs` press RET (enter) or click on the link +`[Update]` in the startup page under the banner then restart Emacs. + +If anything goes wrong you should be able to rollback the update by pressing +RET or clicking on the `[Rollback]` link next to the `[Update]` +link and choose a rollback slot (sorted by date). + +# Configuration layers ## Structure @@ -474,54 +521,6 @@ Custom variables configuration from `M-x customize-group` which are automatically saved by Emacs are stored at the end of your `~/.spacemacs` file. -# Using the package list buffer - -The package list buffer is where you can selectively update one or all -packages installed in your configuration as well as browse for all -available packages in the different Elpa repositories. - -`Spacemacs` replaces the default package list buffer with [Paradox][]. -Paradox enhances the package list buffer with better feedbacks, new -filters and Github information like the number of stars. Optionally you -can also star packages directly in the buffer. - -**Important Note** Don't install new packages from the package list -buffer. If those packages are not referenced in a configuration layer -then `Spacemacs` will treat them as orphans during the next start of -Emacs and they will be deleted. - - Key Binding | Description ----------------------|------------------------------------------------------------ -/ | evil-search -f k | filter by keywords -f r | filter by regexp -f u | display only installed package with updates available -h | go left -H | show help (not accurate) -j | go down -k | go up -l | go right -L | show last commits -n | next search occurrence -N | previous search occurrence -o | open package homepage -r | refresh -S P | sort by package name -S S | sort by status (installed, available, etc...) -S * | sort by Github stars -v | `visual state` -V | `visual-line state` -x | execute (action flags) - -## Update all the packages - -To update all the buffers: -- open paradox: SPC a P -- filter packages (optional): f u -- update all: U x y - -When asked for old packages deletion hit `y`. - # Main principles ## Evil @@ -650,7 +649,27 @@ your `~/.spacemacs`): [evil-jumper][] | jump list emulation [NeoTree][neotree] | mimic [NERD Tree][nerdtree] -# Color themes +# Spacemacs UI + + `Spacemacs` has unique UI elements to make the Emacs experience even + more enjoyable: + - dedicated startup page with a mode aimed at easily managing `Spacemacs` + - dedicated helm source via `helm-spacemacs` + - a [guide-key][] buffer + +## Graphical UI + +`Spacemacs` has a minimalistic and distraction free graphical UI: +- custom [powerline][powerline] mode-line +[with color feedback](#flycheck-integration) according to current + [Flycheck][flycheck] status + - unicode symbols for minor mode lighters which appear in the mode-line + - [custom fringe bitmaps](#errors-handling) and error feedbacks for + [Flycheck][flycheck] + - [custom fringe bitmaps](../contrib/git/README.md#git-gutter-bitmaps) for + git gutter (available in [git layer][]) + +### Color themes By default, `Spacemacs` uses the theme [solarized-light][solarized-theme]. @@ -673,23 +692,74 @@ should be pretty rare. **Hint** If you are an `Org` user, [leuven-theme][] is amazing ;-) -# UI elements +### Font -`Spacemacs` has a minimalistic and distraction free UI with a lot of subtle -customization which make it unique compared to other kits: - - beautiful custom [powerline][powerline] mode-line - [with color feedback](#flycheck-integration) according to current - [Flycheck][flycheck] - status - - unicode symbols for minor mode lighters which appear in the mode-line - - [custom fringe bitmaps](#errors-handling) and error feedbacks for - [Flycheck][flycheck] - - [custom fringe bitmaps](../contrib/git/README.md#git-gutter-bitmaps) for [git gutter][] - - dedicated startup page with a mode aimed at easily managing `Spacemacs` +The default font used by `Spacemacs` is [source code pro][] by Adobe. It is +recommended to install it on your system. -## Toggles +To change the default font set the variable `dotspacemacs-default-font` in +your `.spacemacs` file. + +By default its value is: -Some UI indicators can be toggled on and off (toggles start with `t`): +```elisp +(setq-default dotspacemacs-default-font '("Source Code Pro" + :size 13 + :weight normal + :width normal + :powerline-scale 1.1)) +``` + +The properties should be pretty straightforward, it is possible to set any +valid property of a [font-spec][]: +- `:family` Font family or fontset (a string). +- `:width` Relative character width. This should be one of the symbols: + - ultra-condensed + - extra-condensed + - condensed + - semi-condensed + - normal + - semi-expanded + - expanded + - extra-expanded + - ultra-expanded +- `:height` The height of the font. In the simplest case, this is an integer in +units of 1/10 point. +- `:weight` Font weight—one of the symbols (from densest to faintest): + - ultra-bold + - extra-bold + - bold + - semi-bold + - normal + - semi-light + - light + - extra-light + - ultra-light +- `:slant` Font slant—one of the symbols: + - italic + - oblique + - normal + - reverse-italic + - reverse-oblique +- `:size` The font size—either a non-negative integer that specifies the pixel +size, or a floating-point number that specifies the point size. +- `:adstyle` Additional typographic style information for the font, such as +‘sans’. The value should be a string or a symbol. +- `:registry` The charset registry and encoding of the font, such as +‘iso8859-1’. The value should be a string or a symbol. +- `:script` The script that the font must support (a symbol). + +The special property `:powerline-scale` is `Spacemacs` specific and it is for +quick tweaking of the mode-line height in order to avoid crappy rendering of +the separators like on the following screenshot (default value is 1.1). + +_Ugly separators_ + +![ugly-separators](img/crappy-powerline-separators.png) + +### Graphical UI Toggles + +Some graphical UI indicators can be toggled on and off (toggles start with `t`): Key Binding | Description ----------------------|------------------------------------------------------------ @@ -706,7 +776,10 @@ Some UI indicators can be toggled on and off (toggles start with `t`): SPC t T | toggle tool bar SPC t U | toggle menu bar -## Mode-line +**Note** These toggles are all available via the `helm-spacemacs` interface +(press SPC fe h to display the `helm-spacemacs` buffer). + +### Mode-line The mode line is an heavily customized [powerline][powerline] with the following capabilities: @@ -738,14 +811,14 @@ Some elements can be dynamically toggled: SPC t m f | toggle the flycheck info SPC t m v | toggle the new version lighter -### Flycheck integration +#### Flycheck integration When [Flycheck][flycheck] minor mode is enabled, a new element appears showing the number of errors, warnings and info. ![powerline-wave](img/powerline-wave.png) -### Anzu integration +#### Anzu integration [Anzu][anzu] shows the number of occurrence when performing a search. `Spacemacs` integrates nicely the Anzu status by displaying it temporarily when `n` or `N` are @@ -753,7 +826,7 @@ being pressed. See the `5/6` segment on the screenshot below. ![powerline-anzu](img/powerline-anzu.png) -### Battery status integration +#### Battery status integration [fancy-battery][] displays the percentage of total charge of the battery as well as the time remaining to charge or discharge completely the battery. @@ -768,7 +841,7 @@ Critical | Red Note the these colors may vary depending on your theme. -### Powerline separators +#### Powerline separators It is possible to easily customize the `powerline separator` by setting the `powerline-default-separator` variable in your `~./spacemacs`. For instance @@ -805,7 +878,7 @@ powerline, here is an exhaustive set of screenshots: `zigzag` | ![powerline-zigzag](img/powerline-zigzag.png) `nil` | ![powerline-nil](img/powerline-nil.png) -### Minor Modes +#### Minor Modes `Spacemacs` uses [diminish][diminish] mode to reduce the size of minor mode indicators: @@ -833,81 +906,15 @@ display ASCII characters instead (may be useful in terminal). `Ⓦ` | W | whitespace mode `Ⓨ` | Y | [yasnippet][yasnippet] mode -# Font - -The default font used by `Spacemacs` is [source code pro][] by Adobe. It is -recommended to install it on your system. - -To change the default font set the variable `dotspacemacs-default-font` in -your `.spacemacs` file. - -By default its value is: - -```elisp -(setq-default dotspacemacs-default-font '("Source Code Pro" - :size 13 - :weight normal - :width normal - :powerline-scale 1.1)) -``` - -The properties should be pretty straightforward, it is possible to set any -valid property of a [font-spec][]: -- `:family` Font family or fontset (a string). -- `:width` Relative character width. This should be one of the symbols: - - ultra-condensed - - extra-condensed - - condensed - - semi-condensed - - normal - - semi-expanded - - expanded - - extra-expanded - - ultra-expanded -- `:height` The height of the font. In the simplest case, this is an integer in -units of 1/10 point. -- `:weight` Font weight—one of the symbols (from densest to faintest): - - ultra-bold - - extra-bold - - bold - - semi-bold - - normal - - semi-light - - light - - extra-light - - ultra-light -- `:slant` Font slant—one of the symbols: - - italic - - oblique - - normal - - reverse-italic - - reverse-oblique -- `:size` The font size—either a non-negative integer that specifies the pixel -size, or a floating-point number that specifies the point size. -- `:adstyle` Additional typographic style information for the font, such as -‘sans’. The value should be a string or a symbol. -- `:registry` The charset registry and encoding of the font, such as -‘iso8859-1’. The value should be a string or a symbol. -- `:script` The script that the font must support (a symbol). - -The special property `:powerline-scale` is `Spacemacs` specific and it is for -quick tweaking of the mode-line height in order to avoid crappy rendering of -the separators like on the following screenshot (default value is 1.1). - -_Ugly separators_ - -![ugly-separators](img/crappy-powerline-separators.png) - # Commands -Every sequences must be performed in `normal` mode. - -## Reserved prefix command for user +## Vim key bindings -SPC o is reserved for the user. Setting key bindings behind ` o` -is **guaranteed** to never conflict with `Spacemacs` defaults key bindings. +`Spacemacs` is based on `Vim` modal user interface to navigate and edit text. +If you are not familiar with the `Vim` way of editing text you can try the +[evil tutor][] lessons by pressing SPC h T at any time. -## Escaping +### Escaping `Spacemacs` uses [evil-escape][] to easily switch between `insert state` and `normal state` by quickly pressing the `fd` keys. @@ -940,19 +947,165 @@ to `jj` (it is important set the variable in `dotspacemacs/init`): sequences are not optimal for `Spacemacs`. Indeed it is very easy in `visual state` to press quickly `jj` and inadvertently escape to `normal state`. -## Executing Vim, Emacs and shell commands +### Executing Vim and Emacs ex/M-x commands Command | Key Binding :---------------:|------------------------------------------------------------------ Vim (ex-command) | `:` Emacs (M-x) | SPC : -Shell | SPC ! or just ! The command key `:` can be easily changed with the variable `dotspacemacs-command-key` of your `~/.spacemacs`. Note that is will change both `:` and `SPC :` bindings to keep the symmetry between Vim and Emacs. A good key can be `,` for example. +### Leader key + +On top of `Vim` modes (modes are called states in `Spacemacs`) there is a +special key called the leader key which once pressed gives a whole new +keyboard layer. The leader key is by default SPC (space). +It is possible to change this key with the variable `dotspacemacs-leader-key`. + +## Reserved prefix command for user + +SPC o is reserved for the user. Setting key bindings behind +` o` is **guaranteed** to never conflict with `Spacemacs` defaults key +bindings. + +## Helm + +`Spacemacs` is powered by [Helm][helm-link] which is an incremental completion +and selection narrowing framework. + +`Helm` is the central control tower of `Spacemacs`, it is used to manage +buffers, projects, search results, configuration layers, toggles and more... + +Mastering `Helm` will make you a `Spacemacs` power user. Do not hesitate +to read the [Helm documentation wiki][helm-doc]. + +### Helm micro-state + +`Spacemacs` defines a [micro-state](#micro-states) for `Helm` to make it +work like [Vim's Unit][] plugin. + +Initiate the micro-state with TAB while in a `Helm` buffer. Use +TAB again to exit from the micro-state (actually, like with any +micro-state, pressing any key that is not bound to the micro-state key map +will turn-off the micro-state). + +Key Binding | Description +--------------------|------------------------------------------------------------ +TAB | initiate the micro-state +1 | execute action 0 +2 | execute action 1 +3 | execute action 2 +4 | execute action 3 +5 | execute action 4 +6 | execute action 5 +7 | execute action 6 +8 | execute action 7 +9 | execute action 8 +0 | execute action 9 +a | switch to actions page +g | go to first candidate +G | go to last candidate +h | go to previous source +j | select next candidate +k | select previous candidate +l | go to next source +r | switch to actions page and leave the micro-state (useful combined with TAB) +t | mark current candidate +T | mark all candidates +v | execute persistent action +Any other key | leave the micro-state + +## Discovering + +### Key bindings + +An help buffer is displayed each time the SPC key is pressed in +normal mode. It lists the available key bindings and their associated +commands. + +By default the [guide-key][] buffer will be displayed quickly after the key +has been pressed. You can change the delay by setting the variable +`dotspacemacs-guide-key-delay` to your liking (the value is in second). + +### Available layers + +All layers can be easily discovered via `helm-spacemacs` accessible with +SPC f e h. + +The following helm actions are available: +- default: open the layer `README.md` +- 2nd: open the layer `packages.el` +- 3nd: open the layer `extensions.el` + +#### Available packages in Spacemacs + +`helm-spacemacs` also lists all the packages available in `Spacemacs`. +The entry format is `(layer) packages`. If you type `flycheck` you'll +be able to see all the layers where `flycheck` is used. + +The following helm actions are available on packages: +- default: go the package init function + +#### New packages from ELPA repositories + +`package-list-packages` is where you can browse for all available packages +in the different Elpa repositories. It is possible to upgrade packages +from there but it is not recommended, use the `[Update]` link on the +`Spacemacs` startup page instead. + +`Spacemacs` proposes to use [Paradox][] instead of `package-list-packages` +to list available ELPA packages. +Paradox enhances the package list buffer with better feedbacks, new +filters and Github information like the number of stars. Optionally you +can also star packages directly in the buffer. + +**Important Note 1** Installing a new package from `Paradox` won't make it +persistent. To install a package persistently you have to add it explicitly +to a configuration layer. + +**Important Note 2** Don't _update_ your packages from `Paradox` or +`package-list-packages` because they don't support the rollback feature of +Spacemacs. + + Key Binding | Description +---------------------|------------------------------------------------------------ +/ | evil-search +f k | filter by keywords +f r | filter by regexp +f u | display only installed package with updates available +h | go left +H | show help (not accurate) +j | go down +k | go up +l | go right +L | show last commits +n | next search occurrence +N | previous search occurrence +o | open package homepage +r | refresh +S P | sort by package name +S S | sort by status (installed, available, etc...) +S * | sort by Github stars +v | `visual state` +V | `visual-line state` +x | execute (action flags) + +### Toggles + +`helm-spacemacs` is also a central place to discover the available toggles. +To display only the toggles source press C-l (or in +[Helm micro-state](#helm-micro-state) you can press just l). + +The following helm actions are available on packages: +- default: toggle on/off + +**Tips** Use SPC h l to resume the last helm session. It is +handy to quickly toggle on and off a toggle. + ## Navigating ### Point/Cursor @@ -1806,7 +1959,7 @@ Key Binding | Function SPC m t b | execute buffer tests SPC m t q | ask for test function to execute -## Project management +### Managing projects Projects in `Spacemacs` are managed with [projectile][projectile]. In `projectile` projects are defined implicitly, for instance the root of a @@ -2009,8 +2162,10 @@ server is to use the following bindings: Key Binding | Description -------------------|------------------------------------------------------------ -SPC q q | Quit Emacs and kill the server +SPC q q | Quit Emacs and kill the server, prompt for changed buffers to save +SPC q Q | Quit Emacs and kill the server, lose all unsaved changes. SPC q s | Save the buffers, quit Emacs and kill the server +SPC q z | Kill the current frame ## Troubleshoot @@ -2073,6 +2228,7 @@ piece of software. Thank you to all the contributors and the whole Emacs community from core developers to elisp hackers! +[CONVENTIONS.md]: ./CONVENTIONS.md [evil]: https://gitorious.org/evil/pages/Home [evil-leader]: https://github.com/cofi/evil-leader [RSI]: http://en.wikipedia.org/wiki/Repetitive_strain_injury @@ -2081,7 +2237,8 @@ developers to elisp hackers! [keychords]: http://www.emacswiki.org/emacs/KeyChord [centered-cursor]: http://www.emacswiki.org/emacs/centered-cursor-mode.el [ace-jump]: https://github.com/winterTTr/ace-jump-mode -[helm]: https://github.com/emacs-helm/helm +[helm-link]: https://github.com/emacs-helm/helm +[helm-doc]: https://github.com/emacs-helm/helm/wiki [popwin]: http://www.emacswiki.org/emacs/PopWin [golden-ratio]: https://github.com/roman/golden-ratio.el [solarized-theme]: https://github.com/bbatsov/solarized-emacs @@ -2125,6 +2282,7 @@ developers to elisp hackers! [evil-numbers]: https://github.com/cofi/evil-numbers [evil-org-mode]: https://github.com/edwtjo/evil-org-mode [evil-lisp-state]: https://github.com/syl20bnr/evil-lisp-state +[Vim's Unit]: https://github.com/Shougo/unite.vim [git-gutter]: https://github.com/syohex/emacs-git-gutter-fringe [nose]: https://github.com/nose-devs/nose/ [nose.el]: https://github.com/syl20bnr/nose.el diff --git a/init.el b/init.el index cc6db98a71dd..588ea3882dc1 100644 --- a/init.el +++ b/init.el @@ -9,7 +9,7 @@ ;; This file is not part of GNU Emacs. ;; ;;; License: GPLv3 -(defconst spacemacs-version "0.52.1" "Spacemacs version.") +(defconst spacemacs-version "0.60.0" "Spacemacs version.") (defconst spacemacs-min-version "24.3" "Minimal required version of Emacs.") (defun spacemacs/emacs-version-ok () diff --git a/spacemacs/funcs.el b/spacemacs/funcs.el index 0cb14ca93961..4e5d9342afb7 100644 --- a/spacemacs/funcs.el +++ b/spacemacs/funcs.el @@ -603,19 +603,28 @@ kill internal buffers too." (spacemacs/frame-killer))) (defun spacemacs/save-buffers-kill-emacs () + "Save all changed buffers and exit Spacemacs" (interactive) (setq spacemacs-really-kill-emacs t) (save-buffers-kill-emacs)) (defun spacemacs/kill-emacs () + "Lose all changes and exit Spacemacs" (interactive) (setq spacemacs-really-kill-emacs t) (kill-emacs)) +(defun spacemacs/prompt-kill-emacs () + "Prompt to save changed buffers and exit Spacemacs" + (interactive) + (setq spacemacs-really-kill-emacs t) + (save-some-buffers) + (kill-emacs)) + (defun spacemacs/frame-killer () - "Exit server buffers and hide the main Emacs window" + "Kill server buffer and hide the main Emacs window" (interactive) - (server-edit) + (server-kill-buffer) (make-frame-invisible nil 1)) ;; A small minor mode to use a big fringe @@ -831,7 +840,9 @@ If ASCII si not provided then UNICODE is used instead." (defun spacemacs/open-in-external-app () "Open current file in external application." (interactive) - (let ((file-path (buffer-file-name))) + (let ((file-path (if (eq major-mode 'dired-mode) + (dired-get-file-for-visit) + (buffer-file-name)))) (cond ((system-is-mswindows) (w32-shell-execute "open" (replace-regexp-in-string "/" "\\" file-path))) ((system-is-mac) (shell-command (format "open \"%s\"" file-path))) diff --git a/spacemacs/keybindings.el b/spacemacs/keybindings.el index 71419ead6633..ac76dc082da7 100644 --- a/spacemacs/keybindings.el +++ b/spacemacs/keybindings.el @@ -202,8 +202,10 @@ :evil-leader "t SPC") ;; quit ----------------------------------------------------------------------- (evil-leader/set-key - "q s" 'spacemacs/save-buffers-kill-emacs - "q q" 'spacemacs/kill-emacs) + "qs" 'spacemacs/save-buffers-kill-emacs + "qq" 'spacemacs/prompt-kill-emacs + "qQ" 'spacemacs/kill-emacs + "qz" 'spacemacs/frame-killer) ;; window --------------------------------------------------------------------- (defun split-window-below-and-focus () "Split the window vertically and focus the new window." diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 1615061be76f..7c8d95bc1bee 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -660,7 +660,6 @@ which require an initialization must be listed explicitly in the list.") :init (progn (evil-jumper-mode t) - (setq evil-jumper-auto-center t) (setq evil-jumper-file (concat spacemacs-cache-directory "evil-jumps")) (setq evil-jumper-auto-save-interval 3600)))) @@ -1045,14 +1044,13 @@ which require an initialization must be listed explicitly in the list.") (use-package golden-ratio :defer t :init - (eval `(spacemacs|add-toggle - golden-ratio - :status golden-ratio-mode - :on (golden-ratio-mode) (golden-ratio) - :off (golden-ratio-mode -1) (balance-windows) - :documentation ,(concat "Dynamically resize the focused window " - "using the golden ratio.") - :evil-leader "tg")) + (spacemacs|add-toggle + golden-ratio + :status golden-ratio-mode + :on (golden-ratio-mode) (golden-ratio) + :off (golden-ratio-mode -1) (balance-windows) + :documentation "Dynamically resize the focused window using the golden ratio." + :evil-leader "tg") :config (progn (setq golden-ratio-extra-commands @@ -1149,11 +1147,12 @@ which require an initialization must be listed explicitly in the list.") (use-package helm :defer t :init - (setq helm-split-window-in-side-p nil - helm-bookmark-show-location t - helm-buffers-fuzzy-matching t - helm-always-two-windows t) - (evil-leader/set-key + (progn + (setq helm-split-window-in-side-p nil + helm-bookmark-show-location t + helm-buffers-fuzzy-matching t + helm-always-two-windows t) + (evil-leader/set-key dotspacemacs-command-key 'helm-M-x "bs" 'helm-mini "sl" 'helm-semantic-or-imenu @@ -1164,12 +1163,17 @@ which require an initialization must be listed explicitly in the list.") "rm" 'helm-all-mark-rings "fh" 'helm-find-files "fr" 'helm-recentf - "" 'helm-apropos - ) + "" 'helm-apropos) + (when dotspacemacs-helm-micro-state + (defcustom spacemacs-helm-navigation-micro-state-color + (face-attribute 'error :foreground) + "Background color of helm header when helm micro-state is activated." + :type 'color + :group 'spacemacs))) + :config (progn (helm-mode +1) - ;; alter helm-bookmark key bindings to be simpler (defun simpler-helm-bookmark-keybindings () (define-key helm-bookmark-map (kbd "C-d") 'helm-bookmark-run-delete) @@ -1204,6 +1208,49 @@ which require an initialization must be listed explicitly in the list.") ;;shell (evil-leader/set-key-for-mode 'shell-mode "mH" 'spacemacs/helm-shell-history) + (when dotspacemacs-helm-micro-state + (defun spacemacs//on-enter-helm-navigation-micro-state () + "Initialization of helm micro-state." + (set-face-attribute + 'helm-header nil + :background spacemacs-helm-navigation-micro-state-color) + ;; bind actions on numbers starting from 1 which executes action 0 + (dotimes (n 10) + (define-key helm-map (number-to-string n) + `(lambda () (interactive) (helm-select-nth-action + ,(% (+ n 9) 10)))))) + + (defun spacemacs//on-exit-helm-navigation-micro-state () + "Action to perform when exiting helm micor-state." + ;; restore helm key map + (dotimes (n 10) (define-key helm-map (number-to-string n) nil)) + ;; restore faces + (set-face-attribute + 'helm-header nil + :background (face-attribute 'header-line :background))) + + (spacemacs|define-micro-state helm-navigation + :on-enter (spacemacs//on-enter-helm-navigation-micro-state) + :on-exit (spacemacs//on-exit-helm-navigation-micro-state) + :bindings + ("" nil :exit t) + ("C-i" nil :exit t) + ("?" helm-help) + ("a" helm-select-action) + ("g" helm-beginning-of-buffer) + ("G" helm-end-of-buffer) + ("h" helm-previous-source) + ("j" helm-next-line) + ("k" helm-previous-line) + ("l" helm-next-source) + ("r" helm-select-action :exit t) + ("t" helm-toggle-visible-mark) + ("T" helm-toggle-all-marks) + ("v" helm-execute-persistent-action))) + + (define-key helm-map (kbd "C-i") 'spacemacs/helm-navigation-micro-state) + (define-key helm-map (kbd "") 'spacemacs/helm-navigation-micro-state) + (eval-after-load "helm-mode" ; required '(spacemacs|hide-lighter helm-mode))))) @@ -1695,10 +1742,9 @@ which require an initialization must be listed explicitly in the list.") (list (powerline-raw (spacemacs/window-number) state-face)) (list (powerline-raw (evil-state-property evil-state :tag t) state-face))) (if (and active anzup) - (list - (funcall separator-right state-face face1) - (powerline-raw (anzu--update-mode-line) face1) - (funcall separator-right face1 line-face)) + (list (funcall separator-right state-face face1) + (powerline-raw (anzu--update-mode-line) face1) + (funcall separator-right face1 line-face)) (list (funcall separator-right state-face line-face))) ;; evil state ;; (powerline-raw evil-mode-line-tag state-face) @@ -1713,35 +1759,34 @@ which require an initialization must be listed explicitly in the list.") (funcall separator-left line-face face1) (powerline-major-mode face1 'l) (powerline-raw " " face1) - (if active (funcall separator-right face1 line-face))) + (when active + (funcall separator-right face1 line-face))) ;; flycheck - (if (and active flycheckp) - (list - (powerline-raw " " line-face) - (powerline-raw (spacemacs|custom-flycheck-lighter error) - 'spacemacs-mode-line-flycheck-error-face) - (powerline-raw (spacemacs|custom-flycheck-lighter warning) - 'spacemacs-mode-line-flycheck-warning-face) - (powerline-raw (spacemacs|custom-flycheck-lighter info) - 'spacemacs-mode-line-flycheck-info-face))) + (when (and active flycheckp) + (list (powerline-raw " " line-face) + (powerline-raw (spacemacs|custom-flycheck-lighter error) + 'spacemacs-mode-line-flycheck-error-face) + (powerline-raw (spacemacs|custom-flycheck-lighter warning) + 'spacemacs-mode-line-flycheck-warning-face) + (powerline-raw (spacemacs|custom-flycheck-lighter info) + 'spacemacs-mode-line-flycheck-info-face))) ;; separator between flycheck and minor modes - (if (and active flycheckp spacemacs-mode-line-minor-modesp) - (list - (funcall separator-left line-face face1) - (powerline-raw " " face1) - (funcall separator-right face1 line-face))) + (when (and active flycheckp spacemacs-mode-line-minor-modesp) + (list (funcall separator-left line-face face1) + (powerline-raw " " face1) + (funcall separator-right face1 line-face))) ;; minor modes - (if (and active spacemacs-mode-line-minor-modesp) - (list - (spacemacs-powerline-minor-modes line-face 'l) - (powerline-raw mode-line-process line-face 'l) - (powerline-raw " " line-face))) + (when (and active spacemacs-mode-line-minor-modesp) + (list (spacemacs-powerline-minor-modes line-face 'l) + (powerline-raw mode-line-process line-face 'l) + (powerline-raw " " line-face))) ;; version control - (if (and active (or flycheckp spacemacs-mode-line-minor-modesp)) - (list (funcall separator-left (if vc-face line-face face1) vc-face))) - (if active (list (powerline-vc vc-face) - (powerline-raw " " vc-face) - (funcall separator-right vc-face face2)) + (when (and active (or flycheckp spacemacs-mode-line-minor-modesp)) + (list (funcall separator-left (if vc-face line-face face1) vc-face))) + (if active + (list (powerline-vc vc-face) + (powerline-raw " " vc-face) + (funcall separator-right vc-face face2)) (list (funcall separator-right face1 face2)))))) (defun spacemacs/mode-line-prepare-right () @@ -1750,6 +1795,7 @@ which require an initialization must be listed explicitly in the list.") (face1 (if active 'powerline-active1 'powerline-inactive1)) (face2 (if active 'powerline-active2 'powerline-inactive2)) (state-face (if active (spacemacs/current-state-face) face2)) + (nyancatp (and (boundp 'nyan-mode) nyan-mode)) (batteryp (and (boundp 'fancy-battery-mode) (symbol-value fancy-battery-mode))) (battery-face (if batteryp (fancy-battery-powerline-face))) @@ -1785,13 +1831,13 @@ which require an initialization must be listed explicitly in the list.") (spacemacs-powerline-new-version (spacemacs/get-new-version-lighter-face spacemacs-version spacemacs-new-version) 'r))) - (list - ;; percentage in the file - (powerline-raw "%p" line-face 'r) - (when active - ;; display hud only if necessary - (powerline-chamfer-left line-face face1) - (let ((progress (format-mode-line "%p"))) + (when (and active (not nyancatp)) + (let ((progress (format-mode-line "%p"))) + (list + ;; percentage in the file + (powerline-raw "%p" line-face 'r) + ;; display hud + (powerline-chamfer-left line-face face1) (if (string-match "\%" progress) (powerline-hud state-face face1)))))))) @@ -1799,8 +1845,11 @@ which require an initialization must be listed explicitly in the list.") (let* ((active (powerline-selected-window-active)) (face2 (if active 'powerline-active2 'powerline-inactive2)) (lhs (spacemacs/mode-line-prepare-left)) - (rhs (spacemacs/mode-line-prepare-right))) + (rhs (spacemacs/mode-line-prepare-right)) + (nyancatp (and (boundp 'nyan-mode) nyan-mode))) (concat (powerline-render lhs) + (when (and active nyancatp) + (powerline-render (spacemacs/powerline-nyan-cat))) (powerline-fill face2 (powerline-width rhs)) (powerline-render rhs))))