summaryrefslogtreecommitdiffstats
path: root/Misc/ccpy-style.el
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1996-12-09 21:57:25 (GMT)
committerBarry Warsaw <barry@python.org>1996-12-09 21:57:25 (GMT)
commit0b324590042b1f4a4390e06b226932dbd4d759de (patch)
treee293199e103c81c7d47d2c7afd91fd51331da3af /Misc/ccpy-style.el
parent49852831fc103db3a395980df26d12f97cc9477b (diff)
downloadcpython-0b324590042b1f4a4390e06b226932dbd4d759de.zip
cpython-0b324590042b1f4a4390e06b226932dbd4d759de.tar.gz
cpython-0b324590042b1f4a4390e06b226932dbd4d759de.tar.bz2
C coding standard for Python C files.
Currently fairly minimal, but I'll be adding to this as needed. I think it's pretty darn close. To use this, just load the file and in a C buffer type: M-x c-set-style RET python RET [there are ways to automate much of this!]
Diffstat (limited to 'Misc/ccpy-style.el')
-rw-r--r--Misc/ccpy-style.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/Misc/ccpy-style.el b/Misc/ccpy-style.el
new file mode 100644
index 0000000..66590c7
--- /dev/null
+++ b/Misc/ccpy-style.el
@@ -0,0 +1,35 @@
+;;; ccpy-style.el --- cc-mode style definition for Python C code
+;;
+;; Author: 1996 Barry A. Warsaw
+;; Created: 6-Dec-1996
+;; Version: $Revision$
+;; Last Modified: $Date$
+;; Keywords: c python languages oop
+
+;;; Commentary
+;; This file defines the standard C coding style for Python C files
+;; and modules. It is compatible with cc-mode.el which should be a
+;; standard part of your Emacs distribution (or see
+;; <http://www.python.org/ftp/emacs/>).
+
+;; To use, make sure this file is on your Emacs load-path, and simply
+;; add this to your .emacs file:
+;;
+;; (add-hook 'c-mode-common-hook '(lambda () (require 'python-style)))
+
+;; This file will self-install on your c-style-alist variable,
+;; although you will have to install it on a per-file basis with:
+;;
+;; M-x c-set-style RET python
+
+;;; Code:
+
+(defconst python-cc-style
+ '((indent-tabs-mode . nil)
+ (c-basic-offset . 8)
+ )
+ "Standard Python C coding style.")
+
+(require 'cc-mode)
+(if (not (assoc "python" c-style-alist))
+ (c-add-style "python" python-cc-style))