From 02fb58096b32676c5d1dda2e75d1e88055abf896 Mon Sep 17 00:00:00 2001 From: Daniel Jasper <djasper@google.com> Date: Tue, 21 May 2013 17:05:40 +0000 Subject: [PATCH] Fix off-by-one error in clang-format's emacs integration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182395 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-format/clang-format.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang-format/clang-format.el b/tools/clang-format/clang-format.el index af69118aa2d..48fe36f2e56 100644 --- a/tools/clang-format/clang-format.el +++ b/tools/clang-format/clang-format.el @@ -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))))))) -- GitLab