Thursday, October 1, 2026

What is spook?

What is spook?

The Emacs function spook is not what you think it is. It doesn't make creepy noises, draw scary ASCII art or change the theme to orange on black. In fact it has nothing at all to do with Halloween, ghosts, monsters, pandemics or IRS audits.

What it does is insert words and phrases into the current buffer "to help give your message ... attractiveness for automated keyword scanners."

What kind of words or phrases might you expect to see? To find out I invoked spook while composing this content. Here's what it added:

TELINT Drug North Korea Security Consulting Virii Abu Ghraib Fort Hancock CUD AMEMB Vaccine MARTA racal E.O.D. Blizzard Nigeria

It's easy1 to configure spook to insert an alternate set of words and phrases -- just change the file name in the variable spook-phrases-file from "spook.lines" to the name of the alternate file. Unfortunately it must reside in the Emacs data directory; the file's location is fixed. The variable can be found in the Spook customization group, whose parent group is Games.

Even with only 72 lines in its source code file,2 spook demonstrates how to insert one or more random lines from a file into the current buffer.


1 It's "easy" if you have Administrator permissions.

2 The 72 lines is the entire spook.el file; the first 48% of the file provides the usual comments that describe the GNU GPL, author, maintainer info as well as documentation.

Wednesday, September 30, 2026

Now org-toggle-timestamp-overlays is Disabled

The default keybinding of org-todo is C-c C-t. Today I learned about another command with a similar keybinding (C-c C-x C-t) -- org-toggle-timestamp-overlays. Note the C-x in the middle.

When I pressed that key combination (inadvertently), all the YYYY-MM-DD timestamps in the buffer were converted to the MM/DD/YYYY format. This was unacceptable -- I needed to change them back. However undo did not revert the timestamps; it just undid the last edit. Furthermore, these undesired timestamps couldn't be edited and were impervious to org-shiftright. I was confused yet again.

I didn't even know how this happened. So I invoked view-lossage as a kind reader once suggested 1 and discovered org-toggle-timestamp-overlays.

The docstring was no help – it's self-evident that it would "Toggle the use of custom time stamp formats." Eager to clock out of my task, I didn't care to learn more. All I wanted to do was undo the effect.

I figured that since it toggles the timestamp, all I had to do was invoke it again to toggle it back. Nope. Well, a nice message appears, saying "Time stamp overlays removed." Yet the timestamps looked the same.

Undaunted, I figured I'd reload the buffer with org-mode-restart. That had no effect. To finally fix this, I deleted the buffer and revisited the file.

A command like this surely is in the same category as upcase-region, which is disabled by default. And so this is why I added (put 'org-toggle-timestamp-overlays 'disabled t) to my init file.

1 See https://ray-on-emacs.blogspot.com/2026/05/emacs-view-commands.html

Wednesday, September 16, 2026

A Niftier Way To ASCIIfy An Emacs Buffer

Web page content lately is littered with unusual Unicode characters that resemble ASCII characters. It's possible this is how an author (whether human or AI) might "sign" work.

I use a recorded keystroke macro to brute-force-edly replace such Unicode characters with their ASCII equivalents. This allows me to maintain ASCII-compatible files. For example, to replace the right single quote character having a character code of #x2019, the macro replays M-% ’ RET ' RET ! to replace all occurrences with the straight apostrophe, #x27.

I'm not trying to publish someone else's work as my own -- I do provide a reference to source whenever possible. I'm simply trying to keep my content as unadulterated as possible.

There are at least three problems with my macro:

  • If #x2019 can't be found, an exclamation mark is placed at point.
  • It fails to replace other single-quote-like Unicode characters such as #x2018 or #x2032.
  • The method is clunky and inelegant to an obscene degree.

However, I came across a function in replace.el that led me to find replace-char-fold, a very interesting custom variable.1

According to its docstring, "Non-nil means replacement commands should do character folding in matches. This means, for instance, that \\=' will match a large variety of Unicode quotes." This is exactly what I need!

Now I have Yet Another Fun Emacs Project (YAFEP), which is to create a sleek and robust ASCIIfy Lisp function. And YAFEP aligns fortuitously with this month's Emacs Carnival topic, which is Games.

What's been your experience with quoting web content?


1 For a deeper dive into character folding in Emacs, please read the info node on lax matching.

These pages on Wikipedia served as references for this article: