Commit ecab8835 authored by Mattias Engdegård's avatar Mattias Engdegård

Rename auto-revert-notify-watch-descriptor-hash-list

* lisp/autorevert.el
(auto-revert-notify-watch-descriptor-hash-list):
Rename to auto-revert--buffers-by-watch-descriptor.  Improved doc string.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch,
auto-revert-notify-handler): Use new name.
parent e8c07cae
Pipeline #1424 failed with stage
in 67 minutes and 46 seconds
...@@ -326,12 +326,12 @@ the list of old buffers.") ...@@ -326,12 +326,12 @@ the list of old buffers.")
(add-hook 'find-file-hook (add-hook 'find-file-hook
#'auto-revert-find-file-function) #'auto-revert-find-file-function)
(defvar auto-revert-notify-watch-descriptor-hash-list (defvar auto-revert--buffers-by-watch-descriptor
(make-hash-table :test 'equal) (make-hash-table :test 'equal)
"A hash table collecting all file watch descriptors. "A hash table mapping notification descriptors to lists of buffers.
Hash key is a watch descriptor, hash value is a list of buffers The buffers use that descriptor for auto-revert notifications.
which are related to files being watched and carrying the same The key is equal to `auto-revert-notify-watch-descriptor' in each
default directory.") buffer.")
(defvar-local auto-revert-notify-watch-descriptor nil (defvar-local auto-revert-notify-watch-descriptor nil
"The file watch descriptor active for the current buffer.") "The file watch descriptor active for the current buffer.")
...@@ -500,7 +500,7 @@ will use an up-to-date value of `auto-revert-interval'" ...@@ -500,7 +500,7 @@ will use an up-to-date value of `auto-revert-interval'"
(defun auto-revert-notify-rm-watch () (defun auto-revert-notify-rm-watch ()
"Disable file notification for current buffer's associated file." "Disable file notification for current buffer's associated file."
(let ((desc auto-revert-notify-watch-descriptor) (let ((desc auto-revert-notify-watch-descriptor)
(table auto-revert-notify-watch-descriptor-hash-list)) (table auto-revert--buffers-by-watch-descriptor))
(when desc (when desc
(let ((buffers (delq (current-buffer) (gethash desc table)))) (let ((buffers (delq (current-buffer) (gethash desc table))))
(if buffers (if buffers
...@@ -534,7 +534,7 @@ will use an up-to-date value of `auto-revert-interval'" ...@@ -534,7 +534,7 @@ will use an up-to-date value of `auto-revert-interval'"
(gethash key file-notify-descriptors)) (gethash key file-notify-descriptors))
'auto-revert-notify-handler)) 'auto-revert-notify-handler))
(setq auto-revert-notify-watch-descriptor key))) (setq auto-revert-notify-watch-descriptor key)))
auto-revert-notify-watch-descriptor-hash-list) auto-revert--buffers-by-watch-descriptor)
;; Create a new watch if needed. ;; Create a new watch if needed.
(unless auto-revert-notify-watch-descriptor (unless auto-revert-notify-watch-descriptor
(setq auto-revert-notify-watch-descriptor (setq auto-revert-notify-watch-descriptor
...@@ -549,8 +549,8 @@ will use an up-to-date value of `auto-revert-interval'" ...@@ -549,8 +549,8 @@ will use an up-to-date value of `auto-revert-interval'"
auto-revert-notify-watch-descriptor auto-revert-notify-watch-descriptor
(cons (current-buffer) (cons (current-buffer)
(gethash auto-revert-notify-watch-descriptor (gethash auto-revert-notify-watch-descriptor
auto-revert-notify-watch-descriptor-hash-list)) auto-revert--buffers-by-watch-descriptor))
auto-revert-notify-watch-descriptor-hash-list) auto-revert--buffers-by-watch-descriptor)
(add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch 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 ;; If we have file notifications, we want to update the auto-revert buffers
...@@ -585,7 +585,7 @@ no more reverts are possible until the next call of ...@@ -585,7 +585,7 @@ no more reverts are possible until the next call of
(file (nth 2 event)) (file (nth 2 event))
(file1 (nth 3 event)) ;; Target of `renamed'. (file1 (nth 3 event)) ;; Target of `renamed'.
(buffers (gethash descriptor (buffers (gethash descriptor
auto-revert-notify-watch-descriptor-hash-list))) auto-revert--buffers-by-watch-descriptor)))
;; Check, that event is meant for us. ;; Check, that event is meant for us.
(cl-assert descriptor) (cl-assert descriptor)
;; Since we watch a directory, a file name must be returned. ;; Since we watch a directory, a file name must be returned.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment