emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f20c1ff 3/3: * autorevert.el (auto-revert-notify-rm


From: Mattias Engdegård
Subject: [Emacs-diffs] master f20c1ff 3/3: * autorevert.el (auto-revert-notify-rm-watch): Simplify.
Date: Mon, 22 Apr 2019 12:19:38 -0400 (EDT)

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

    * autorevert.el (auto-revert-notify-rm-watch): Simplify.
---
 lisp/autorevert.el | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 4fb865e..6f2415a 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -499,18 +499,16 @@ will use an up-to-date value of `auto-revert-interval'"
 
 (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)
-       (when (equal key auto-revert-notify-watch-descriptor)
-        (setq value (delete (current-buffer) value))
-        (if value
-            (puthash key value auto-revert-notify-watch-descriptor-hash-list)
-          (remhash key auto-revert-notify-watch-descriptor-hash-list)
-          (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 t))
+  (let ((desc auto-revert-notify-watch-descriptor)
+        (table auto-revert-notify-watch-descriptor-hash-list))
+    (when desc
+      (let ((buffers (delq (current-buffer) (gethash desc table))))
+        (if buffers
+            (puthash desc buffers table)
+          (remhash desc table)))
+      (ignore-errors
+       (file-notify-rm-watch desc))
+      (remove-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch t)))
   (setq auto-revert-notify-watch-descriptor nil
        auto-revert-notify-modified-p nil))
 



reply via email to

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