Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 1 | ;;; ccpy-style.el --- cc-mode style definition for Python C code |
| 2 | ;; |
Barry Warsaw | de4636c | 1999-12-01 22:52:19 +0000 | [diff] [blame] | 3 | ;; Author: 1996 Barry A. Warsaw |
Barry Warsaw | 086bc36 | 1999-12-01 22:46:09 +0000 | [diff] [blame] | 4 | ;; Created: 6-Dec-1996 |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 5 | ;; Keywords: c python languages oop |
| 6 | |
| 7 | ;;; Commentary |
Barry Warsaw | 0319b370 | 1999-12-01 22:38:59 +0000 | [diff] [blame] | 8 | ;; |
| 9 | ;; NOTE: This file is obsolete! All current versions of CC Mode |
| 10 | ;; include a "python" style by default. |
| 11 | |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 12 | ;; This file defines the standard C coding style for Python C files |
| 13 | ;; and modules. It is compatible with cc-mode.el which should be a |
| 14 | ;; standard part of your Emacs distribution (or see |
Barry Warsaw | 6c3e3a9 | 1999-12-01 23:30:46 +0000 | [diff] [blame] | 15 | ;; <http://www.python.org/emacs/cc-mode>). |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 16 | |
| 17 | ;; To use, make sure this file is on your Emacs load-path, and simply |
| 18 | ;; add this to your .emacs file: |
| 19 | ;; |
| 20 | ;; (add-hook 'c-mode-common-hook '(lambda () (require 'python-style))) |
| 21 | |
| 22 | ;; This file will self-install on your c-style-alist variable, |
| 23 | ;; although you will have to install it on a per-file basis with: |
| 24 | ;; |
Barry Warsaw | 8c0710f | 1996-12-09 22:07:22 +0000 | [diff] [blame] | 25 | ;; M-x c-set-style RET python RET |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 26 | |
| 27 | ;;; Code: |
| 28 | |
| 29 | (defconst python-cc-style |
Barry Warsaw | 8c0710f | 1996-12-09 22:07:22 +0000 | [diff] [blame] | 30 | '((indent-tabs-mode . t) |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 31 | (c-basic-offset . 8) |
Barry Warsaw | 7607e8f | 1996-12-20 16:42:04 +0000 | [diff] [blame] | 32 | (c-offsets-alist . ((substatement-open . 0) |
| 33 | )) |
Barry Warsaw | fca8371 | 1996-12-20 16:43:32 +0000 | [diff] [blame] | 34 | (c-hanging-braces-alist . ((brace-list-open) |
Barry Warsaw | 7607e8f | 1996-12-20 16:42:04 +0000 | [diff] [blame] | 35 | (brace-list-intro) |
| 36 | (brace-list-close) |
| 37 | (substatement-open after) |
| 38 | (block-close . c-snug-do-while) |
| 39 | )) |
Barry Warsaw | 0b32459 | 1996-12-09 21:57:25 +0000 | [diff] [blame] | 40 | ) |
| 41 | "Standard Python C coding style.") |
| 42 | |
| 43 | (require 'cc-mode) |
| 44 | (if (not (assoc "python" c-style-alist)) |
| 45 | (c-add-style "python" python-cc-style)) |
Barry Warsaw | 1d75734 | 1996-12-10 16:29:21 +0000 | [diff] [blame] | 46 | |
| 47 | (provide 'ccpy-style) |
| 48 | ;;; ccpy-style.el ends here |