GNU bug report logs -
#77529
31.0.50; [Feature Request][VC] How can I get the current revision of the buffer opened by =vc-find-revision=?
Previous Next
Reported by: jixiuf <jixiuf <at> qq.com>
Date: Fri, 4 Apr 2025 04:26:01 UTC
Severity: wishlist
Found in version 31.0.50
Done: Sean Whitton <spwhitton <at> spwhitton.name>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 77529 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>
> Emacs already has vc-git-next-revision, so if you need this only
> for Git, the function is already there, you just need to wrap it with
> a command.
>
> As for vc-prev-revision, isn't that just SHA^, where SHA is the hash
> of the revision used to call vc-prev-revision?
But how can I get the SHA of the current revision when I am in a buffer
opened by =vc-find-revision=?
Getting the SHA from the buffer name is not easy, as shown in the demo
below:
- 7f855b5297b..: Eli Zaretskii 2023-01-07 ; Fix description of etc/DOC
- (origin/emacs-29)e9341119fe4..: Eli Zaretskii 2023-01-07 ; Fix documentation of etc/DOC
- cae528457cb..: Eli Zaretskii 2023-01-01 ; Add 2023 to copyright years.
(vc-git-previous-revision "doc/lispref/help.texi" "7f855b5297b")
=> "remotes/origin/emacs-29"
(vc-git-next-revision "doc/lispref/help.texi" "cae528457cb")
=> "remotes/origin/emacs-29"
(vc-find-revision "doc/lispref/help.texi" "remotes/origin/emacs-29")
=> buffer-name: help.texi.~remotes_origin_emacs-29~
As you can see, the SHA is "remotes_origin_emacs-29" (obtained from the
buffer name). I don’t know the true branch/tag name of
"remotes_origin_emacs-29"; it could be "remotes/origin/emacs-29" or
"remotes_origin_emacs-29."
This bug report was last modified 93 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.