branch: elpa/dirvish
commit 622996fb41def424d888266a89b4677440b55aef
Author: Alex Lu <[email protected]>
Commit: Alex Lu <[email protected]>
fix(subtree): incorrect expanding in an edge case
---
dirvish.el | 2 +-
extensions/dirvish-side.el | 4 ++--
extensions/dirvish-subtree.el | 6 ++++++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dirvish.el b/dirvish.el
index cac77fc7bb..042da5ceab 100644
--- a/dirvish.el
+++ b/dirvish.el
@@ -197,7 +197,7 @@ Works all the same as `dirvish-hide-details' but for
cursor."
:type '(choice (boolean :tag "Apply to all Dirvish buffers")
(repeat :tag "Apply to a list of buffer types: 'dired,
'dirvish, 'dirvish-fd or 'dirvish-side" symbol)))
-(defcustom dirvish-window-fringe 3
+(defcustom dirvish-window-fringe 2
"Root window's left fringe in pixels."
:group 'dirvish :type 'natnum)
diff --git a/extensions/dirvish-side.el b/extensions/dirvish-side.el
index 6a52a542aa..290e0a5317 100644
--- a/extensions/dirvish-side.el
+++ b/extensions/dirvish-side.el
@@ -132,8 +132,8 @@ filename until the project root when opening a side
session."
((not (string-suffix-p "COMMIT_EDITMSG" curr)))
((not (equal prev curr))))
(with-selected-window win
- ;; TODO: `find-alternate-file' lead to incorrect auto-expanding, why?
- (let (buffer-list-update-hook) (dirvish--find-entry 'find-file dir))
+ (let (buffer-list-update-hook)
+ (dirvish--find-entry 'find-alternate-file dir))
(if dirvish-side-auto-expand (dirvish-subtree-expand-to curr)
(dired-goto-file curr))
(dirvish--update-display))))))
diff --git a/extensions/dirvish-subtree.el b/extensions/dirvish-subtree.el
index 8d0fbd72e7..4ec6297301 100644
--- a/extensions/dirvish-subtree.el
+++ b/extensions/dirvish-subtree.el
@@ -334,6 +334,12 @@ See `dirvish-subtree-file-viewer' for details"
(goto-char (dired-subdir-min))
(goto-char (next-single-property-change (point) 'dired-filename))
(forward-line -1)
+ ;; Without this `sit-for', the following movement may stop at a
+ ;; "strange" point where the file name belongs to a subtree that
is
+ ;; not expanded yet. This can occur when reopening a path
+ ;; immediately after the original buffer visiting that path is
+ ;; killed, affecting functions like `dirvish-side--auto-jump'.
+ (sit-for 0.01)
;; TARGET is either not exist or being hidden (#135)
(when (dirvish-subtree--move-to-file next depth)
(dirvish-subtree-expand-to target))))