changeset 72461:2fee33a062da

Remove * in defcustom docstrings. (run-python, python-proc, python-try-complete): Use derived-mode-p. (python-mode): Set tab-width and indent-tabs-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 20 Aug 2006 18:14:50 +0000
parents dd4d02e66de4
children bacf0e610ccc
files lisp/ChangeLog lisp/progmodes/python.el
diffstat 2 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Aug 20 17:58:09 2006 +0000
+++ b/lisp/ChangeLog	Sun Aug 20 18:14:50 2006 +0000
@@ -1,3 +1,9 @@
+2006-08-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/python.el: Remove * in defcustom docstrings.
+	(run-python, python-proc, python-try-complete): Use derived-mode-p.
+	(python-mode): Set tab-width and indent-tabs-mode.
+
 2006-08-20  Dave Love  <fx@gnu.org>
 
 	* progmodes/python.el: Update to Dave Love's latest version.
--- a/lisp/progmodes/python.el	Sun Aug 20 17:58:09 2006 +0000
+++ b/lisp/progmodes/python.el	Sun Aug 20 18:14:50 2006 +0000
@@ -400,18 +400,18 @@
 ;;;; Indentation.
 
 (defcustom python-indent 4
-  "*Number of columns for a unit of indentation in Python mode.
+  "Number of columns for a unit of indentation in Python mode.
 See also `\\[python-guess-indent]'"
   :group 'python
   :type 'integer)
 
 (defcustom python-guess-indent t
-  "*Non-nil means Python mode guesses `python-indent' for the buffer."
+  "Non-nil means Python mode guesses `python-indent' for the buffer."
   :type 'boolean
   :group 'python)
 
 (defcustom python-indent-string-contents t
-  "*Non-nil means indent contents of multi-line strings together.
+  "Non-nil means indent contents of multi-line strings together.
 This means indent them the same as the preceding non-blank line.
 Otherwise preserve their indentation.
 
@@ -430,7 +430,7 @@
   :group 'python)
 
 (defcustom python-continuation-offset 4
-  "*Number of columns of additional indentation for continuation lines.
+  "Number of columns of additional indentation for continuation lines.
 Continuation lines follow a backslash-terminated line starting a
 statement."
   :group 'python
@@ -1094,7 +1094,7 @@
 ;;;; pychecker
 
 (defcustom python-check-command "pychecker --stdlib"
-  "*Command used to check a Python file."
+  "Command used to check a Python file."
   :type 'string
   :group 'python)
 
@@ -1126,7 +1126,7 @@
 ;; Fixme: Make sure we can work with IPython.
 
 (defcustom python-python-command "python"
-  "*Shell command to run Python interpreter.
+  "Shell command to run Python interpreter.
 Any arguments can't contain whitespace.
 Note that IPython may not work properly; it must at least be used
 with the `-cl' flag, i.e. use `ipython -cl'."
@@ -1134,7 +1134,7 @@
   :type 'string)
 
 (defcustom python-jython-command "jython"
-  "*Shell command to run Jython interpreter.
+  "Shell command to run Jython interpreter.
 Any arguments can't contain whitespace."
   :group 'python
   :type 'string)
@@ -1227,7 +1227,7 @@
   (compilation-shell-minor-mode 1))
 
 (defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'"
-  "*Input matching this regexp is not saved on the history list.
+  "Input matching this regexp is not saved on the history list.
 Default ignores all inputs of 0, 1, or 2 non-blank characters."
   :type 'regexp
   :group 'python)
@@ -1334,7 +1334,7 @@
 	(setq python-buffer (current-buffer)))
       (accept-process-output (get-buffer-process python-buffer) 5)
       (inferior-python-mode)))
-  (if (eq 'python-mode major-mode)
+  (if (derived-mode-p 'python-mode)
       (setq python-buffer (default-value 'python-buffer))) ; buffer-local
   ;; Load function definitions we need.
   ;; Before the preoutput function was used, this was done via -c in
@@ -1441,7 +1441,7 @@
   (python-switch-to-python t))
 
 (defcustom python-source-modes '(python-mode jython-mode)
-  "*Used to determine if a buffer contains Python source code.
+  "Used to determine if a buffer contains Python source code.
 If a file is loaded into a buffer that is in one of these major modes,
 it is considered Python source by `python-load-file', which uses the
 value to determine defaults."
@@ -1484,9 +1484,9 @@
   ;; isn't one for `python-buffer'.
   (unless (comint-check-proc python-buffer)
     (run-python nil t))
-  (get-buffer-process (or (if (eq major-mode 'inferior-python-mode)
-				  (current-buffer)
-				python-buffer))))
+  (get-buffer-process (or (if (derived-mode-p 'inferior-python-mode)
+                              (current-buffer)
+                            python-buffer))))
 
 (defun python-set-proc ()
   "Set the default value of `python-buffer' to correspond to this buffer.
@@ -1912,7 +1912,7 @@
 
 (defun python-try-complete (old)
   "Completion function for Python for use with `hippie-expand'."
-  (when (eq major-mode 'python-mode)	; though we only add it locally
+  (when (derived-mode-p 'python-mode)	; though we only add it locally
     (unless old
       (let ((symbol (python-partial-symbol)))
 	(he-init-string (- (point) (length symbol)) (point))
@@ -2218,7 +2218,12 @@
   (if (featurep 'hippie-exp)
       (set (make-local-variable 'hippie-expand-try-functions-list)
 	   (cons 'python-try-complete hippie-expand-try-functions-list)))
+  ;; Python defines TABs as being 8-char wide.
+  (set (make-local-variable 'tab-width) 8)
   (when python-guess-indent (python-guess-indent))
+  ;; Let's make it harder for the user to shoot himself in the foot.
+  (unless (= tab-width python-indent)
+    (setq indent-tabs-mode nil))
   (set (make-local-variable 'python-command) python-python-command)
   (python-find-imports)
   (unless (boundp 'python-mode-running)	; kill the recursion from jython-mode
@@ -2227,9 +2232,9 @@
 
 (custom-add-option 'python-mode-hook 'imenu-add-menubar-index)
 (custom-add-option 'python-mode-hook
-		   '(lambda ()
-		      "Turn off Indent Tabs mode."
-		      (set (make-local-variable 'indent-tabs-mode) nil)))
+		   (lambda ()
+                     "Turn off Indent Tabs mode."
+                     (set (make-local-variable 'indent-tabs-mode) nil)))
 (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode)
 (custom-add-option 'python-mode-hook 'abbrev-mode)
 (custom-add-option 'python-mode-hook 'python-setup-brm)