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

From: Juri Linkov <[email-masked]>
Date: Sun, 15 Aug 2021 11:32:49 +0300

> (save-some-buffers t 'save-some-buffers-root)
>
> So how does it work? save-some-buffers-root auto detects a git repo
> root via project-find-functions in project.el or something there? I
> havent followed entire call chain. I ask, because I guess this is going
> to be part of Emacs 28 but wonder if you have any plans to port it
> into older versions?

You can make it backward-compatible with older versions by copying
the contents of the function save-some-buffers-root literally
to your code.  This call should work in older versions:

#+begin_src emacs-lisp
  (save-some-buffers
   t
   (let ((root (or (and (project-current) (project-root (project-current)))
                   default-directory)))
     (lambda () (file-in-directory-p default-directory root))))
#+end_src

> Could you guys care to take a look at my little branch switcher? If you
> have time. I could use some review and advice. It is ~200 sloc and most
> of it is helm boiler code, I am really interesting about opinion on
> stash/unstash strategy. I stash everything include untracked
> files. However I am thinking of implementing other strategy, via commit
> and undo commit.

Thanks, this is a useful package.  It uses the right strategy
to stash and unstash changes.  This is much better than committing
and undoing commits like we recently discussed in
https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00346.html