r182395 - Fix off-by-one error in clang-format's emacs integration.

Daniel Jasper djasper at google.com
Tue May 21 10:05:40 PDT 2013


Author: djasper
Date: Tue May 21 12:05:40 2013
New Revision: 182395

URL: http://llvm.org/viewvc/llvm-project?rev=182395&view=rev
Log:
Fix off-by-one error in clang-format's emacs integration.

Modified:
    cfe/trunk/tools/clang-format/clang-format.el

Modified: cfe/trunk/tools/clang-format/clang-format.el
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.el?rev=182395&r1=182394&r2=182395&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.el (original)
+++ cfe/trunk/tools/clang-format/clang-format.el Tue May 21 12:05:40 2013
@@ -40,14 +40,14 @@
         (call-process-region (point-min) (point-max) clang-format-binary t t nil
                              "-offset" (number-to-string (1- begin))
                              "-length" (number-to-string (- end begin))
-                             "-cursor" (number-to-string (point))
+                             "-cursor" (number-to-string (1- (point)))
                              "-style" style)
       (goto-char (point-min))
       (let ((json-output (json-read-from-string
                            (buffer-substring-no-properties
                              (point-min) (line-beginning-position 2)))))
         (delete-region (point-min) (line-beginning-position 2))
-        (goto-char (cdr (assoc 'Cursor json-output)))
+        (goto-char (1+ (cdr (assoc 'Cursor json-output))))
         (dotimes (index (length orig-windows))
           (set-window-start (nth index orig-windows)
                             (nth index orig-window-starts)))))))





More information about the cfe-commits mailing list