Iedit

Mbork has posted a sequel to his highlighting post that I wrote about before. This time he discusses iedit. Mbork says you can think of it as Hi Lock mode with the added capability of editing all the highlighted entries at once. I usually think of it as an alternative to Magnar Sveen’s multiple cursors.

If you want to see the power of iedit take a look at abo-abo’s refactoring workflow. The basic idea is to use rgrep to find every occurrence of a variable, enable editing of the grep output with wgrep, and then change every occurrence of the variable (in the grep output) with iedit. Abo-abo says that he thinks of iedit as a drop in replacement for occur and query-replace.

As mbork mentions in his post, the selection criteria in iedit are very flexible and require a bit of care. Mostly this is because iedit will place symbol bounds around the current symbol. The easy way to get all matching strings is to just mark the string you want to match.

It also behaves differently when given prefix arguments. You can, for example, restrict its action to the current function or cause it to use the same occurrence as the last time it was used in the current buffer. See the built-in help for the details.

Posted in General | Tagged | Leave a comment

The Heisenberg Release Uncertainty Principle

Steve Purcell formulates a fundamental law of software engineering

Posted in General | Tagged , | Leave a comment

Why Helm

Sean Irby has posted his thoughts on why you should be using helm. Irby argues that helm not only makes navigating the Emacs UI easier but also assists in learning Emacs in much the same way that spelling correctors help you learn correct spelling.

Helm is, at heart, an Elisp programming framework that allows you to easily add UI elements to a project. You can see this in Kris Jenkins’ brilliant video on building a Spotify client. But it also comes with a number of built-in and add-on functions that can be accessed at the user level.

It’s these built-in and other user-level helm extensions that Irby writes about. He mentions the built-in functions

  • helm-apropos (apropos with fuzzy matching)
  • helm-find-file (ido-like functionality)
  • helm-M-x (smex-like functionality)
  • helm-google (call google from Emacs)

and the helm-extentions

  • helm-dash (use Dash docsets from within Emacs)
  • elevator (a REPL for data transformation)
  • helm-descbinds (describe currently active bindings)
  • helm-proectile (a Helm interface to the Projectile package)

Irby makes a good case for at least giving Helm a try. If you write your own Elisp, Helm can be especially useful but even as a user it offers at lot.

Posted in General | Tagged | 4 Comments

Highlighting

Mbork has another nice post on some of the lessor known corners of Emacs. This time it’s about highlighting words in a buffer. There are lots of ways of doing that, of course, but they have subtle differences that make them suitable for different tasks.

The most common such command is isearch. It’s what most people use all the time for searching or even navigation. As mbork points out, isearch highlights the target word only until you exit the command, which may not be what you need.

The second command is occur. I use this all the time but as mbork says many people are probably not familiar with it. What I didn’t know was that you can edit the original buffer directly from the occur buffer and you can enable a mode where the original buffer will display the line that the point is on in the occur buffer. See mbork’s post for the details.

Finally, there is highlight-regexp, which allows you to highlight any expression matching a regular expression. I’ve only used that command once. I tried it and couldn’t figure out how to turn it off short of killing the buffer. It turns out to be easy, of course, but that was back when I was a n00b and didn’t even know enough to bring up the help buffer for it.

Take a couple of minutes to read mbork’s post. You might learn something you didn’t know.

Posted in General | Tagged | Leave a comment

Still Think You Have Nothing to Hide?

How about sexually explicit pictures from your webcam? Would you like to keep those private? As they point out in the article, the GCHQ capturing random pictures from the webcam is eerily reminiscent of the telescreens in Orwell’s 1984. But hey, you have nothing to hide.

Posted in General | Tagged | Leave a comment

Premature Optimization and Bugs

All developers are aware of Knuth’s warning about the dangers of premature optimization. Yesterday, I ran across two posts that nicely illustrate those dangers in the wild.

The first is a tweet that explains why Unix files that begin with a dot are hidden—that is, why they are not normally displayed by the ls command. That turns out to be a bug: the result of an optimization attempting to simplify a test for another condition.

The second is a post by Eric Raymond that explains how he was recently seduced by the siren song of premature optimization. He ended up with buggy, complicated code that, as it turns out, was slower than doing the same task by the obvious brute force approach.

If you write code, you should definitely read these two items. They serve as an excellent reminder that even the masters can get tripped up when they optimize too early. That said, I’m sure I haven’t done it for the last time but at least we’re all warned.

UPDATE: ESR wrote to say that he hadn’t measured the relative speeds of the two methods so I’ve deleted that part of the post.

Posted in Programming | Tagged | 2 Comments

Open the Current Buffer’s File in Another Application

Ustun Ozgur has posted a video in which he demonstrates his package emacs-friends. The idea is that you provide the package with an association list mapping (your name for) an application to it’s executable and the code automatically generates functions you can call to open the file associated with the current buffer in that application.

Watch the video to see how it works. Oddly, a couple of the examples he uses are opening the file in Vim and Sublime. I’m not sure why an Emacser would want to do that but he finds it useful. In any event, don’t be put off by that. Look at the other examples and the association list he’s using to get an idea of what’s possible.

Xah Lee has a bit of code that does something similar. If you’re in the market for this sort of thing, take a look at both packages to see which best fits your needs.

Posted in General | Tagged | 3 Comments

The Mysteries of Perl

Those of you who have used Perl will understand this:

It turns out, though, that the joke’s on us:

Posted in General | Tagged | Leave a comment

Emacs Tips

Davide Giannella has been blogging for some time and has collected a nice set of Emacs tips going back to 2007. Mostly they are the solutions to problems that Giannella ran into and which we could probably figure out for ourselves but it’s nice to see them written out. Perhaps the list will help you remember a solution when you run across a similar problem.

If you use Emacs to deal with logs, you should take a look at his post about log4j-mode and log4j-start-filter. It seems like a useful tool. Thankfully, I don’t deal with log files much anymore so I haven’t tried it but you may find it useful. It’s still under active development and is available on Melpa.

Posted in General | Tagged | 1 Comment

Emacs 25

We’re getting there:

Kudos to everyone working on the new release. We all really appreciate your efforts.

Posted in General | Tagged | Leave a comment