Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: third_party/clang_format/scripts/clang-format.el

Issue 135773002: Revert of Add clang-format binaries and scripts for all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/clang_format/scripts/clang-format.el
diff --git a/third_party/clang_format/scripts/clang-format.el b/third_party/clang_format/scripts/clang-format.el
deleted file mode 100644
index 520a3e250cf5ee2c35882504f20fd5aebc93beaa..0000000000000000000000000000000000000000
--- a/third_party/clang_format/scripts/clang-format.el
+++ /dev/null
@@ -1,56 +0,0 @@
-;;; Clang-format emacs integration for use with C/Objective-C/C++.
-
-;; This defines a function clang-format-region that you can bind to a key.
-;; A minimal .emacs would contain:
-;;
-;; (load "<path-to-clang>/tools/clang-format/clang-format.el")
-;; (global-set-key [C-M-tab] 'clang-format-region)
-;;
-;; Depending on your configuration and coding style, you might need to modify
-;; 'style' in clang-format, below.
-
-(require 'json)
-
-;; *Location of the clang-format binary. If it is on your PATH, a full path name
-;; need not be specified.
-(defvar clang-format-binary "clang-format")
-
-(defun clang-format-region ()
- "Use clang-format to format the currently active region."
- (interactive)
- (let ((beg (if mark-active
- (region-beginning)
- (min (line-beginning-position) (1- (point-max)))))
- (end (if mark-active
- (region-end)
- (line-end-position))))
- (clang-format beg end)))
-
-(defun clang-format-buffer ()
- "Use clang-format to format the current buffer."
- (interactive)
- (clang-format (point-min) (point-max)))
-
-(defun clang-format (begin end)
- "Use clang-format to format the code between BEGIN and END."
- (let* ((orig-windows (get-buffer-window-list (current-buffer)))
- (orig-window-starts (mapcar #'window-start orig-windows))
- (orig-point (point))
- (style "file"))
- (unwind-protect
- (call-process-region (point-min) (point-max) clang-format-binary
- t (list t nil) nil
- "-offset" (number-to-string (1- begin))
- "-length" (number-to-string (- end begin))
- "-cursor" (number-to-string (1- (point)))
- "-assume-filename" (buffer-file-name)
- "-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 (1+ (cdr (assoc 'Cursor json-output))))
- (dotimes (index (length orig-windows))
- (set-window-start (nth index orig-windows)
- (nth index orig-window-starts)))))))
« no previous file with comments | « third_party/clang_format/bin/win/clang-format.exe.sha1 ('k') | third_party/clang_format/scripts/clang-format.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698