Skip to content

Add one-shot prompt preview override with C-u F8 #5

Description

@morinim

Problem

my-codex-enable-prompt-preview is currently global: users either preview every prompt or none of them.

That is coarse. Preview is most useful for expensive, unusual, or high-risk prompts, while routine prompts are better sent directly.

Proposal

Add a universal one-shot preview override for F8 prompt commands:

  • F8 <command>: use the configured my-codex-enable-prompt-preview behaviour;
  • C-u F8 <command>: invert that behaviour for this prompt only.

Examples:

  • If my-codex-enable-prompt-preview is nil, C-u F8 s previews the selected-region prompt before sending.
  • If my-codex-enable-prompt-preview is t, C-u F8 s sends directly for this invocation.

Rationale

C-u is idiomatic Emacs for a one-off command variation. It avoids adding duplicate preview commands or spending extra F8 keyspace, while keeping the global option useful as the default behaviour.

Implementation note

Because F8 opens a transient menu, the prefix argument may be received by my-codex-transient-preserve-selection / my-codex-transient rather than by the final suffix command.

So this likely needs deliberate plumbing:

  1. Capture whether C-u was used when opening the F8 transient.
  2. Store it as a one-shot prompt-preview override.
  3. Have my-codex--preview-and-send-prompt consult that override and invert my-codex-enable-prompt-preview for the current prompt only.
  4. Clear the override after use.

Documentation

Document this as “invert prompt preview for this command” rather than “preview this prompt”, since users with preview enabled globally would get direct send for the one invocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions