TIL: Something New About Ace Jump Mode

Regular readers know that I’ve been a huge fan of ace-jump-mode ever since I saw it demonstrated by Magnor Sveen in one of his celebrated Emacs Rocks! episodes. More recently, I’ve been using it all the time as a replacement for isearch to navigate within a buffer.

Since I started using ace-jump-mode instead of the Yegge approved isearch, my efficiency at jumping around a buffer has been increased significantly. Still, it doesn’t directly address a problem that I often have. When scrolling through a buffer with【Ctrl+v】 or【Meta+v】, I often find myself at the wrong edge of the display—at the top when I want the bottom, or vice versa. I generally solve that problem by picking a word on the desired line and using ace-jump-mode to jump directly to that word. It turns out, though, that ace-jump-mode has me covered for that case too. If I type【Ctrl+u Ctrl+u Hyper+a】 instead of【Hyper+a】, where【Hyper+a】is the sequence I use to invoke ace-jump-mode, each line is marked and I can jump to the desired line by typing the corresponding letter.

One could argue, I suppose, that that’s not any easier than picking a word on the desired line and jumping to that word but it feels more direct and somehow doesn’t take as many of my ever-diminishing brain cycles to invoke. If you aren’t already an ace-jump-mode user, you owe it to yourself to try it out. You’ll be amazed at how much more efficient your navigation becomes.

Posted in General | Tagged | 6 Comments

Org Mode Links

Artur Malabarba has a great post on using Org-mode links to link to anything. It’s a hugely powerful facility that, as Malabarba says, is mostly unknown. Head over to Endless Parentheses for the details.

I wasn’t going to write about this because I didn’t have anything useful to add but decided to mention it in case any Irreal readers missed Malabarba’s post. As I’ve said before, if you aren’t reading Endless Parentheses already, you should start right now. Really.

Posted in General | Tagged , | Leave a comment

John Kitchin on Using Org Mode

I’ve written about John Kitchin and his use of Emacs and org-mode several times (1, 2, 3, 4, 5). Somehow I missed his latest contribution but Sacha Chua had my back and mentioned it in her weekly review.

In his post, What we are using org-mode for, Kitchin recounts how about four years ago he started using Emacs again mainly for its org-mode functionality. His initial idea was to employ Org to manage his obligations—to use it as a GTD application. As he learned more about Org, he began integrating it into more and more of his work.

Kitchin describes how he uses org-mode to write books and papers, develop software in a literate programming way, give presentations, write blog posts, and interact with students about their classwork and assignments in his classes. He remarks that there is hardly any aspect of his work that is not touched by Org. This is an interesting post and definitely worth a read. It’s another example of how you can use Emacs and Org Mode in virtually every aspect of your work flow.

Update: What we using org-mode for → What we are using org-mode for

Posted in General | Tagged , | 5 Comments

Sacha Chats with Harry R. Schwartz

Sacha Chua has posted the latest in her series of Emacs Chats. This time it’s with Harry R. Schwartz. Schwartz is one of the organizers of Emacs NYC, which holds meetings and produces videos of the talks that the participants give. If you live in NYC and are an Emacs aficionado you should check out one of the meetings. If you don’t live in the city, the videos of the talks are available for streaming or download.

As always with Chua’s chats, I learned something useful. I find that I often want to move a line up or down but there’s no built in way of doing that. Schwartz has a couple of simple functions, move-line-up and move-line-down, that do that. You can find their source at GitHub.

The chat is 53 minutes so you’ll want to plan accordingly.

Posted in General | Tagged | Leave a comment

Moving from Scrivener to Org-mode

The estimable Org-mode maintainer Bastien Guerry tweeted a link to an interesting thread on the Org-mode mailing list.

The thread concerned advice for a writer wishing to try Emacs and Org-mode. What I found interesting is that the writer was currently using Scrivener. I’ve written before about my belief that Emacs can do everything Scrivener can. The thread doesn’t address that but it is interesting that some of the commenters moved from Scrivener to Emacs/Org1.

Writers, and everyone else for that matter, should use whatever tools they’re comfortable and productive with but the thread is another piece of evidence that there’s no reason that tool can’t be Emacs.

Footnotes:

1

Not everyone agrees. In this post, Charlie Stross discusses his use of Scrivener and his belief that it’s much better than Org mode. There’s additional discussion of this point in the comments so when you get to the post, search for Scrivener to see everything.

Posted in General | Tagged , | 2 Comments

A Third NSA Leaker?

According to Betteridge’s law the answer should be no but Bruce Schneier isn’t so sure. We’ve heard the speculation about a second leaker responsible for revealing the details of the TAO catalog, X-KEYSTORE rules, and the tapping of Angela Merkel’s cell phone but the latest revelations do not appear to come from either Snowden or the second leaker.

Schneier believes that these latest disclosures represent a separate, third stream of information. If so, perhaps it’s an indication that other insiders are disturbed by what the NSA is doing and taking what steps they can to end it as suggested by Charlie Stross. One can only hope.

Posted in General | Tagged | Leave a comment

Report from the Copyright Front

Rick Falkvinge has another excellent diatribe in his series on copyright and its abuses. This time he examines the common notion that without copyright, artists wouldn’t get paid and would therefore stop producing their art. That’s a powerful argument and one that, unexamined, is very easy to accept. Falkvinge has the figures on how much artists actually get from copyright and who the system is really serving. Definitely worth a read.

There are two other interesting things happening on the front. First, at long last, someone is calling Warner/Chappell’s bluff on their claimed ownership of a copyright on Happy Birthday and is suing them asking the court to return the hundreds of millions of dollars they collected in licensing fees. Almost every expert agrees that Happy Birthday has been out of copyright since the 1920s and, in view of its provenance, was probably never eligible for copyright in the first place. Warner, of course, charges a license fee that is less than the cost of a lawsuit and has been able to persuade users to pay it rather than seek relief in the courts. Those days could be coming to an end and Warner may have to return those fees. Whatever your thoughts about copyright, you’ll have to agree that this is long overdue.

The second piece of good news concerns Sherlock Holmes. All but 10 of the Sherlock Holmes stories have gone out of copyright but Doyle’s estate has claimed that Holmes was a complex character that couldn’t be dismantled into in-copyright/out-of-copyright parts. Author Leslie Klinger sued arguing that the Holmes character was no longer in copyright.

Last June, Judge Richard Posner of the 7th circuit ruled against the estate. This month, Posner ordered the estate to pay Klinger $30,000 in legal fees and described the estate’s actions as a form of extortion. Another excellent result. As I said, whatever your feelings about copyright, there’s no reason to support its abuse.

Posted in General | Tagged | 3 Comments

Gnus Guide

For a long time, I’ve had the urge to move my email processing to Emacs. That would make Email one more function that I wouldn’t have to leave Emacs to handle. I have found three candidate packages for this: mew, mu4e, and gnus.

Most everyone agrees that gnus is the 800 pound gorilla but that it is difficult to learn. Now Chen Bin has published an interesting post entitled Practical guide to use Gnus with Gmail. Even if you’re not using Gmail, the guide is still useful. The main differences are in configuration.

I like that he takes the tack of “here is the 5% of gnus that you need to get started and manage your day-to-day email chores.” That’s especially nice because gnus is built-in and all you need do is configure it to try it out. Of course, that configuration is far from trivial but Bin shows what you need to do to get going with Gmail. If you’re using another service, the EmacsWiki shows you how to configure POP or IMAP.

After covering configuration, Bin demonstrates how to read, send, reply to, and search your emails. If you’ve been thinking about trying out gnus or, like me, looking for a way to handle email from within Emacs, you should take a look at Bin’s post, especially if you’re using Gmail.

Posted in General | Tagged | 3 Comments

Org Mode Links to Git Commits

One of the nice things about writing with the Org-mode mark-up language is the ability to easily add links to external sources such as HTTP links or mail messages. But what about linking to a Git commit? Happily, there’s a Worg article that describes org-git-link.el, a contributed package shipped with Org-mode, that allows you to do just that.

A reasonable question is why anyone would want to do that. The article has an interesting use case. Suppose you are using Org to implement a laboratory notebook and that you have a link to an externally generated graph of some data. You add some notes about some aspect or another of the graph but later update the graph with new data. Now the link points to the new graph and the explanatory note is out of date. To prevent that, you commit the first graph and then link to the commit. Now if the graph is updated, the link still points to the original graph and the notes are still accurate.

The article covers how to form the links and the various formats they can take. It’s easy to imagine additional use cases for this facility so it’s well worth being familiar with it.

Posted in General | Tagged , | Leave a comment

Generating Graphs with Org and Dot

When I want to draw graph-like pictures I almost always use dot from the graphviz suite. The language is simple and it’s easy to generate it programmatically. Still, I don’t do it every day and so I always have to do a quick review of the language to draw my picture.

The other day, while I was looking for something completely different, I came across this wonderful tutorial by Karl Voit on Org’s Worg site. In it he shows how to leverage a bit of Elisp code from Rick Frankel to produce dot diagrams from a couple of tables. The idea is that you list the nodes of the graph in one table and the edges in the other and the code runs dot for you to produce the PNG file.

The examples that Voit uses doesn’t do his tutorial justice because they involve producing flow charts and who wants to do that? Not me, at least. I almost always either want a tree of some sort or perhaps a state diagram. So here are a couple of examples that show how easy it is to use the code and techniques he describes to draw those objects. Be sure to read the tutorial so you can follow along with the examples.

 1: (org-babel-execute:dot
 2:  (concat
 3:   "digraph {\n"
 4:   (when horiz "rankdir=LR;\n")       ;up-down or left-right
 5:   (mapconcat
 6:    (lambda (x)
 7:      (format "%s [label=\"%s\" shape=%s style=\"filled\" fillcolor=\"%s\"]"
 8:              (car x)
 9:              (nth 1 x)
10:              (if (string= "" (nth 2 x)) "box" (nth 2 x))
11:              (if (string= "" (nth 3 x)) "none" (nth 3 x))
12:              )) nodes "\n")
13:   "\n"
14:   (mapconcat
15:    (lambda (x)
16:      (format "%s -> %s [taillabel=\"%s\"]"
17:              (car x) (nth 1 x) (nth 2 x))) graph "\n")
18:   "}\n") params)

I’ve reproduced the code here because I made a small tweak in line 4 so that I can produce both horizontal and vertical layouts with the same code block. With the code in the tutorial you have to uncomment code to get the horizontal layout. To use my code you should change the HEADER line to

#+HEADER: :var nodes=simple-tree-nodes graph=simple-tree-graph horiz='nil

for vertical layout or

#+HEADER: :var nodes=simple-tree-nodes graph=simple-tree-graph horiz='t

for horizontal layout. The horiz variable can be changed in #+CALL statements so that you can have both modes in the same file.

Here’s a simple tree with a blue root, white internal nodes, and yellow leaves.

Table 1: simple-tree-nodes
node label shape fillcolor
a A ellipse blue
b B ellipse none
c C ellipse none
d D ellipse yellow
e E ellipse yellow
f F ellipse yellow
g G ellipse yellow

Table 2: simple-tree-graph
from to label
a b  
a c  
b d  
b e  
c f  
c g  

simple-graph.png

As a second example, here’s the transition diagram for a simple state machine that recognizes C-style comments. It uses the #+CALL statement

#+CALL: graph-from-tables[:file ~/org/blog/state-machine.png](nodes=state-nodes[2:-1],graph=state-edges[2:-1],horiz='t) :results file

Table 3: state-nodes
node label shape fillcolor
start START ellipse green
b1 BEGIN-1 ellipse none
c IN-COMMENT ellipse none
e1 END-1 ellipse none
d DONE ellipse red

Table 4: state-edges
from to label
start start ANY
start b1 /
b1 start ANY
b1 c *
c c ANY
c e1 *
e1 c ANY
e1 d /

state-machine.png

I love how simple all this is. Just include the code (non-exported, of course) into your buffer and write the two tables and you’ve got yourself a nice diagram without having to fuss with the dot language.

Posted in General | Tagged , | 3 Comments