From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Campbell Barton Newsgroups: gmane.emacs.devel Subject: Thoughts on support for vc-diff unsaved buffer contents? Date: Fri, 22 Nov 2024 09:02:30 +1100 Message-ID: <68c0ce3e-8316-43db-8f3c-ead0ad028326@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19814"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 21 23:03:17 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 1tEFGe-00051Z-Pz for ged-emacs-devel@m.gmane-mx.org; Thu, 21 Nov 2024 23:03:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEFG3-0000we-7p; Thu, 21 Nov 2024 17:02:39 -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 1tEFG1-0000wC-3N for emacs-devel@gnu.org; Thu, 21 Nov 2024 17:02:37 -0500 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEFFz-0002y0-LU for emacs-devel@gnu.org; Thu, 21 Nov 2024 17:02:36 -0500 Original-Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2124a86f4cbso14067155ad.3 for ; Thu, 21 Nov 2024 14:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732226554; x=1732831354; darn=gnu.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cRXCQ9ny4I6EPFYjeey2z0H3xkRJc2/GZ1TNMj0Mces=; b=mjjSt2BWcJeEXB1xCYZfWsGBVtJlgG/QDAlzoN4TLBhNX16fMeBezrrfGx4Sohws+c iPFiqPlCBn2azArXRAwQ03GYLgZn+LA+B7ZpBHP2OvrHdTovHuHoct4Vg+xqfzHltyvQ cWhnrqwtWA7iiZ4TxlZFYeqr/X86+NR9o3e+U27SBi8QKt8rVcRXswKlrYBnsE721fmi F3G+NZEI5Y2Ojy//tLy0u63OrqrUNP9sqBXOcdnddZ+h0ME4hLLl8/4RVMU7Y0sCGv+C 2C1ExtytFIakST1MGpUEap76mW9ztZD31TCyAlALM8flEZKmPMwoLHNZ4Vm/aOdL186M GArA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732226554; x=1732831354; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cRXCQ9ny4I6EPFYjeey2z0H3xkRJc2/GZ1TNMj0Mces=; b=ffsOcIT8Q06b6IF+EhfoK8sQ2hcQsexge3W3hyIRsB4rxsr2/3k24PEB0gr3I+TsP2 XfhJEUsk0Qz/WAFfnUIlK0X1JL/omU1sjMsGbx5aLDXm0/MBtW5etVBLI4J4USWzT5H7 fJHVVuvg3opiqUdr7TSJMPgLIrPbAIM5aYTR8BZnBO2PJbWyDQT1trVX9aPgWko0B/sE aWnURdkZtqQPF/5ImouUc728OFqHn7ADZNwNAThNOWk4uaepjms5fDfNpVKj1PT1H0Gz /Bq2Vz5IEQHHA8Crsfoit9kAHuMkfHDDYwgEw10hCKnaeer62LERjSMMDLFa2yHLxUcM OKFg== X-Gm-Message-State: AOJu0YxZdC/mYkk/mqugAQU9YOwYUeG8TLMoBv0BhbR/jjGOKe1Hal0O DaH02Eun4/TV+GTfEe4bGFV8RTGZU7J0whZUkCSC4ZnLbyZolNVqm9bvzw== X-Gm-Gg: ASbGncsTwTflMZiIgKLQV2Re1dk00gkjlBoGB8+0UNkjI1hmrQymMGcxkqm6RX64Ulg d7MeQIaYX9ytO2bVXU73xy0c5ez7Z+Neq1HknnnT1GkS4l9mXNj9KALLRtmuy6WAVZOCKOsR2iP 7rbpDA19T6fSIXT8IYJidHtgcSROIxyzYZ8XCs0baxFjg+2M3+1D/FQRFT+KiEcAC2pJFB1fdU8 d3QaCto8EbXG/2RSBudT2NxXgcglKWP/zBpWIRzKap/EK47eYCeo7HY X-Google-Smtp-Source: AGHT+IGeslmPCi5cZvjxAWJqdfw1jP/qppEqzKKUwu1aLDONZw3vF0tYGFwkK39whSs+E09b9JxK0A== X-Received: by 2002:a17:902:f64c:b0:20c:bffe:e1e5 with SMTP id d9443c01a7336-2129f78070dmr5309455ad.19.1732226553383; Thu, 21 Nov 2024 14:02:33 -0800 (PST) Original-Received: from ?IPV6:2402:b801:2c65:4b00::1? ([2402:b801:2c65:4b00::1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2129db8c804sm3182405ad.52.2024.11.21.14.02.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Nov 2024 14:02:32 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=ideasman42@gmail.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:325564 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). 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.