Skip to content

Commit

Permalink
Prevent dired-subtree-insert from duplicating content
Browse files Browse the repository at this point in the history
As reported by #105, dired-subtree-insert would duplicate the
directory content if applied to an already expanded directory.

This patch adds a check to make sure we don't try to expand an already
expanded directory.
  • Loading branch information
Nathan Aclander committed Sep 10, 2017
1 parent ab74ed5 commit f7fe59f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dired-subtree.el
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ Return a string suitable for insertion in `dired' buffer."
(defun dired-subtree-insert ()
"Insert subtree under this directory."
(interactive)
(when (dired-subtree--dired-line-is-directory-or-link-p)
(when (and (dired-subtree--dired-line-is-directory-or-link-p)
(not (dired-subtree--is-expanded-p)))
(let* ((dir-name (dired-get-filename nil))
(listing (dired-subtree--readin dir-name))
beg end)
Expand Down

0 comments on commit f7fe59f

Please sign in to comment.