update packages
This commit is contained in:
@@ -16,10 +16,14 @@
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;; File event watch and reaction implementation.
|
||||
;;; Open directories are put under watch and file changes event collected even if filewatch-mode
|
||||
;;; is disabled. This allows to remove deleted files from all the caches they are in. Activating
|
||||
;;; filewatch-mode will therefore only enable automatic refresh of treemacs buffers.
|
||||
|
||||
;; File event watch and reaction implementation.
|
||||
|
||||
;; Open directories are put under watch and file changes event
|
||||
;; collected even if filewatch-mode is disabled. This allows to
|
||||
;; remove deleted files from all the caches they are in. Activating
|
||||
;; filewatch-mode will therefore only enable automatic refresh of
|
||||
;; treemacs buffers.
|
||||
|
||||
;;; Code:
|
||||
|
||||
@@ -108,8 +112,8 @@ COLLAPSE: Bool"
|
||||
"Stop watching PATH for file events.
|
||||
This also means stopping the watch over all dirs below path.
|
||||
Must be called inside the treemacs buffer since it will remove `current-buffer'
|
||||
from PATH's watch list. Does not apply if this is called in reaction to a file
|
||||
being deleted. In this case ALL is t and all buffers watching PATH will be
|
||||
from PATH's watch list. Does not apply if this is called in reaction to a file
|
||||
being deleted. In this case ALL is t and all buffers watching PATH will be
|
||||
removed from the filewatch hashes.
|
||||
|
||||
PATH: Filepath
|
||||
@@ -150,6 +154,11 @@ An event counts as relevant when
|
||||
(not (or (eq action 'stopped)
|
||||
(and (eq action 'changed)
|
||||
(not treemacs-git-mode))
|
||||
(and treemacs-hide-gitignored-files-mode
|
||||
(let* ((file (caddr ,event))
|
||||
(parent (treemacs--parent-dir file))
|
||||
(cache (ht-get treemacs--git-cache parent)))
|
||||
(and cache (not (string= "!" (ht-get cache file))))))
|
||||
(let* ((dir (caddr ,event))
|
||||
(filename (treemacs--filename dir)))
|
||||
(--any? (funcall it filename dir) treemacs-ignored-file-predicates)))))))))
|
||||
@@ -210,8 +219,10 @@ Extracted only so `treemacs--process-file-events' can decide when to call
|
||||
(treemacs-run-in-every-buffer
|
||||
(treemacs-save-position
|
||||
(-let [treemacs--no-messages (or treemacs-silent-refresh treemacs-silent-filewatch)]
|
||||
(treemacs--recursive-refresh))
|
||||
(hl-line-highlight)))))
|
||||
(dolist (project (treemacs-workspace->projects workspace))
|
||||
(-when-let (root-node (-> project (treemacs-project->path) (treemacs-find-in-dom)))
|
||||
(treemacs--recursive-refresh-descent root-node project)))))
|
||||
(hl-line-highlight))))
|
||||
|
||||
(defun treemacs--process-file-events ()
|
||||
"Process the file events that have been collected.
|
||||
@@ -265,13 +276,13 @@ Called when filewatch mode is disabled."
|
||||
(treemacs--cancel-refresh-timer))))
|
||||
|
||||
(define-minor-mode treemacs-filewatch-mode
|
||||
"Minor mode to let treemacs autorefresh itself on file system changes.
|
||||
"Minor mode to let treemacs auto-refresh itself on file system changes.
|
||||
Activating this mode enables treemacs to watch the files it is displaying (and
|
||||
only those) for changes and automatically refresh its view when it detects a
|
||||
change that it decides is relevant.
|
||||
|
||||
A file change event is relevant for treemacs if a new file has been created or
|
||||
deleted or a file has been changed and `treemacs-git-mode' is enabled. Events
|
||||
deleted or a file has been changed and `treemacs-git-mode' is enabled. Events
|
||||
caused by files that are ignored as per `treemacs-ignored-file-predicates' are
|
||||
counted as not relevant.
|
||||
|
||||
@@ -279,8 +290,12 @@ The refresh is not called immediately after an event was received, treemacs
|
||||
instead waits `treemacs-file-event-delay' ms to see if any more files have
|
||||
changed to avoid having to refresh multiple times over a short period of time.
|
||||
|
||||
Due to limitations in the underlying kqueue library this mode may not be able to
|
||||
track file modifications on MacOS, making it miss potentially useful updates
|
||||
when used in combination with `treemacs-git-mode.'
|
||||
|
||||
The watch mechanism only applies to directories opened *after* this mode has
|
||||
been activated. This means that to enable file watching in an already existing
|
||||
been activated. This means that to enable file watching in an already existing
|
||||
treemacs buffer it needs to be torn down and rebuilt by calling `treemacs' or
|
||||
`treemacs-projectile'.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user