From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#49869: Revert buffer? Yes/No/Maybe Date: Fri, 06 Aug 2021 09:20:03 +0300 Message-ID: <83tuk3hz70.fsf@gnu.org> References: <87im0la99d.fsf@mail.linkov.net> <83pmutl8iv.fsf@gnu.org> <87lf5h53u0.fsf@mail.linkov.net> <83wnp0jvb2.fsf@gnu.org> <87bl6bcw6s.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33574"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49869@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 06 08:21:11 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 1mBtEE-0008WK-Ho for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Aug 2021 08:21:10 +0200 Original-Received: from localhost ([::1]:46766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBtEC-0006bD-HY for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 06 Aug 2021 02:21:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBtE6-0006ZY-J5 for bug-gnu-emacs@gnu.org; Fri, 06 Aug 2021 02:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mBtE6-0004o4-BL for bug-gnu-emacs@gnu.org; Fri, 06 Aug 2021 02:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mBtE6-0004V5-1b for bug-gnu-emacs@gnu.org; Fri, 06 Aug 2021 02:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 06 Aug 2021 06:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49869 X-GNU-PR-Package: emacs Original-Received: via spool by 49869-submit@debbugs.gnu.org id=B49869.162823081017228 (code B ref 49869); Fri, 06 Aug 2021 06:21:02 +0000 Original-Received: (at 49869) by debbugs.gnu.org; 6 Aug 2021 06:20:10 +0000 Original-Received: from localhost ([127.0.0.1]:48932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBtDG-0004Tm-1o for submit@debbugs.gnu.org; Fri, 06 Aug 2021 02:20:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mBtDE-0004TX-Oh for 49869@debbugs.gnu.org; Fri, 06 Aug 2021 02:20:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37902) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBtD9-0003ti-8u; Fri, 06 Aug 2021 02:20:03 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2622 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBtD8-0002FH-TF; Fri, 06 Aug 2021 02:20:03 -0400 In-Reply-To: <87bl6bcw6s.fsf@mail.linkov.net> (message from Juri Linkov on Fri, 06 Aug 2021 02:33:55 +0300) 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:211294 Archived-At: > From: Juri Linkov > Cc: 49869@debbugs.gnu.org > Date: Fri, 06 Aug 2021 02:33:55 +0300 > > > And second, are you talking only about reverting when there are no > > unsaved changes? If so, what are the use cases when you need to do > > such a thing, and why? Perhaps such use cases justify a separate > > command and key binding, like "C-x RET r" does for one such use case. > > I discovered this problem while editing source code in one > Emacs instance, and updating the source file in `emacs -Q`. > To get an updated version of the file in `emacs -Q` required > typing 4 more keys after every revert. If this is a frequent use case, we could have a separate command for it. > >> But when the user decided to revert the buffer explicitly, > >> why require to type more keys? > > > > In general, when there are unsaved changes? To let the user think one > > last time before doing something potentially very destructive. > > The question was why require typing more keys > when there are no unsaved changes. In the use case you described, depending on the situation, you could still be in danger of losing important parts of the buffer text, even though you have no unsaved changes. E.g., imagine that for some reason the file on disk is empty or omits most of your current buffer contents. Wouldn't you in general want at least the check for size differences between the two, with a request for confirmation if the sizes differ too much? And maybe also time stamp differences? IOW, this use case seems to really call for a separate command with a separate logic. If we provide such a command, then perhaps we could make it omit the confirmation prompt when invoked with C-u, for those cases where you know in advance you want to revert unconditionally, for example if it was you who made the external changes just now. But I don't think it makes sense to tweak the general-purpose revert-buffer command in this direction, as revert-buffer supports many other use cases, where this kind of shortcut could produce disastrous results.