Pages

Tuesday, June 2, 2026

Change Emacs Cursor to Indicate Overwrite Mode

The text editor I'd used for 20 years on an MS-DOS platform would change the shape of the cursor to distinguish between insert mode and overwrite mode. A filled rectangle (or box, in Emacs terms) indicated overwrite mode; an underscore (hbar), insert mode. It's a nice way to make overwrite mode obvious.

The video starts out with Emacs in Insert Mode. Then Overwrite Mode is activated, which changes cursor-type from hbar to box. The word "Overwrite" replaces "Insert" to demonstrate the effect.

Incidentally, you might enjoy listening to some sound while playing back the video. One of my favorites is "Forest Voice" from https://mynoise.net, by Dr. Stéphane Pigeon.

Anyway, here's a function to implement that behavior in Emacs:

(defun zeit-change-cursor-shape ()
  "Set cursor shape depending on overwrite mode.
When overwrite-mode is nil (off), set cursor-type to hbar.
Otherwise, set it to box."
  (interactive)
  (if (not overwrite-mode)
      (setq cursor-type 'hbar)
    (setq cursor-type 'box)))

Wednesday, May 27, 2026

Emacs view- Commands

A kind reader suggested I try the view-lossage command to display a list of recent keystrokes. This would be helpful for those times when I press a key accidentally and don't know what I did (as described in "zap-to-char M-z").

The output resembles what you'd get from edit-kbd-macro (assuming that a keyboard macro had been defined). This provides an alternate way to define a keyboard macro -- just select the desired portion of the output and invoke read-kbd-macro.  At this point you can "play back" those keystrokes with C-x e.

After I understood view-lossage,  I skimmed through the list of commands that start with view- (by doing M-x view- TAB). The commands view-buffer,  view-file(and variants that view in another buffer, window, frame) provide a safe (read-only) way to examine the contents of a buffer or file.

Entering M-x view-file-other-frame .emacs allows me to display my init file in a new Emacs frame and close it (by pressing "q") when I'm done with it. And then I don't have to worry about changing it inadvertently.

Monday, May 25, 2026

Emacs and Wordle

Did you know that "EMACS" is a valid Wordle word?  Check it out:

Sunday, May 24, 2026

zap-to-char M-z

Sometimes I discover an Emacs feature after an accidental keystroke. If I can remember the keystroke, I'll invoke the keystroke help (C-h k) to learn about it. Or sometimes the prompt in the mode line will suggest the function's name.

Today, the keystroke was M-z , which is bound to the function zap-to-char.

It seems to be ideal if, like me, you doze briefly while typing a senteeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Oops, there I go again!

To fix that I can just press M-- M-z t to delete all the trailing "e" characters.

Note that M-- is invoked by holding down the Alt key while pressing hyphen. It defines a negative prefix argument, which instructs zap-to-char to "go backward," deleting all characters from point to the specified character ("t"). I'm not sure how or why you'd want the default "forward" behavior.

What accidental keystroke have you discovered recently?

Saturday, May 23, 2026

Emacs -- It's Worth Revealing Oneself For

"...how can people keep up with what you're learning?"1

I've always kept a low profile on the Internet.  It can be a scary place!  But I've been asked to show glimpses of my online work to the people I was meeting in real life.

I agreed to chat with Sacha Chua about Emacs and Life (but not the Universe -- that'll be next time).  Emacs is worth revealing oneself for.  If people really do want to keep up with what I'm learning, they can visit here.

My init file2 shows only a small aspect of how I have Emacs configured.  You'll want to see an example of my org file(s), my diary file, and the Lisp I have tucked away under my home directory.

Aside from Emacs, my workflow relies on Vivaldi and LibreOffice, so I'll try to show what I'm doing with them, as well.  Perhaps I can provide screen recordings, too!

"Sometimes it just takes somebody saying, your stuff is interesting. I'm telling you, your stuff is interesting."3

Thank you, again, Sacha!


1Sacha Chua, https://sachachua.com/blog/#ID-ec23-transcript
2https://www.emacswiki.org/emacs/RaymondZeitler
3Sacha Chua, ibid.