From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Herman, Geza" Newsgroups: gmane.emacs.help Subject: autorevert vs git checkout Date: Fri, 1 Jan 2021 14:01:48 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34306"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 01 14:02:27 2021 Return-path: Envelope-to: geh-help-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 1kvK4Z-0008qg-5L for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 14:02:27 +0100 Original-Received: from localhost ([::1]:37410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvK4Y-0004pL-5L for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 08:02:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvK42-0004p1-9f for help-gnu-emacs@gnu.org; Fri, 01 Jan 2021 08:01:54 -0500 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:36287) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kvK40-0005Sw-Lh for help-gnu-emacs@gnu.org; Fri, 01 Jan 2021 08:01:53 -0500 Original-Received: by mail-ej1-x635.google.com with SMTP id lt17so28004681ejb.3 for ; Fri, 01 Jan 2021 05:01:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=nNhnpbh0ZZ20F6kP8DK6BGPHkg5M+gsUlsf4Xodkh7Y=; b=NcB+fyu35W5MWAUh9I4DrMvpk/sXZfe+RuBiwIdHP7NQ+0Z6wrADcCW6W1k4rULj5l ZNgsrwL850iVvkY4TxClnwWhnFPyJjExxRtsyiy7EwXvKy3xdZbkjqpTpAAVDXwy0daT tBzhAZUa2qRxsw1rcVKWk1K/k+Yu7+hJ3H6FAUQP2/NECqNHrkuSUj0vStVdHky2VUWo asg/K17on5p8ae+T8lXhZ1jgpECuGufKvTrGoHbZIgoR7wC6TyW4CqGLvx7OrywQq+fL TEhY3emjxTFN/ct/LiC427aILzJ/E4aeoYhJLCHw6KSgukMIYZQTxYqUir3bQpb3MjIQ V1Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=nNhnpbh0ZZ20F6kP8DK6BGPHkg5M+gsUlsf4Xodkh7Y=; b=Rk/vnaiinMPjGsxe1zct7Z3uE50QPI27YKKIWYSDq3Q3Kvea60lh6fev6V0UybqXDw OZZMB4AW3pY9DB1rYYWJdjQR9sG9e4Izn+AdzDhEGrUiSaQAbZP93su3Kwfliowkt1Tt ObQqi8Y+QfJ+r+26h3y9qmRPHooQ/yZct/NRqkmz/jAQANxYLm6jjAP/XnhJKrjO0PNJ 5AcnhCDBcf7fgQ9sIprG/wmQt4Cbak4yMLP7U6/WBLFhYibI71bAKPsu3gcPta/OKpFI 4sGPRvlwsCtTy1W1moykNXCy3OfVgKT5SE0nPHiAN5tfo2uM4jboxUKjwB2z+EY1zD/C jYcA== X-Gm-Message-State: AOAM533QZNRLVPLB6pPYEU52294IKYDkJUpf/rEQ495pYQr88Hz9a/XK XpBYIM80thJmckcSbC8OCewM+v8bgZM= X-Google-Smtp-Source: ABdhPJxQ/7x1DQsXy3ntwU0NWkB6JUzjkRhB0Z21DEQYs3RgC1EnN/0cbDIJ5OCPaYuM1NBPEQFsrg== X-Received: by 2002:a17:906:fa12:: with SMTP id lo18mr58697454ejb.354.1609506109766; Fri, 01 Jan 2021 05:01:49 -0800 (PST) Original-Received: from [192.168.8.108] (netacc-gpn-104-120-202.pool.telenor.hu. [91.104.120.202]) by smtp.gmail.com with ESMTPSA id r18sm22056737edx.41.2021.01.01.05.01.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Jan 2021 05:01:49 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=geza.herman@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126940 Archived-At: Hi all, It seems that immediate autorevert (I mean autorevert induced by OS file watcher) doesn't work on git checkout. As git first deletes the file, and then puts a new version during checkout, emacs only autoreverts these files periodically (auto-revert-interval), not immediately. Even magit's magit-auto-revert-immediately doesn't work correctly because of this. Currently I'm using these advices on magit functions to handle the situation better, but I wonder is there a better solution?   (defun my-refresh-buffers (&rest r)     (dolist (b (buffer-list))       (with-current-buffer b         (when buffer-file-name           (unless (buffer-modified-p) (revert-buffer :ignore-auto :noconfirm)))))   )   (advice-add 'magit-checkout :after 'my-refresh-buffers)   (advice-add 'magit-branch-checkout :after 'my-refresh-buffers)   (advice-add 'magit-branch-orphan :after 'my-refresh-buffers)   (advice-add 'magit-branch-and-checkout :after 'my-refresh-buffers)   (advice-add 'magit-branch-or-checkout :after 'my-refresh-buffers)   (advice-add 'magit-branch-spinoff :after 'my-refresh-buffers) Thanks, Geza