From 8562c0c1f3d3c411076ff7194e43c8821938937a Mon Sep 17 00:00:00 2001 From: bth Date: Mon, 8 Jun 2026 21:46:35 -0700 Subject: [PATCH] minmo : minmo--window-hook --- packages/minmo.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/minmo.el b/packages/minmo.el index 67b1b90..291d4ba 100644 --- a/packages/minmo.el +++ b/packages/minmo.el @@ -192,12 +192,15 @@ Optional FORCE means ignore the minmo--git-directory-table." (add-hook 'after-save-hook #'minmo--update-git-cache) ;; NOTE: but normal cache update when window state changes: -(defun minmo--update-git-cache-window (frame-or-window) +(defun minmo--window-hook (frame-or-window func) (let ((win (if (framep frame-or-window) (frame-selected-window frame-or-window) frame-or-window))) (with-current-buffer (window-buffer win) - (minmo--update-git-cache)))) + (funcall func)))) + +(defun minmo--update-git-cache-window (frame-or-window) + (minmo--window-hook frame-or-window 'minmo--update-git-cache)) ;; NOTE: window-state-change-functions includes size changes, which would be spammy. ;; this does selection changes, eg other-window: @@ -261,11 +264,7 @@ Optional FORCE means ignore the minmo--git-directory-table." (file-exists-p buffer-file-name))))) (defun minmo--update-file-exists-cache-window (frame-or-window) - (let ((win (if (framep frame-or-window) - (frame-selected-window frame-or-window) - frame-or-window))) - (with-current-buffer (window-buffer win) - (minmo--update-file-exists-cache)))) + (minmo--window-hook frame-or-window 'minmo--update-file-exists-cache)) (add-hook 'find-file-hook #'minmo--update-file-exists-cache) ;; NOTE: before hook, because revert will refuse when it's gone: