Visualizing Your Undo Tree

I’ve been using undo-tree for a long time but mostly I just take advantage of it’s (very much improved) redo functionality. The other day, I saw this tweet

which inspired me to try to learn a bit more about undo-tree‘s features. The first thing, as suggested by the tweet is that you can step through the undo tree and your buffer will reflect the buffer state at that point in the undo tree. Once you get the buffer to the desired state, you can make that the current buffer or you can save that state to a register for later retrieval.

The main problem with undo-tree is that it’s feature rich and a bit hard to figure out how things work. Fortunately, there’s a long commentary at the head of the source file that serves as a tutorial. If you read through that once or twice you’ll have a good idea of what it can do.

What undo-tree really needs, I think, is a good video tutorial. Emacs Gifs has a short video on undo-tree-visualize but it doesn’t really show the power. I vaguely remember Magnar Sveen discussing it but I don’t think it was one of the Emacs Rocks videos. Mike Zamansky sometimes stops by Irreal; perhaps he’ll put it on his list of future Emacs videos. Sadly, I’m neither set up nor temperamentally suited to do the video so consider this a shameless attempt to get someone else to do the heavy lifting.

UPDATE [2016-10-06 Thu 19:42]: Fixed link to Emacs Gifs.

Posted in General | Tagged | 5 Comments

Some Helpful Reminders and Advice

If you’re running a tech company, Christopher Soghoian has a helpful reminder for you:

I’d just add that you can be sure that it will leak eventually and your company will take the hit. The government will continue as before hardly noticing the bump as it runs you over.

If you’re a Yahoo user, Edward Snowden has some useful advice for you:

Just as you should have stopped using Microsoft products when it became clear they couldn’t be trusted, you should dump Yahoo immediately. If you want an idea of how badly Yahoo betrayed your trust, take a look at this Ars Technica article. Say what you will about Google and Apple, both said they would have unequivocally refused such a request. Here’s Apple’s statement:

Posted in General | Tagged | Leave a comment

Problem Applications in eshell

If you’re like me and try to stay in Emacs as much as you can, you have probably tried eshell. It’s a nice Emacsy shell (Mickey has an excellent eshell tutorial you should check out) but can sometimes have problems with applications that do direct cursor addressing.

It turns out that it’s easy to teach eshell to run such applications in a term buffer so that things still work. The most common examples of such apps are less and top (at least for my workflow). All you need to do is tell eshell to treat these applications specially and everything works just fine.

The TL;DR is that you should read Mickey’s tutorial and set eshell-visual-commands to run problem applications in a term buffer.

UPDATE [2016-10-04 Tue 14:33]: At least in Emacs 25, it turns out that eshell-visual-commands is already defined to a reasonable default list. You may want to add to it for other problem applications that you discover.

UPDATE [2016-10-05 Wed 12:07]: shell –> eshell

Posted in General | Tagged | 3 Comments

Move Text

If you’re the type of writer who likes to move text around as you edit, you might find this Emacs package helpful.

I like how you can specify a region and then move the whole thing. Sure, you can highlight the region, kill it, and then yank it back at the new location but move-text lets you move it around at will and try different locations.

If you use Emacs strictly for coding, you may not find move-text useful but if you’re writing papers, reports, novels, or some other type of creative writing, it may be just what you need.

Posted in General | Tagged | Leave a comment

Searching for Words with eww

Wilfed Hughes offers an excellent tip

You can highlight a region in an Emacs buffer and invoke eww to search for the text in that region. I like it because I’m not forced out to a browser; everything stays in Emacs. The search engine is, of course, configurable. It will use whatever you have eww configured (via eww-search-prefix) to use.

Posted in General | Tagged | Leave a comment

Elisp Tutorial Videos

Daniel Gopar is working on a series of video tutorials for Elisp. It’s definitely for n00bs so if you want to understand the basics of Elisp, you might want to take a look. Right now there are 4 videos but Gopar says he will be adding others.

These videos won’t make you an Elisp master but they will give you enough background to continue your studies or to be able to understand simple Elisp and work on your init.el. If you find the tutorials useful you can subscribe and Youtube will let you know when others are added. Or, of course, you can just check back periodically.

Posted in General | Tagged , | Leave a comment

Org Babel and Applescript

Grant Rettke over at Wisdom and Wonder points to an interesting project that integrates Org Babel and Applescript. If you’re a Mac user and sometimes work with Applescript (or even if you want to play around with it) you should check out ob-applescript.org.

I don’t really know Applescript but I have figured out enough to allow me to grab links to the URL for the current page in Safari. If you want to play around with Applescript or try implementing little helper functions, this is a nice way to do it while taking notes on your progress.

Posted in General | Tagged , | Leave a comment

Reevaluating Local Variables

An odd but very useful feature of Emacs is (file) local variables. This allows you to specify certain Emacs variables either on the first line of a file or at the end in a special Local Variables block. Typical uses include specifying line lengths, indention amounts, and other formatting features and specifying how to compile the file so that the compile command will work correctly.

I described it as odd because I first encountered the Local Variables block before I became an Emacs user and I thought it was very odd to see that sort of thing in a C source file. Regardless, local variables can be very useful.

One problem with them is what happens if you change a value or when you first add them to a file. How do you get Emacs to recognize the new value? I always solved this problem by reloading the file with Ctrl+x Ctrl+v (find-alternate-file) but there are other, better ways.

Grant Rettke over at Wisdom and Wonder points to two methods for reevaluating local variables. One method re-runs the hooks associated with the file and the other method doesn’t. Hop on over and take a look; it will take you less than a minute.

Posted in General | Tagged | 1 Comment

Tramp and cd

I try to use ehsell as much as I can when I need to drop into the shell. That way, I stay in Emacs and still have the power of Emacs available. The other day in a post about something else, I saw this powerful use of cd mentioned.

You can cd into a directory on another machine like this

cd /ssh:aineko:org

This logs me into my iMac in the ~/org directory using tramp. Something like

cd /ssh:aineko:

is the same as connecting to aineko with SSH. If you need to log into the remote server as a different user, use something like

cd /ssh:different_user@aineko:

It’s not quite completely transparent but it does make remote machines seem like they’re mounted locally. Very nice. And powerful.

Posted in General | Tagged | Leave a comment

Is Emacs Really Hard to Learn/Use?

J. Pablo Fernández has another one of those posts that drive me crazy.
His thesis is that Emacs is hurting Clojure because it’s hard to
learn and use or something. It’s a silly, even risible, argument.
His complaint is almost exactly the same as Ray Dillinger’s that I
wrote about
almost four years ago.

Fernández says that Clojure n00bs are forced by the community to use
Emacs and that learning Emacs and Clojure at the same time is too
hard. Of course, no one is forced to use any editor in particular and
lots of Clojure folks are not Emacs users. It’s hard to see how Emacs
can have much effect on Clojure uptake one way or the other.

“But,” as Arlo Guthrie famously said, “that’s not what I came to tell
you about.” Rather, I’d like to address the notion that Emacs is hard
to learn and use. To be sure, every long term Emacs user has
experienced the joy of learning some new Emacs feature even after
years of use but that’s not the same thing as being hard to use.
Anyone who’s willing to spend an hour or two with the tutorial can
obtain a reasonable facility with Emacs.

There’s still a lot to learn, of course, but you can do basic editing
and if you leave the menus on, you can take advantage of many of the
advanced features as well. After a month or two of everyday use you’ll
be well on your way to journeyman status. That, at least, was my
experience. Really, folks, it’s just not that hard to learn.

Even more ridiculous is the idea that Emacs is hard to use. What
exactly is hard? Once you learn the common keystrokes, you can edit
quickly and easily from the keyboard. No messing with mice or menus,
just typing.

It’s fun to joke about the weird shape of the Emacs learning curve but
it’s still a joke. My suspicion is that most of the people whining
about how hard Emacs is to learn and use haven’t bothered to put in
the minimal effort required to become effective users.

Posted in General | 6 Comments