Subject: bug#49980: 28.0.50; [PATCH] Should we have project-save-buffers?

From: Arthur Miller <[email-masked]>
Date: Fri, 13 Aug 2021 19:22:13 +0200

Juri Linkov <[email-masked]> writes:

>> I am sorry I am bit late to the party, but I would like to have a
>> command to save all modified buffers belonging to a project directory. I
>> am just about to code something like this for myself and a small project
>> of mine, so I would be happy if you can point me into something that
>> exists.
>>
>> I have coded a little branch switcher with helm. The purpose it so be
>> able to fast switch branch, say you are working on some bigger feature,
>> and than wish for some reason to switch to some other branch and then
>> comeback and continue on the previous one. The workflow is to simply
>> stash everything on change, and apply stash when branch is checked out
>> again. I have it working, minus the part to save all buffers belonging
>> to a project which is root directory wtih .git in my case.
>>
>> I don't know if that fits into your purpose or something, nor do I think
>> it is hard to code, but I always prefer if I can skip duplicating code
>> and per-use soemthing.
>
> Now it's possible just to type 'C-x s' after customizing
> 'save-some-buffers-default-predicate' to 'save-some-buffers-root',
> or after setting this value in project's .dir-locals.el.
>
> If you want to use this new feature programmatically,
> then just call:

Yes, that is exactly my intention; I would like to save all modified
buffers belonging to git root and subdirectories programmatically.

>   (save-some-buffers t 'save-some-buffers-root)

Thank you, I have just pulled and rebuild. Will try it and let you know
how it works when I am done testing.

Thank you very much.