Spacemacs - Using Magit With Github

By adding the git layer to Spacemacs you have the fully featured git client called magit. The github layer allows you to clone repositories from Github and to create, list, update and delete gists

Today I discovered Magithub which can create a new remote repository on Github from within Spacemacs, using the command line tool called hub.

Previously I opened a shell inside Emacs and ran the hub create command to create a new remote Github repository for a project. This worked, but not the same speed as having a feature built-in to Magit itself.

Read More

Kanban in Emacs Org-Mode to Get More Work Done

A Kanban board is a way to visualise your work and help you get more work done. You organise your work into tasks that need completeing and use the board to show the state of each card. Kanban encourages you to get work finished before starting new work.

The amazing Emacs Org-mode can be used to create a very fast and easy to use Kanban board that is with you where ever you are.

Update: Using Org-mode doesnt give me everything I want from a Kanban board, but it was an interesting exersice. For now, I am just sticking to my list view of a Kanban board.

Org-mode is built into Emacs / Spacemacs so there is no need to install any packages or layers for any of the following.

Read More

YASnippets for Faster Clojure Coding

Using snippets saves you time typing common coding structures and helps you avoid silly typos too. Simply typing in a snippet name and pressing M-/ or using M-x yas-expand gives you the full text & code structure from the snippet template.

For example, if you are defining a new function in Clojure then type defn and press M-/ to expand to the full definition structure, including all parens. Then use TAB to move through the structure to complete the name, doc-string, arguments and behaviour of the function.

Lets look at the built-in snippets that come with the Clojure layer in Spacemacs (and should be the default in Emacs YASnippet package).

Its easy to wrtie your own snippets for Clojure or any other language you use with Spacemacs / Emacs

Read More

Spacemacs - Adding Custom Snippets to Yasnippet

Using yasnippet saves time by avoiding the need to write boilerplate code and minimising other commonly typed content. YASnippet contains mode-specific snippets that expand to anything from a simple text replacement to a code block structure that allows you to skip through parameters and other sections of the code block. See YASnippet in action in this Emacs Yasnippet video.

To use a specific snippet simply type the alias and press M-/. For example, in html-mode typing div and pressing M-/ expands to <div id="▮" class="▯">▯</div> and places the cursor so you can type in the id name, then TAB to the class name, finally TAB to the contents of the div.

You can also combine yasnippets with autocompletion select snippets from the autocompletion menu.

Spacemacs has lots of snippets for most of the languages and modes it supports. However, YASnippets also uses a simple template system in plain text, so its pretty easy to learn. Lets look at how to add your own snippets with Spacemacs.

In regular Emacs, yasnippets expand funciton is usually bound to TAB, but that key is used already in Spacemacs so M-/ is used instead.
If you just want text replacement you can also use Emacs Abbrev mode.

Read More

Spacemacs for Clojure Development With Emacs - Configure Clojure

Adding the Clojure layer to Spacemacs provides great support for the language via CIDER, Clojure-mode, clj-refactor and lots of useful tools.

The Clojure layer also adds to the auto-completion layer, providing matches for anything currently defined in the current namespace. The yasnippets package also allows you to expand shortcuts for common Clojure code structures, eg. def, defn, let, require.

Read More

Spacemacs - First Impressions From an Emacs Driven Developer

Spacemacs is a community developed configuration for Emacs that makes it easier for anyone to use this amazing developer tool. Spacemacs is a well thought out way to apply the vast and diverse power of Emacs, making it more accessible especially to those who are used to using Vi.

Unless you’ve spent the last few years hand-crafting your own Emacs configuration, then I think you will enjoy Spacemacs. Here are some reasons why I love Spacemacs as an Emacs user.

Read More

Clean Git Commits With Emacs Magit

An effective way to have a clean and valuable commit history is to create the smallest valuable commit each time, with a descriptive commit message. This sounds obvious, but when you are in the midst of work things can get messy. Using Emacs Magit you can be highly selective as to what changes you include in each commit, down to individual characters.

This follows on from staging patches for cleaner commits with the command line, git add -p. Also see how to drive Git with Emacs and Magit for more background.

Read More

Custom Powerline Theme for Emacs Modeline

Continuing my modeline customisation with powerline, I wanted to add colour to match the Cyberpunk theme of Emacs Live. To do this I copied the default them and custmised it, adding colours and chaning the style of seperatr. Here is how I customised the powerline code to make my own theme.

See how I previously tweaked Emacs modeline with powerline, as this article carries on from that. My modeline also includes an earlier tweak for the minor modes.

Read More