Making text diagrams with Artist mode

Leveraging more Emacs features to do useful things.

When writing code or taking notes, I occasionally find myself wanting to include some kind of drawing alongside the text. I have historically used Mermaid diagrams for this, but I find they suffer from two key limitations. The first is that by virtue of being a description of a diagram rather than a diagram itself, Mermaid diagrams require some kind of renderer to actually produce meaningful output. The second is that this output is generally an image when I frequently prefer something I can embed in text. Fortunately, while browsing the Emacs manual the other night for inspiration, I happened to stumble upon Picture mode and Artist mode.

Per the doc-string for artist-mode (from the GitHub mirror, as the GNU git browser is too slow):

Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard.

The mode is fairly straightforward, and largely does what it says it does: mouse-2 (i.e., the middle click button on a modern mouse) and various hotkeys allow the user to set an operation to use, such as drawing a line, and mouse-1 executes that operation. By holding shift at the same time as mouse-1, Artist mode will execute a different flavor of the same operation. The line operation, for example, allows for drawing a line from one point to another when not holding shift. When holding shift, however, it limits lines to one of eight directions. The output of Artist mode looks something like so:


                                                                     .
                                                                . .  m
                                                              .  ..-.+. .
                                                              ----m.+#.
                                                            ...-+m#*%%.-
               . -.- --                                  -  ++--*#%.%.+
          .- . ..-+++..+...                        . --  . +-%mm*m. -+ .
          .-.m -%++.+ m-.   - -.                -  .-m .-..*.+.%+..-.
        -+%m.+-*#**#-##+%-+.-.   -   .  ..   ..-..m.*+m+%+##-%++m+.
      --m-%%#*# ..-*.--#*%# *.-%.-.  m % .--.m- -%+.##%+*-- . . .
     .  *##-m*+%--m.m-.-m+.*+%+*#--+ m++ %mm.+#####%# ..   .-.. .
    .-+*#m .-m. -.-- + .--.- *+m#+####+#+##+%*#-+ +-  - .-
     m.*mm+m.. .      .. . ..+-.%-m.m-+.--m +-m..m.--
    --m++.-                 -  .+++--  -- - - - .m -
    -.*%. +                        ..... -   .-
     .+#.-
     ..+
         .
      .

    +------------------+                     +------------------+
    |                  |                     |                  |
    |                  |                     |                  |
    |        A         |<------------------->|        B         |
    |                  |                     |                  |
    |                  |                     |                  |
    +------------------+                     +------------------+


Since it is a minor mode, it is possible to enable it within a buffer that is already using some other major mode. This is particularly useful in cases where a user might want to include a diagram in source code or some other text file. For example, the following Org entry about edible plants includes a (partial) taxonomy of things humans can eat:

** Edible plants
:PROPERTIES:
:ID: 44592df2-0351-40e4-ab02-3fceff0e096d
:TIMESTAMP: <2026-08-22 Sat>
:END:

The following is a partial taxonomy of edible plants:

                  +------------------------+
                  |                        |
                  |      Edible plants     |
                  |                        |
                  +-----------+------------+
                              |
                  +-----------+------------+
                  |                        |
         +--------+---------+    +---------+---------+
         |                  |    |                   |
         |    Rosaceae      |    |   Amaryllidaceae  |
         |                  |    |                   |
         +--------+---------+    +---------+---------+
                  |                        |
         +--------+---------+    +---------+---------+
         |                  |    |                   |
         |      Apple       |    |       Onion       |
         |                  |    |                   |
         +------------------+    +-------------------+

There are some quirks in Artist mode. I haven't quite figured out what "vaporize" does, for instance, and changing operations via mouse-2 doesn't work at times. However, I have found it to be a decent way to quickly create diagrams that I want to be embedded in text (or to just doodle with the spray can to pass the time).

Subscribe to treats.now

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe