pub fn other_file_dispatch_transient(ids: &MagitActionIds) -> TransientSpecExpand description
Build the file-level dispatch transient (C-c f).
Items resolve to real actions that operate on the buffer that was
active when the transient was opened (ActionContext::buffer_id
at fire time) — see
magit_global_mode::global_action_handler_contributions for the
file-path resolution. Unlike the root dispatch, there is
no per-file SectionIndex-cursor resolution when opened from
inside a magit-status buffer; the file is always “whichever real
buffer was active”, which covers the common case (editing a file,
pressing C-c f to stage/diff it) but not “invoke from within
magit-status, act on the entry at cursor”.
Key assignments follow Emacs magit’s own magit-file-dispatch
(s stage, u unstage, x discard, d diff, l log, b
blame) — the same reasoning as dispatch_transient’s. Magit
entries with no lattice implementation (stage-all/unstage-all,
edit-blob, trace-definition, commit-fixup) are absent rather than
inert.
MG.23a: :magit-other-file-dispatch — the file menu for a file you
are not visiting.
A stand-alone command, tied to no buffer: invoke it from anywhere,
set the target with =f, then act. Deliberately bound to no chord —
C-c f is the common case (act on what you are looking at) and this
is the occasional one; bind it yourself if you prefer magit’s
always-ask behaviour.
Same rows and the same actions as file_dispatch_transient; the
only difference is the file argument, which those actions read in
preference to the visited file. With the argument unset every row
falls back to the visited file, so an unset menu is a superset of
C-c f rather than something that acts wrongly — and the preview
line always names the target that will be used.
Discard works here as of IX.7. It is destructive, so it goes
through §12.13’s ask/execute pair — and Effect::Confirm opens a
transient of its own, which replaces this menu and its state. That
used to lose the target: the execute half found no file argument
and fell back to the visited file, asking about one file and
deleting another’s changes. IX.1 made the confirm carry its target
and IX.2 made the execute half read it, so the dialog replacing this
menu no longer matters.