notes from /dev/null

by Charles Choi 최민수


10 Feb 2026

Deburring Emacs Imenu GUI Configuration

A while back, I made a post on Emacs Imenu configuration that made an unsafe assumption that any mode derived from prog-mode would support Imenu. Turns out, that’s not always true (for example, looking at you gnuplot-mode). This post shows how to deal with this using an error handler.

One such implementation of an error handler is the lambda expression shown below using condition-case.

1
2
3
4
5
6
(add-hook 'prog-mode-hook
          (lambda nil
            (condition-case err (imenu-add-menubar-index)
              (imenu-unavailable
               (let ((inhibit-message t))
                 (message "Warning: %s" (error-message-string err)))))))

A couple of observations:

  • The error handler is opportunistic in applying imenu-add-menubar-index to a mode derived from prog-mode.
  • If the error imenu-unavailable is caught, then a warning message is logged but not messaged to the mini-buffer.
    • The variable inhibit-message is used to avoid sending a warning message to the minibuffer (it will still be logged in *Messages*) to avoid noise from modes that do not support Imenu. (Thanks to bpalmer for this guidance.)

If you use Emacs and this is the first time you’ve heard of Imenu, I highly recommend that you learn what it has to offer.

emacs

Past Articles

7
FEB
2026

Using Casual to work with Emacs Registers, Rectangles, and Windows

Use Casual to effectively use Emacs registers, rectangles, and windows on the regular.

read more
26
JAN
2026

Getting Eshell nth History to Work

Out of the box, Eshell nth history recall is disabled. Here’s how to turn it on.

read more
22
JAN
2026

Announcing Casual EWW

Announcing Casual support for EWW, a web browser within Emacs.

read more
6
JAN
2026

Announcing Casual HTML & CSS

Announcing Casual support for the HTML and CSS editing modes in Emacs.

read more
4
JAN
2026

Moment - Thursday January 01, 2026 00:06 PST

Photo taken Thursday January 01, 2026 00:06 PST.

read more
30
DEC
2025

F16 F17 F18

Binding the function keys above the number pad to window management has been a total win for me. Perhaps it might be the same for you.

read more
17
DEC
2025

Export Org to Markdown with the Clipboard

A companion post to my last one on importing Markdown to Org, but the other way around.

read more
4
DEC
2025

Import Markdown to Org with the Clipboard in Emacs

Import Markdown from other apps into your Org files easy.

read more
24
NOV
2025

Announcing Casual CSV

If you need to work with CSV files in Emacs, Casual with csv-mode can help. Announcing Casual CSV, now available in the Casual v2.11.1 update.

read more

Page 1 / 18   >

 

AboutMastodonBlueskyGitHub

Feeds & Tags
Get Scrim for macOSGet Captee for macOS

Powered by Pelican