GNU bug report logs -
#49980
28.0.50; [PATCH] Should we have project-save-buffers?
Previous Next
Reported by: Giap Tran <txgvnn <at> gmail.com>
Date: Tue, 10 Aug 2021 14:49:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #60 received at 49980 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:
>> (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:
Ah, that was was the magic. I was looking into those functions, but
wasn't really sure what I should snitch :).
> 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
Thank you!
>> 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
I have to admit, I haven't followed so much the discussion, this was
just sommething I wished to had for longer time, but never come about to
implement.
I am not sure if my approach is correct. I think it can mess up things
when multiple branches get changed. If there are only two branches
invloved, a->b, b->c, there are no problems (I think). Also with
multiple branches without changes there should be no problems.
But in case of a->b, b->c, ... , c->n, I am not sure, but I believe they
would have to be checked out in correct reversed order. Otherwise I
think there is possiblity that applied stashes tramp over each others
and cause conflicts. I don't know, I haven't had time to test it that
far. I had this for a couple of weeks, and works fine for my modest
need, but I would appreciate some more input on the code.
I have attached it the source in this mail, if anyone is interested to
look at it, but there is also a github project with some more info in a
readme file at:
https://github.com/amno1/helm-git-branch
I am thankful for all input, and thanks for all your help Juri!
[helm-git-branch.el (text/plain, attachment)]
This bug report was last modified 3 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.