Ediff Files from Dired

The prolific abo-abo has a nice bit of Elisp that you will find useful if you like to use dired for your file operations and find yourself diffing a lot of files. His snippet allows you to mark two file in dired, press e, and call ediff on the two marked files.

The code tries to put the newest file second so that ediff will display the changes in a logical way. That is, if you add “new stuff” to the original file, you want ediff to show the change as an addition of “new stuff” rather than as a deletion of it.

Posted in General | Tagged | Leave a comment

Flash, FedEx? Really?

I like FedEx and I use them all the time to send packages and even important papers that need to be there the next day. I’ve always assumed that like UPS they are a technically sophisticated operation. That illusion was shattered today by this tweet pointed to by Kontra.

If you want to sign on to the FedEx Office site to, say, order up a print job, this is what you get. They even has extensive directions for how to install Flash in case you want to add a serious and well known security risk to your computer.

I don’t understand how a large, presumably clueful, corporation like FedEx could still be using Flash and even encouraging it customers to install it. The word that comes to mind is “malfeasance.” It’s hard enough to get average users to protect their computers from being recruited into a BOT net. We don’t need FedEx asking them to make it easier.

Posted in General | Tagged | Leave a comment

A Beautiful On-line Version of SICP

If, like me, you’re a lover of SICP (Structure and Interpretation of Computer Programs) you’ll be happy to know that there’s a beautiful on-line version of it available. Years ago, MIT generously put up a version but some of the figures were hard to read and the typography was pretty much what you’d expect from an automatic rendering of the \(\LaTeX\) from that era.

This text is rendered in HTML5 and the figures drawn in vector graphics. You can read about the evolution of this project in the UTF Introduction in the book. A lot of loving work went into this and it shows. The introduction says that this was completed in 2014 but I am just now seeing it. If you’re interested in the source or an epub version, the project’s web page has an an announcement of this version along with links to the source and other renderings of it. Take a look and see if you don’t agree that it’s a beautiful rendering of one of the most important books in CS.

I think that last judgment (about SICP being one of the most important CS books) is even more true today since, sadly, the approach taken by SICP is no longer popular. It’s been abandoned—even at MIT, where the whole thing began—in favor of plugging black boxes, in the form of libraries, together to build a program. Perhaps, as even the authors of SICP say, that’s necessary in today’s environment but students are missing out by not being immersed in the view of our profession offered by SICP.

Posted in General | Tagged , , | Leave a comment

Query on mbsync for macOS

The wheels grind slowly here at Irreal but they do grind. I’m in the final stages of moving my email to Emacs in my neverending quest to run everything in Emacs. My specific intent is to run mu4e as my client and have mbsync take care of retrieving and syncing emails for my Apple mail account.

Sadly, I can’t get mbsync to connect with the Apple IMAP server. The relevant part of my .mbsyncrc is

IMAPAccount icloud
Host IMAP.mail.me.com
User XXX
PassCmd "security find-generic-password -s mbsync-icloud-password -w"
Port 993
SSLType IMAPS
SSLVersions TLSv1.2
AuthMechs Login
#CertificateFile /usr/local/share/certs/ca-bundle.crt

when I run this with mbsync -D icloud, I get

...
Logging in...
>>> 1 LOGIN <user> <pass>
1 NO [AUTHENTICATIONFAILED] Authentication failed
IMAP command 'LOGIN <user> <pass>' returned an error: NO [AUTHENTICATIONFAILED] Authentication failed

It makes no difference whether or not the CertificateFile line in the configuration is commented out. The security function on the PassCmd line does return my icloud password and even entering the password itself on a PASS line doesn’t work. It makes no difference whether the USER line is just my user name or my full email address.

I’ve consulted DuckDuckGo but I can’t find any examples of setting things up for macOS. If anyone has a working mbsync configuration for talking to Apple’s IMAP server, I’d really like to hear from you. Please leave a comment if you have any wisdom to impart.

UPDATE [2017-03-25 Sat 12:54] Andy Bold figured out the main problem. Since Sierra (I think) introduced two-factor authentication, you need to generate an application specific password for this sort of thing. Once I did that, mbsync connected to the Apple IMAP server without a problem. Now I’m dealing with the notoriously finicky Apple Mail service to get things downloaded. I’ll write up my adventures when I’m done.

Posted in General | Tagged | 7 Comments

Dired Sorting

If you like to manage your files with Dired and tend to rely on the Dired listing rather than, say, ls, Ben Maughan has an excellent suggestion: dired-quick-sort. Take a look at the Github site to get an idea of what the package can do.

Posted in General | Tagged | Leave a comment

Reproducible Journalism?

Longtime readers know that we here at Irreal do not generally hold journalists in high regard. Putting the best light on things, they are all too often ignorant and lazy. Still, Irreal is nothing if not dedicated to the scientific method so we’re always interested in contrary evidence. Wilfred Hughes offers this example of such evidence:

For an article entitled Wages rise on California farms. Americans still don’t want the job, the Los Angeles Times performed an analysis of California crop production wages as an IPython notebook. The analysis was done by Ben Welsh of the LA Times Data Desk, which appears to be an internal LA Times group dedicated to such matters. The byline on the article itself was Natalie Kitroeff and Geoffrey Mohan.

I really like this because:

  1. Rather than rely on anecdotal evidence, the Times did an actual analysis of the data.
  2. The analysis was done in a reproducible research manner. The data source is identified and all the calculations are shown in the notebook.

The article links to the analysis so that any interested readers can see for themselves how the analysis was done. Kudos to the LA Times and their reporters for an excellent example of reproducible research in Journalism and for making the data and the analysis of it public.

Posted in General | Tagged | 1 Comment

Stein’s Emacs Productivity Series

Gregory Stein over at Caches to Caches has a nice series on how he uses Emacs to increase his productivity. I’ve written about a couple of those articles (1, 2) already but it’s useful to see the whole series.

As I’ve said before, Stein is a Ph.D student at MIT and like all such students his time is at a premium. These posts discuss how he leverages Emacs to organize his time and tasks and even optimize his email. There are (currently) four articles and none of them are very long so it’s very much worth your while to take a look if you’d like to make your own workflow at little more frictionless.

Posted in General | Tagged | Leave a comment

The Silver Searcher, Ivy-occur, and Swiper

I’m stuck in my ways and stubborn so even though I use macOS as my primary platform, I have, for years, insisted on compiling all my tools from source myself. The Mac platform has just enough idiosyncrasies to sometimes make that a challenge. Of course, there’s the excellent Homebrew to solve these problems but as I said: stubborn.

For a long time, I’ve wanted to try out ag (The Silver Searcher) but the make process required a bunch of utilities that I didn’t have installed and it just seemed like too much trouble. Then I watched Mike Zamansky’s video on using Emacs for C++ programming in which he mentioned ag and using it with counsel-ag (part of Ivy) as a particularly nice way of tracking down where identifiers or other symbols are used in a project. There’s also the excellent refactoring workflow using ag and ivy-occur that Samuel Barreto wrote about. That, finally, convinced me to install homebrew so that I could easily install ag and other hard to build tools.

I’ve been really happy with ag since I installed it and have woven it into my workflow. If you have Ivy installed, you can use counsel-ag to call ag from Emacs and have the results put in the minibuffer. That’s what Zamansky showed in his video. You can also put the results in a separate buffer so that you can visit each occurrence separately and conveniently. Although it’s not clear from the video, Zamansky does this by calling ivy-occur with Ctrl+c Ctrl+o.

Once you’ve got the results in a separate buffer, you can toggle on wgrep with Ctrl+x Ctrl+q and then use iedit, multiple-cursors, or query-replace to change all occurrences of some text. It’s a really powerful way of working. Because ag operates recursively, it’s perfect for working with all the files of a project at the same time.

That got me thinking that you could doubtlessly do the same thing with the results of a swiper search. That is, you can move the results of the search from the minibuffer to a separate buffer. There’s no point, of course, in making that buffer writable and making changes because you could do that in the original buffer more easily but it is nice if you want to visit some or all of the results. Since the buffer is an occur buffer you can simply click (or type Return) to visit any particular instance and then change back to the occur buffer to pick another. That’s often very handy.

Posted in General | Tagged | 3 Comments

Going to the Nth Paragraph in Emacs

The Emacs Stack Exchange has an interesting discussion on how to navigate to the nth paragraph in an Emacs document. The original questioner noted that although there is a function to navigate to the \(n^\text{th}\) line, there is no corresponding function to navigate to the \(n^\text{th}\) paragraph.

If you’re like me and hardly ever need to do this, the easiest thing is to move to the beginning of the buffer and use Meta+} with a numeric argument of the paragraph number you want to go to. For example, to move to the 7th paragraph you would type Meta+< Meta+7 Meta+}1.

If you do this a lot, one of the answers provides a function, that essentially does the above, that you can bind to a convenient key sequence.

Footnotes:

1

Or Ctrl+7 Meta+} if you don’t map Meta+n to a numeric argument

Posted in General | Tagged | Leave a comment

Guile 2.2

The long awaited 2.2.0 version of Guile has been released. This version is a significant update to the Guile system. It includes a new compiler and VM and several other performance enhancing changes. They even boast a complete Elisp emulation. See the announcement, linked above, for a complete list of the changes. Andy Wingo has been working on this upgrade for 6 years and we all owe him a debt of gratitude.

I downloaded, compiled, and installed it without any problems on my MacBook Pro. It takes a while to compile—even on my speedy laptop—but installs cleanly after that. You may remember that I’ve had problems compiling and installing Guile on my Macs before but I had no difficulties this time.

I just got it installed so I haven’t had much time to play with it yet but it seems very nice at a cursory glance. If you’re a Schemer, you should definitely give it a try.

Posted in General | Tagged , | 1 Comment