Skip to content

Add transient menu #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Add transient menu #343

wants to merge 8 commits into from

Conversation

rogsme
Copy link

@rogsme rogsme commented Apr 6, 2025

Closes #341

Here's the new transient menu!

How it looks outside the chatgpt-shell buffer:

image

How it looks in the chatgpt-shell buffer (C-c C-t by default):

image

How it looks on region selection:

image

Some videos:

General demo:

demo.mp4

Region selection demo:

highlight-demo.mp4

rogsme added 8 commits March 31, 2025 22:55
- Adds a new file, `chatgpt-shell-transient.el`, providing transient menus.
- Defines a transient prefix `chatgpt-shell-transient--popup`.
- Implements various actions for shell interaction, region manipulation, and configuration.
- Provides a `chatgpt-shell-transient` function to invoke the menu.
- Includes actions for model swapping, transcript management, and version display.
- Uses autoload to ensure dependencies are loaded correctly.
- Provides a `chatgpt-shell-transient` function to invoke the menu.
- Restructured the transient menu into groups based on context.
- Added conditional availability based on buffer mode and region activity.
- Moved "Clear Shell Buffer" and "Interrupt Request" to shell-specific group.
- Changed "K" to "I" to avoid conflict with "Previous Source Block".
- Added "Swap Model" and "Swap System Prompt" to utilities group.
- Added "Save Transcript" and "Restore Transcript" to utilities group.
- Added a helper predicate `chatgpt-shell-transient--in-shell-p`.
- Defined a suffix command for cleaner menu definition.
- Add `transient` to `Package-Requires`.
- Require `chatgpt-shell-transient.el`.
- Bind `C-c C-t` to `chatgpt-shell-transient`.
@xenodium
Copy link
Owner

Hi @rogsme!

Thanks a lot for the PR! It'll be super handy to have these menus.

While I haven't done a thorough review, maybe we should iterate on the menu organization, naming, bindings... you know thet stuff we all love to bikeshed on :)

You have a really great selection of commands. I'm thinking we can likely consolidate some sections a little and maybe tweak some names...

Menu organization

The following is only a rough brain dump (and totally open for discussion), there's no need to implement just yet. The idea is to pin down general menu organization and once we have that, we can go and implement.

Shells                     Compose prompt via                Inline edit

b Switch to shell buffer   e Dedicated buffer                q Quick insert/edit
N Create new shell         p Minibuffer
                           P Minibuffer (include last kill)

Session               History     Navigation              Source blocks    Transcript

m Swap model          ? Next      j Next item             x Execute        S Save
L Reload models       ? Previous  k Previous item         E Edit           O Restore
m Swap system prompt  ? Search    J Next source block     V View
                                  K Previous source block

Bindings

We have options here:

  1. Reuse existing bindings: Something to consider here is that by reusing the existing bindings, the transient menu becomes a "help sheet" of sorts and trains users over time.
  2. New bindings (reuse when possible): We use single char bindings, but try to relate them to existing bindings when possible. For example Next/Previous are TAB/Backtab (unless we go for idiomatic n/p, more on that below).

Vanilla vs Evil

If possible, let's try to use idiomatic bindings when possible. For example, n/p are prevalent in Emacs for moving next/previous (gotta say though TAB is pretty handy). Executing org blocks is well known to be C-c C-c, etc.

We could also make it smart to use vanilla vs evil.

Stickiness

I think this is possible with transient, but I haven't looked, maybe making the menu sticky for certain commands that are meant to be repeated? For example next/previous.

These are just thoughts for now. Lemme know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Add transient menu (prototype included) inspired by Aidermacs/Magit
2 participants