Lisp Dialects Compared

Elia Scotto has an excellent post on the major Lisp dialects. There are, of course, several Lisp flavors and while they share many features—including, more or less, syntax—there are nevertheless differences that make the choice of which one to use nontrivial.

That’s where Scotto’s post comes in. He compares Common Lisp, Clojure, Racket (Scheme), and Elisp. He describes each dialect, its strengths, and its weaknesses. The TL;DR is:

Common Lisp
The oldest most complete Lisp, it had libraries and functions for almost everything. It’s premier implementation, SBCL, operates on a large range of hardware and compiles to native code. Its generated code rivals that of C.
Clojure
A modern dialect with some syntactical oddities, this Lisp runs on the JVM, which makes it perfect for large business apps running on Java. Scotto recommends Clojure as a first choice for a beginner looking for a practical and elegant Lisp.
Racket
Racket is a Scheme derived Lisp that’s particularly strong for designing and implementing new languages. Unlike the other Lisps, Racket lets you specify a syntax for your new language even if it’s not a Lisp-like syntax.
Emacs Lisp
Irreal readers probably need no introduction to Elisp. Scotto describes it as an older, limited extension language for Emacs but it is, of course, much more. I—and many others—use it for building tools and one-off internal apps.

There’s a lot more detail in Scotto’s post so be sure to a look at it.

Posted in General | Tagged | Leave a comment

Apple Advertising

This week, I came across a couple of posts feeding my new hobby horse: Apple’s descent into advertising. Like almost everyone else, I HATE, HATE, HATE having ads pop up when I’m trying to do something else. It’s bad enough on Web sites where at least they have the excuse of having to make money some how but it rises to intolerable when they put them up on a device I’ve already paid for.

The annoyance is reason enough to dislike Apple’s ads but for me the worst thing is that they’re corrupting and inevitably lead to the user being replaced by the advertiser as the customer. I’ve said all this before and now John Gruber at Daring Fireball is making much the same argument. He says ads in software are like stickers on your laptop. Apple has always considered the stickers an abomination and refused to put them on their hardware. Gruber reminds us what Steve Jobs had to say about those stickers:

You know, we put ourselves in the customers’ shoes and we say, what do we want stuck on our product when we take it out of the box? And the answer is, nothing.

The same principal applies, I submit, to advertisements in software. We’re not talking about freeware here but to software that we purchased as part of the price of our Apple products.

Meanwhile, Jason Snell over at Six Colors makes the analogy of checking into an expensive but good hotel. You expect things to be perfect: the soap smells nice, the refrigerator is maintained, and the pool is clean. The hotel, of course, can save money by scrimping on those things but if they do they become a lousy but expensive hotel.

It’s the same with Apple. We’re willing to pay more for their products because they’re excellent and give good value. If Apple starts sullying those products, suddenly that extra cost doesn’t seem as worthwhile.

I hope Apple abandons this misadventure. It’s not like they need the extra cash.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: The Scourge Of Dickovers

Over at Pluralistic, Cory Doctorow has a righteous diatribe about dickovers. If you’re not familiar with the term, dickover was coined by John Gruber to describe those super annoying popups that cover the text you’re trying to read. They’re bad enough for those of us in the U.S. but Doctorow says they’re even worse in the UK and EU where they’re used as a sort of malicious compliance with the GDPR.

The thing is, those popups asking if we consent to the use of cookies are completely unnecessary. The law says that sites must presume that users do not want to be spied on and the popups are simply a way of tricking users into giving that consent. It appears to work. According to the Kill The Cookie Banner site, 90% of people agree to the spying by simply clicking through so they can get on with reading whatever they came to see.

A lot of Doctorow’s post describes ways of dealing dickovers but the salient point for me is the “Global Privacy Control” (GPC) signal. That’s an indication that browsers can send to websites saying that the user does not give permission for their spying. The surveillance industry hates this, of course, and largely ignores it. There are efforts in the EU to make compliance mandatory and a couple of states in the U.S. have already done so. The advertisers are, naturally, against this and have pulled out all stops to scuttle the legislation.

