update of packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; magit-autorevert.el --- Revert buffers when files in repository change -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2008-2022 The Magit Project Contributors
|
||||
;; Copyright (C) 2008-2023 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
|
||||
@@ -99,14 +99,14 @@ seconds of user inactivity. That is not desirable."
|
||||
|
||||
(defun magit-turn-on-auto-revert-mode-if-desired (&optional file)
|
||||
(if file
|
||||
(--when-let (find-buffer-visiting file)
|
||||
(with-current-buffer it
|
||||
(when-let ((buffer (find-buffer-visiting file)))
|
||||
(with-current-buffer buffer
|
||||
(magit-turn-on-auto-revert-mode-if-desired)))
|
||||
(when (and (not auto-revert-mode) ; see #3014
|
||||
(not global-auto-revert-mode) ; see #3460
|
||||
buffer-file-name
|
||||
(file-readable-p buffer-file-name)
|
||||
(compat-executable-find (magit-git-executable) t)
|
||||
(compat-call executable-find (magit-git-executable) t)
|
||||
(magit-toplevel)
|
||||
(or (not magit-auto-revert-tracked-only)
|
||||
(magit-file-tracked-p buffer-file-name)))
|
||||
@@ -133,26 +133,30 @@ seconds of user inactivity. That is not desirable."
|
||||
;; - If the user has set the variable `magit-auto-revert-mode' to nil
|
||||
;; after loading magit (instead of doing so before loading magit or
|
||||
;; by using the function), then we should still respect that setting.
|
||||
;; - If the user sets one of these variables after loading magit and
|
||||
;; after `after-init-hook' has run, then that won't have an effect
|
||||
;; and there is nothing we can do about it.
|
||||
;; - If the user enables `global-auto-revert-mode' after loading magit
|
||||
;; and after `after-init-hook' has run, then `magit-auto-revert-mode'
|
||||
;; remains enabled; and there is nothing we can do about it.
|
||||
;; - However if the init file causes `magit-autorevert' to be loaded
|
||||
;; and only later it enables `global-auto-revert-mode', then we can
|
||||
;; and should leave `magit-auto-revert-mode' disabled.
|
||||
(defun magit-auto-revert-mode--init-kludge ()
|
||||
"This is an internal kludge to be used on `after-init-hook'.
|
||||
Do not use this function elsewhere, and don't remove it from
|
||||
the `after-init-hook'. For more information see the comments
|
||||
and code surrounding the definition of this function."
|
||||
(if magit-auto-revert-mode
|
||||
(let ((start (current-time)))
|
||||
(magit-message "Turning on magit-auto-revert-mode...")
|
||||
(magit-auto-revert-mode 1)
|
||||
(magit-message
|
||||
"Turning on magit-auto-revert-mode...done%s"
|
||||
(let ((elapsed (float-time (time-subtract nil start))))
|
||||
(if (> elapsed 0.2)
|
||||
(format " (%.3fs, %s buffers checked)" elapsed
|
||||
(length (buffer-list)))
|
||||
""))))
|
||||
(magit-auto-revert-mode -1)))
|
||||
(if (or (not magit-auto-revert-mode)
|
||||
(and global-auto-revert-mode (not after-init-time)))
|
||||
(magit-auto-revert-mode -1)
|
||||
(let ((start (current-time)))
|
||||
(magit-message "Turning on magit-auto-revert-mode...")
|
||||
(magit-auto-revert-mode 1)
|
||||
(magit-message
|
||||
"Turning on magit-auto-revert-mode...done%s"
|
||||
(let ((elapsed (float-time (time-subtract nil start))))
|
||||
(if (> elapsed 0.2)
|
||||
(format " (%.3fs, %s buffers checked)" elapsed
|
||||
(length (buffer-list)))
|
||||
""))))))
|
||||
(if after-init-time
|
||||
;; Since `after-init-hook' has already been
|
||||
;; run, turn the mode on or off right now.
|
||||
@@ -247,8 +251,8 @@ defaults to nil) for any BUFFER."
|
||||
(not auto-revert-buffer-list-filter))
|
||||
(funcall fn)
|
||||
(let ((auto-revert-buffer-list
|
||||
(-filter auto-revert-buffer-list-filter
|
||||
auto-revert-buffer-list)))
|
||||
(seq-filter auto-revert-buffer-list-filter
|
||||
auto-revert-buffer-list)))
|
||||
(funcall fn))
|
||||
(unless auto-revert-timer
|
||||
(auto-revert-set-timer))))
|
||||
|
||||
Reference in New Issue
Block a user