From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Karpov Newsgroups: gmane.emacs.bugs Subject: bug#20943: 25.0.50; Dired buffers are not always auto-reverted Date: Thu, 09 Jul 2015 21:30:10 +0600 Message-ID: <874mldtkl9.fsf@openmailbox.org> References: <87y4j1oy87.fsf@openmailbox.org> <87pp41cvl1.fsf@openmailbox.org> <83615tv14o.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1436456067 7702 80.91.229.3 (9 Jul 2015 15:34:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jul 2015 15:34:27 +0000 (UTC) Cc: 20943@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 09 17:34:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZDDq2-0001pO-92 for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Jul 2015 17:34:14 +0200 Original-Received: from localhost ([::1]:40491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDq1-0004gG-HP for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Jul 2015 11:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDpv-0004c2-Nk for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 11:34:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDDpq-0004ej-Jt for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 11:34:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDpq-0004ef-BQ for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 11:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZDDpq-0004KH-3z for bug-gnu-emacs@gnu.org; Thu, 09 Jul 2015 11:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mark Karpov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Jul 2015 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20943 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20943-submit@debbugs.gnu.org id=B20943.143645603316613 (code B ref 20943); Thu, 09 Jul 2015 15:34:02 +0000 Original-Received: (at 20943) by debbugs.gnu.org; 9 Jul 2015 15:33:53 +0000 Original-Received: from localhost ([127.0.0.1]:45326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDDph-0004Jq-2n for submit@debbugs.gnu.org; Thu, 09 Jul 2015 11:33:53 -0400 Original-Received: from smtp26.openmailbox.org ([62.4.1.60]:43974) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDDpe-0004Jh-VN for 20943@debbugs.gnu.org; Thu, 09 Jul 2015 11:33:51 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.openmailbox.org (Postfix) with ESMTP id F3A7D2E01E1; Thu, 9 Jul 2015 17:33:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=openmailbox.org; h=content-transfer-encoding:content-type:content-type :mime-version:user-agent:message-id:in-reply-to:date:date :references:subject:subject:from:from:received; s=openmailbox; t=1436456028; bh=XNBI7SePXon/mrSLPWKG/JLXN1089QoG2Xv3x13CVlk=; b= b8PMFh3wuYni26ShmesbWNZhclDEjWOkdsJE+dVEJcv9XqM4TeO3F9q8UJpwokN6 jdHkZslU40b08ushUOSx5kAUFFNP+58ko4eQbO8W3PAnW9aWsLxPnDkObPky4o8p mjh7BMlQT9mlYJD4DyXpe9M8Usr+TU2spcTyxsPRPwc= X-Virus-Scanned: amavisd-new at openmailbox.org Original-Received: from mail.openmailbox.org ([62.4.1.34]) by localhost (mail.openmailbox.org [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ed2aipbaoRnM; Thu, 9 Jul 2015 17:33:48 +0200 (CEST) In-Reply-To: <83615tv14o.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Jul 2015 17:47:35 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104854 Archived-At: > We need to come up with a way of telling auto-revert that although the > buffer was modified by the commands you mentioned, it's okay to revert > it. Can you suggest a change along those lines? I propose two changes: 1. In =E2=80=98auto-revert-handler=E2=80=99, autorevert modified files if c= urrent buffer is a Dired buffer: (defun auto-revert-handler () "Revert current buffer, if appropriate. This is an internal function used by Auto-Revert Mode." (when (or auto-revert-tail-mode (eq major-mode dired-mode) (not (buffer-modified-p))) ...)) This removes =C2=ABfreezing=C2=BB of modified buffers (=E2=80=98auto-revert= -buffer=E2=80=99 is only called when auto-revert mode is enabled right? this should not affect users who don't use auto-revert). This is what I currently use. Control flow goes into body of =E2=80=98when=E2=80=99 and for Dired bu= ffers this boils down to conditions that check if current buffer is stale, and if it is, then the function revert it. 2. To eliminate adverse effects (reordering of files because of auto-revert mode), we need to write down all functions (commands) that can insert new elements out of order in Dired buffer, then at the end of every such a command, add: (when auto-revert-mode (revert-buffer nil t t)) ;; not sure about the collection of args This should be done only for Dired-specific commands (that are used only in Dired mode, if there is uncertainty, add additional condition to test that current major mode is =E2=80=98dired-mode=E2=80=99), of course. In principle, a macro can be written for this set of functions, but I don't think it's a good idea for Elisp, given such limited use case. The only thing I cannot do myself from this is form full list of functions that should call =E2=80=98revert-buffer=E2=80=99 when =E2=80=98au= to-revert-mode=E2=80=99 is enabled. You should be able to do it better than me. These functions should contain reverting code in themselves because =E2=80=98auto-revert-handler=E2=80=99 cannot help here =E2=80=94 its period= is too long. Maybe I don't see some corner cases? If you disagree with this plan, let's discuss it.