Since upgrading to Ubuntu 15.04, I’ve been living with systemd. I’ve been a Debian user mainly and was wary of the doom-and-gloom comments about systemd but actually, I’ve been a bit impressed with it so far. One thing that is undeniably easier with systemd is writing what System V init sytems called init scripts. In systemd they are known as service files.
Anyway, I usually run emacs as daemon and I had the idea that emacs could run as a systemd service! Immediately I fell into the trap that Umberto Eco describes:
there are two laws no human being can escape: the first idea that comes into a person’s mind will be the most obvious one; and, having had an obvious idea, nobody ever thinks that others may have had the same idea before.
So yes, there plenty of systmed emacs service files out there, but this one is mine.
The main difference from my config is that I’ve added the GPG_AGENT_INFO data so that emacs can uses GPG agent. I run keychain so my ssh-agent and gpg-agent are launched at login. There are probably nicer ways to pass the environment variables. This only works if you user ID is 1000, which it most likely will be if you are the first user. Just check the output of id -u and change the 1000 to whatever it says and it will probably work.
Lastly, I run this service as a user so I put the file in ~/.config/systemd/user/emacs.service and then did:
After a short hiatus, I’ve dusted off my BeagleBone Black (BBB) and started tinkering again. This time I replaced Angstrom with Ubuntu 13.04. Angstrom is a good distribution for the truly embedded projects, i.e. ones that require a small footprint and low-level IO, but for more application-level play, I think Ubuntu is a bit more user friendly.
The fortune utility remains one of my favorite programs (after all, it’s the name of this blog 🙂 ). The random quotes are a refreshing reminder not to take myself too seriously. But since I’ve been using byobu and GNU Screen, I rarely see the fortune cookie when my shell starts.
But then I realized what I really wanted was to see fortunes in Emacs. Fortunately, there is a package, fortune.el, included in Emacs which provides a front-end to the fortune program. When invoked with M-x fortune it throws the cookie into a new buffer and makes the new buffer active, which is slightly annoying.
What would be better would be to display the fortune in the mini-buffer. Well, with the following code in your .emacs (or personal directory in prelude 😉 ), M-x fortune-message will do just that. I’m considering submitting a patch, but there appears to be a bit of a procedure that I must review first.
Although, to get fortune.el to work I had to create a new writable fortune file as it was not satisfied using the read-only fortunes included with my distribution. And now I have cookies on demand (om nom nom…)
As I’m working more on the command line now, I’ve been trying to incorporate GNU Screen into my workflow. Some might argue it’s a bit redundant when using a window manager and a terminal that supports tabbed sessions, but I prefer not to deal with the tabs and it’s nice to attach to a screen and pick up where I left off.
And I was quite happy with GNU Screen. The only issue is that I had to change the default escape key \C-a to \C-\ since I heavily use \C-a in both Emacs, GNU readline and zsh to go to the beginning of the line. (Actually, I use prelude’ssmarter-move-beginning-of-line in Emacs.) Anyway, I quickly changed the escape to C-\ with this line in the .screenrc: escape ^\\\.
But then I stumbled onto Byobu, which provides a set of “window-dressings” for GNU Screen (and Tmux if you prefer). The default backend is Tmux but it can be easily changed to GNU Screen. All of the normal screen commands work as you’d expect but I like the extra mode lines on the bottom of the terminal. The bottom lines are bit flashy if you prefer the simplicity of GNU Screen, but the notifications can be customized for a slew of options including an option to add your own. So far I’m liking it 🙂
I finally gave in and forked Bozhidar Batsov’s Emacs bundle, Prelude. Initially I resisted using an out-of-the-box setup and tried to roll my own, but as I added more customizations I realized that I was slowly incorporating all of Prelude. Then I recognized that Prelude’s organization is much cleaner than my approach. It’s also very easy to fork the repo and add in personal touches as I’ve done here.
I’m working through some growing pains in the switch to Prelude from my spaghetti framework, but Bozhidar provided one line install scripts and I also like how all external packages are auto-downloaded from the package manager. If you are new to Emacs or you want to use a customization that 409 other forkers are using, try Prelude (must have Emacs 24 btw).
After viewing this slideshare on the Z shell (zsh), I decided to give it a spin. As recommended in the presentation, I went ahead and setup oh-my-zsh as well. At first, it was a bit awkward moving around, I mean the cd completions happen under the prompt! But then I cd‘d to a git directory and I don’t think I’m switching back. The git plugin has really nice command completion and the prompt itself shows the branch name. Continue reading “oh-my-zsh and fun with fonts”→
I’ve been playing around with my BeagleBone (BB) lately and it’s felt a bit, incomplete. It’s not because it has a faster and cheaper brother out there now either (BeagleBone Black (BBB)). It’s because it didn’t have Emacs installed! 🙂