Just because we need a lot of organizational support characters in your text files doesn’t mean you have to physically type them all.
In this tutorial, I present how to coordinate YAS for inserting dynamic templates and auto-insert for laying down context aware boilerplate for your new files.
In this old essay by Steve Yegge, he has a nice synthesis of static vs dynamic types, but also includes lots of interesting observations on Emacs (one would have to, since static vs. dynamic is almost as old a debate as emacs vs. vi. I liked this quote:
People have observed that Emacs has QWAN1: a nice, organic, comfortable rightness that fits like a pair of old jeans, or a snug warm chair in a library by a fire. It’s very right-brain stuff we’re talking about here, all touchy and feely and sensitive: exactly the kind of thing that programmers are often so lousy at, so it’s no wonder we don’t know the recipe for building it into our software. But unlike with UI design, software QWAN can only come from the programmer, who is playing the roles of interior decorator, head chef, and ergonomic consultant for all the programmer-users of said software.
Yesterday, I hosted a workshop on Literate Programming with org-mode for the PDX Emacs Hackers group. For everyone who couldn’t attend, I decided to expand it into a tutorial.
Warning: The examples are pretty lame.
PS: I think that I have finally figured out my RSS woes, so you shouldn’t have issues if you follow along.
Sure we should program as if we are writing for our team mates, but writing code for people is far less precise, for what might be readable to one, may be Perl code to another. This essay is simply the start conversations…
My daughter read a book about Ada Lovelace, which generated discussion about Alan Turing, which generated discussions about computers, which showed me how much kids not only don’t know about computers, but how unlikely they are to understand the guts underneath the icons.
Over the weekend, I completed my personal hack-a-thon on a project to demonstrate the depths of a computer, but in a simpler way. I may give it to my after school computer club that I run at a local middle school.
Pretty simple as my entire assembly language parser was written as a
Also, some teammates accidentally pushed a merge into one of our repositories at work, so I wrote shortcut instructions on keeping a clean, sequential Git history.
My current dayjobgig is building private clouds, and I’m surprised at how much context switching I need to do due to waiting for the bloody things to deploy.
Perhaps I need to invest in sword play.
Each week, I teach an after school class at my local Middle School. Today, while getting ready to present, I switched over to the browser tab containing my presentation and waited for the kids to take their seats.
One girl raised her hand and asked about a browser tab that showed Emacs Meetup. Clearly she wouldn’t care about some old programming editor, but I quickly summarized so I could get to the lesson. She said she uses it to play snakes. I told her that she probably uses something else, as Emacs is just some old editor. She insisted.
She quickly fired up Terminal on the Mac, typed
M-x snake… How…how…did you do…know that?
While I wrote a version of the snake game on my Apple ][ computer
when I was a kid, I didn’t know that any one had written one for
Emacs. Huh. Schooled in my editor by a kid.
She also typed in
She’s now my favorite.
I was asked to speak about Literate Devops at EmacsConf 2015. Due to work and family complications, I knew that I couldn’t physically attend. Wait, what year is this!? We should open a can of virtualization on this meatspace! The week before, we tested out the technology, and the Furies looked favorable upon me to remotely attend a live conference.
On Saturday, September 29th at 9:00am, I sat at my large monitor,
carefully arranged into windows of note taking Emacs, conference
twitter feeds, the
#emacsconf IRC channel … and of course, the
live video feed. “This is good,” I thought. No struggling in
uncomfortable seats to power small-screened laptops. I had all
the coffee I wanted, and just the way I wanted it too.
The first talk, by Nicolas Petton (who was also presenting remotely from France), illustrated immutable data structures and lazy sequencing from Clojure to Emacs Lisp. I thought, “This is going to be a great day!”
And then it happened. The power went out halfway through the second talk. Using the battery and data service on my cell phone, I went to the power utility’s web site. Their power outage map was covered in red. Estimated time began at 12:50… then 1:30… then 3:00…
I panicked and put out a plea for help. I quickly cross town to the first friend who responded, to give my talk perched in his living room.
My demonstration went well enough (I start at 1:27:00), but I was frazzled and the environment on my laptop was less than ideal. I received some very thoughtful compliments, however:
Your talk on Literate DevOps with Org-Mode was fantastic, and everyone was blown away by it. You had a really stressful day, but you gave the talk anyway for your fellow emacers, and everyone really enjoyed it. I really appreciate the effort it took to go through with the talk after your power cut out. An excerpt from IRC at the end of your talk:
The virtual clapping on IRC was pretty humorous:
| 5:41 PM | <tered> <clap clap> | 5:41 PM | — cestdiego *claps* | 5:41 PM | <python476> <fingerclap> | 5:41 PM | <Caine> great talk | 5:41 PM | <momerath> thanks Howard!! | 5:41 PM | <cestdiego> M-x clap | 5:41 PM | — offby1 stomps feet | 5:42 PM | — python476 flips IKEA desks
While the entire experience was interesting and enjoyable, I just wasn’t pleased, and felt my fellow Cultists in the Church of Emacs deserved better, so last night, I re-recorded myself. The audio is better, but it doesn’t have the questions and answers afterward.
See you all next year at EmacsConf 2016!
I’ve collected some table formatting code for OpenStack’s
command, and placed them in an Tower of Babel file that make
:post commands in org-mode files able to use them.
os-table function, in that file, converts the ASCII tables
from OpenStack’s CLI into
org-mode tables that I can export,
render, and feed into other code blocks as values. This feature
came in handy today…
For your own projects, you can commit to Git anytime, but one of the advantages of committing frequently is sharing code…either to your team mates or even to yourself. Best approach, however, is to commit a single bug or feature at a time, but use Gerrit to make sure that single commit is perfect.
Today I got around to playing around with the
wrap and the
org-mode source blocks, and updated my Literate Devops
essay, to help explain how I email my formatted notes directly to my
I have been in many meetings over the years where the presenter’s screen is more of a distraction. If you find yourself sharing your Macintosh desktop, may I suggest a couple of tips?
While I seldom leave Emacs, I do dabble on the shell from time to
time, and many colleagues ask about my terminal usage with
so I present my very-opinionated Getting Started Guide to TMux.
I swore I wouldn’t put any more examples of my literate devops
idea, but when I habitually used
org-mode during a recent
exploration of MySQL database instance, followed by emailing the
results to my teammates, I thought I would share. Read more…
On the Macintosh, the Finder can trigger a script due to any change
of a file in a directory (Apple calls these Folder Actions). I was
tempted to try and learn enough of this so I could
rsync all local
file changes to a system in the lab….
Seemed easier for me to just modify Emacs.
I’ve discovered the ultimate in Yak Shaving: Gnu Shaving!
Since I keep everything as org-mode formatted text files, I tried an experiment to directly convert the spreadsheet-like tables in my “tax notes” into a PDF mail for my accountant.
After reading the Wired article, Why We Should Design Some Things to Be Difficult to Use, I finally realize that Emacs should be hard to use, and we really should just give up changing it to be easier for new-comers.
This quote sums up my 20 year experience with Emacs:
[Fujifilm took] the controls out of deep menu functions and putting them back on chrome knobs that just beg to be twiddled.
I bought a Fujifilm X100 two years ago. It was the first piece of technology I’d bought in 15 years where I had to read the manual. Actually, I’ve read the manual at least four times. Now I’m taking the best pictures of my life, and I love it. By being hard to use, my X100 made me a better photographer.
Seems like Emacs users are now in some elite club where the hazing ritual amounts to learning Lisp. Consequently, I’ve decided to start signing all my Emacs-related correspondence with:
Yours in Emacs,
Maintaining servers falls into two phases: First, bang head until server works; second, capture effort into some automation tool like Puppet or Chef. Recently, I’ve been playing around with making the first phase closer to the second. For lack of a better word, I’m calling it literate devops.
Update 1: I finally got around to troubleshooting using Tramp references to execute code blocks on remote servers (even those behind firewards).
Update 2: Need another complete example? Check out my notes onsetting up IP Tables (and this org-mode file), where part of the file can be executed in the editor in order to see how my machines are configured, and the other part is a script that can be tangled to a machine and executed to reset to the firewall rules.
In Emacs, a key sequence is special key binding that uses multiple keys in a series. Since they require more effort to type, a sequence is chosen for functions that interrupt the normal editing flow.
Let’s explore some code associated with key sequences as well as write a macro to help make these more palatable.
I’m not saying the Emacs Way is objectively better, but you may find your work-style improved if you incorporate this way in your workflow. Let me demonstrate the way with a few examples.
I have played with a lot of window managers, and while many claim to
be unobtrusive and minimal, I really just want Emacs in full-screen
mode. So, I create an
.xinitrc file that contains only:
That’s right, folks, Emacs is my window manager.
Manipulating the commit history in Emacs isn’t as straight-forward as other Magit processes, so I thought I would share my notes.
Saw this video with Woz, where he describes how he wanted every trace on the original Apple board to be placed where the chips would be in the best position. He then said:
It had to be that artistically perfect to me, because it represents yourself when you do a great design.
Yeah, we can relate.
I like to publish only positive essays on my blog, and I’ve been conflicted about publishing my perspective on perching on Paul Graham’s shoulders to extend his essay on the Hundred-Year Language. So keep in mind that any snarkiness is my inept attempt at humor.
After many years of teaching Scratch at my local elementary school, I decided to start teaching an after-school session at my local Middle School. With diverse interests and abilities (not to mention, I’m considerably more busy during my day job), I thought I would try a new approach: nothing.
After all the fun I had this summer at the Open Source Bridge giving my talks on both Lisp/Clojure and Emacs, I figured that I would upload them to YouTube:
Now that my company is starting to use Gerrit, I decided to resurrect some old essays on Git usage.
Good Git practice encourages developers to create a history of useful commits. This essay is a ‘recipe’ for squashing multiple… uh… less than helpful commits into a single commit using the Git’s interactive rebase command.
This is a good technique if you start to use the Gerrit Review system.
As a professional software engineer, I’m stunned that put up with an editor that insists that you bind your fingers to someone else’s accepted practice.
Using functional programming techniques and the standard functions from Underscore to generate random numbers that favor particular numbers. Useful for picking colors.
Just learning? Well, this ancient editor can be modernized for someone without much memory already embedded in their fingertips.
You’re viewing the results.
Everything should be simple, open, and easy. Oh, and did I mention that I’m publishing directly from Emacs. Yeah, that is how old men do.
My original blog was originally written in Markdown. Once easy to
org-mode is much better. To convert or not convert them
all? I’ve done these, but most of my original essays will continue
to date themselves.
After a fun discussion with Mr. JJ Asghar, I wrote up a mini-tutorial on getting Emacs to do some of the heavy typing for you when you create a new file… you know, boilerplate needed when creating a new file of a particular type.
My tutorial covers and integrates the
auto-insert feature and the
yasnippet template system.
QWAN stands for Quality Without a Name, and reminds me of much of the thesis of the book, Zen and the Art of Motorcycle Maintenance. Regardless of what you think of the book, we often recognize quality without being able to define it.