Subject: bug#3625: save-some-buffers won't buzz off and let me just visit a file

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 13 Oct 2019 21:41:42 +0200

[email-masked] writes:

> C-x s runs the command save-some-buffers,
> which will ask
>   Type SPC or `y' to save the current buffer;
>   DEL or `n' to skip the current buffer;
>   RET or `q' to give up on the save (skip all remaining buffers);
>   C-g to quit (cancel the whole command);
>   ! to save all remaining buffers;
>   C-r to view this buffer;
>   d to view changes in this buffer;
>   or . (period) to save the current buffer and exit.
> But nowhere in that list is there a choice to just let you visit that
> buffer. E.g.,
>   C-r to view this buffer;
> still "waits out there in the parking lot (minibuffer) with the engine
> running, waiting for you to come back out. He just won't buzz-off."

That's a good idea -- exiting the query and popping to the buffer being
asked about is a pretty natural thing to do.

So I've now added it to Emacs 27, but it was surprisingly awkward to do,
based on how the actions are defined (a defvarred alist), what they can
return (just "don't do this" and "do this"), and the fact that
`save-some-buffers' is wrapped in a `save-window-excursion' that I think
is best left alone.

But I think I successfully hacked it together by mixing some dynamic
binding with some lexical binding in a kinda messy way.  If somebody has
a better idea how to do this that doesn't go through three indirections:
please be my guest.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no