Bait and Switch

Remember how I told you not to trust government promises about data collection? That, according to the iron law of data collection, the data will always be used for other purposes even if the government promises otherwise?

Not that you need it but here is another example of the iron law. Australia is trying to pass a data retention law that will require ISPs to maintain connection logs. The government vehemently denied that the law would allow the data to be used to prosecute, say, file sharers or offenses other than major crimes such as terrorism.

Now in an unusual act of candor—what we in the U.S. have taken to calling a Gruberism—the Minister of Communication has admitted that once the data is collected there is nothing to prevent a civil action from gaining access to it. In other words, a suit from a Movie Studio against an accused file sharer would be enough to get access to the accused’s communication history.

The lesson is clear: never believe the government’s promises about limited use and demand that such data not be collected in the first place. The only way to prevent data abuse is to insist that it not be collected.

Posted in General | Tagged | Leave a comment

Help on Symbols with Info

LWN has a great article on esr’s proposal to revamp Emacs documentation that I wrote about previously. If you’ve been following that debate, you should definitely give it a read.

I made a serendipitous discovery in the comments. In response to a question about the utility of indices, drothlis notes that having an index allows you to type 【Ctrl+h S】 and pop right to the documentation for the symbol at point.

The example he gives involves checking a makefile symbol having nothing to do with Emacs. It’s a great example of how flexible Emacs with Info is. Be sure to read his comment.

This comment also shows how important it is to make sure any replacement of texinfo and info preserve the indices and the ability to query them that we have now.

Posted in Programming | Tagged | Leave a comment

From One of My Favorite Comics…

The NSA goes Christmas Shopping.

Posted in General | Tagged , | Leave a comment

Anchored Transpose

Thanks to Tim Stewart, I stumbled across the anchored-transpose package. You can think of it as a generalization of the other transpose functions such as transpose-chars, transpose-words, transpose-sexps, and the other less used transposition functions. Instead of transposing around the point, anchored-transpose lets you specify an arbitrary anchor region to pivot around.

Here’s an example of its use: suppose I have

First DO this and then do that.

and I want

First do that and then DO this.

To do that

  1. Select a region that covers the things you want to swap and everything in between.
  2. Call anchored-transpose.
  3. Select the anchor region. That is everything in between what you want to transpose.
  4. Call anchored-transpose again.

For our example, we first select the region

DO this and then do that

and call anchored-transpose. Then select

and then

and call anchored-transpose again.

You can also swap two disjoint regions by selecting one, calling anchored-transpose, selecting the other, and calling anchored-transpose again. You can specify the two regions in any order. You can also select the entire phrase and anchor phrase in the first example in either order.

I often want to swap parts of a sentence or even several sentences so anchored-transpose is a real win for me. I’ve mapped it to 【Hyper+t】 to make it easy to call.

You can get anchored-transpose from Melpa.

Posted in General | Tagged | Leave a comment

Disappointment

Richard Posner is a 7th Circuit Federal Judge. He’s always struck me as the ideal jurist. Informed not only on the law but in many other areas, especially economics. More than a Judge, he’s an intellectual and perhaps even a polymath.

I was really saddened, therefore, to see this piece on BoingBoing detailing some of Posner’s shocking remarks on privacy. Among other things, Posner thinks that the NSA should be given carte blanche “to vacuum all the trillions of bits of information that are crawling through the electronic worldwide networks”, that privacy is over rated, and that he’s shocked that any company would be allowed to build a device that the government can’t search.

These statements—and more, read the post—are shocking and profoundly disappointing. I expected more from Posner and hope that the rest of the judiciary rejects his views.

Posted in General | Tagged | Leave a comment

Diacritical Mark in Emacs

I recently ran across this old post from Emacs master Mickey. In it, Mickey explores ways to enter diacritical marks in Emacs. For example, if you want resume to be rendered (properly) as résumé you need to know how to convince Emacs to do that.

It turns out that there’s at least three ways of doing it. To get the ‘é’ character, I usually just type 【Ctrl+x 8 ' e】 but I could also type 【Ctrl+x 8 ReturnLATIN SMALL LETTER E ACUTE or if I know the codepoint, 【Ctrl+x 8 Returne9.

If you’ve used Emacs for any length of time and needed to enter diacritical marks, you’re probably familiar with these methods. Mickey has a third way that I didn’t know about: you can use multilingual text input along with TeX input mode. If you’re writing a document with a lot of diacriticals, this method may be your best bet. Head on over to Mickey’s post for the details.

Posted in General | Tagged | Leave a comment

My Solution to the Changing Times Challenge

Last week, I posted an EmacsGolf challenge on changing times to 24-hour notation. Most of the solutions were much like mine: they used query-replace-regexp with a complicated regular expression and an even more complex replacement expression. One trick that most responders missed was using \#n to get the nth subexpression as a number. That avoids needing to call string-to-int or something similar.

That said, my solution was to call query-replace-regexp with

\([0-9][0-9]?!\):\([0-9][0-9]!\)\([ap]!\)

as the regular expression to search for and

\,(format "%02d:%s" (if (equal \3 "p") (+ \#1 12) \#1) \2)

as the replacement expression.

David Ongaro had a really great (and surprising) solution leveraging the date handling functions of Emacs Calc. It’s nice because it avoids the horrendous regular expression that the rest of us used and simplified the replacement. Very clever.

Posted in General | Tagged | 3 Comments

Happy Birthday!

Posted in General | Tagged | Leave a comment

Names

Yesterday, I wrote about name spaces in Emacs Lisp and mentioned Artur Malabarba’s names package. In a nice example of serendipity, Malabarba has just published a post that explains what the names package is all about1.

The basic idea is that you wrap your Elisp package in a define-namespace macro and write your code as if you were in a private name space. That is, you needn’t worry about adding the package name to every symbol that might be seen externally. This is pretty much what I was describing in footnote 3: internally all symbols are specified and accessed without worrying about the package name. Externally, the package name must be prepended to access those symbols.

The nice thing about the package is that it has no impact on existing code. Everything still works as before. When you’re writing new code you can choose to use define-namespace and dispense with worrying about adding the package name to all of your variables and functions. The define-namespace macro will take care of doing that for you.

You might think this could be risky—think about how you would write that macro—but Malabarba has already used it in two packages that he’s released to ELPA. When you read his post you will see that he’s considered the edge cases.

This package is really an accomplishment. Head on over and see if you don’t agree. It may even help put the eternal fretting about Emacs name spaces to rest.

Footnotes:

1

We don’t coordinate these things. Really.

Posted in Programming | Tagged , | Leave a comment

Name Spaces in Emacs Lisp

Whenever Emacs Hackers come together to discuss what the most urgently needed enhancements to Emacs are, some sort of module system is always mentioned. In terms of Common Lisp, the idea is to add a (Common Lisp) package system to Elisp1.

It seems like a no-brainer. The current system seems to be a mess where we’re forced to add the module name to each package symbol2 so they don’t leak into other modules. It’s something that I never really questioned until I read RMS’s explanation for why Elisp doesn’t implement name spaces.

RMS takes a lesson from his efforts in implementing the Common Lisp package system back in the 1980’s. He says that although the idea sounds nice, it doesn’t really do what you need it to do: you almost always have to add the module name to each exported symbol anyway so the extra complexity in the language isn’t worth it. He decided that for Emacs you might as well just add the package name to the symbol and do away with all the name space machinery.

When I first read that, I thought it was obviously wrong. On further reflection, I think that RMS had it right. Suppose you have two Emacs packages that implement an insert-results function. If you want to call insert-results, you clearly you have to specify which function to use; you have to specify the package name. But how do you know whether there’s another package that exports the same function name? Maybe you’re not loading it today but will tomorrow or the next day. Just to be sure, you better specify the package name every time.

See what happens? You can either specify some-package:insert-results or some-package-insert-results. It’s the same amount of work for the user either way but in one case the package writer has to deal with the name space machinery. Yes, name spaces do protect internal variables and functions but maybe Malabarba’s names package is good enough for that.

Of course there are many intermediate modules systems that might fit well3, but it’s clear to me that the Common Lisp package system is not what we need. What do you think?

Footnotes:

1

The Common Lisp package system implements name spaces. This is different from the Emacs package system, which deals with obtaining and loading 3rd party packages.

2

Although Artur Malabarba’s names package can help here.

3

Maybe that within a package source file all the symbols are accessible without the package name, but externally the package name has to be specified.

Posted in Programming | Tagged | 8 Comments