Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Could you install the patch below to ztree?


2021-04-15  Stefan Monnier  <>

    * ztree-diff-model.el (ztree-diff-additional-options):
    * ztree-dir.el (ztree-dir-move-focus): Avoid overlong lines.
    * ztree-diff.el (ztreediff-mode): Avoid pre-Emacs-21 calling convention
    of define-minor-mode.

    * .gitignore: Ignore generated files.

Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Ztree is a project dedicated to implementation of several text-tree applications inside GNU Emacs. It consists of 2 subprojects: ztree-diff and ztree-dir (the basis of ztree-diff). Available in GNU ELPA and MELPA.


Using ELPA

Press M-x in GNU Emacs and write list-packages. Find the ztree in the list of packages and press i to select this package, x to install the package.


Add to your .emacs or .emacs.d/init.el following lines:

(setq package-archives '(("gnu" . "")
                         ("melpa" . "")))

Follow the installation instructions for the GNU ELPA above.


Add the following to your .emacs file:

(push (substitute-in-file-name "path-to-ztree-directory") load-path)
(require 'ztree)


ztree-diff is a directory-diff tool for Emacs inspired by commercial tools like Beyond Compare or Araxis Merge. It supports showing the difference between two directories; calling Ediff for not matching files, copying between directories, deleting file/directories, hiding/showing equal files/directories.

The comparison itself performed with the external GNU diff tool, so make sure to have one in the executable path. Verified on OSX and Linux.

If one wants to have a stand-alone application, consider the (WIP)zdircmp project based on ztree-diff.

Call the ztree-diff interactive function:

M-x ztree-diff

Then you need to specify the left and right directories to compare.

Hotkeys supported

  • Open/close directories with double-click, RET or Space keys.
  • To jump to the parent directory, hit the Backspace key.
  • To toggle open/closed state of the subtree of the current directory, hit the x key.
  • RET on different files starts the Ediff (or open file if one absent or the same)
  • Space show the simple diff window for the current file instead of Ediff (or view file if one absent or the same)
  • TAB to fast switch between panels
  • h key to toggle show/hide identical files/directories
  • H key to toggle show/hide hidden/ignored files/directories
  • C key to copy current file or directory to the left or right panel
  • D key to delete current file or directory
  • v key to quick view the current file
  • r initiates the rescan/refresh of current file or subdirectory
  • F5 forces the full rescan.


By default all files starting with dot (like .gitignore) are not shown and excluded from the difference status for directories. One can add an additional regexps to the list ztree-diff-filter-list.

One also could turn on unicode characters to draw the tree with instead of normal ASCII-characters. This is controlled by the ztree-draw-unicode-lines variable.

The variable ztree-diff-consider-file-permissions (which is nil by default) if set to t allows to compare file attributes as well, the files will be considered different if they have different mode.

The special variable ztree-diff-additional-options introduced to provide an additional arguments to the 'diff' tool. For example one could specify

(setq ztree-diff-additional-options '("-w" "-i"))

to ignore case differences and whitespace differences.


ztreediff emacsx11

ztreediff-diff emacsx11


ztree-dir is a simple text-mode directory tree for Emacs. See screenshots below for the GUI and the terminal versions of the ztree-dir.

Call the ztree-dir interactive function:

M-x ztree-dir

Hotkeys supported

  • Open/close directories with double-click, RET or Space keys.
  • To jump to the parent directory, hit the Backspace key.
  • To toggle open/closed state of the subtree of the current directory, hit the x key.
  • To visit a file, press Space key.
  • To open file in other window, use RET key.
  • To open Dired with the directory the point is currently on, use the d key.


Set the ztree-dir-move-focus variable to t in order to move focus to the other window when the RET key is pressed; the default behavior is to keep focus in ztree-dir window.

ztree emacsapp

ztree emacsx11


You can contribute to ztree in one of the following ways.

  • Submit a bug report
  • Submit a feature request
  • Submit a simple pull request (with changes < 15 lines)

Copyright issues

Since ztree is a part of GNU ELPA, it is copyrighted by the Free Software Foundation, Inc.. Therefore in order to submit nontrivial changes (with total amount of lines > 15), one needs to to grant the right to include your works in GNU Emacs to the FSF.

For this you need to complete this form, and send it to The FSF will send you the assignment contract that both you and the FSF will sign.

For more information one can read here to understand why it is needed.

As soon as the paperwork is done one can contribute to ztree with bigger pull requests. Note what pull requests without paperwork done will not be accepted, so please notify the maintainer if everything is in place.


Directory tree comparison mode for Emacs







No releases published


No packages published