OLD | NEW |
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' in clang-format, below. | 10 ;; 'style' in clang-format, below. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 "-style" style) | 47 "-style" style) |
48 (goto-char (point-min)) | 48 (goto-char (point-min)) |
49 (let ((json-output (json-read-from-string | 49 (let ((json-output (json-read-from-string |
50 (buffer-substring-no-properties | 50 (buffer-substring-no-properties |
51 (point-min) (line-beginning-position 2))))) | 51 (point-min) (line-beginning-position 2))))) |
52 (delete-region (point-min) (line-beginning-position 2)) | 52 (delete-region (point-min) (line-beginning-position 2)) |
53 (goto-char (1+ (cdr (assoc 'Cursor json-output)))) | 53 (goto-char (1+ (cdr (assoc 'Cursor json-output)))) |
54 (dotimes (index (length orig-windows)) | 54 (dotimes (index (length orig-windows)) |
55 (set-window-start (nth index orig-windows) | 55 (set-window-start (nth index orig-windows) |
56 (nth index orig-window-starts))))))) | 56 (nth index orig-window-starts))))))) |
OLD | NEW |