OSX Dictionary Interface

Here’s something that may be of interest to those of you falling in the intersection of Emacs users and Mac heads. It’s an Emacs interface to the macOS dictionary app. What it does is give you access to the macOS dictionary from within Emacs. There are two commands:

  1. osx-dictionary-search-word-at-point
  2. osx-dictionary-search-input

that look up the word at point or any word that you input. In both cases, the results are displayed in an Emacs buffer (rather than popping up a separate Mac window with the definition). Take a look at the screen shot at the link to see what it looks like.

This almost seems like a no-brainer but my dictionary needs are more than adequately met and I don’t feel the need to install this. As I’ve written many times, I have access to the famed 1913 Webster dictionary (my latest method for accessing it is here) and for quick lookups I use abo-abo’s excellent define-word. Still, if you’re using a Mac and don’t otherwise have an acceptable way of accessing a dictionary from within Emacs, this seems like an excellent solution.

Emacs really does offer us an embarrassment of riches. If you need a dictionary, there’s not just one or two solutions but many.

Posted in General | Tagged , | Leave a comment

Replacing Dash

It seems like only yesterday that Magnar Sveen introduced his Dash library for working with lists. It provided macros and functions for dealing with lists that weren’t covered by the standard Elisp library. Dash gained immediate traction and became a mainstay for Elisp developers. It’s one of those things that you use without even realizing it. So many packages install it that it’s present in almost every user’s Emacs so it’s easy to use its functions without realizing they’re from Dash.

Dash was so successful that its functions or their clones have made their way into the standard Elisp libraries. Now, Bozhidar Batsov writes that Dash has been essentially replaced by seq.el and subr-x.el and is no longer necessary.

No longer necessary except for the huge number of applications that use it. Batsov recently took over maintaining Flycheck and decided to eliminate the Dash dependencies. That turned out to be easy—almost trivial—to do. It was pretty much a one-for-one replacement of the function name.

It’s a tribute to Sveen’s vision and work that his library was so successful that the Emacs maintainers felt obligated to import its functionality into Emacs core. As a practical matter, Dash will live on if only because many of the applications that use it won’t have a Batsov to refactor them. It’s a nice library and I wouldn’t feel bad about using one of its functions today.

Posted in General | Tagged | Leave a comment

The History of C Compilers

Diego Crespo over at Deus In Machina has a nice post on the history of C compilers. If you’re a Unix head, you probably know most of it but it was fun to remember the old days of trying to use C on MSDOS. Remember, not relive. Back then C compilers were expensive and not that good but we were happy to have anything at all.

In the early days, machine language was a lot simpler and it was relatively easy to write compilers for machines such as the PDP 11. Recent processors, and even old Intel processors such as the 8086, were a bigger challenge. Still people wrote compilers for them but it wasn’t until GCC that a high quality free compiler became available. It’s easy to forget how easy we have it now.

C is more than 50 years old now and despite the naysayers, it’s still going strong. Yes, there are some dark corners but it’s not an exaggeration to say that our modern computer milieu is built on C.

That’s not to say, of course, that every application should be written in C. It’s great for operating systems, compilers, and system utilities but not everything needs to be written in it. As a case in point, Crespo mentions that the Ford F150 truck is run by 150 million lines of C code. As I said before, this should terrify you. There is no way that 150 million lines of C code doesn’t have significant errors, yet we’re riding around with that code everyday.

Regardless, C has a great history and is apt to be with us for some time.

Posted in General | Tagged | Leave a comment

And You Still Don’t Mess Around With Jim

Three years ago, I wrote about patent trolls and Cloudflare and compared filing frivolous patent suits against to CloudFlare to messing around with Jim despite the warning from the late Jim Croce. At that time, Cloudflare had already destroyed (literally) Blackbird Technologies, another patent troll, and were then being sued by Sable Networks who, apparently, hadn’t taken the Cloudflare response to Blackbird to heart.

Now, finally, that case has also come to an end. It didn’t end well for Sable Networks. Cloudflare used its usual strategy of offering a bounty for prior art on all of Sable Network’s patents—not just the ones being asserted against Cloudflare.

Despite the suit being filed in the Western District of Texas—a venue notorious for being friendly to patent holders—the jury took less than 2 hours to find not only that Cloudflare had not violated Sable’s patents but that the patents were invalid and should never have been granted.

Go read the story. It’s a feel good tale but it also underlines a not-so-good fact: lots (most) big companies such as Cisco, Juniper Networks, Checkpoint, Fortinet, and others just capitulate to these trolls rather than go to the expense of fighting them. It’s just cheaper. Sadly, this just encourages the trolls to go after other companies. Fortunately, they’re mostly too dumb to realize that you don’t mess around with Jim.

Posted in General | Tagged | Leave a comment

Opening Dired On External Drives

Marcin Borkowski (mbork) has a nice post on opening a Dired buffer for an external drive. Plugging the drive into a USB port causes it to automount but then you have to call Dired on the path to the drive, which can be long and complicated. Mbork’s solution to this is to automate the process.

If there is more than one drive mounted, his function will give you a completing read list to choose the one you want the Dired buffer for. It’s a small thing but like many things we do with Emacs, it helps smooth our workflow.

His code is both short and obvious, and nicely demonstrates how simple it is to do this sort of thing. This is an example of how easy it is to make Emacs into a secret weapon that can automate away many routine but tedious tasks. As Mbork says, it took him about 10 minutes to write the code but since he’s always mounting external drives, it won’t be long before he’s amortized that effort.

