From 7f748c657121c801f219b28680373729fefce82a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 18:01:07 -0300 Subject: Putall saves every pane holding unsaved edits to a file, each as its own Save, a refused one said and the rest saved all the same Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 1d524514..8fcc3c01 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1144,6 +1144,21 @@ pub const Get = struct { } }; +/// acme's Putall: every pane holding unsaved edits to a file is saved, each +/// as its own Save; one that is refused (changed on disk since, a write +/// that fails) says so and the rest are saved all the same. +pub const Putall = struct { + pub const scope: Scope = .session; + pub fn run(c: Ctx) void { + for (c.p.panes, 0..) |slot, id| { + const pane = slot orelse continue; + const f = pane.file orelse continue; + if (f.output != null or f.listing != null or f.revision == f.saved_revision) continue; + exec.saveFile(c.p, id); + } + } +}; + /// Write the pane's text to its file, or to the file its argument names. pub const Save = struct { pub const takes_arg = true; -- cgit v1.3