What Cursor Position

You may or may not know about what-cursor-position (bound to Ctrl+x =) that displays the current position of the point in the echo area. It’s probably not too useful if you have the row and column displayed in the mode line although it does give additional information.

Wilfred Hughes’ Emacs Command of the Day offers a handy tip about it:

All that information is the same as what you get with describe-char but it’s conveniently bound to a shortcut, which decribe-char isn’t by default.

Posted in General | Tagged | Leave a comment

File Name Conventions and Tagging Trees

A couple of days ago, Karl Voit gave a really great talk at Grazer Linuxtage 2018. It was entitled The Advantages of File Name Conventions and Tagging, which is pretty much self-explanatory except for the tagging part.

The first part of the talk discusses Voit’s fine naming conventions and the tools he uses to make dealing with them easier. A typical file in his file system has the form

 2013-05-09T16.17 file name with time stamp -- tag3 finance.csv 

Note that there are several parts to the name. First there’s the date or date/time section that gives the date—and perhaps time—of a file. Next there’s a brief description of the file’s content followed by one or more optional tags separated from the description by “ -​- ”. Finally, there’s the file extension, as usual.

Notice how that convention makes it easy to search for files in any number of ways. If you’re searching for photographs taken on 2018-04-29, you might use something like

find . -name "2018-04-29*.jpg" 

to locate them no matter where they’re stored. Similarly, you could search for one or more tags.

The meat of the talk for me is the notion of Tag Trees. The idea is that the files are kept in a single storage area and then indexed by their tags. If we’re trying to find the file 2013-05-09T16.17 file name with time stamp -- tag3 finance.csv, we can look for all the files in the Tag Tree with the tag tag3 or for all the files with the tag finance but there might be many such files. In the branch of the Tag Tree for tag3 there’s a subtree for finance, which has all the files with a tag of both tag3 and finance. Similarly, the Tag Tree branch finance/tag3 contains a link to the file.

I’ve given a very brief description here, so be sure to take a look at the talk for the details. The video is 45 and a half minutes, so plan accordingly. If you’d like to get your file system organized and make files easy to find, you really need to watch this video.

Posted in General | Tagged | Leave a comment

Emacs Video: Play Emacs Like an Instrument

Alain Lafon gave an excellent talk on using Emacs like a virtuoso, which, happily, was captured on video and is available for everyone to enjoy. The talk isn’t really an introduction to Emacs for n00bs—although it could be used for that—rather it’s a demonstration of how a master uses Emacs as the center of all his computing.

Lafon’s inclination, like mine, is to do everything from within Emacs. He thinks of Emacs not as an editor but as a Lisp REPL. That’s similar to my thinking of Emacs as a sort of light-weight Lisp Machine. The impetus for both points of view is that Emacs is the hub of our computing, not just an editor.

This talk is definitely worth watching. I learned about generating thumb nails of pictures from Emacs, picked up an idea for a “code snippet” capture template, and several other Emacs capabilities that I either didn’t know about or didn’t know the details of. The subject matter is much too extensive to cover here so I’ll just refer you to the talk. The only thing that surprised me about his Emacs environment is that he’s still using Ido and Smex rather than the far superior Ivy/Counsel/Swiper suite.

The video is a bit over and hour and 50 minutes so you’ll definitely need to schedule time. You may want to download the slide deck first so that you can get an idea of what Lafon covers but be warned that the slides don’t cover some of the most interesting material he discusses.

Again, even though the video is lengthy, it’s well worth your time. You’ll almost certainly learn some new Emacs techniques and it’s just enjoyable to watch a master show his work flow and what he can make Emacs do.

Posted in General | Tagged | Leave a comment

Documents and Presentations with Org Mode

John Goerzen has another post in his coming back to Emacs series. This time he looks at writing documents and preparing presentations with Emacs and Org mode. It’s an elementary discussion but there’s plenty that will be useful to newcomers to Org.

He starts with an explanation of the Org exporting system and how easy it is to export an Org document in many different formats. In addition to the “standard” export formats provided out-of-the-box by Org, there are several 3rd party packages that allow exporting to additional formats.

One of those export options is to Beamer. Although it’s just another export choice, it feels like a separate functionality. You can write your presentation in an easy and natural way with Org and then export it to a set of slides suitable for a presentation. Although he doesn’t mention it, there is also the org-reveal package for presentations. If you have presentations to give and want slides to go with them, either Beamer or org-reveal gives you an easy way to generate them from the comfort of Emacs and Org.

If you’re new to Emacs, Goerzen’s series on his return to Emacs is worth reading. It’s a good overview of Org mode and Emacs and what they can do for you.

Posted in General | Tagged , | Leave a comment

Org 9.1.12

Bastien Guerry tweets that there’s a new version of Org available:

If you’re tracking the Org repository, the new version is already there.

Posted in General | Tagged , | Leave a comment

Happy Birthday Irreal

Today is the 7th anniversary of Irreal as a WordPress blog1. Irreal started out as a way to make occasional posts about Scheme, Common Lisp, and a couple of other Lispy subjects. It’s evolved into a daily blog that considers a broad range of technical areas and, occasionally, a rant about privacy and government spying on its citizens.

A lot of readers think of Irreal as an Emacs blog, which isn’t surprising given that the majority of my posts are on Emacs. I didn’t expect that but I suppose it’s a logical outcome of my interest in Lisp and my yearning for a Lisp Machine-like environment.

As Irreal enters its eighth year, I expect things to stay pretty much the same: daily posts featuring a lot of Emacs, some Lisp, and the occasional venting of my fury about government surveillance abuses. If there’s something that you’d like to see me write about more, feel free to leave a comment.

Footnotes:

1

The original Blogger version of Irreal started in 2009.

Posted in General | Tagged | Leave a comment

Programs that Program

I’ve written before about Eric Raymond’s (esr) UPSide project that aims to build an open source UPS that has reasonable performance and sensible operation. Esr’s latest post is especially interesting to me because it uses one of my favorite techniques: having programs write programs.

The control logic for UPSide features a state machine that listens for events—loss of AC power, say—and performs the required action based on the current state of the system. The traditional way of documenting state machines (at least for reasonably sized ones) is with a state transition diagram. Here’s the state transition diagram for UPSide. It’s straightforward and easy to understand. Spend a couple of minutes with it and you’ll understand the broad view of how UPSide works.

The diagram itself is produced with the Graphviz dot language. Dot is pretty simple to use but there’s a lot of boilerplate and it can be hard to read. Rather than deal with the grunt work, esr wrote the states and their transitions (what he calls “actions”) in a pseudocode that he shows at the bottom of the state diagram. I almost always do something like this when I’m dealing with a nontrivial dot graph because it lets you think about the diagram you’re producing rather than the dot language.

Esr took this one step further. He realized that he could use that pseudocode to generate the Go source code for the state machine too. That’s a big win because it’s much easier to understand and debug the state diagram then it is the Go code. Indeed, within an hour of posting the diagram, people were already reporting a bug in the state machine. Did you see it? Fixing it was easy: Esr simply changed a single action in the pseudocode and regenerated the diagram and Go code.

Generation of the diagram and code are both done with this small Python program. Everything that’s needed—including the pseudocode—is contained in the source for that program. It’s easy to understand and worth studying if this technique is new to you. Or even if it isn’t, you may learn some useful ideas.

Esr talks about using this technique in this UPSide progress report.

Posted in Programming | Tagged | Leave a comment

Enough With Smartphone Addiction Already

The new luddites are ever with us, of course, but I must say that the constant harping on smartphone addiction is becoming tiresome. Actually, it became tiresome some time ago; now it’s infuriating.

I was saddened to see that Tony Fadell has joined the cacophony and is agitating for Apple—of course—to do something about it. As I argued before, it’s not up to Apple or anyone else to solve this problem for you. If you think you have a problem—something I find unlikely—then it’s up to you to find a solution, not Apple or any other smartphone provider.

The TechCrunch article on Fadell’s remarks notes that he makes an analogy with healthy eating. Just as we listen when the nutrition experts tell us what constitutes a healthy diet, we should also listen when the tech addiction experts tell us what constitutes healthy behavior. Maybe I’m just feeling curmudgeonly today but that statement infuriates me.

In the first place, those nutritional experts have been telling us for 50 years to avoid fats and eat carbs instead. Except, oops, they were wrong and we ended up with a nation (or world) of overweight people. Now we’ve got a bunch of “experts” from a field that can’t even manage a 50% reproducibility rate in their studies1 telling us how we’re behaving unhealthily with our phones. My attitude is, “Get back to me when you can show me some reproducible studies.”

Fadell notes that Apple can already provide use tracking to help iPhone users use their phones responsibly. Does anyone else find that condescending and annoying? Apple, Fadell says, is willing to provide this capability for young people so parents can monitor their iPhone use. Just what we need: another way for parents to spy on their kids. I’m a long way from being a kid but that enrages me even so.

I wish these people would throw their phones away and go live on a farm. Maybe carrying water from the well will keep them busy enough that they’ll leave the rest of us alone to enjoy the benefits that technology brings.

Footnotes:

1

According to a 2015 study in Science, only 39% of psychology studies were reproducible.

Posted in General | Tagged , | Leave a comment

Zamansky 48: Silver Searcher

The other day, Mike Zamansky made a post that I really liked. It was about his grading workflow and how he tries to lessen the tedium by making it as efficient as possible. As many of you know, I enjoy reading about other people’s workflows and invariably learn something useful from them. It didn’t have a video but I was planning to write about it anyway. Then, Zamansky produced an accompanying video that talks about some of the tools he uses.

Zamansky has his students submit their homework and projects into git repositories, which he clones so that he can examine and grade their work. A typical (abbreviated) setup might look something like this on his computer (stolen from his Grading Workflow post):

hw
├── doe_jane
│   ├── hw_01
│   ├── hw_02
│   └── hw_03
│ 
└── doe_john
    ├── hw_01
    └── hw_02

Suppose he’s grading hw_02. He’d like to produce a dired listing that has just the hw_02 repository for each of his students. It’s a little tricky because the hw_02 repositories have separate parent directories. You need something like find to locate those files and pipe them into dired. The dired command find-name-dired does this but adds the inode number to the listing, which makes it wrap and look confusing.

Zamansky’s solution is to use The Silver Searcher and Philip Snowberger’s ag.el package that include the function ag-dired-regexp. That allows Zamansky to search for hw_02 in the hw directory and produce a nice dired listing of all the repositories for that assignment.

The video and post are definitely worth your time. Even if you’re not a teacher, you may have a workflow that can leverage the same ideas. The video is just short of 12 minutes so you can watch it while you’re enjoying a cup of coffee.

Posted in General | Tagged | Leave a comment

The Trouble With OneNote and Evernote

In a post that serves as a nice complement to my recent musings on Open Source Tools, Karl Voit notes that Microsoft is discontinuing OneNote. Although he’s too polite to say so directly, if you’re a OneNote user, you have no one to blame but yourself. OneNote suffers from all the disadvantages that I discussed in my Open Source Tools post: it runs on someone else’s computer, uses a proprietary file format, and, as Voit’s post reminds us, is subject to discontinuance at someone else’s whim.

Not being a Windows user, I’ve never used or even seen OneNote but I have read about it in Bell and Gemmell’s Total Recall. That’s the book that got me interested living a (more) digital life and eventually led me to Evernote. Like OneNote, Evernote’s purpose is to store all your data, whether it’s a Web page, a note, some audio, or whatever. Like OneNote it has a proprietary file format, runs on someone else’s server, and could be gone tomorrow. I no longer use it although I still pay for it and have a few notebooks containing material that I mostly don’t care about very much.

My solution for replacing these proprietary and, in the end, dangerous-to-use services is the same as Voit’s: switch to Org mode. Unlike OneNote and Evernote, Org runs on your own machine, is open source so it will always be there for you, and, most importantly, stores its data as plain text1. The data is readable by any application that knows about text.

Voit makes the case for Org mode in his post but by now we2 should all be familiar with it. For most of us, what’s required is to import any data we care about into Org so we no longer have to worry about what third parties are planning to do with their products.

Footnotes:

1

You can, of course, ask it to store a file that’s not text but that’s a function of the data itself, not how you’re storing it.

2

In this context, “we” means the community of Emacs users, of course.

Posted in General | Tagged , | Leave a comment