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

Side by Side Diff: tools/clang-format/clang-format.el

Issue 184973004: Prep for merging 3.4: Undo changes from 3.3 branch (Closed) Base URL: http://git.chromium.org/native_client/pnacl-clang.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « test/SemaCXX/cxx11-inheriting-ctors.cpp ('k') | www/cxx_status.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ;;; Clang-format emacs integration for use with C/Objective-C/C++. 1 ;;; Clang-format emacs integration for use with C/Objective-C/C++.
2 2
3 ;; This defines a function clang-format-region that you can bind to a key. 3 ;; This defines a function clang-format-region that you can bind to a key.
4 ;; A minimal .emacs would contain: 4 ;; A minimal .emacs would contain:
5 ;; 5 ;;
6 ;; (load "<path-to-clang>/tools/clang-format/clang-format.el") 6 ;; (load "<path-to-clang>/tools/clang-format/clang-format.el")
7 ;; (global-set-key [C-M-tab] 'clang-format-region) 7 ;; (global-set-key [C-M-tab] 'clang-format-region)
8 ;; 8 ;;
9 ;; Depending on your configuration and coding style, you might need to modify 9 ;; Depending on your configuration and coding style, you might need to modify
10 ;; 'style' and 'binary' below. 10 ;; 'style' and 'binary' below.
11 (defun clang-format-region () 11 (defun clang-format-region ()
12 (interactive) 12 (interactive)
13 13
14 (let* ((orig-windows (get-buffer-window-list (current-buffer))) 14 (let* ((orig-windows (get-buffer-window-list (current-buffer)))
15 (orig-window-starts (mapcar #'window-start orig-windows)) 15 (orig-window-starts (mapcar #'window-start orig-windows))
16 (orig-point (point)) 16 (orig-point (point))
17 (binary "clang-format") 17 (binary "clang-format")
18 (style "LLVM")) 18 (style "LLVM"))
19 (if mark-active 19 (if mark-active
20 (setq beg (region-beginning) 20 (setq beg (region-beginning)
21 end (region-end)) 21 end (region-end))
22 (setq beg (min (line-beginning-position) (1- (point-max))) 22 (setq beg (line-beginning-position)
23 end (min (line-end-position) (1- (point-max))))) 23 end (line-end-position)))
24 (call-process-region (point-min) (point-max) binary t t nil 24 (call-process-region (point-min) (point-max) binary t t nil
25 "-offset" (number-to-string (1- beg)) 25 "-offset" (number-to-string (1- beg))
26 "-length" (number-to-string (- end beg)) 26 "-length" (number-to-string (- end beg))
27 "-style" style) 27 "-style" style)
28 (goto-char orig-point) 28 (goto-char orig-point)
29 (dotimes (index (length orig-windows)) 29 (dotimes (index (length orig-windows))
30 (set-window-start (nth index orig-windows) 30 (set-window-start (nth index orig-windows)
31 (nth index orig-window-starts))))) 31 (nth index orig-window-starts)))))
OLDNEW
« no previous file with comments | « test/SemaCXX/cxx11-inheriting-ctors.cpp ('k') | www/cxx_status.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698