From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Alfred M. Szmidt" Newsgroups: gmane.emacs.devel Subject: Re: Thoughts on support for vc-diff unsaved buffer contents? Date: Fri, 22 Nov 2024 01:05:08 -0500 Message-ID: References: <68c0ce3e-8316-43db-8f3c-ead0ad028326@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26752"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Campbell Barton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 22 07:05:57 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tEMnl-0006pD-4e for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Nov 2024 07:05:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEMn1-0003dR-5H; Fri, 22 Nov 2024 01:05:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEMmz-0003cJ-0Z for emacs-devel@gnu.org; Fri, 22 Nov 2024 01:05:09 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEMmy-0000iG-OK; Fri, 22 Nov 2024 01:05:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=BCCUmgDPYB492mBwx484bzSlR3Ii9pvEw2186qP63zk=; b=JNny1G7S6czd RgXHf0C6hY8Ov6sHdFyciX+V8jOYK42Y8LQDyfx/WR77/2lQFAmeipeJ28sYgezWwha+BCmYCqjSS QsIdf2YFEAK0hgUhZVSLsmZPYvawJC2E76OoO8DtdryDMcIXeraTutXHhXmK0kHK4SsdB9tXOJU64 4dMswn7ULaXBq9YzFvG6e+sDmPSC603Dhzh3EUrbSwj1c8msEWw1d+/PFT5mCCQEyCxtmxmhQ6pVj BkpdqhRxAUAHp2nrSJBTBdd8p5HUcktieps01zGtXmscocv2FJEqEemifizx/zbgAViSQkOI/H8s0 kkyRD2iWLr/PjT0NV1CAyg==; Original-Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tEMmy-0002Oe-7k; Fri, 22 Nov 2024 01:05:08 -0500 In-Reply-To: <68c0ce3e-8316-43db-8f3c-ead0ad028326@gmail.com> (message from Campbell Barton on Fri, 22 Nov 2024 09:02:30 +1100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325569 Archived-At: 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). Maybe diff-buffer-with-file? 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.