On Sat, Aug 18, 2007 at 01:51:50AM -0600, Travis Oliphant wrote: > > Not any more! See the revised PEP 007, > > http://www.python.org/dev/peps/pep-0007/ > > > > In Python 3000 (and in the 2.x series, in new source files), > > we'll switch to a different indentation style: 4 spaces per indent, > > all spaces (no tabs in any file). The rest will remain the same. > > > > I would love to see this as the standard in numpy as well. Then files > > obey WYSIWYG regardless of editor. (Except for unicode woes, but that > > is another topic.) > > > > I'm fine with this. Some information on how to make sure emacs (and > other editors) does this would be helpful.
Here are some of my .emacs snippets. I assume that .el files are placed in ~/elisp and that the following line is in your emacs configuration: (add-to-list 'load-path "~/elisp") Highlight unnecessary whitespace ================================ Download: http://www.emacswiki.org/cgi-bin/wiki/show-wspace.el ; Show whitespace (require 'show-wspace) (add-hook 'python-mode-hook 'highlight-tabs) (add-hook 'font-lock-mode-hook 'highlight-trailing-whitespace) Clean up tabs and trailing spaces ================================= M-x untabify and M-x whitespace-cleanup Tell emacs never to use tabs ============================ (setq-default indent-tabs-mode nil) Highlight all text after column 80 ================================== Download: http://www.emacswiki.org/cgi-bin/wiki/column-marker.el (require 'column-marker) (add-hook 'font-lock-mode-hook (lambda () (interactive) (column-marker-1 80))) Show a ruler with the current column position ============================================= (require 'ruler-mode) (add-hook 'font-lock-mode-hook 'ruler-mode) Enable restructured text (ReST) editing ======================================= (require 'rst) (add-hook 'text-mode-hook 'rst-text-mode-bindings) Fix outline-mode to work with Python ==================================== (add-hook 'python-mode-hook 'my-python-hook) (defun py-outline-level () "This is so that `current-column` DTRT in otherwise-hidden text" ;; from ada-mode.el (let (buffer-invisibility-spec) (save-excursion (skip-chars-forward "\t ") (current-column)))) ; this fragment originally came from the web somewhere, but the outline-regexp ; was horribly broken and is broken in all instances of this code floating ; around. Finally fixed by Charl P. Botha ; <<a href="http://cpbotha.net/">http://cpbotha.net/</a>> (defun my-python-hook () (setq outline-regexp "[^ \t\n]\\|[ \t]*\\(def[ \t]+\\|class[ \t]+\\)") ; enable our level computation (setq outline-level 'py-outline-level) ; do not use their \C-c@ prefix, too hard to type. Note this overides ;some python mode bindings ;(setq outline-minor-mode-prefix "\C-c") ; turn on outline mode (outline-minor-mode t) ; initially hide all but the headers ; (hide-body) (show-paren-mode 1) ) Cheers Stéfan _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
