Crafted Emacs v2

Michael Ashley wrote to tell me that System Crafters has released version 2 of their Crafted Emacs configuration. Irreal readers will be familiar with System Crafters from David Wilson’s System Crafters video series that I’ve written about many times.

It turns out, though, that they also produce the Crafted Emacs configuration, which can be described as a sort of Emacs starter kit with the emphasis on starter. Their idea is to provide a simple but effective Emacs configuration that can serve as a starting point for users to build their own bespoke configurations.

The base configuration is designed to provide reasonable defaults that result in a usable Emacs. They add a few packages to that base configuration but mostly leave the development of the configuration to the user. They believe that the end configuration should be uniquely the user’s and that Crafted Emacs is merely a jumping off point.

If you’re like me and already have a highly customized configuration, it’s still worthwhile taking a look at the repository to see the defaults they chose and some of their implementation strategies. For example, I learned that you can specify priorities for your ELPA repositories so that you get your packages from your preferred repositories, whatever they are. I was also impressed that they used customize-set-variable instead of setq for defcustom values.

If nothing else, you should take a look at their README to see what the project is about and their philosophy. It’s comprehensive but worth a few minutes of your time. I see lots of people wanting to migrate off, say, Spacemacs or Doom and develop their own configuration. Crafted Emacs is an excellent way of getting started.

Posted in General | Tagged | Leave a comment

Customizing Emacs Journal

Rob Streeting has a very interesting post on building the ideal Emacs journal. He was an Org-roam user but discovered that he never seemed to add links to the data he needed later. He began building the ideal journaling system in his head but discovered that org-journal did almost everything he wanted.

His original plan was to modify the source code to mold org-journal to fit his workflow but he soon realized that all he had to do was write a wrapper function around org-journal-new-entry. It was almost like advising the function except that he called his wrapper function directly rather than org-journal-new-entry to add a new entry.

He had four types of entries he wanted to make:

  • Tasks
  • Notes
  • Meetings
  • Breaks

His wrapper code takes care of clocking him into and out of events when he adds a new entry. It also insists that his cursor be on a TODO task when he chooses a Task event. That automatically creates a link from the journal entry back to the TODO and clocks him into the TODO task.

He includes the code for his wrapper function at the end of his post so you can see how he did it. It’s quite clear and easy to follow and could easily serve as a go-by for your own custom org-journal. He’s added some tweaks since but he provides a pointer his Github repository so you can his latest version.

I really like his system and am half tempted to replace my own system with something similar. I have a journal file but it’s more general and doesn’t use org-journal so it would be a major effort to migrate. Regardless, it’s a good post with some nice ideas so take a look.

Posted in General | Tagged | Leave a comment

Exploratory Data Analysis With AWK

This post is about Brian Kernighan and AWK, two things always worth hearing about. All of you, I’m sure, know that after retiring from Bell Labs, Kernighan took a professorship at his Alma Mater, Princeton. Since he’s been there, Kernighan has often offered courses in Computer Science aimed at students in the Humanities, such as Computers in our World.

Last Spring he taught a course in the Humanities department, Literature as Data, that considered using computational techniques for answering questions in literature research. The usual vehicle for this sort of thing is Python and the Pandas library but Kernighan and his co-instructor decided to emphasize AWK and how it can be used in exploratory data analysis.

After the class was over, Kernighan wrote a short essay describing the class and their experience with it. He gives examples of many of the questions they explored by running AWK against a database of sonnets and their authors. The database is in CSV format and perfect for exploring with AWK. Some of the results were surprising. For example, although sonnets are supposed to be exactly 14 lines long, some—even some by Shakespeare—have more or less lines. One even had 123 lines. Who were the poets who broke the rules? AWK makes it easy to explore the question.

Kernighan’s essay has more examples of questions they were able to explore by querying the database with AWK. The essay links to the database they used so you can play with it yourself if you’re inclined. It’s an interesting essay and a short read so well worth spending a couple of minutes on.

Posted in General | Tagged , | Leave a comment

PlantUML and Org-mode

AbstProcDo, like me, is a terrible artist. Sometimes, though, we need to add a diagram to our documentation, report, or Blog post. I usually use Graphviz or, when I’m in Troff mode, Pic for this. But these aren’t the only possibilities. Another that I keep meaning to try is PlantUML. Despite its name, it’s a pretty flexible drawing program—at least for the types of diagrams that I need to draw.

AbstProcDo has a short reddit post that very succinctly demonstrates using PlantUML with Org Babel. It’s by no means a complete exegesis on using PlantUML but it does give a flavor of using it with Org mode and showcases two very different types of diagrams that you can produce with it.

I like that the markup language is intuitive and probably easy to remember. Take a look at the second diagram and the markup that it generated. It would be a lot harder to generate that in Pic or even Graphviz. Don’t get me wrong, they’re both great applications that I’ve used many, many times over the years but I don’t use them everyday and I always have to refresh my memory on their use when I do.

If you occasionally have to produce line drawings in your work, PlantUML is definitely worth a look.

Afterward

After writing this post, I discovered a second reddit post by AbstProcDo that describes making Gantt-like charts with PlantUML. You can see an example of its actual use in Org Babel blocks here by clicking on the Raw button.

Posted in General | Tagged , | Leave a comment

The find-grep-dired Command

Just a quick tip from Ruslan Bekenev: find-grep-dired. It’s a nice way of running grep directly from a Dired buffer. The nice thing, as Bekenev points out is that the result is a filtered Dired listing of all the files that contain the specified regular expression. That means that you can do any of the standard Dired operations on them.

The command is really easy to use. The starting directory is already filled in for you, although you can edit it if desired. Then you just specify the regular expression and Emacs takes care of the rest.

You should contrast this with the Dired dired-do-find-regexp command (A) that searches only the marked files and produces a standard grep output. The commands are different but both can be useful. They’re just another set of tools in your Emacs arsenal.

Posted in General | Tagged | Leave a comment

Zamansky: Learning Elisp #11

Mike Zamansky has returned from his European vacation and is jumping right back into his Learning Elisp video series. The current video is the start of a new project: automatically inserting an Emolji into an Emacs buffer.

This video is an easy introduction to the project. The idea is that the text :bird:, say, should be replaced by 🐦, the Emolji of that name. That’s not too hard. Zamansky starts with a short list of Emoljis and names arranged in an association list. The rest is easy. Simply look up the name in the association list and substitute the corresponding Emolji.

The first video is concerned with implementing a simple function to do this. Right now, you have to call the function manually to do the substitution but Zamansky plans to make this automatic by invoking a hook function. After that, he is going to use overlays to to display the Emolji but keep the underlying text the same. Finally, the plan is a capture all this in a minor mode.

You may or may not be interested in having this capability but that’s not the point. The point is to demonstrate how to do things like automating actions with hook functions, use overlays, and even implement a minor mode.

The video is 15 minutes, 32 seconds long so you’ll probably have to set aside some time but, as always, Zamansky’s videos are worth the time. If you already know some Elisp or have watched the previous Learning Elisp videos, you probably won’t learn much new from this one but it’s setting the stage for the more advanced techniques that are coming.

Posted in General | Tagged | Leave a comment

Emacs 29.2 Pretest

Eli writes to tell us that the Emacs 29.1.90, a pretest for Emacs 29.2, is available. It seems like 29.1 was just released and we’re already in the early stages of the Emacs 29.2 release. The point releases are mainly bug and bolt tightening fixes, of course, but they’re still a welcome addition to the Emacs family.

As always, thanks to Eli and all the other developers who have worked so hard on this new release. If you can, please help out the effort by using and testing the pretest. It will help the developers clean up any remaining problems.

Posted in General | Tagged | Leave a comment

A (Non Irreal) Rant On Returning To The Office

As you all know, forcing workers to return to the office is one of my hobby horses. I’ve written about it quite a few times. From what I can tell, it’s mostly a matter of CEOs talking to each other rather than their employees and exposure, in one way or another, to the downtown real estate market.

Soatok has a full blown rant on return to the offfice that makes my efforts look meager and forgiving. His rant is based on experience. He was hired as a remote-only employee working from home in Florida. He doesn’t identify the employer but my sense is that it was not local. After COVID, the company’s CEO unilaterally decided—apparently with no evidence supporting the notion that it was a good idea—that everyone should return to the office and that remote employees must relocate. It doesn’t take a business genius to realize what a bad idea that was.

In any event, Soatok played along until he found a new employer and reports that a majority of the best engineers did likewise. The comments to the reddit post are also revealing. Several of them recounted similar experiences and most of them expressed support for Soatok’s opinion. A few made the obvious observation that some people prefer working in the office and should be allowed to do so.

The best comment, in my opinion, told the story of the commenter’s experience. When his company’s CEO demanded everyone return to the office the employees revolted. When the company actually talked to the employees, it turned out that the main concern was paying for child care. The company instituted a policy of subsidizing childcare and everyone walked away happy. Often it’s just that simple: talk to the people your policy is going to affect.

Posted in General | Tagged | Leave a comment

Marking Repeated Words

One of the first things every writer learns—probably in high school—is to avoid using the same word repeatedly in close proximity to each other. I’m really strict about that to the point where I try to avoid using the same word close together even twice. For me at least, it’s hard to get this right the first time. When I first read a post right after reading it, there’s almost always some repeats that I have to fix up.

Marcin Borkowski has the same problem. Borkowski’s problem is even greater since he’s often writing in English, which is not his first language. To help with that problem he wrote a bit of code to find out how far away from a given word other instances of that word are. In addition, he highlights those words giving him a nice visual image of how close the collisions are.

The code is reasonably short so you can just suck it into your own init.el if you’re interested in a tool like this. A year and a half ago, I wrote about Albert Heinle who had a similar problem and also made his code available.

Other editors may or may not have a function to help with discovering repeated words but how many can let you add that functionality to the editor on your own? Even if an editor claims to be “extensible” how many have an extension language powerful enough to do the job easily? This is Irreal so you all know the answer.

Posted in General | Tagged | Leave a comment

Five Reasons To Love Org Mode

Gavin Freeborn has a new video on 5 Reasons I Love Emacs Orgmode. Freeborn notes up front that Org is so big and has so much functionality that it can be intimidating. Rather than try to cover everything it does, he concentrates on how he uses Org to manage his life and workflow.

As most of you know, one of my primary uses of Org is note taking and writing. Freeborn’s usage seems similar. He uses it to keeps notes on the projects he working on, share results and insights with colleagues, and capture his debugging efforts.

He also covers capturing and exporting. In a way, these are what make Org so powerful. You can write an essay or report in Org and export it to PDF to share with others. The thing about Org, though, is that you can export to pretty much any other format and if, in the unlikely even that Org doesn’t support the intended output target, you can seamlessly use Pandoc to export your document to almost any conceivable format.

The other side of Org exporting is the capture system. You can configure capture templates to capture information and turn it into an Org entry. The system is very flexible and can turn captured information into virtually any type of Org entry.

Of course, the main advantage of Org is that everything is in plain text. There’s a lightweight markup that Emacs seamlessly renders correctly but you can edit an Org file with any editor. It’s the ultimate defense against application lock in: Your data is always available and parsable regardless of what happens to Org mode and Emacs.

If you’re an experienced Org user, the video probably won’t tell you anything you don’t already know but if Org is new to you, it offers good overview of why it’s worth your while.

Posted in General | Tagged , | Leave a comment