emacs-31 f2c4c1029d7: VC-Dir: Fix removing empty directory entries
Sean Whitton <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit f2c4c1029d7a1723f3e997a65085426aa768c47a Author: Sean Whitton <[email protected]> Commit: Sean Whitton <[email protected]> VC-Dir: Fix removing empty directory entries * lisp/vc/vc-dir.el (vc-dir-refresh-files): Do another pass to remove directory entries with no children. Do not merge to master. --- lisp/vc/vc-dir.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 687968d5d24..df3bbd14b66 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1520,7 +1520,19 @@ specific headers." 'up-to-date)) (setf (vc-dir-fileinfo->state info) nil)) - (not (vc-dir-fileinfo->needs-update info)))))))))))) + (not (vc-dir-fileinfo->needs-update info)))) + ;; One more pass to remove directory entries with no children. + (let ((inhibit-read-only t) + (crt (ewoc-nth vc-ewoc -1)) + (first (ewoc-nth vc-ewoc 0))) + (while (not (eq crt first)) + (let ((prev (ewoc-prev vc-ewoc crt))) + (when (and (vc-dir-fileinfo->directory (ewoc-data crt)) + (let ((next (ewoc-next vc-ewoc crt))) + (or (null next) + (vc-dir-fileinfo->directory (ewoc-data next))))) + (ewoc-delete vc-ewoc crt)) + (setq crt prev)))))))))))) (defun vc-dir-revert-buffer-function (&optional _ignore-auto _noconfirm) (vc-dir-refresh)