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