Writing and Publishing Emacs Packages

NOTE: It turns out that I wrote about Scott’s post before but it has useful information so I’m going to publish this anyway.


Al Scott was annoyed that he couldn’t run his Mocha tests from inside Emacs. He knew it could be done because it was possible for other frameworks so he decided to write his own package. He wrote about his experience in Take Your Emacs to the Next Level by Writing Custom Packages.

Most of the post is about the mechanics of the using the Emacs compilation system. If you have a similar need, Scott’s post is an excellent go-by. The last part of the post concerns publishing the package to MELPA. Although that can seem mysterious, it’s actually very straightforward and easy to do: make the package file and open a pull request to MELPA. Someone at MELPA will check your code and if everything seems okay, your package will automatically be included in the next MELPA build. From then on, updates are simply pulled from your GitHub repository without any further action from you.

If you’ve been thinking about building your own package, Scott’s post is well worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

A Reminder about MELPA

If you’re anything more than a casual Emacs user, one of your most important resources is almost certainly the MELPA package repository. I’ve mentioned this before but apparently a reminder is needed: MELPA is a voluntary operation run by Steve Purcell and whoever he can get to help out. He doesn’t get paid and, believe it or not, he has a family and job that also make demands on his time. Even so, he spends a lot of time and effort on MELPA. Follow that last link to see what I mean.

I’m posting this reminder because someone on the Emacs subreddit was whining that it was taking too long to get new packages approved. MELPA is curated and part of that curation process is reviewing each package to make sure it meets MELPA’s guidelines and is safe. This requires human scrutiny, which, again, means Purcell. As my previous post makes clear, he’s dancing as fast as he can.

I have to admit that I found the reddit post annoying. I can only imagine how Purcell will feel when he sees it. As I said, he doesn’t get paid but I’m sure he’d be happy to get a little gratitude instead of complaints for his efforts.

Posted in General | Tagged | Leave a comment

Emacs for R Programming

Although I’ve played around with it a bit and even written a few blog posts about it, I’m not really an R user and barely rise to the dilettante level. andyptt21 over at The Scientific Shrimper is an R user with several years experience. Like most R users he started out with Rstudio and used it for four years before he replaced it with Emacs and Org-mode.

In a blog post, Soapbox Rant: Why I use Emacs for R programming, he explains why he made the switch and why he thinks it was the right move. He finds that Emacs is more flexible with respect to window arrangement and is, of course, customizable so that you can make editing/experimenting experience just the way you like it.

He’s also discovered—as many of us have—that using keyboard navigation so that you never have to take your hands off the keyboard is a real win over using a mouse for the same tasks. This seems counter intuitive and always surprises people when they discover it.

He gives a few other reasons for the switch—including the integration with Org-mode through Babel. If you’re an R user, you should give it a read. Perhaps it will convince you to make the switch as well.

Posted in Programming | Tagged , | Leave a comment

Merry Christmas the Linux Way

It’s Christmas and the Interweebs are quiet so I’ll just pass on this as your Christmas card from Irreal.

Posted in General | Tagged | Leave a comment

The History of cat

Over at Two-Bit History Sinclair Target makes the case that although it seems as if computer technology is always advancing and changing, we are still using software that is virtually unchanged from the dawn of the computer age. As a case study he looks at the history of the cat command.

The cat command was in the first edition of Unix in 1969 and has been there ever since. Target looks at the code to see how much it’s changed since then. Thompson wrote the first version in PDP assembly language and it wasn’t until the 7th edition that it was rewritten in C.

Most of the changes since then have been the usual accretion of features and their flags. So many flags were added that Rob Pike complained about it in his famous essay UNIX Style, or cat -v Considered Harmful. Nonetheless, the heart of the utility remains the two lines

while ((c = getc(fi)) != EOF)
    putchar(c);

Target provides a link to gist that contains all the implementations of cat that he discusses (including those written in assembly) so you can see how things have changed. He concludes that the macOS version of cat that he uses today has not changed at all in 13 years. If you like reading through code and enjoy Unix history, be sure to take a look at Target’s post.

Posted in General | Tagged , | Leave a comment

A Theme for Prose Writers

I came across a pointer to Kunal Bhalla’s Emacs Poet theme that may interest Emacsers writing prose using the Org or Markdown modes. As you can see from the screenshots at the above link, it uses a variable pitch font for prose text and a fixed pitch font for code examples. It has a number of other formatting options that makes the text pleasant to look at while you’re writing. The look is a bit like Abhinav Tushar’s writing configuration that I wrote about a couple of months ago.

