The Ferret Lisp System

Nurullah Akkaya has an interesting project, Ferret, that compiles a Lisp dialect into C++. It’s very portable and can compile code not only for the major platforms but for embedded systems as well. Basically anything that can support C++ can be used as a target.

The system is written in Clojure so it would normally fall outside of Irreal’s interests but it has one feature that makes it very interesting to Irreal: The source of the whole system is a single Org mode file. If you had any doubts as to whether Org could support a literate programming approach in a non-trivial project, you can put them aside. If you follow the above link, you’ll see a beautifully rendered manual complete with the source code presented in literate form. For example, if you click on the Compiler section, you’ll see the actual compiler code along with an explanation of what it’s doing.

All of this is generated from the ferret.org file (which I’ve linked to in RAW format so you can see how it works). If you look at the Makefile, you’ll see that it calls Emacs in batch mode to tangle the ferret.org file into the various files needed for the runtime and compiler.

This is an outstanding example of literate programming made all the better by leveraging the power of Emacs and Org mode. Take a look even if you aren’t interested in Lisp or Clojure. The way Akkaya ties everything together in a single Org file is instructive and worth study.

Posted in General | Tagged , , , | Leave a comment

The Past Comes Around Again

Many (many) years ago in the age of MS-DOS when Unix on the PC was still a dream, there was an editor called Brief. It was far and away the best editor available for DOS. It was fast, had multiple windows, regular expression search and replace, multiple undo/redo, could deal with rectangular regions, and could even call and interact with your compiler directly from the editor.

It was, in short, very Emacs-like and even had a Lisp extension language. Later, they added a C-like extension language. I recall the developers saying that it was inspired by Emacs. For example, a lot of the editor was implemented in the extension language(s). Of course, it wasn’t as powerful as Emacs: you couldn’t do things like listen to music with it or any of the many other things that we do from within Emacs but it was a darn good editor and had a fanatical following.

I remember it fondly and regret that it died with DOS (although there were OS/2 and Window versions). It turns out, though, that it hasn’t quite died. One of those fanatical followers, Luke Lee, has been working on emulating it under Emacs for over 17 years. Now, finally, he feels that it’s ready for official release.

There probably aren’t a lot of people who still have Brief muscle memory or who would prefer the Brief emulation to normal Emacs but if you are such a person, Lee has just added it to the ELPA package master branch. Lee’s announcement on emacs-devel is detailed and describes the changes and enhancements he made. If you were a Brief user and would like to relive the old days, give it a try.

Posted in General | Tagged , | Leave a comment

Emacs Podcast #3

Rakhim Davletkaliyev is back with another Emacs podcast. As I said in my first post about his podcasts, using a podcast to discuss Emacs may seem odd but it actually works pretty well.

Davletkaliyev starts by telling us what’s changed in his configuration and approach since the last podcast. The major changes are the addition of Helm and Projectile. With them he was able to recreate some of the functionality that he likes best in Sublime. In one case he was even able to expand on that workflow. Another example of how you can make Emacs work your way.

The majority of the podcast is about Org mode. I was a bit surprised at how much Org functionality he was able to harness as a n00b. It certainly took me a lot longer. Of course, as he makes a point of saying, there’s no need to be intimidated by the vastness of Org. You can start off with just a few of the basic functions and discover new capabilities as you need them.

The first thing he liked about Org is its ability to link to other files (or parts of other files). That makes it easy to tie together related files and topics in the usual hypertext way. He reminds us several times that the magic of Org is that it has all these capabilities but is just plain text. You can read it—or even create it—with any editor.

He especially likes Org tables. They’re easy to use and create and bring along spreadsheet capability for free. That seems like almost a throwaway but almost every Org table I create uses that functionality in some way. It’s just too convenient to ignore.

Like me, he really likes the Babel functionality. The ability to add code blocks and export (or not) the code and embed the result in your document all without leaving Org mode can not be overpraised. It’s one of the centers of my workflow.

He also talks about TODOs, one of the fundamental functions of Org. He likes how they can distributed among many different files and summarized in the agenda. He also likes that it integrates the functions of three other applications that he was using for the same thing: Things, the Mac Notes app, and iA Writer. He especially likes how all the information is available to each of the three functions in Org, which is not the case with the three separate applications.

Finally, he describes how he implemented a list of browser links and automatically exports it to HTML so that it is available to his browser. He finds that much nicer and easier to navigate than using the native browser bookmarks.

The podcast is a bit over 29 minutes so you’ll have to schedule some time. I enjoyed it; perhaps you will too.

Posted in General | Tagged | Leave a comment

Karl Voit on Security

Karl Voit has an useful post on good password security practices. There’s not really anything new in the post but it brings together most of the best practices in a single place.

The main problem is that you no longer have to be a nation state to build a machine capable of trying millions of passwords a second. Throw a few GPUs into a pretty much standard PC and you’ve got an excellent password cracking machine. Given that fact you absolutely can’t afford a weak password. Even worse are the common 123456 and password type passwords. Voit points out that the top 10,000 passwords are used by 98.8% of users. Don’t be one of those users. It probably takes less than a second to recover your password if you are. Brute force isn’t the only way to discover your password, of course, and Voit discusses some of the others.

Passwords are never going to be absolutely secure but you can do better than almost everyone else (remember that 98.8 percent?) by following a few simple precepts. That mainly means:

  • Getting and using a password manager that will generate long, random, unique passwords for you.
  • Never, ever, reusing a password. That way even if one of your passwords is recovered it effects only a single site instead of many.
  • Using secure software that won’t leak your passwords. This is harder than it seems. Voit suggests using only open source software to help with this.
  • Staying alert and aware. That means don’t click on any email links. Always use your bookmarks to open a site. The next time you get an email from big company XYZ thanking you for your order and, by the way, if you want to cancel click here, hover over the link; there’s a good chance it won’t point to XYZ’s domain.

All of this is a bit of trouble but necessary to stay safe. As Voit says, security is pretty much the opposite of usability. Read Voit’s post. If you do and follow his advice you’ll be safer than almost everyone else.

Posted in General | Tagged | Leave a comment

Use The Profiler!

For the last year, Matus Goljer (fuco1) has been working on a static analyzer for Elisp. Although still in its early stages, the project is promising and I’ve been following it with interest. Goljer has made good progress and can now analyze the main file in the smartparens code base. There was a problem, however.

It was slow. Very slow. Analyzing smartparens took about 42 seconds even though the smartparens.el file is only about 9500 lines. Goljer was expecting it to be a bit slow because he used EIEIO and CL generics. While they’re a natural fit for the problem, they have notorious performance issues. What to do? Goljer did what we all do: he assumed the problem was with EIEIO and generics and started changing his code. That turned out to be a mess so he did what we all promise ourselves we’re going to do in situations like this but rarely actually do: he fired up the profiler to see were all the time was going.

The answer was surprising. The problem turned out to be in a function that he would never have thought would cause difficulties. I won’t spoil the surprise by telling you what it was; you’ll have to read his post to see. In any event, he replaced the problem function with some code that accomplished the same end and reduced the running time to 5 seconds.

The moral here is what it always is: don’t assume you know where all the cycles are being spent. You’re probably wrong. Almost every environment has a profiler and they’re the go-to method for determining where your application is spending its time.

Be sure to take a look at Goljer’s post. It’s an interesting story and a nice illustration of the power of profilers.

Posted in General | Tagged | Leave a comment

Emacs for the CEO, Part 2

Almost three years ago, I wrote about Josh Stella, a former programmer who had become the CEO of his company. Stella found that he really hated all the context switching required as he moved from application to application. So he decided to return to Emacs but as a CEO rather than technical user. His original post discussed why he was doing that and what his experience was like.

Now, Stella is switching roles and becoming the CTO of his company and decided to revisit his Emacs post in light of the 3 years experience he’d had using it as a company officer rather than one of the technical staff. All-in-all, he concludes that the experiment was successful and that using Emacs made him happier and more productive. He liked the way Emacs stayed out of his way and wasn’t constantly demanding his attention.

He also liked that Emacs was more ergonomic than other applications. We Emacsers don’t often hear that but Stella says that using an ergonomic keyboard combined with a much reduced reliance on mouse operations cured the RSI problems he was having. He discusses that at some length so if you’re an Emacser who’s suffering from RSI problems, you should take a look at what he did.

He also wrote that he gave up trying to use Org mode to keep his calendar and TODO lists. That, he said, was because he shares that information with many people who weren’t Emacs users. There are, of course, packages that move entries between Emacs and Google/Apple calendar but he decided it was simpler to just use Google calendar like everyone else at his company.

The post is an interesting retrospective on the experiences of a CEO using Emacs and well worth a read.

Posted in General | Tagged | Leave a comment

Emacs Podcast

Rakhim Davletkaliyev is a new Emacs user who has decided to document his journey into the world of Emacs with a series of podcasts. Using a podcast for this might seem like an odd choice given that the subject matter is intrinsically visual but it turns out to work pretty well.

So far, there are two podcasts. The first doesn’t really discuss Emacs but serves as an introduction to Davletkaliyev and why he’s making these podcasts. Davletkaliyev is an experienced developer who uses Sublime in his day-to-day work. Lately, though, he’s been experimenting with Emacs and learning how to use it effectively. He’s still in the learning phase and not even certain he’ll switch in the end.

The second podcast is about his configuration. He’s already using an Org file for his configuration but, so far, has loaded only a few packages. This is in keeping with his experimental approach to Emacs; he trying things out and seeing what works for him.

One of the most interesting aspects of his configuration is his choice of key bindings. While he’s pretty much content to go with the defaults, he made some choices that I never would; you can listen to the podcast to discover what they are. This merely shows that Davletkaliyev has discovered early on that Emacs lets you have it your way. He can make what you or I might consider outlandish choices without affecting the rest of us.

The podcasts are 21:59 and 25:26 minutes long so you’ll need to schedule some time if you’d like to listen.

Posted in General | Tagged | Leave a comment

The Machine that Builds Itself

Bohdan Khomtchouk, Edi Weitz, and Claes Wahlestedt have an interesting paper that argues for the use of Common Lisp in bioinformatics and computational biology. Lispers will recognize Weitz from his many contributions of outstanding Lisp packages, including the unrivaled CL-PPCRE for regular expressions.

The paper makes the case for why Common Lisp is an excellent choice for developing software in bioinformatics and computational biology. Oddly, though, you could apply those same arguments to most fields, an indication of how flexible and useful Lisp can be for developing serious software.

The authors believe that the biology/Lisp community is set to take off and expect that it will soon reach critical mass. Those of us who are Lispers can only hope that’s true. In any event, if you’re a Lisper or wondering why you should become one, take a look at the paper; it gives plenty of reasons and you don’t have to know anything about biology to follow their arguments.

Posted in General | Tagged , | Leave a comment

Another Emacs/Vim Survey

If you care about this sort of thing, there’s (yet another) survey on whether folks prefer Emacs, Vim, or something else. I wouldn’t bother linking if it were just another “what do you prefer” quickie but the poll asks additional questions and the results are summarized in a spreadsheet.

As I’ve said many times, the best editor is the one that works for you. Depending on what you’re looking for, that may be Vim or it may be Emacs. It may even be something else. Still, these polls can be fun if only to validate what we already believe or to provide another example of how worthless these polls are.

Posted in General | Tagged , | Leave a comment

Keyboard Macros: A Reason to Use Emacs

Bill over at ATMakers has a short video on Why I Use Emacs. He’s a long term user and the reasons are many, he says, but the video is just one example showing how Emacs can make repetitive tasks easier.

The problem is that he has a list of two columns that he wants to mark up with HTML. The video shows how to do this using keyboard macros. It’s a natural solution and the video shows how easy it is. To be sure, it’s an elementary application of keyboard macros so the video is most suited for someone asking “Why do you use Emacs?” Still, even more experienced folks may enjoy it.

The video is only 6 minutes and 15 seconds so it should be easy to find time to view it if you’re interested.

Posted in General | Tagged | Leave a comment