Read a .docx file in Emacs with its tracked changes and its comments intact, rendered as org-mode.
Word documents arrive from collaborators full of revision marks and margin comments, and that is exactly the part every text-mode reader throws away. Pandoc’s own org writer discards revision and comment spans, so pandoc -t org gives you clean prose while losing the whole review without saying so, and that review is the part docx-view keeps.
Reading is all it does. It never writes to a .docx and it does not convert one, and it refuses a save with an error instead of accepting it and discarding the text, so the document you are reading cannot be damaged by a stray C-x C-s.
Here is a document with an insertion, a deletion, a substitution and a comment.
** Fox Report [[dvchg:c0][(1)]]The quick [[dvchg:ins-1][very]] [[dvchg:del-2][brown]] fox jumps over the lazy dog. We should [[dvchg:del-3][utilize]][[dvchg:ins-4][use]] plain words. ** Comments (1) - [1] Alice Smith, 2026-08-01 03:00 Which dog?
In the buffer each link shows only its description, colored by kind and by author. Insertions are underlined, deletions struck through, and comment markers get a face of their own. The link target carries the change identity, which is what makes navigation, the change list and imenu work.
Org emphasis characters cannot express this, so links do the work instead. Org requires /slashes/ to sit at a word boundary, and a tracked change routinely begins mid-word or against a CJK character, where the markup would not render at all. A link works in both places.
docx-view requires Emacs 27.1 or newer, pandoc, and unzip. It has no Emacs Lisp dependencies at all.
(use-package docx-view
:vc (:url "https://github.com/nick-maderight/docx-view" :rev :newest))Keep the :rev :newest. The default, :last-release, means the newest commit that changed the Version: header. Nothing has bumped that header since the first commit, so the default installs the first commit rather than current code.
(use-package docx-view
:ensure (:host github :repo "nick-maderight/docx-view"))A recipe in :ensure requires elpaca-use-package-mode already on, which elpaca’s own bootstrap block enables.
(add-to-list 'load-path "/path/to/docx-view")
(require 'docx-view)That is the whole setup. Opening any .docx, .docm, .dotx or .dotm then puts you in docx-view-mode, because the package autoloads its own auto-mode-alist entry.
Pandoc must be on exec-path. If it lives somewhere Emacs cannot see, set docx-view-pandoc-program to its absolute path.
Open a file the way you open any other, with C-x C-f, or call M-x docx-view for a prompt that offers only Word documents. In Dired, M-x docx-view-dired-view opens the file at point.
| Key | Command | Effect |
|---|---|---|
C-c C-c | docx-view-cycle-mode | cycle all changes, accepted, rejected |
C-c C-v | docx-view-set-mode | choose one of those three directly |
C-c C-n | docx-view-next-change | move to the next change |
C-c C-p | docx-view-previous-change | move to the previous change |
C-c C-o | docx-view-show-at-point | describe the change or comment under point |
C-c C-l | docx-view-list-changes | every change in one buffer, RET jumps to it |
C-c C-a | docx-view-filter-author | mark one reviewer’s changes, empty input clears |
C-c C-e | docx-view-open-externally | hand the file to the system’s own application |
g | docx-view-revert | re-read from disk |
q | quit-window | leave |
The buffer runs org-mode itself, with org-mode-map as its parent keymap, so folding, imenu, speed keys and org navigation all work as usual.
All three view modes come from a single pandoc run. docx-view asks for --track-changes=all once and derives the accepted and rejected views from that same tree, which makes switching modes instant and keeps the three views from ever disagreeing.
These live in the docx-view customize group.
| Option | Default | Meaning |
|---|---|---|
docx-view-default-mode | all | which revisions a document shows when first opened |
docx-view-render-comments | section | section, inline or none |
docx-view-render-change-marker | link | link, or plain for face-only marking with no markup |
docx-view-render-author-colors | 7 colors | the palette assigned to authors in order of appearance |
docx-view-render-metadata-drawer | t | give each heading a property drawer of change counts |
docx-view-startup-folded | nil | open with headings folded |
docx-view-show-warnings | t | report in the echo area what could not be represented |
docx-view-pandoc-program | "pandoc" | name of, or absolute path to, pandoc |
docx-view-pandoc-extra-args | nil | extra pandoc arguments, such as --extract-media=DIR |
docx-view-unzip-program | "unzip" | must accept -p, meaning write member to stdout |
With docx-view-render-comments set to section, a comment appears as a numbered marker in the prose and its text goes to a section at the end, where a threaded discussion keeps its structure. inline puts the text in the prose immediately after the range it annotates, which reads well for one short comment and badly for a thread. none keeps the markers and leaves the text to C-c C-o and the change list.
Styling comes from six faces that theme like any others. They are docx-view-insertion, docx-view-deletion, docx-view-paragraph-change, docx-view-comment-marker, docx-view-comment-range and docx-view-comment-resolved.
Each layer gets a file of its own, so that a change to any one of them stays contained.
docx-view-pandoc.elowns the pandoc subprocess and the shape of its JSON output. The request is for JSON and not for org, because the JSON AST is the only form that still carries the revision and comment spans. Filtering for the accepted and rejected views happens here, over the parsed tree.docx-view-ooxml.elreads the parts of the archive that pandoc does not report. Comment authors, timestamps, reply threading and resolved state live inword/comments.xml,word/commentsExtended.xmlandword/people.xml, and while pandoc surfaces the comment text it leaves the metadata around it behind. This layer extracts single members withunzip -pand parses them with the built-in XML parser.docx-view-render.elturns the filtered tree into org text, records where every change landed, and builds the comment section.docx-view.elis the mode itself, holding the keymap, the menu, the overlays, navigation, the change list,imenu, and the guards that keep the buffer from ever being written back. A read-only buffer can still be saved, so the refusal lives onwrite-contents-functionsand carries thepermanent-local-hookproperty to survive a major mode change.
Pandoc’s docx reader represents insertions, deletions and paragraph-level insertions and deletions, and it reports comment text. Moves, formatting-only revisions, and table row and cell revisions are outside what it represents. Those are read straight from the OOXML instead and listed in an “Other revisions” section, so the document tells you they exist instead of dropping them without a word.
When something cannot be placed in the text at all, say a comment anchored nowhere, it is reported in the echo area and still shown in the comment section. A viewer that hides what it could not represent is worse than one that says so.
make test # run the ERT suite
make compile # byte-compile with every warning an error
make lint # package-lint and checkdoc
make check # all three, which is what CI runsPlain make is a deliberate choice. Eldev and cask are both good, but each is one more thing to install before a contributor can run the tests, and this package’s whole claim is that it requires nothing but Emacs and pandoc.
The 68 tests cover each layer and the mode. The fixtures under test/fixtures are hand-built OOXML rather than documents saved by Word, so each one exercises one feature of the format and the suite has no dependency on a Word installation. test/fixtures/generate-fixtures.py rebuilds them.
Tests that require pandoc skip instead of failing when it is absent, so the suite still says something useful on a machine without it.
CI runs the suite on Emacs 27.1, 27.2, 28.2, 29.4, 30.2 and snapshot on Linux, and on 28.1 and 30.2 on macOS. The macOS floor is 28.1 rather than 27.1 because macos-latest is Apple Silicon and nix-emacs-ci, which purcell/setup-emacs builds from, does not build anything below 28.1 for aarch64-darwin. The 27.1 floor is still tested, on Linux.
GPL-3.0-or-later. See LICENSE.