emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/helm d1a4c6eee7: Add commentaries and remove one repetitio


From: ELPA Syncer
Subject: [nongnu] elpa/helm d1a4c6eee7: Add commentaries and remove one repetition
Date: Sat, 17 Sep 2022 14:58:43 -0400 (EDT)

branch: elpa/helm
commit d1a4c6eee7b963f42e3473ac5ffe7d18af856d1e
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Add commentaries and remove one repetition
---
 helm-files.el | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index d7aeaf6a1b..b9c0b727f5 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3449,7 +3449,16 @@ later in the transformer."
         (add-text-properties (point-min) (point-max) '(helm-ff-file t))
         (split-string (buffer-string) "\n" t)))))
 
+;; This is to fix issue with file-notify.el no more following symlinks
+;; on emacs-29 (regression) with inotify backend at least. Also it
+;; seems inotify is not configured to follow symlinks on other systems
+;; (MacOS) so this should fix as well this issue on such systems see
+;; bug#2542.
+;; Store here associations of (truename . symlink) when opening a
+;; symlinked directory, then add the watch to the truename; When the
+;; watcher ring on the truename remove the symlinked directory from cache.  
 (defvar helm-ff--list-directory-links nil)
+
 (defun helm-ff-directory-files (directory &optional force-update)
   "List contents of DIRECTORY.
 Argument FULL mean absolute path.
@@ -3500,12 +3509,16 @@ in cache."
                         (member method helm-ff-inotify-unsupported-methods)
                         (gethash directory helm-ff--file-notify-watchers))
               (condition-case-unless-debug err
-                  (puthash directory
-                           (file-notify-add-watch
-                            (or truename directory)
-                            '(change attribute-change)
-                            (helm-ff--inotify-make-callback (or truename 
directory)))
-                           helm-ff--file-notify-watchers)
+                  (let ((to-watch (or truename directory)))
+                    ;; Keep adding DIRECTORY to
+                    ;; helm-ff--file-notify-watchers but watch on the
+                    ;; truename and not the symlink as before bug#2542.
+                    (puthash directory
+                             (file-notify-add-watch
+                              to-watch
+                              '(change attribute-change)
+                              (helm-ff--inotify-make-callback to-watch))
+                             helm-ff--file-notify-watchers))
                 (file-notify-error (user-error "Error: %S %S" (car err) (cdr 
err))))))))))
 
 (defun helm-ff--inotify-make-callback (directory)
@@ -3518,6 +3531,9 @@ in cache."
       ;; etc... AFAIU the desc for this is `changed' and for our
       ;; use case we don't care of this.
       (when (memq desc '(created deleted renamed attribute-changed))
+        ;; Watched directory is the truename which is not in the
+        ;; cache, so remove its associated directory (the symlink)
+        ;; from the cache bug#2542.
         (helm-aif (assoc directory helm-ff--list-directory-links)
             (progn
               (setq target (cdr it))



reply via email to

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