Back to the talks Previous by time: Elisp and McCLIM Next by time: New in hyperdrive.el: quick install, peer graph, transclusion! Track: General - Watch

Re-imagining the Emacs User Experience with Casual Suite

Charles Choi (he/him) - Pronunciation: Che, IRC: kickingvegas, http://yummymelon.com/devnull/ , Mastodon: https://sfba.social/@kickingvegas

The following image shows where the talk is in the schedule for Sat 2024-12-07. Solid lines show talks with Q&A via BigBlueButton. Dashed lines show talks with Q&A via IRC or Etherpad.

Format: 19-min talk ; Q&A: BigBlueButton conference room https://media.emacsconf.org/2024/current/bbb-casual.html Etherpad: https://pad.emacsconf.org/2024-casual
Etherpad: https://pad.emacsconf.org/2024-casual
Discuss on IRC: #emacsconf-gen
Status: Q&A open for participation

Times in different time zones:
Saturday, Dec 7 2024, ~2:45 PM - 3:05 PM EST (US/Eastern)
which is the same as:
Saturday, Dec 7 2024, ~1:45 PM - 2:05 PM CST (US/Central)
Saturday, Dec 7 2024, ~12:45 PM - 1:05 PM MST (US/Mountain)
Saturday, Dec 7 2024, ~11:45 AM - 12:05 PM PST (US/Pacific)
Saturday, Dec 7 2024, ~7:45 PM - 8:05 PM UTC
Saturday, Dec 7 2024, ~8:45 PM - 9:05 PM CET (Europe/Paris)
Saturday, Dec 7 2024, ~9:45 PM - 10:05 PM EET (Europe/Athens)
Sunday, Dec 8 2024, ~1:15 AM - 1:35 AM IST (Asia/Kolkata)
Sunday, Dec 8 2024, ~3:45 AM - 4:05 AM +08 (Asia/Singapore)
Sunday, Dec 8 2024, ~4:45 AM - 5:05 AM JST (Asia/Tokyo)
Find out how to watch and participate

00:00.000 introduction 00:43.800 Recall vs recognition 02:34.800 Emacs with keyboard-driven menus 03:43.400 Transient 04:08.200 A Transient menu can be pinned 04:29.303 Modes are apps, really 04:59.527 Transient all the modes! 05:28.040 Casual design principles 06:17.960 Casual design conventions 07:04.366 Casual Dired 09:06.640 Casual EditKit 10:36.200 EditKit demo 11:31.997 Marking and moving 12:53.140 Rectangles 14:04.976 Numbering 14:36.600 Sorting 17:02.640 Casual has transformed my user experience with Emacs 17:34.451 Thanks and acknowledgements

Duration: 18:24 minutes

Description

To date, the predominant interaction model for Emacs has been to use keybindings or the mini-buffer prompt to issue commands. These commands are drawn from a vast ecosystem of packages (both core and third party) designed to extend Emacs. When these commands are used in aggregate, the aforementioned interaction model places a high cognitive load on the user. It also sets a very steep learning curve for Emacs.

The inclusion of the Transient model package in Emacs facilitates a different interaction model using keyboard-driven menu interfaces. Menu interfaces excel at discovery and recognition, neither of which are well supported with keybindings and a prompt. Menu interfaces also can be made contextual to allow the user to focus on a task at hand.

Casual Suite is a personal effort to re-imagine the Emacs user experience by using keyboard-driven Transient menus as its primary interaction model.

This talk describes Casual Suite, detailing its implementation and operation.

About the speaker:

Charles Choi has been an Emacs user since 1989 but did not get around to learning Elisp until 2022. He possesses formal knowledge of computers with a Ph.D. in Computer Engineering received from the University of Virginia in 1997. He is from and continues to live in San Francisco.

Transcript

[00:00:00.000] introduction

Hello, my name is Charles Choi and welcome to my talk: "Reimagining the Emacs user experience with Casual Suite." Casual Suite is a set of opinionated user interfaces to different modes offered in Emacs. Before I get into describing Casual in detail, let's first talk about the existing Emacs user experience. To make Emacs go, people can either invoke commands by name with execute-extended-command, run a command directly with a pre-assigned key binding, finally, use a mouse menu if it's available.

[00:00:43.800] Recall vs recognition

From human-computer interface research, there is a concept of recall versus recognition in user interface design. Let's show their distinction by example. A common recall interface is password entry. Absent any historical affordances, a user must directly remember information to succeed with this interface. In contrast, menus offer immediate visual cues on what commands are available. This allows a user to recognize familiar behavior to support successful selection of it. From user interface research, the key finding is this. Interfaces emphasizing recognition are much easier to use than those relying on recall. In this light, we see that the Emacs user experience leans too much towards recall. Completion in history can help tip the scales towards recognition, but only by a little bit. This reliance on recall is discouraging to users both new and old, and that's a shame because Emacs has so many useful commands. But the kicker is that most of them are infrequently used. You can't recall them all. At least I can't. So, a conundrum. While I've been using Emacs since the early 90s, truthfully, it's been only in this past decade that I've leveled up in using it. Org Mode, Magit, Eglot, Avy, and many other packages have transformed how I use it. I can only deal with so much cognitive load and physically straining key bindings. So, what to do about it?

[00:02:34.800] Emacs with keyboard-driven menus

Let's bring back an old ideal. Keyboard-driven menus have been around since TTY video terminals with mainframes. If you're old enough to recall working with such interfaces, these terms will seem familiar. They all worked with the limitations of text-based video displays. With keyboard-driven menus, if a command exists but nobody can find it, it's not really useful. A well-designed menu can make a command discoverable. If the command is infrequently used, making it recognizable helps a lot. And for working primarily with text, having keyboard-only interactions encourages flow. Given the above, the next steps seem natural: augment Emacs with keyboard-driven menus. This is not saying that I want to obsolete name commands, keybindings, and mouse menus. They all can happily coexist. Emacs is large. It can contain multitudes.

[00:03:43.400] Transient

Conveniently, Emacs has a built-in library for building such menus. It's called Transient, and it's been around since Emacs 28. Developed primarily by Jonas Bernoulli as a UI toolkit for Magit, Transient has an essential feature for building great keyboard-driven interfaces.

[00:04:08.200] A Transient menu can be pinned

A transient menu can be pinned and their state updated as commands are issued from them. This lets us build interfaces that reflect internal state changes made by commands issued from the user. This is great because many modes have stateful behavior, and guess what? Emacs has a lot of modes.

[00:04:29.303] Modes are apps, really

If you think about it, Emacs modes are akin to the ecosystem of apps that we see today, but with far less structure and packaging. A mode, like an app, focuses on delivering specific behavior to the user. There are many built-in modes in Emacs, and these modes are complex with dozens, if not hundreds, of commands. Calc itself has over 1,000 of them. It's frustrating to know that these commands are there, but I really can't access them via recall.

[00:04:59.527] Transient all the modes!

So I decided to do something about it, and that was to transient all the modes, or at least the most major ones. This past summer, I had the time and resources to start building Transient interfaces for modes that I wanted to more elegantly use. I decided to call this work Casual. Given its definition, it seemed like a good fit for the vibe that I wanted these interfaces to embody.

[00:05:28.040] Casual design principles

Design principles that I embraced up front were handcrafted information architecture and layout. This is largely an exercise in mapping a mode's command set to a hierarchical menu structure. I wanted these menus to make sense to most people. Ideally, users would not have to read documentation to get at the command that they wanted. Early on, I quickly learned that it was impossible to maintain the existing default key bindings when mapping them over to a hierarchical menu. Also, some bindings I just flat out disagreed with. I resolved to be friendly, but not beholden to them. In all of the above, I've gone out of my way to make clear that my design decisions are opinionated.

[00:06:17.960] Casual design conventions

Using casual. To reinforce habit, a common key binding is used per mode to raise a main menu. This key binding is left to user preference. For me, that binding is C-o. Command bindings are mnemonic when possible. Mode-specific settings are given their own menu. Since transient menus can be pinned, we can support repeat or stateful behavior in a mode. As of this writing, there are 11 modes supported by Casual, with several more on the way.

[00:07:04.366] Casual Dired

Let's look at the Casual menu for Dired to highlight the design conventions previously mentioned. In a Dired Emacs window, the user can invoke their preferred key binding to call a top-level Casual main menu. This main menu is displayed at the bottom of the Emacs frame. Zooming into this menu, we see the commands offered in it categorized into different sections. Each command has a key binding, usually a single character shown before its label. The File section holds commands that act upon the currently selected item or marked items. The Directory section holds commands that affect the current directory or its subdirs within it. The Mark section has marking commands that allow for aggregate operations. The Navigation section shows commands that move the point in a direct buffer. The quick section provides access to bookmark and buffer list commands. Search and replace commands are grouped in the search section. New directory and file creation are given their own section. Finally, at the bottom of the menu are commands dedicated to Casual menu navigation. Casual is conformant to Transient conventions where the key binding C-g for dismiss one and C-q to dismiss all menus are honored. Another transient convention is to reserve the key binding q to quit the current mode. For most main menus, casual uses the , key binding to invoke a mode-specific settings menu. Casual also adopts the common UI convention of using ... > symbols to denote required input and submenus respectively.

[00:09:06.640] Casual EditKit

Some commands are more global or non-mode specific in nature. A great deal of these commands relate to editing, which I find to be a prime motivation for using Emacs. Let's examine one such menu that supports this. The main menu for Casual EditKit is designed to provide easy access to editing and editing-related commands. Like the previous Dired menu, it organizes commands into different sections. Commands related to file and buffer operations are in the File section. Commands for editing text are in the Edit section. S- or balanced expression commands are given a dedicated section for their own. More often than not, in many modes, I find them to do what I want. The tools section provides access to common tools. Bookmarks I consider to be an essential feature. If you haven't used them, it's never too late to start. Emacs window management commands are given this section. Commands for search and replace, macros, and projects can be accessed from here. Finally, the menu navigation section. Note that register commands can be accessed from here.

[00:10:36.200] EditKit demo

Okay, enough screenshots. Let's look at Casual in action with a demo of the EditKit menus. Let's start our demo of casual-editkit with raising the menu, which is bound to C-o. You'll see the menu pop up here. In particular, we want to look at the edit operation. We'll press e and we'll see a number of menu items that allow you to make editing transformations to the text, be it marking, copying, killing, transposing, transforming, moving, or deleting the text. You'll see also that there is a submenu for rectangle operations. Let's first...

[00:11:31.997] Marking and moving

Let's actually dig through and look at what's in the Mark submenu. You'll see that there are increments of text in which you can mark. You can mark a word, a sentence, a paragraph, and balanced expression. If we go back, you'll see a similar pattern for copying as well as killing. Transposing. Let's go and try to move a sentence. We have the point there at hello there. We'll move that sentence around. If we press s, we can move it backward or forward. In this case, let's move it forward. We'll press f. You'll see hello there move up a sentence. Then we can also press b to move it back. Then press RET to dismiss. Also, if we wanted to, we can... In this menu particularly, you'll see that we also have cursor navigation, so we can move the point there. That's not in all the menus, but in a good part number of the menus in Casual Edit Kit, you'll see that here. Let's press RET to dismiss that.

[00:12:53.140] Rectangles

Let's actually look at some rectangle operations here. In this case, we have a list with items x, y, and z. Let's say we wanted to prefix each item here with a string. We'll say we want to put in there hello. One way of doing that is to make a rectangle. So if we go into our rectangle menu, first off, what we need to do is define that rectangle region. We'll press m to mark where the point is right there. Then we can use our cursor operation to move the point to define the rectangle. In this case, it's right at the start there. We can use the string insert command, i, to insert hello, colon, and then we'll put a space there to make it look a little nicer. Sure enough, that's in there. We can have access to a number of rectangle commands here.

[00:14:04.976] Numbering

If we wanted to, let's say, number, we can go through that same operation here, define a region, a rectangle region that is, and press n. You'll see that it has incremented a number for each item in that rectangle region. We can also tap u to undo these operations and leave that at that.

[00:14:36.600] Sorting

Sorting. If we select a region here, And we go back. You'll see that the sort submenu is now enabled. Sorting won't work unless you have a region started. That's one of the nice things about transient is that it allows you to visually enable or disable command items with regards to whatever the current state or context is here. In this case is whether or not you have a region highlighted. Let's say we want to sort these two columns of numbers and so there's a command called n here which is numeric fields. Let's choose that here. Sure enough we get that. But there's a nice twist there. Let's say we wanted to sort on the second column. Let's move our point back up to here and we'll mark that. Since everything is in a continuous line, we can sort of pretend that this region is actually a paragraph and mark that. We'll go and select our sorting routine. But now we need to figure out how to make numeric fields sort on the second column. In transient, if we press a ?, that gives us basically a intermediate help section where, if we press a key binding, it will tell us or load the docstring for the command that's there. That command in this case is sort-numeric-fields. It requires an argument. That argument can be passed using the prefix argument, C-u. Press q. Let's do that. In this case, we want to check or use the value 2 and press n. Sure enough, that region is sorted with respect to the second column.

[00:17:04.340] Casual has transformed my user experience with Emacs

Before Casual, so many powerful Emacs commands were not available to me because they were too hard to recall or I could not discover them. Making Casual has changed that, letting me reimagine more positively my user experience with Emacs. If you're interested in any of what I've shown today, I invite you to try out Casual.

[00:17:34.451] Thanks and acknowledgements

Before I leave, my thanks and acknowledgments go out to the following people. First, to Jonas Bernoulli for making Transient and Magit. Casual would not be possible without your work. Next, to Psionic-k for writing Transient Showcase. It showed me how I could build casual. To all the casual users and their support, I am genuinely appreciative. Finally, to Jon Snader for writing the kind posts on Casual on the Irreal website. Thank you. Casual can be found on MELPA, and its repository is hosted on GitHub.

Captioner: sachac

Questions or comments? Please e-mail emacsconf-org-private@gnu.org

Back to the talks Previous by time: Elisp and McCLIM Next by time: New in hyperdrive.el: quick install, peer graph, transclusion! Track: General - Watch