Articles Spacemacs

Playing Music in Spacemacs with EMMS

I have been thinking about playing songs inside Spacemacs for quite a while, so that I don’t have to leave my favorite editor for just playing music. After a small exploration I found out that all I need is to enable EMMS inside Spacemacs.


Spacemacs is a community-driven Emacs distribution. It is a new way to experience Emacs with a sophisticated and polished set-up focused on ergonomics, mnemonics and consistency.


Emms is the Emacs Multi-Media System. It tries to be a clean and small application to play multimedia files from Emacs using external players.

Getting EMMS

Clone the spacemacs-emms repo

cd into your .emacs.d/private directory. clone the repository into the emms folder

Add emms layer

Add emms as a layer to your dotspacemacs-configuration-layers to enable emms within Spacemacs.


EMMS is just like the back-end to setup a music system, and we need a front-end, a player to actually play the music. We are going to use mplayer as the player for EMMS. Add /usr/local/bin (where mplayer is located) to Emacs’s exec-path by adding the following line to your ~/.spacemacs file in the spacemacs/user-config section.

Setting up emms

The next thing you have to do is telling Spacemacs where Emms is located. Let’s say you have it in ~/.emacs.d/site-lisp/emms/lisp. So add this line to your .emacs:

You’ll then want to load Emms into Spacemacs. To achieve this you invoke the emms-standard setup function by adding the following lines.

Next you want to setup the file extensions you want to play with your player. And you specify mplayer as the emms simple player.

Final config (full)

This is the full configuration all you need to set up EMMS in Spacemacs.

That’s all, now you need to restart Spacemaces Spc-q-R

Bonus content (Some helpful key-bindings)

Adding emms to Spacemacs is not enough, you need some good key bindings to control your playback within Spacemacs. So I found this keybindings here and tweaked it a bit to my liking.

Playing music on Spacemacs startup

And if you are like me who wants to start playing music as soon as you open your text editor you can add this little function in your dotspacemacs/user-config



Using nvm with Spacemacs

nvm is a version manager for Node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: Unix, Mac OS, and Windows WSL. But most of the times, it is not properly identified by eshell in Spacemacs. Recently I found out a package called nvm.el by Johan Andersson.

Let’s walk you through how you can use nvm to choose different Node.js versions within Spacemacs on the fly.

Installing nvm

To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

Add nvm.el to Spacemacs

Since there is not a standard layer that comes with Spacemacs to support nvm, we are going to use the nvm.el package to do the same. First add the nvm package to dotspacemacs-additional-packages inside your .spacemacs file.

Set node version with nvm-use

Then once the nvm package is installed you can use the nvm-use function to set the appropriate node version inside your dotspacemacs/user-config function.

Please note that you need the absolute node version passed as the parameter value here, otherwise you will get error such as No such version

You can find out the list of installed node versions using nvm:

Choosing node versions on the fly

You can also make use of the nvm-use function to choose a particular node version. Using M-x nvm-use and then typing the node version something like “v12.7.0”



Setting up Prettier on Spacemacs

What is Spacemacs?

Spacemacs is a community-driven Emacs distribution. It is a new way to experience Emacs with a sophisticated and polished set-up focused on ergonomics, mnemonics and consistency.

What is Prettier?

Prettier is an opinionated code formatter which supports many languages and integrates with most editors. It can be installed through npm. It is recommended to install prettier globally in your system so that your editor integrates it properly and can be even made to auto formatted while saving your files.

How to setup prettier?

Make sure you installed prettier globally on your system before following the below steps.

If you are using yarn package manager, you can install it with:

Get the develop branch of Spacemacs. Usually it will be located in your home directory under ~/.emacs.d

Add the prettier layer to dotspacemacs-configuration-layers

Add/update javascript layer with prettier as the javascript-fmt-tool. We are going to set prettier as the value for this. This variable tells which is the formatter to format a JavaScript file. Possible values are ‘web-beautify’ and ‘prettier’.

Create a js2-mode-hook to run prettier while saving your files. We are using the js2-mode-hook here because that is the major mode in which javascript files are opened.

If you want to know what is the list of modes you are currently working in like the major mode and the minor mode names, you can use the describe-mode command to know the same. You can either use the shortcuts C-h m or <Space> h d m to run the describe-mode command.

We are going to make use of the before-save-hook for the same. It is a normal hook that is run before a buffer is saved to its file.



Mind maps in Spacemacs

This post is the second in the series of posts called PlantUML in Spacemacs. In this post we are going to see how we can create awesome Mind maps in Spacemacs using PlantUML. Mind map diagrams is the new feature recently rolled out in PlantUML and they are still in the beta* stage.

And you will find only minimal documentation in the official site related to mind map diagrams. This post gives you some additional bonus information such as adding colors to your mind map, creating high resolution mind maps and so on. You can find all these details in the Advanced Usage section in the bottom of the post.

If you want to know how to setup PlantUML in Spacemacs, please visit our previous post in this series.


Spacemacs is a community-driven Emacs distribution. It is a new way to experience Emacs with a sophisticated and polished set-up focused on ergonomics, mnemonics and consistency.

Mind maps

A mind map is a diagram used to visually organize information. A mind map is hierarchical and shows relationships among pieces of the whole. It is often created around a single concept, drawn as an image in the center of a blank page, to which associated representations of ideas such as images, words and parts of words are added. Major ideas are connected directly to the central concept, and other ideas branch out from those major ideas.


Although the term “mind map” was first popularized by British popular psychology author and television personality Tony Buzan, the use of diagrams that visually “map” information using branching and radial maps traces back centuries.

OrgMode syntax

Mind maps in PlantUML support the org-mode syntax also, which means you can easily create mind maps if you know understand the standard org-mode conventions for outlining. This will be an added advantage for people who are already familiar with Emacs and org-mode syntax.

Removing box

You can remove the box drawing using an underscore.

Arithmetic notation

You can use the following notation to choose diagram side.

Markdown syntax

This syntax is compatible with Markdown.

Changing diagram direction

It is possible to use both sides of the diagram.

Complete Example

Here is the complete example of a mind map with all the options which can be provided for your mind maps like caption, title, header, footer and legends.

Advanced Usage

So far we have only seen the examples provided by the official docs for Mind maps in PlantUML. Now we move into more advanced usage like colors, style and other stuff which will be very helpful for people instead of boring monotonously colored mind maps.

First we will jump into the colors section which is my favorite one, because I want my mind maps to be more colorful because that was the original idea proposed by Tony Buzan in his book called The Speed Reading Book.


With PlantUML, you can use specify a color using any one of the below methods:

  • with its standard name
  • using HEX value #AABBCC
  • using short HEX value #ABC

You can visit the official colors page in PlantUML for the list of color names you can use.

Changing background color

You can also change the entire background color of your mind maps other than the default white color using skinparam. skinparam is a command to change colors and fonts for the drawing.

You can use this command:

  • In the diagram definition, like any other commands,
  • In an included file,
  • In a configuration file, provided in the command line or the ANT task

Changing color of each node

If you want to change the color of each of the nodes in your mind map tree, you can do so by giving the color option within each node like below. Again you can use any of the three options such as color names, short and long HEX values.

Using color names:

Using HEX values:

Shorthand hex notation abbreviates 6-character RRGGBB CSS colors into 3-character RGB shorthand. So the color value ##FF6600 becomes #F60 in the shorthand notation.

Using short version HEX values:

Creating Monochrome Mind Map

If you are a person who cares about the environment, who don’t want to waste the color inks in your printer, you can choose to generate your mind maps in monochrome version like black/white with the monochrome skinparam command.

Handwritten style

If you want your mind maps to look realistic or you are not comfortable with computer-generated mind maps, or you want a natural feel to your mind maps so that they will look like they are hand drawn, then you need to configure your mind map generation with the handwritten skinparam.

By default this property will be false and if you want handwritten style mind maps you can set it to true.

Disabling Shadows

You can disable shadows from your mind map items with the option called shadowing. Again it is a skinparam command with a Boolean value. To disable shadows you need to explicitly set them to false.

Creating Print resolution Mind Map

By default, the default resolution for the image generated using PlantUML will be 72 which is the default resolution for digital media and the size of your mind maps will be determined by the content it has such as how big the tree is or how many number of nodes or leafs you have in it.

This option called dpi will come in handy if you want to take a print out of your mind maps and hang it in your favorite place so that you can take a look at them at your convenience.

DPI or Dots per inch is a measure of spatial printing or video or image scanner dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch.

For print material, the ideal resolution needed is 300 which you can set it via the dpi skinparam command.

Hope you enjoyed the post and it will help you to create awesome Mind maps from within your favorite editor. Please let me know your feedback or queries in the comments. Stay tuned for more in this series on other cool stuff you can do with PlantUML.