Here’s a very nice tip from Johan Lindstrom:
#emacs tip: C-s (incremental-search), now C-w (pick up words), and then the real tip: M-% to query-replace the searched-for text. *BOOM*
— Johan Lindstrom (@jplindstrom) October 1, 2015
Here’s a very nice tip from Johan Lindstrom:
#emacs tip: C-s (incremental-search), now C-w (pick up words), and then the real tip: M-% to query-replace the searched-for text. *BOOM*
— Johan Lindstrom (@jplindstrom) October 1, 2015
Artur Malabarba has an excellent Emacs tip on how to get the minibuffer to make an informed guess as to what who want to enter at the prompt. This is a really nice tip and something I didn’t know. Be sure to give it a read.
One of the nicest things in Scheme, I think, is the notion of streams. These are basically lazy, infinite lists. The idea is that you want a list of (possibly computationally complex) objects of indeterminate length. You could calculate the list beforehand making more entries than you think you’ll need but that’s wasteful and you may not have a good handle on how many you’ll need.
Streams are very easy to implement and even though the notion never seemed to gain traction in Common Lisp, they are easy to implement there too. Now Nicolas Petton has implemented them for Emacs Lisp too. His stream.el, which is available on Elpa, requires the seq.el library and therefore requires Emacs 25 or later.
It’s not obvious what a good use case would be in the Emacs environment but I’m sure there are some. I just like the idea that they’re there for me when I find I need them. It might not seem like there would be many opportunities to make use of streams no matter the language but as SICP shows, they are very natural solutions to many problems once you internalize the idea.
Streams for Emacs is another reason I can’t wait for Emacs 25.
UPDATE: wouldn’t → would
Daniel Gopar has started a series of Emacs interview podcasts called Emacs.el. His first subject, fittingly, is Sacha Chua. Gopar and Chua have a far ranging discussion on Emacs. Gopar starts off by asking the obligatory “How did you get started with Emacs?” question. As part of her response, Chua mentions how she leveraged Emacs Speak and ERC to tell her when someone mentions her on the IRC Emacs channel.
From there the discussion moved to how to learn Emacs. As we’ve all found out, that’s a never ending process and Chua says she learns things a little at time. I think it’s that way for most of us. We want to add something to our workflow or we see how someone else is doing things and we learn the bit of Emacs that makes that possible.
For me, the most interesting part of the interview was their discussion of Emacs Chats and Emacs Hangouts. Chua explains her rationale for the videos and how they differ. Many people will be surprised that Chua mentions her anxieties about the videos: that she won’t have a question to ask or that there will be awkward silences. She always seems so engaged and on top of things during the videos that it’s easy to miss the fact that, like most of us, she worries about her public performances.
It’s a nice chat. It lasts just shy of 42 minutes so you’ll have to schedule some time to watch it but it’s very worthwhile.
At Emacsconf 2015, Erik Hetzner gave a very interesting talk on Making Emacs a Better Tool for Scholars. Hetzner works for the Public Library of Science, which publishes about 30,000 papers every year. He notes that about 90% of those papers are submitted in Microsoft Word. Word is OK, he says, but not really a very good tools for scholars. In his quest to provide better tools he is looking at ways that Emacs can better meet scholars’ needs.
Hetzner makes an observation I hadn’t thought about before: the needs of scholars and programmers are remarkably similar. Where programmers talk about refactoring their code, scholars talk about revising/editing their papers but they are both concerned with adding, deleting, moving, and changing text.
There are more similarities. For example, scholars need to version control their papers. The publication cycle can be years long and perhaps changes specific to one or more journals will need to be made. Version control makes this easy as well as helping with collaboration.
An even less obvious similarity is the need to compile the results of the editing. In the case of scholars this may involve integrating citations; generating and adding graphs, figures, and charts; handling cross references; and dealing with one or more output format for the paper (HTML, PDF, ePub, etc.).
As Hetzner says, Org mode is Emacs’ secret weapon. Along with Babel, it gives researchers everything they need to do their calculations, graphs, and other processing right in the paper’s source file. Or, of course, to make reproducible research easy and natural. When it comes time to generate output, Org can generate a PDF, HTML, or, for those poor souls whose publishers require it, DOC.
The talk is a little over 30 and a half minutes so plan accordingly. You can see the slides from the talk on Hetzner’s Web site.
UPDATE: Fixed link to slides.
Ryan Winchester has a nice post complaining about the stupid password rules that some sites enforce. It’s not that Winchester and the rest of us aren’t in favor of stronger passwords or even that we mind some rules that might help with making them stronger. It’s that the rules don’t actually help make them stronger.
A example makes this clear. A typical rule might be
That seems like it would probably require a strong password but it doesn’t because it allows passwords like Abcd1234, which would be found almost instantly by a good password cracker. Even passwords like Loverboy1982 will be found fairly quickly by a decent password cracker. Notice that while our rule allows these two passwords—and many others—it doesn’t allow passwords like the famous correct horse battery staple which is actually much stronger than even the XKCD cartoon suggests1.
Read Winchester’s post for more examples and a possible solution (on the server side). As a user, you must use a password manager that will generate long random strings from the full character set. For your master password or in situations where the password manager is too inconvenient or impossible, choose 4–6 random words using a Diceware scheme (It’s important that the words be chosen randomly. Don’t choose any 4 words that pop into your mind.) It’s easy; even a sixth grader can do it.
One final reminder: If a site has rules that restrict the maximum length of your password or what types of characters are legal, it’s a sure sign that their password security is broken and that passwords exposed by an exploit can be easily recovered. Avoid such sites if you can. If you can’t, be sure to use a unique password for that site2.
UPDATE: batter → battery
Or would be if everyone didn’t know it. You can be sure that password cracking programs will try it. Nonetheless, the point stands: four random words makes a strong password that would not be allowed by the rule.
You should do that anyway, of course, but even if you sometimes cheat, don’t do it on one of these sites.
I often see Tweets or posts asking for help in finding a way of using Emacs as a C++ IDE. Mostly people turn to Eclipse for features such as
Átila Neves, a long time Emacs user, took a job as a C++ programmer and started using Eclipse because everyone else at his new job was and because he wanted the features listed above. As every Emacs user will understand, he missed Emacs and started looking for a way to use it as an IDE that would provide at least the above functionality.
In this talk at CppCon 2015, Neves recounts how he made Emacs into a first class IDE that provides all the functionality that he was looking for. This involves using CMake, rtags, Flycheck, semantic, and a bit of custom Elisp (cmake-ide) to take information from the compiler about definitions and their locations and make them available to Emacs to enable easy navigation.
Neves has a quick demonstration of all this at work. Leveraging the compiler and CMake is a nice trick and provides for an intelligent IDE in a way that tools like CScope, that don’t actually understand the target language, can’t.
Neves’ talk is about 16 and quarter minutes so it’s easy to find time for it. If you’re looking for a great way to use Emacs as a C++ IDE, be sure to watch Neves’ video. It’s the best answer to the “How do I use Emacs as a C++ IDE?” question that I’ve seen. You can see his see his cmake-ide package on GitHub.
Arguably, the third most famous member of the Unix pantheon is Brian Kernighan. Although he did not, in fact, work on the development of the C language (he was the co-author along with Ritchie of the definitive book on C) his contributions were significant and seminal. I think of him as the ultimate tool builder—I have no idea if he would embrace that description—and master of the Unix Way™. After K&R, he’s probably best known for awk, a little language that is still in use today and has devoted adherents.
In a recent Computerphile video, Kernighan and Professor David Brailsford sit down to talk about Kernighan’s career and what it was like to work at Bell Labs in the glory days.
Kernighan talks about the introduction of pipes into Unix and the dramatic difference it made in the way people thought of and performed computations. In some sense, pipes were a necessity. Memory was in such short supply in those days that you pretty much had to stitch together a bunch of small programs to get things done.
If you’re at all interested in our shared history—and you should be—you will want to watch this video. It’s a bit over 28 minutes so you’ll have to schedule some time but it’s well worth it.
UPDATE: Added link to video.
Two weeks ago, I wrote about Daniel Mai’s video on writing your Emacs configuration as an Org file. He showed how to organize your configuration in a literate programming way. Now he has a second video that ties everything together by showing how to load the configuration in the Org file when Emacs starts.
The idea is to use init.el as a sort of boot loader that does a small bit of preliminary initialization and then loads the config by calling org-babel-load-file. The files are set up so that he can drop this small init.el and his Org configuration file onto a new machine and have it download all his packages. If you find yourself setting up new Emacs installations frequently, that can be a big time saver: just pull the two files from some repository, start Emacs, and everything gets taken care of for you. Very nice.
The video is just 5 minutes, 15 seconds so it’s easy to watch during a coffee break. As I said in my previous post on this series, if you’re thinking of refactoring your Emacs configuration, consider making it an Org file and using Mai’s technique to load it.
Yesterday I wrote about Emacs for Social Scientists so it’s only fair to mention how creative writers can benefit from Emacs too. I written about this before, of course, more than once but Balle over at I Love Emacs, has a post with some useful pointers for creative writers. He mentions Randall Wood’s guide and cheat sheet that I mentioned in the above post as well as a video on how to export your Org mode to the doc file that your publisher will surely insist upon.
It’s a nice post and worth a read if you make your living writing words and would like to do it in Emacs.