bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20539: 24.5; magit-auto-revert-mode broken by 24.5 upgrade with chan


From: Stefan Monnier
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> +++ /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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]