Blogging Woes

I finally got yesterday’s post up by generating the HTML from my Org source file and then pasting it into the WordPress editor. I’m still not sure what’s happening. Very occasionally I can push a post with org2blog but most times it gets an error and hangs Emacs.

I recompiled org2bog and updated all the packages. Now I’m about to try to push this file. If I have to paste in the HTML again, I’ll add an update. In the meantime, if anyone else is seeing this problem, please leave a comment.

UPDATE 2016-09-21 14:06:08: OK, that worked but I’m suspicious that it might have been one of the rare exceptions. If this update pushes too, I’ll be more confident that things are back to normal.

Posted in Administrivia | Tagged | Leave a comment

The Five Second Rule

The New York Times has published an article on the five second rule.
You’ll be shocked—shocked—to learn that if you drop food on the floor
you get bacteria on it even if you pick it up in less than 5 seconds.
There are a couple of things I don’t understand.

First, why would anyone waste time and money studying this issue? It’s
not the first time someone’s looked at it and guess what: they arrived
at exactly the same conclusion last time. Is there anyone who doesn’t
realize that the 5 second rule is meant as a joke? Even as I child, I
understood that it was nonsense and just a humorous way of justifying
picking food off the floor and eating it.

The second thing I don’t understand is why the Times thought it was
worth devoting space to this. It’s not like we’ve run out of news.
It’s like those cloyingly cute stories we keep seeing on TV news: all
sugar, no nutrition.

As is often the case, Kontra has the final word on the matter

Posted in General | Tagged , | 1 Comment

Problem Posting

I’m have a problem posting today’s offering and I’ve run out of time to deal with it right now. I’ll try to get back to it later tonight.

If you’re reading this, it means that it’s not a problem with Emacs or org2blog so it must be something in the post itself.

Sorry.

UPDATE: have –> having

UPDATE: It looks like the problem is something with org2blog afterall. Every once in a while the post will work but most times not. I doing these updates from WordPress itself. Sigh.

Posted in Administrivia | Tagged | Leave a comment

Fundamentals

So true and so often disregarded

Hat tip to Karl Voit.

Posted in Programming | Tagged | Leave a comment

Emacs 25.1

As you surely know by now, Emacs 25.1 is out and available for download at the usual places. Check the Emacs download page for a mirror near you. They also have pointers to some precompiled binaries if you prefer that.

I built and installed the new version with no problems at all. The compile even seemed snappier than I remember. If you’re on OS X and want to use eww you need to use a slightly different configure line. I explained how to compile Emacs with eww on OS X for version 24.4 but the procedure is the same.

Meanwhile, Mickey has an excellent annotation of the NEWS file for the new version. You should be sure to give it a read to find out what’s new and changed. One thing I learned is that if you want dynamic modules you have to specify that on the configure line. I haven’t done that yet but if you want it be sure to add it.

I’m writing this with Emacs 25.1 but I just finished compiling and installing it so I haven’t done much with it yet. So far, though, everything seems fine. If you haven’t been living on the bleeding edge and using the development version, you can finally install the new Emacs.

Thanks to the many people under the excellent leadership of John Wiegley for this release. I know it was a big change and a lot of work.

Posted in General | Tagged | Leave a comment

Repeating a Command

Zachary Kanfer has a nice post on how to repeat a command with a single keystroke. A familiar instance of this is the old-style keyboard macro execution. After defining the macro, you can execute it with 【Ctrl+x e】 and then execute it additional times by simply typing 【e】. Kanfer wants to be able to do this for his own commands.