Posted in General | Tagged | Leave a comment

OPML and RSS

Knut Magnus Aasrud has an interesting post on OPML. If you haven’t heard of OPML before (I hadn’t) it stands for Outline Processor Markup Language and is a file format for outliner applications. It’s fairly general but has found particular use as a file format for exchanging subscription lists between feed readers and aggregators. It’s an unholy collection of nasty XML—although some think “nasty” applies to all XML—but it has the advantage of holding your subscription list and being exportable to HTML so that you can share it others on, say, your blog.

Of course, if you’re an Emacs user you have no need for OPML because you already have a builtin solution1 that does the same thing. I’m talking about using elfeed-org with elfeed as your feed reader. With elfeed-org you can list your feeds in a Org file and add descriptive text to each entry if you like. Naturally, this is exportable to HTML or most any other format you can think of so if you want to share it as a blogroll on your blog or someplace else, it’s easy. You can even export it to OPML so its capabilities are a strict superset of OPML’s.

It’s just another example of how Emacs has our backs. As I’ve said many times before, if you’re reading RSS/Atom feeds—and you should be—you can’t do better than elfeed. And if you want to see the actual articles instead of just the text, take a look at elfeed-webkit.

Footnotes:

1

Well, not really builtin but it’s a use-package away.

Posted in General | Tagged | Leave a comment

Cl-callf

Just a quickie today. I came across this reddit post about cl-callf. It was something I had never heard of. One of the Lisp idioms is to toggle a boolean with

(setq bool (not bool))

I use it all the time but when the variable is named AVeryLongAndStupidName instead of something reasonable like bool, it can be a pain because you have to repeat the name. Of course, no true Scotsman Lisper would use such a name but occasionally one comes across such monstrosities.

It turns out that Elisp has the macro cl-callf that lets you write the idiom as

(cl-callf not bool)

There’s also the related cl-callf2. You should check out the documentation for both because they’re a bit richer than the above suggests.

I’m not sure why Emacs thinks this is a Common Lisp thing because as far as I can tell there is no callf in Common Lisp. It’s probably due to the fact that the variable can be a place rather than a simple variable in which case cl-callf does the equivalent of a setf, a Common Lisp form. In any event, it can save you some typing when using a common idiom.

Posted in General | Tagged | Leave a comment

Zamansy: Using Emacs #82

Mike Zamansky is using some of his newfound free time to learn more about AI. He’s going through Andrew Ng’s Coursera ML class, which requires working in Python. Zamansky used to do a lot of Python but has recently switched to Clojure as his go to language. From his previous Python work, he’s familiar with the idea of virtual Python environments and wanted to upgrade his workflow.

In this latest video he talks about Conda and Direnv to help automate his Python workflow. Conda lets you set up separate environments for such things as the Python version and the packages available to it. This is really handy if you have several different Python projects going on or you want to replicate the environment of someone else’s project.

Of course, you still have to activate the appropriate environment before you start working in it. That’s where Direnv comes in. The idea is that you put a special file in the directory of your project and it will set up whatever environment you need when you enter the directory. It can, for example, activate a Conda environment but it’s more general and not really tied to Python. You can use it anytime you want to automatically set up an environment.

You can get all the details from Zamansky’s post and the associated video. It looks as if Direnv can be a little fussy to set up but he has links to his configuration to help you get going. The video is 15 minutes, 20 seconds long, so you’ll have to set some time aside but, as usual, it’s worth your time. Even if you aren’t using Python, you may find that Direnv can ease your workflow.

Posted in General | Tagged | Leave a comment

Emacs Elements on Denote

I’ve written about Denote before but those posts were usually about advanced features that Prot, the author of Denote, was working on. If you don’t know anything about Denote, those other posts may not have meant a lot to you.

Emacs Elements to the rescue. He has a short video called Emacs Note Taking Recommendation that’s a brief introduction to Denote for those with no experience with the app. Unlike the advanced features that Prot talks about in his videos, this video shows how easy it is to get started with Denote. There are only a few commands that you need to know to start using it effectively.

One of it’s really nifty features is the ability to import existing notes into Denote. When you do that, Denote will use the existing file date when renaming the file. It can also add the appropriate metadata, such as tags, to the file. Take a look at the video for the details.

One of the most useful things I learned from the video is dired-narrow-regexp. It’s part of the dired-narrow package and does just what its name says. You specify a regular expression in a Dired buffer and it will narrow the buffer to files matching the regexp. It’s very handy, especially since I already had the dired-narrow package installed.

The video is only 4 minutes, 16 seconds so you should not have a problem finding time for it. It’s a good introduction to Denote and worth a few minutes of your time.

Posted in General | Tagged | Leave a comment

Selected-window-accent-mode Now On MELPA

A month ago, I wrote about James Dyer’s experiment with marking the active window. His original idea was to make the fringe of the active window a different color so that it stood out and was easy to discern from the others.

Almost immediately, Ignacio Paz Posse commented on his solution which was to make the mode line of the active window a bright color. I loved his solution and adapted it for my own use. I haven’t looked back. I’m still using Posse’s solution and really like it.

Meanwhile, Dyer continued to evolve his method and even made it into a package. Now he has put it on Melpa along with his latest updates. Take a look at his screen shot to see what it looks like. It’s an excellent solution to marking the active window. I still prefer Posse’s method but many will, I’m sure, want to use Dyer’s solution. The Github repository for the project is here. It’s reasonably configurable so you can adjust it to your tastes.

Posted in General | Tagged | Leave a comment