emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 87d1dc1 2/3: Revert "Don't remove notify descriptor


From: Mattias Engdegård
Subject: [Emacs-diffs] master 87d1dc1 2/3: Revert "Don't remove notify descriptor that is already gone"
Date: Mon, 22 Apr 2019 12:19:38 -0400 (EDT)

branch: master
commit 87d1dc19c933de522a6f4341701903b6418f3abe
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Revert "Don't remove notify descriptor that is already gone"
    
    This reverts commit e9e807e9317ca7aa99a5dd220ee8586f8f4331bf,
    which is no longer necessary as `file-notify-rm-watch' has been
    made robust against reentry.
---
 lisp/autorevert.el | 31 ++++++++++---------------------
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1dc2f0e..4fb865e 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -287,7 +287,7 @@ You should set this variable through Custom."
           (dolist (buf (buffer-list))
             (with-current-buffer buf
               (when (symbol-value 'auto-revert-notify-watch-descriptor)
-                (auto-revert-notify-rm-watch t))))))
+                (auto-revert-notify-rm-watch))))))
   :initialize 'custom-initialize-default
   :version "24.4")
 
@@ -371,7 +371,7 @@ without being changed in the part that is already in the 
buffer."
          'kill-buffer-hook
          #'auto-revert-remove-current-buffer
          nil t))
-    (when auto-revert-notify-watch-descriptor (auto-revert-notify-rm-watch t))
+    (when auto-revert-notify-watch-descriptor (auto-revert-notify-rm-watch))
     (auto-revert-remove-current-buffer))
   (auto-revert-set-timer)
   (when auto-revert-mode
@@ -480,7 +480,7 @@ specifies in the mode line."
     (dolist (buf (buffer-list))
       (with-current-buffer buf
        (when auto-revert-notify-watch-descriptor
-         (auto-revert-notify-rm-watch t))))))
+         (auto-revert-notify-rm-watch))))))
 
 (defun auto-revert-set-timer ()
   "Restart or cancel the timer used by Auto-Revert Mode.
@@ -497,10 +497,8 @@ will use an up-to-date value of `auto-revert-interval'"
                            auto-revert-interval
                            'auto-revert-buffers))))
 
-(defun auto-revert-notify-rm-watch (remove-descriptor)
-  "Disable file notification for current buffer's associated file.
-If REMOVE-DESCRIPTOR is non-nil, remove the corresponding notification
-descriptor; otherwise assume that it has already been removed."
+(defun auto-revert-notify-rm-watch ()
+  "Disable file notification for current buffer's associated file."
   (when auto-revert-notify-watch-descriptor
     (maphash
      (lambda (key value)
@@ -509,19 +507,13 @@ descriptor; otherwise assume that it has already been 
removed."
         (if value
             (puthash key value auto-revert-notify-watch-descriptor-hash-list)
           (remhash key auto-revert-notify-watch-descriptor-hash-list)
-           (when remove-descriptor
-            (ignore-errors
-              (file-notify-rm-watch auto-revert-notify-watch-descriptor))))))
+          (ignore-errors
+            (file-notify-rm-watch auto-revert-notify-watch-descriptor)))))
      auto-revert-notify-watch-descriptor-hash-list)
-    (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch-callback t))
+    (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t))
   (setq auto-revert-notify-watch-descriptor nil
        auto-revert-notify-modified-p nil))
 
-(defun auto-revert-notify-rm-watch-callback ()
-  "Disable file notification for current buffer's associated file,
-and remove the notification descriptor."
-  (auto-revert-notify-rm-watch t))
-
 (defun auto-revert-notify-add-watch ()
   "Enable file notification for current buffer's associated file."
   ;; We can assume that `auto-revert-notify-watch-descriptor' is nil.
@@ -561,8 +553,7 @@ and remove the notification descriptor."
               (gethash auto-revert-notify-watch-descriptor
                        auto-revert-notify-watch-descriptor-hash-list))
          auto-revert-notify-watch-descriptor-hash-list)
-        (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch-callback
-                  nil t)))))
+        (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)))))
 
 ;; If we have file notifications, we want to update the auto-revert buffers
 ;; immediately when a notification occurs. Since file updates can happen very
@@ -618,9 +609,7 @@ no more reverts are possible until the next call of
                                 (file-name-nondirectory buffer-file-name)))
                           ;; A buffer w/o a file, like dired.
                           (null buffer-file-name)))
-                ;; Since we got a `stopped' event, the notification descriptor
-                ;; is already gone; don't try to remove it.
-                (auto-revert-notify-rm-watch nil))))
+                (auto-revert-notify-rm-watch))))
 
         ;; Loop over all buffers, in order to find the intended one.
         (cl-dolist (buffer buffers)



reply via email to

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