r181299 - Fix clang-format emacs integration in last line.
Daniel Jasper
djasper at google.com
Tue May 7 02:25:29 PDT 2013
Author: djasper
Date: Tue May 7 04:25:29 2013
New Revision: 181299
URL: http://llvm.org/viewvc/llvm-project?rev=181299&view=rev
Log:
Fix clang-format emacs integration in last line.
Emacs seems to have a line that is just past the last character of the
buffers content. This needs to be handled specially so that clang-format
is not called with an invalid -offset.
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=181299&r1=181298&r2=181299&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format.el (original)
+++ cfe/trunk/tools/clang-format/clang-format.el Tue May 7 04:25:29 2013
@@ -19,8 +19,8 @@
(if mark-active
(setq beg (region-beginning)
end (region-end))
- (setq beg (line-beginning-position)
- end (line-end-position)))
+ (setq beg (min (line-beginning-position) (1- (point-max)))
+ end (min (line-end-position) (1- (point-max)))))
(call-process-region (point-min) (point-max) binary t t nil
"-offset" (number-to-string (1- beg))
"-length" (number-to-string (- end beg))
More information about the cfe-commits
mailing list