From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#52507: [PATCH] Option for vc-delete-file to keep file on disk Date: Tue, 28 Dec 2021 02:53:19 +0200 Message-ID: References: <20211215095324.18195-1-ashwin@ashwink.com.np> <86a6h13j4i.fsf@mail.linkov.net> <85o85hsr3b.fsf@ashwink.com.np> <861r2dzqrj.fsf@mail.linkov.net> <85fsqt67y1.fsf@ashwink.com.np> <8535mt67k8.fsf@ashwink.com.np> <86k0g4a875.fsf@mail.linkov.net> <85czljcund.fsf@ashwink.com.np> <85h7av9xf8.fsf@ashwink.com.np> <85e94803-dd45-8223-a0b8-9ae3ca8e268b@yandex.ru> <85tuevjqg2.fsf@ashwink.com.np> <89a1cb96-80dc-bdc9-8f4f-409b0aa692c0@yandex.ru> <85ilvb8fj8.fsf@ashwink.com.np> <5fb80cff-2292-3a48-c789-5bedc8d1816c@yandex.ru> <85v8zay9il.fsf@ashwink.com.np> 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="742"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cc: 52507@debbugs.gnu.org, Juri Linkov To: Ashwin Kafle Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 28 01:56:12 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1n20mi-000AZ1-KM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Dec 2021 01:56:12 +0100 Original-Received: from localhost ([::1]:60292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n20mh-0004Ak-9S for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Dec 2021 19:56:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n20lb-0002RH-Qy for bug-gnu-emacs@gnu.org; Mon, 27 Dec 2021 19:55:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n20la-0002y6-HA for bug-gnu-emacs@gnu.org; Mon, 27 Dec 2021 19:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n20la-0003FP-8Z for bug-gnu-emacs@gnu.org; Mon, 27 Dec 2021 19:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Dec 2021 00:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52507-submit@debbugs.gnu.org id=B52507.164065288112448 (code B ref 52507); Tue, 28 Dec 2021 00:55:02 +0000 Original-Received: (at 52507) by debbugs.gnu.org; 28 Dec 2021 00:54:41 +0000 Original-Received: from localhost ([127.0.0.1]:44711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n20lE-0003Eh-K0 for submit@debbugs.gnu.org; Mon, 27 Dec 2021 19:54:40 -0500 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:42954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n20lC-0003ET-9U for 52507@debbugs.gnu.org; Mon, 27 Dec 2021 19:54:39 -0500 Original-Received: by mail-wr1-f43.google.com with SMTP id w20so26186785wra.9 for <52507@debbugs.gnu.org>; Mon, 27 Dec 2021 16:54:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wSUtBWS1fDajM3QKSqXEOcb1Umb8JK1qo/K1urvLuv0=; b=L06r+uuO/c8qJyAWM8UHUJWIx1NJWk39t2YF+YX9P/uq6ac8Z2NiAfknJGUAUW4X0O tQrg5jb+Me9ww5gsMk74tZuOOhs6mGCyfnMvwcP/ff/tfnGSEL+L81uvI1akyDaDO9A5 FMki4HJ9OmHubEILMAcYF6dBYk98xmciH0DXqSs227A9xkOBoycE1OlW20FkZc2dZp3x 7dzyZvtvN0N3i+o0bgZiql0fILa4Q0pEH/Uvhw0BBbFKX4QbADTLly6V/KMhIa4Cw+on FxbSZopnl6lmYn/1hbRxSBOv3+Bvn9Gu+uqS4VMbDPu0nMnmdbGckESBh8sblKmxUxit Lbyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wSUtBWS1fDajM3QKSqXEOcb1Umb8JK1qo/K1urvLuv0=; b=SGfgYrjsfkgc4rh2Ju66WFP+gDa6pzotBkDpx/Qn2W+pDflOVILI/mj6jp4Z2jNGVs GFw6Mdq0hjb2BVkyxs4AIva8/i74LKHOE0jnre56kYmnKFjVwBfW1IsOzq7pWkekyGUd aXNl/uQUAJ5yGdzJfD07ShsAOY2ds7kDeDw/stjfrPjG7Fc3avWesMuuL2k8NokAPeuI zAVNt3RbYz3C/0gbE5RFyy5IUobzWXMqjUdzyExyq+9aXLlXtlxGAyDmxdtnnEUJV22X iRFX3XC1qeWAYHSDihLPQBoC+nlws0/bPI38eLSeaep3ewjWSSQrZ6moDDgftePW7G19 w1cQ== X-Gm-Message-State: AOAM530VLOI4YkwTYfrVegPCDBchJ+dlzKdxrq0esX5E3PMpPRlzSzau yq22M8MaOMvF/vqrmvjyv0Q= X-Google-Smtp-Source: ABdhPJwY0d0yOfqyHw3cHaAinttKEEP2eyDBUmCo3r2qZmNLYN1gJkKhEfx1iGDk7fBKMVe1/0vtfA== X-Received: by 2002:adf:9bdb:: with SMTP id e27mr14515644wrc.417.1640652872424; Mon, 27 Dec 2021 16:54:32 -0800 (PST) Original-Received: from [10.111.255.129] ([185.209.196.135]) by smtp.googlemail.com with ESMTPSA id m21sm15802050wrb.2.2021.12.27.16.54.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Dec 2021 16:54:31 -0800 (PST) In-Reply-To: <85v8zay9il.fsf@ashwink.com.np> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:223223 Archived-At: On 27.12.2021 07:08, Ashwin Kafle wrote: > Dmitry Gutov writes: >>>> But the file would stay around, right? That would be different. >>> Only if you give vc-delete-file a prefix argument, otherwise it'll >>> be >>> exactly the same. It will delete even if we use git rm --cached (because >>> it is checked later if the file exists anymore or not) >> >> OK, that seems to make sense. But how would we convey to the user that >> that "removed" (followed by "unregistered") refers to the staging >> area? >> > > By mentioning it in the manual or perhaps in the docstring of > vc-delete-file? It should be intuitive enough once you do it. Ideally the user interface would convey that information without requiring the user to read the manual. >> Patch which would implement this in VC-Dir/Git is welcome. > > Can you please explain to me briefly how vc-dir gets this info? I will > try at it but if you don't hear from me in a week then you know what > happened ;-) It's fairly involved. There is the vc-git-dir-status-files which fetches the status information asynchronously. But it is also updates for the individual files when a buffer is saved, if a VC-Dir buffer is already open (then the status comes from vc-git-state). There is also vc-git-dir-printer which renders individual entries. And finally, there is the ewoc.el package which stores the information about the statuses of files which are displayed inside the VC-Dir buffer. One should probably verify that it can show different statuses for one file name (might be non-trivial to change, or not). > On a related note, how do you test patches? Last time i had to manually > C-M-x each and every function that was changed. I either use 'M-x eval-buffer' (bound to a key, 'C-c v' in my config) to re-evaluate the whole buffer which contains the changed code, or in some other cases I run 'make' in the checkout which updates the .elc files, and then restart Emacs (or rather launch a second instance for testing, while keeping the first one running for editing). > Is there a way to tell > emacs to ignore byte compiled files so as a simple restart will apply > new changes? (setq load-prefer-newer t) should tell Emacs to do exactly that. Though I suppose this will depend on the order the packages are loaded -- if the edited file is loaded before the part of your init script where this line resides, or -- even worse -- is preloaded, this won't have the desired effect. But otherwise this setting is very handy, and I recommend people turn it on. Especially when developing their own packages. >> And the next step would be to ensure that such deletions (which keep >> the file on disk) can be committed by vc-next-action. >> > > If it shows the two files, then you can mark the one saying removed and > vc-next-action can commit it. I mean verify that this actually works. As a UI, it sounds workable.