It’s fine to deploy stopgap measures—such as those recommended by Doctorow—to fight surveillance advertising but the real solution is to make the advertisers follow the law and stop offering specious reasons why they can’t or won’t obey it. A good first step is to make honoring the GPC mandatory.

Posted in General | Tagged | Leave a comment

Turning Two Spaces Into A New Sentence

In the Apple ecosphere—especially in iOS—a convenient short cut is to type two spaces to end the current sentence and start a new one. Specifically, two spaces will delete the spaces, insert a period and a space, and capitalize the next letter. There’s probably something similar in the Android world; it seems like a natural thing to do.

Over at Bicycle For Your Mind, macosxguru has a post that describes three of the recent changes he’s made to his Emacs environment. Two of them—showing tabs and newlines explicitly, and fiddling with his mode line probably won’t interest most Irreal readers. The third is importing the two space shortcut into Emacs.

Emacs, of course, doesn’t have that capability but macosxguru added it with a bit of Elisp which he binds to the Space key with the text-mode hook. It looks for two consecutive spaces and repaces them with a period and space. The tricky part is capitalizing the next letter. He does that by reading the next character explicitly and capitalizing it if it’s a letter. He also checks for some special keys (like an arrow key) and “unreads” them so that Emacs can treat them normally. All the code is in the post so see it for the details if you’re interested.

I’m ambivalent about this change. On the one hand, I use it all the time on my iPhone and iPad but that’s because typing is such a pain on virtual keyboards. On a regular keyboard, I’m pretty sure that I could type the period, space, and next letter just as fast. The shift for the next letter might slow things down a bit but not by much. I haven’t decided yet whether I will adopt it but inertia will probably cause me not to.

Posted in General | Tagged | Leave a comment

Folding In Non-Org Buffers

Marcin Borkowski (mbork) really likes being able to cycle folding in Org buffers. Of course, then he wanted to be able to do the same thing in any buffer. In particular, he wanted to be able to fold and unfold groups of functions as a set. He experimented with all sorts of solutions including the builtin outline minor mode.

None of them were quite what he wanted. Then he found outli. It was perfect for his needs. It’s a third party package but appears to be well maintained and is less than 400 lines of code. What he really likes, though, is the keybindings. Most important to him is that Tab cycles the folding just like in Org mode.

Although I like and use headline folding in Org mode, I’ve never been able warm up to code folding. On those rare occasions when I want to narrow focus to a single function—usually to delimit searches—I simply narrow to the function or region in question. Of course, others, like mbork, disagree and those folks may want to check out mbork’s post to get the details of his solution.

Posted in General | Tagged | Leave a comment

A Quick EWW Hack

I’ve been writing a bit lately about my growing use of EWW [1, 2, 3, 4]. I was always a little skeptical of those who said they made significant use of EWW for their browsing but then I realized that I had started doing the same thing. It certainly hasn’t replaced Safari but I am using it more and more.

It started fairly innocently. I use elfeed-webkit to render the web pages from my RSS feed. That has the significant disadvantage that my ad and tracking blocker doesn’t work for them. That, in turn, means that I get all sorts of junk displayed. It’s usually a dickover but sometimes there’s a seemingly never ending train of popup ads. Fortunately, elfeed (and elfeed-webkit) have a hot key to display the page in EWW and avoid all that. Now as soon as a dickover covers up the text or a avalanche of ads starting popping up, I simply switch over to EWW and read in peace. It’s surprising how little I need JavaScript.

As I said, I find myself using EWW more and more. It’s easy to call it from Embark when the point is on a URL and often I’ll just use it instead of invoking Safari. Of course, that brings up question. Can I switch from Safari to EWW when I need to? I couldn’t find any builtin way but I realized I already had everything I needed to do it. The first part is to retrieve the URL of the current Safari Web page. I’ve had a function to do this for a long time and use it all the time to capture links to the current Web page into Org. It’s pretty simple but restricted to macOS. Here it is.

(defun jcs-retrieve-url ()
  "Retrieve the URL of the current Safari page as a string."
  ;; (org-trim (shell-command-to-string
  ;;   "osascript -e 'tell application \"Safari\" to return URL of document 1'")))
  (do-applescript "tell application \"Safari\" to return URL of document 1"))

The way to do this varies by browser and OS but is usually straightforward.

