emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/python.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/python.el,v
Date: Sun, 20 Aug 2006 18:14:51 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        06/08/20 18:14:50

Index: progmodes/python.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- progmodes/python.el 20 Aug 2006 17:55:16 -0000      1.40
+++ progmodes/python.el 20 Aug 2006 18:14:50 -0000      1.41
@@ -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,7 +1484,7 @@
   ;; 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)
+  (get-buffer-process (or (if (derived-mode-p 'inferior-python-mode)
                                  (current-buffer)
                                python-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,7 +2232,7 @@
 
 (custom-add-option 'python-mode-hook 'imenu-add-menubar-index)
 (custom-add-option 'python-mode-hook
-                  '(lambda ()
+                  (lambda ()
                      "Turn off Indent Tabs mode."
                      (set (make-local-variable 'indent-tabs-mode) nil)))
 (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]