From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#55310: 27.2; vc-revert: unhelpful error message when modified buffers exist Date: Sun, 08 May 2022 13:44:45 +0200 Message-ID: <87y1zcjljm.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4233"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 55310@debbugs.gnu.org To: "Alfred M. Szmidt" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 08 13:45:12 2022 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 1nnfLc-0000sS-7z for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 May 2022 13:45:12 +0200 Original-Received: from localhost ([::1]:50728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnfLa-0003G8-V7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 May 2022 07:45:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnfLS-0003Fy-3F for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 07:45:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnfLR-0002VC-QZ for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 07:45:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnfLR-0004uh-Mi for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 07:45:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 May 2022 11:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55310 X-GNU-PR-Package: emacs Original-Received: via spool by 55310-submit@debbugs.gnu.org id=B55310.165201029818854 (code B ref 55310); Sun, 08 May 2022 11:45:01 +0000 Original-Received: (at 55310) by debbugs.gnu.org; 8 May 2022 11:44:58 +0000 Original-Received: from localhost ([127.0.0.1]:53494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnfLN-0004u2-Q6 for submit@debbugs.gnu.org; Sun, 08 May 2022 07:44:58 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:57926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nnfLM-0004tn-7t for 55310@debbugs.gnu.org; Sun, 08 May 2022 07:44:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=R3ayTrpiILGA5Cl7aRrWAxE/eJcfHU1PSTb5aS7LqU0=; b=ZTxgBCn7cz3lsWtGcKpfFQ7G2i t8Fq4Eyq9mEzWPp4VAiGtvfhD96JpOZtXEg1lfiLUVqZOmxLYE0lITzG6Om90nj5HLynVNZx3i4Xv LaGH0t5r82CRh8Llj+2g1UBZEOJoE+WEa8w0eVHeGkA7EEqlbWMTEXcRYWP5zPcfGFhI=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnfLD-0007tK-3l; Sun, 08 May 2022 13:44:49 +0200 X-Now-Playing: Nina Simone's _The Montreux Years (1)_: "Don't Smoke in Bed (Live At Casino Montreux, 13th July 1990)" In-Reply-To: (Alfred M. Szmidt's message of "Sun, 08 May 2022 03:41:44 -0400") 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:231637 Archived-At: "Alfred M. Szmidt" writes: > When doing vc-revert in a vc-dir buffer, and when one has a bunch of > open files, one somtimes gets the unhelpful message: > > vc-revert: Please kill or save all modified buffers before reverting > > Nicer would be prompting the user to kill/save those buffers, or list them. I don't think we want to have an interface that offers to kill buffers in a loop -- it sounds like something that's really error-prone, which is why that code is the way it is, I think. (To make the user make the decision themselves explicitly.) We could do this, of course: diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 3508f684c4..cb5e42db4c 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2780,6 +2780,10 @@ vc-revert ;; show the changes and ask for confirmation to discard them. (when (or (not files) (memq (buffer-file-name) files)) (vc-buffer-sync nil)) + ;; Offer to save all the buffers we're reverting. + (save-some-buffers + nil (lambda () + (member (buffer-file-name) files))) (dolist (file files) (let ((buf (get-file-buffer file))) (when (and buf (buffer-modified-p buf)) But if the user answers "no", then it'll just signal an error anyway, so that's just confusing. So I think leaving it the way it is is the best option here, since this command is one of the most potentially destructive ones we have in Emacs. Anybody have an opinion here? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no