all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* autorevert vs git checkout
@ 2021-01-01 13:01 Herman, Geza
  0 siblings, 0 replies; only message in thread
From: Herman, Geza @ 2021-01-01 13:01 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-01 13:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-01 13:01 autorevert vs git checkout Herman, Geza

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.