* Thoughts on support for vc-diff unsaved buffer contents?
@ 2024-11-21 22:02 Campbell Barton
2024-11-22 0:04 ` James Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Campbell Barton @ 2024-11-21 22:02 UTC (permalink / raw)
To: emacs-devel
Hi, recently I've run into a situation where it's necessary to calculate
modified line ranges without first saving the buffer (where "modified"
is determined by a version control diff).
I'm curious if this is something that might be supported - or, is
already supported (although I'm fairly sure it's not).
The use case is for auto-formatters only to format modified lines.
This particular case is for clang-format.el although the same
functionality could useful for other formatters too.
clang-format.el can be configured to format on save,
so when saving: clang-format.el calculates the lines that differ from
the working copy them formats them before saving.
Currently it's necessary for clang-format.el to call git & diff
directly, which makes the functionality limited to git. I was hoping
this could be supported in a generic way that uses generic `vc` API's.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Thoughts on support for vc-diff unsaved buffer contents?
2024-11-21 22:02 Thoughts on support for vc-diff unsaved buffer contents? Campbell Barton
@ 2024-11-22 0:04 ` James Thomas
0 siblings, 0 replies; 2+ messages in thread
From: James Thomas @ 2024-11-22 0:04 UTC (permalink / raw)
To: emacs-devel
Campbell Barton wrote:
> Hi, recently I've run into a situation where it's necessary to
> calculate modified line ranges without first saving the buffer (where
> "modified" is determined by a version control diff).
>
> I'm curious if this is something that might be supported - or, is
> already supported (although I'm fairly sure it's not).
>
> ...
>
> so when saving: clang-format.el calculates the lines that differ from
> the working copy them formats them before saving.
>
> Currently it's necessary for clang-format.el to call git & diff
> directly, which makes the functionality limited to git. I was hoping
> this could be supported in a generic way that uses generic `vc` API's.
Isn't it enough to pipe vc-find-revision-no-save of vc-working-revision to
diff? (IIUYC)
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-22 0:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 22:02 Thoughts on support for vc-diff unsaved buffer contents? Campbell Barton
2024-11-22 0:04 ` James Thomas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).