Listing all branches of the current repository using Magit

At work, I have a git project with several branches, one for each feature or bug I'm currently working on. Once in a while I like to clean those up in order to keep my sanity. In the interest of performing that cleanup, I went looking for a command to list all branches in Magit. I found magit-show-refs-popup, which brings a pop-up window (or panel if you're not used to Emacs's terminology) that lists all refs. [Read More]

Capturing files

So far we've been using org-capture to capture notes. To do this we set a template and indicate in which file to put it. But we do this in a static way, by providing the exact place we want it as a hardcoded string. (setq org-capture-templates '( ("i" "Post idea" entry (file "~/Dropbox/wordpress_rake/IDEAS.org") "* %?\n") ("w" "Woodworking project" entry (file "~/Dropbox/org-files/woodworking_projects.org") "* TODO %?\n") )) When I first learned to use org-capture, the main use case I wanted for it was to write blog posts. [Read More]

org-capture templates

We've talked about how to configure org-capture and the types of captures we can create. On that second topic, we showed the default templates for each type of note. On this article, we'll focus on templates. To lay out a definition, a template is the chunk of text that will be inserted by default into our note. They work as I've shown on the first part of this series, by adding a string as the fourth parameter for a note type: [Read More]

org-capture note types

On the last post we learned how to use and do a basic configuration for taking notes using org-capture. Today we'll explore capture templates. If you recall, on the previous article, you can add a new type of note like this (setq org-capture-templates '( ("k" "Entry description" entry (file "/path/to/file.org") "Template") )) The inner most list represents the note and it has five elements Key The key used to invoke the template after calling org-capture Description The description that'll be shown for the note type Type The type of note Target Target location for where the note should be written to Template The template for the note. [Read More]

Capture ideas and more with org-capture

I've recently started using org-capture. I heard great things about it long ago but never dag in on what it was, until I recently watched Rainer König's series on Getting yourself organized with OrgMode, which I can't recommend enough. In this article I'll explain how I understand it and use it. I'll leave a trick on the sleeve for a future post. What is org-capture? org-capture is a way to take notes in Emacs in an unobstructive way. [Read More]

Automatically refreshing files in Emacs

I like my editor to auto-refresh the file I'm visiting if it has changed on disc. To give a simple example, I tend to run the pessimize command after installing dependencies for a project. This adds version numbers to the project's Gemfile. But I usually do this right after adding or removing a gem from the file, which means it's almost a fact that the file will be opened in a buffer on Emacs. [Read More]

One step back

I don't believe in new year's resolutions, that's why I didn't make any this year (or any other for that matter). But what I did do is make some mid-term plans. One of them was to start blogging every day, not forever, but for 12 weeks. I also started exercising every day and, after some forced time of, I also needed to make up some work time. I'm trying to blog every single day because I have a goal to finish a book and to do some teaching and I think that making a habit of writing will help me achieve those goals. [Read More]

Running RSpec specs on a Virtual Machine from the outside with emacs

As we saw on the previous article, we can run our specs using rspec-mode in emacs. But when working with code behind a wall, such as a VM environment, there's a catch. We write code on the host machine (in a shared directory), but the specs need to be run inside the virtual machine. This means that, for one, we need to modify the running command to previously access the target environment and on the other hand, there's a high probability that our directory structure differs from one side to the other. [Read More]

Rspec-mode

Here's the basic TDD workflow: Write a test Run the tests Write enough code to make it pass Run the tests Refactor the code Run the tests Repeat Give or take that's how it works. If you take a quick look at that list, you're running the test suite after every change you make either in the code or the suite itself. Even if you're not doing TDD (maybe test first or test after), running the test suite is a recurring process. [Read More]

Executing a command in a VirtualBox VM from the outside

At work, I regularly have to run scripts, tests or commands on a Virtual Machine. To do this, the common approach is to log in via SSH and then just run what I need to run. But sometimes, there are commands that need to be run repeatedly. VirtualBox allows us to do it from outside the machine by using vagrant ssh -c '<command>' <vm_name> which is a huge help. That's a great way to do it right there. [Read More]