The second part is doing the actual switch. Again, it’s simple:

(defun jcs-switch-to-eww ()
  "Invoke EWW for the current Safari web page"
  (interactive)
  (eww (jcs-retrieve-url)))

I put this in iCanHazShortcut and bound it to Ctrl+F7. It works fine except I haven’t yet figured out how to switch to Emacs from Safari so I have to press F6 for that. That’s a small price to play until I figure out the rest of the magic spell.

EWW, of course, has a way to switch to the default browser so it’s easy to pop back and forth as needed. It’s a small thing but makes my workflow easier.

Posted in General | Tagged , | Leave a comment

Embark For CIDER & Projectile

Bozhidar Batsov, who’s been writing about Embark lately has a nice post on integrating CIDER and Projectile into Embark. I don’t use either of them so you might wonder why I care. The answer is that Batsov’s post is a good example of how to add a new application to Embark.

That turns out to be pretty easy. For projectile, Batsov built it into the app so you’ll have to check the source code to see the details. For CIDER, though, he adds the Embark functionality externally so you can see how it’s done. It’s mainly a matter of writing some straightforward wrapper functions, binding them up in a keymap for Embark, providing a target function that identifies symbols, and finally adding the keymap to Embark.

For me, then, the value of Batsov’s post is that it serves as a how to that shows you the recipe for extending Embark to include new applications.

Posted in General | Tagged | Leave a comment

Copy Link At Point In EWW

Raymond Zeitler over at Ray on Emacs has a nice post on copying the link at point in EWW. It’s sort of hidden so that’s the reason for his post and this one. He decided to write his own because he couldn’t find anything that already did the job. It was only after he wrote it that he stumbled on the existing functionality.

The short answer is that the u key does just what he wanted. The longer answer is that sometimes w also works. The documentation says that w copies the URL of the current page but if the point is on a link, it will copy the link’s URL instead.

I’m finding that I’m using EWW more and more so I’m glad to have this information. Zeitler has more details so be sure to take a look at his post.

Posted in General | Tagged | Leave a comment

A Couple Of Tips For Emacs on macOS

Over at The Art Of Not Asking Why, JTR has begun a series on his Emacs configuration. This post covers his special arrangements for macOS. There are two tips, in particular, that seem to come up all the time.

The first is setting the path. That, of course, is supposed to be a simple process on Unix-like systems but doesn’t work correctly for Emacs on macOS. A long time ago, Steve Purcell solved this problem with his exec-path-from-shell package. You can read the details and what the exact problem is at the package’s GitHub repository. If you’re using Emacs on a Mac, you definitely need this package.

The second problem involves Dired. It’s obvious, if you think about it, that Dired depends on the Unix ‘ls’ command to produce its listings and some of its other operations. The problem is that the macOS version of ls is missing some of the options that Dired needs. The solution is to use the GNU version of ls, called gls. That’s easy to do but you first have to install it. The easy way to do that is through Homebrew. Once gls is installed, you need merely tell Dired to use it.

All the details for solving these two problems are in JTR’s post so if you’re running on macOS, you should definitely take a look at it. I’ve had both those changes installed for as long as I can remember but I do recall struggling with these issues until I found the solutions. Happily, if you’re new to Emacs on the Mac, JTR has both solutions for you in one place.

Posted in General | Tagged , | Leave a comment

Emacs 31.0.91 (pretest 2) Is Available

Sean Whitton writes to say that Emacs 31.0.91, the second Emacs 31 pretest, is now available. If you’re interested in trying it out, you can get a copy from https://alpha.gnu.org/gnu/emacs/pretest/emacs-31.0.91.tar.xz. It’s signed so you should also get the signature file from https://alpha.gnu.org/gnu/emacs/pretest/emacs-31.0.91.tar.xz.sig.

This is good news, of course, because it means that Emacs 31 is that much closer to release. There’s some great new features coming in Emacs 31 (see the NEWS file for details) so I’m looking forward to its release. On the other hand, it’s good that the devs are being conservative and trying to wring all the bugs out before the official release.

If you don’t mind living (slightly) on the edge, try it out and let the devs know if you find any problems.

Posted in General | Tagged | Leave a comment