The trick is to use a transient keymap. Once you use a key in a transient keymap, the keymap goes away so the key will revert to its old meaning. This is a handy trick that’s useful in other circumstances too. For example, here is my code for invoking the ping utility in a full-frame buffer and then restoring the previous window configuration.

 1: (defun net-utils-restore-windows ()
 2:   "Restore windows and clean up after ping."
 3:   (interactive)
 4:   (kill-buffer (current-buffer))
 5:   (jump-to-register :net-utils-fullscreen))
 6: 
 7: (defadvice net-utils-run-program (around net-utils-big-page activate)
 8:   (window-configuration-to-register :net-utils-fullscreen)
 9:   (let ((buf ad-do-it))
10:     (switch-to-buffer buf)
11:     (delete-other-windows)
12:     (set-transient-map
13:       (let ((map (make-sparse-keymap)))
14:         (define-key map (kbd "q") 'net-utils-restore-windows)
15:         map))
16:     (message "Type \"q\" to restore other windows.")))

After the ping operation finishes and we’ve inspected the results, we want to restore the previous window configuration by typing 【q】. As shown on lines 1215, we do that by defining a transient map. After typing 【q】 the transient map disappears and 【q】 reverts to simply being a letter.

Posted in General | Tagged | 7 Comments

On Emacs Being an OS

Katherine Cox-Buday has a lovely 8-tweet long sequence in which she outlines how she uses Emacs to perform a periodic, tedious chore. It’s worth looking at to see if you can get some ideas from it. Here’s the last tweet in the sequence. (Click on the tweet to see the whole sequence.)

What struck me, though, is her remark that “So yes, it is an OS, but that’s a feature!” I’ve always taken that joke to be a comment about Emacs’ editor function not an indictment that you can reasonably compare Emacs to an OS. I’ve also taken it as a given that yes, of course, it’s a feature.

That may be because I yearn for a Lisp Machine and Emacs gives me some semblance of that. On the other hand, how can you not like the fact that Emacs can do so much? What do you think? Is the fact that Emacs is like an OS a bug or a feature? You already know my answer.

UPDATE [2016-09-16 Fri]: also → always.

Posted in General | Tagged | 3 Comments

Capturing Images with Org Mode

Back in January, I came across a post by Arne Babenhauserheide on capturing images into Org. It looked interesting but required Image Magick, which doesn’t play well with OS X1. I thought at the time that it would be pretty easy to adapt but I never got around to it.

Then the other day, I came across this reddit post that pointed to a Stack Overflow post on the same question. That bit of code handles both the Linux and OS X case so I thought I should install it and try it out. But then I saw a comment on the reddit post that pointed to abo-abo’s org-download over on GitHub.

Abo-abo’s code looks like it can be configured to handle Linux, OS X, or windows and it’s available on Melpa. Coming from abo-abo, it’s sure to receive any necessary updates so if you’re looking for a nice utility to grab images and insert them into Org files, you should give it a look.

Footnotes:

1

You have to use the X-server when running it on OS X.

Posted in General | Tagged , | Leave a comment

Abrams on Yasnippet

Howard Abrams over at howardism.org has posted a very nice tutorial on yasnippet. I learned a couple of things I didn’t know so you may find it worth a few minutes too.

First off, I was only dimly aware that you can bring up a template for a new snippet with 【Ctrl+c Ctrl+n】. What’s really nice is that the template is a snippet so you can tab through it filling in the fields like any other snippet. I always have to copy an existing snippet into my buffer to get all the boiler plate. This is a lot easier.

More importantly, Abrams shows us how to use yas-expand-snippet to treat any text as a snippet even if it hasn’t been added to the snippet collection. That may not seem like much but it turns out to be tremendously useful. Abrams gives an interesting use case where he combines auto-insert with yas-expand-snippet to fill in the boiler plate at the top of many programming files.

It’s a good tutorial and well worth taking a look at. It shows some of the power of yasnippet that you may not know about.

Posted in General | Tagged , | 1 Comment

Copying Text with a Mouse in OS X and Emacs

Ben Maughan over at Pragmatic Emacs has a nice tip for those of you using Emacs on OS X. It turns out that it’s easy to copy text to the kill ring with a mouse. I agree with Maughan that it’s not something I want because I try to avoid the mouse when I’m in Emacs but many people feel otherwise.

If you’d like to be able to easily copy text to the kill ring with a mouse, take a look at Maughan’s post to see how easy it is1.

Footnotes:

1

Hint: It’s a single line in your emacs.el.

Posted in General | Tagged | Leave a comment