GNU bug report logs - #20539
24.5; magit-auto-revert-mode broken by 24.5 upgrade with change to behaviour of `let`

Previous Next

Package: emacs;

Reported by: "Greg A. Woods" <woods <at> robohack.ca>

Date: Sat, 9 May 2015 20:28:02 UTC

Severity: minor

Tags: notabug

Found in version 24.5

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 20539 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Greg A. Woods" <woods <at> robohack.ca>
Cc: 20539 <at> debbugs.gnu.org
Subject: Re: bug#20539: 24.5;
 magit-auto-revert-mode broken by 24.5 upgrade with change to
 behaviour of `let`
Date: Sun, 10 May 2015 22:33:21 -0400
> +++ /Users/gaw/.emacs.d/elpa/magit-1.4.1/magit.el	2015-05-09 13:04:57.000000000 -0700
> @@ -4065,7 +4065,8 @@
>                (and file (string-prefix-p topdir file)
>                     (not (string-prefix-p gitdir file))
>                     (member (file-relative-name file topdir) tracked)
> -                   (let ((auto-revert-mode t))
> +                   (progn
> +                     (auto-revert-mode t)
>                       (auto-revert-handler)
>                       (run-hooks 'magit-revert-buffer-hook))))))))))
 
I see you've figured that the above patch won't really do what you want,
and that calling auto-revert-handler is a bad idea here.

I think it should just check if the buffer is modified and if not call
revert-buffer.  The obvious other place where such a code can be found
is in PCL-CVS where we did the exact same thing for the same reasons
(before auto-revert-mode existed):

      (unless (or (null buffer)
		  (memq (cvs-fileinfo->type fileinfo) '(MESSAGE UNKNOWN))
		  ;; FIXME: check whether revert is really needed.
		  ;; `(verify-visited-file-modtime buffer)' doesn't cut it
		  ;; because it only looks at the time stamp (it ignores
		  ;; read-write changes) which is not changed by `commit'.
		  (buffer-modified-p buffer))
	(with-current-buffer buffer
	  (ignore-errors
	    (revert-buffer 'ignore-auto 'dont-ask 'preserve-modes)
	    ;; `preserve-modes' avoids changing the (minor) modes.  But we
	    ;; do want to reset the mode for VC, so we do it explicitly.
	    (vc-find-file-hook)
	    (when (eq (cvs-fileinfo->type fileinfo) 'CONFLICT)
	      (smerge-start-session))))))))



-- Stefan




This bug report was last modified 7 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.