<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang-format Emacs integration breaks on Windows"
   href="https://llvm.org/bugs/show_bug.cgi?id=31092">31092</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-format Emacs integration breaks on Windows
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Romain@alazartech.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Running `clang-format-buffer` from clang-format.el on any file that contains
multiple lines under Windows throws an error, even if the file contains only
ASCII characters:

    (clang-format failed with code 1: error: invalid length 34, offset + length
(34) is outside the file.)

The issues comes from the fact that Emacs uses `undecided-unix` encoding by
default to send data to subprocesses, but `undecided-dos` to receive data from
them, as shown by calling `describe-coding-system` on any buffer.

This problem can be fixed by calling `(setq default-process-coding-system
'(undecided-dos . undecided-dos))` in `.emacs`.

I am not sure if this issue can or should be solved at clang-format.el level,
but I thought it is worth pointing out since it affects every Emacs user on
Windows that hasn't fiddled with the `default-process-coding-system` variable.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>