If you’re writing pose and like the more finished look you get when using a word processor, you should definitely take a look at the Poet theme. It doesn’t turn Emacs into a word processor—thankfully—but it does make your source text look prettier.

One of the additional packages that Bhalla recommends is Jorgen Schaefer’s typo. It makes entering quotations and other punctuation such as em- and en-dashes easier. It even lets you enter non-breaking spaces and special characters such as arrows. Take a look at the README to see what it can do. Even if you’re not interested in the type of eye candy that Poet offers, you may like the ease of entering punctuation that typo offers. Although the README doesn’t say so, the package is available on MELPA.

Posted in General | Tagged , | Leave a comment

Another Blogging Workflow with Org Publish

I have a cold and feel awful so today’s post will be short but I did want to point you to Narendra Joshi’s excellent post on how he uses org-publish for his blog. What I really like about his setup is that it does everything with Org. That means it takes care of building the RSS feed, the index page, the archive, and the Disqus comment block. Once the system is set up, all he has to do is write his post as an Org file and push a couple of buttons to publish the post.

He has pointers to the complete source so you can see how everything works and use it to build your own blogging system. Again, I like that it doesn’t depend on a third party blogging engine. It’s simple and portable and doesn’t depend on the continued existence of anything but Emacs and Org mode. If you’re looking for a nice blogging solution, take a look.

Posted in General | Tagged , | Leave a comment

The Yoda of Silicon Valley

The New York Times has a nice article on Don Knuth entitled The Yoda of Silicon Valley that talks briefly about his life and contributions to Computer Science. It’s been all over Internet but if you haven’t had a chance to read it, you really should. It’s a look at one of the super stars in our field.

Speaking of Knuth, I watched his 24th annual Christmas Lecture the other day and it’s also well worth spending some time on. It’s about “Dancing Links,” a data structuring idea for backtracking that turns out to be useful in a wide variety of combinatorial problems. In the talk, Knuth mentions that a draft of the section of AOCP that deals with Dancing Links is available but not linked. Since the talk, he has supplied a link so you can get it from his Website if you’re interested in reading some more.

Posted in General | Tagged | Leave a comment

Org to Dotfiles

Back in 2016, I wrote about Haoyang Xu’s idea of keeping all your dotfiles in a single Org-mode file that tangles the individual dotfiles to their proper place in your directory structure. This allows you to write the dotfiles in a literate way and have a single, version controlled source for them. Sadly, Xu’s post has disappeared so his examples are no longer available.

Happily, Toon Claes has rediscovered the idea and posted a description of his process. He also has a GitLab repository with the dotfiles he’s implemented in this way. Claes has a separate Org file for each dotfile but there’s no reason they couldn’t be combined into a single file. If you follow the link at the bottom of each Org file to the source and then click on the Display source button, you can see the raw Org that he used.

I really like this idea although it’s probably not worth the effort if you have a single machine. If, like me, you have two or more machines running the same OS, it can be a real win. If you like keeping your configuration files under version control and want a way of recording why you made the choices you did for your dotfiles, this can be a useful technique. It’s just another example of how Org is assimilating everything.

Posted in General | Tagged , | Leave a comment

Scrolling with Emacs

Back when I was still a Vim user, I would occasionally try Emacs because of its nice features. It never stuck—until it did—because some of its behavior seemed too alien. The most prominent example of that was the scrolling. By default, Emacs has a sadistic scrolling mode where the screen will suddenly scroll up when the point got a certain distance from the bottom of the window. I found it very jarring and usually abandoned my Emacs adventure shortly after it started. I can see how, in a theoretical sense, you can make the case that the default behavior is the right thing but I can’t believe anyone actually likes it1.

Of course, I was a n00b then and didn’t understand that with Emacs you can have it your way. A little Googling and I discovered that it’s easy to stop that scrolling behavior. I did that 10 years ago and really haven’t thought about scrolling since.

Now Clemens Radermacher over at (with-emacs has his own issues with scrolling and wrote a bit of Elisp to get scrolling the way he likes it. His solution scrolls the screen by half a page each time he calls his code and highlights the line the point is on for a short time. There’s an animated GIF in his post so you can see what the result looks like.

If you’re dissatisfied with Emacs’ scrolling, take a look at Radermacher’s post and see if his method feels more comfortable.

Footnotes:

1

This will, I know, bring me many explanations of how it is the right thing but I stand by my judgment. Of course, that’s the beauty of Emacs: we can both be right. Or at least have it our way.

Posted in General | Tagged | Leave a comment