diff options
| author | Stefan Monnier | 2006-08-20 18:14:50 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2006-08-20 18:14:50 +0000 |
| commit | 65a16bef2356d8972743ecc03ca8bf922d8eddeb (patch) | |
| tree | 81e42efb3b63e31c6c28e217c14f606ce407a935 /lisp/progmodes/python.el | |
| parent | c5b76d6cf7f35283aae93ef33b8dad1bdf13e085 (diff) | |
| download | emacs-65a16bef2356d8972743ecc03ca8bf922d8eddeb.tar.gz emacs-65a16bef2356d8972743ecc03ca8bf922d8eddeb.zip | |
Remove * in defcustom docstrings.
(run-python, python-proc, python-try-complete): Use derived-mode-p.
(python-mode): Set tab-width and indent-tabs-mode.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 40f4e8aab57..8a7b0537516 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -400,18 +400,18 @@ The criteria are that the line isn't a comment or in string and | |||
| 400 | ;;;; Indentation. | 400 | ;;;; Indentation. |
| 401 | 401 | ||
| 402 | (defcustom python-indent 4 | 402 | (defcustom python-indent 4 |
| 403 | "*Number of columns for a unit of indentation in Python mode. | 403 | "Number of columns for a unit of indentation in Python mode. |
| 404 | See also `\\[python-guess-indent]'" | 404 | See also `\\[python-guess-indent]'" |
| 405 | :group 'python | 405 | :group 'python |
| 406 | :type 'integer) | 406 | :type 'integer) |
| 407 | 407 | ||
| 408 | (defcustom python-guess-indent t | 408 | (defcustom python-guess-indent t |
| 409 | "*Non-nil means Python mode guesses `python-indent' for the buffer." | 409 | "Non-nil means Python mode guesses `python-indent' for the buffer." |
| 410 | :type 'boolean | 410 | :type 'boolean |
| 411 | :group 'python) | 411 | :group 'python) |
| 412 | 412 | ||
| 413 | (defcustom python-indent-string-contents t | 413 | (defcustom python-indent-string-contents t |
| 414 | "*Non-nil means indent contents of multi-line strings together. | 414 | "Non-nil means indent contents of multi-line strings together. |
| 415 | This means indent them the same as the preceding non-blank line. | 415 | This means indent them the same as the preceding non-blank line. |
| 416 | Otherwise preserve their indentation. | 416 | Otherwise preserve their indentation. |
| 417 | 417 | ||
| @@ -430,7 +430,7 @@ are always indented in lines with preceding comments." | |||
| 430 | :group 'python) | 430 | :group 'python) |
| 431 | 431 | ||
| 432 | (defcustom python-continuation-offset 4 | 432 | (defcustom python-continuation-offset 4 |
| 433 | "*Number of columns of additional indentation for continuation lines. | 433 | "Number of columns of additional indentation for continuation lines. |
| 434 | Continuation lines follow a backslash-terminated line starting a | 434 | Continuation lines follow a backslash-terminated line starting a |
| 435 | statement." | 435 | statement." |
| 436 | :group 'python | 436 | :group 'python |
| @@ -1094,7 +1094,7 @@ Repeat ARG times." | |||
| 1094 | ;;;; pychecker | 1094 | ;;;; pychecker |
| 1095 | 1095 | ||
| 1096 | (defcustom python-check-command "pychecker --stdlib" | 1096 | (defcustom python-check-command "pychecker --stdlib" |
| 1097 | "*Command used to check a Python file." | 1097 | "Command used to check a Python file." |
| 1098 | :type 'string | 1098 | :type 'string |
| 1099 | :group 'python) | 1099 | :group 'python) |
| 1100 | 1100 | ||
| @@ -1126,7 +1126,7 @@ See `python-check-command' for the default." | |||
| 1126 | ;; Fixme: Make sure we can work with IPython. | 1126 | ;; Fixme: Make sure we can work with IPython. |
| 1127 | 1127 | ||
| 1128 | (defcustom python-python-command "python" | 1128 | (defcustom python-python-command "python" |
| 1129 | "*Shell command to run Python interpreter. | 1129 | "Shell command to run Python interpreter. |
| 1130 | Any arguments can't contain whitespace. | 1130 | Any arguments can't contain whitespace. |
| 1131 | Note that IPython may not work properly; it must at least be used | 1131 | Note that IPython may not work properly; it must at least be used |
| 1132 | with the `-cl' flag, i.e. use `ipython -cl'." | 1132 | with the `-cl' flag, i.e. use `ipython -cl'." |
| @@ -1134,7 +1134,7 @@ with the `-cl' flag, i.e. use `ipython -cl'." | |||
| 1134 | :type 'string) | 1134 | :type 'string) |
| 1135 | 1135 | ||
| 1136 | (defcustom python-jython-command "jython" | 1136 | (defcustom python-jython-command "jython" |
| 1137 | "*Shell command to run Jython interpreter. | 1137 | "Shell command to run Jython interpreter. |
| 1138 | Any arguments can't contain whitespace." | 1138 | Any arguments can't contain whitespace." |
| 1139 | :group 'python | 1139 | :group 'python |
| 1140 | :type 'string) | 1140 | :type 'string) |
| @@ -1227,7 +1227,7 @@ For running multiple processes in multiple buffers, see `run-python' and | |||
| 1227 | (compilation-shell-minor-mode 1)) | 1227 | (compilation-shell-minor-mode 1)) |
| 1228 | 1228 | ||
| 1229 | (defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'" | 1229 | (defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'" |
| 1230 | "*Input matching this regexp is not saved on the history list. | 1230 | "Input matching this regexp is not saved on the history list. |
| 1231 | Default ignores all inputs of 0, 1, or 2 non-blank characters." | 1231 | Default ignores all inputs of 0, 1, or 2 non-blank characters." |
| 1232 | :type 'regexp | 1232 | :type 'regexp |
| 1233 | :group 'python) | 1233 | :group 'python) |
| @@ -1334,7 +1334,7 @@ buffer for a list of commands.)" | |||
| 1334 | (setq python-buffer (current-buffer))) | 1334 | (setq python-buffer (current-buffer))) |
| 1335 | (accept-process-output (get-buffer-process python-buffer) 5) | 1335 | (accept-process-output (get-buffer-process python-buffer) 5) |
| 1336 | (inferior-python-mode))) | 1336 | (inferior-python-mode))) |
| 1337 | (if (eq 'python-mode major-mode) | 1337 | (if (derived-mode-p 'python-mode) |
| 1338 | (setq python-buffer (default-value 'python-buffer))) ; buffer-local | 1338 | (setq python-buffer (default-value 'python-buffer))) ; buffer-local |
| 1339 | ;; Load function definitions we need. | 1339 | ;; Load function definitions we need. |
| 1340 | ;; Before the preoutput function was used, this was done via -c in | 1340 | ;; Before the preoutput function was used, this was done via -c in |
| @@ -1441,7 +1441,7 @@ Then switch to the process buffer." | |||
| 1441 | (python-switch-to-python t)) | 1441 | (python-switch-to-python t)) |
| 1442 | 1442 | ||
| 1443 | (defcustom python-source-modes '(python-mode jython-mode) | 1443 | (defcustom python-source-modes '(python-mode jython-mode) |
| 1444 | "*Used to determine if a buffer contains Python source code. | 1444 | "Used to determine if a buffer contains Python source code. |
| 1445 | If a file is loaded into a buffer that is in one of these major modes, | 1445 | If a file is loaded into a buffer that is in one of these major modes, |
| 1446 | it is considered Python source by `python-load-file', which uses the | 1446 | it is considered Python source by `python-load-file', which uses the |
| 1447 | value to determine defaults." | 1447 | value to determine defaults." |
| @@ -1484,9 +1484,9 @@ See variable `python-buffer'. Starts a new process if necessary." | |||
| 1484 | ;; isn't one for `python-buffer'. | 1484 | ;; isn't one for `python-buffer'. |
| 1485 | (unless (comint-check-proc python-buffer) | 1485 | (unless (comint-check-proc python-buffer) |
| 1486 | (run-python nil t)) | 1486 | (run-python nil t)) |
| 1487 | (get-buffer-process (or (if (eq major-mode 'inferior-python-mode) | 1487 | (get-buffer-process (or (if (derived-mode-p 'inferior-python-mode) |
| 1488 | (current-buffer) | 1488 | (current-buffer) |
| 1489 | python-buffer)))) | 1489 | python-buffer)))) |
| 1490 | 1490 | ||
| 1491 | (defun python-set-proc () | 1491 | (defun python-set-proc () |
| 1492 | "Set the default value of `python-buffer' to correspond to this buffer. | 1492 | "Set the default value of `python-buffer' to correspond to this buffer. |
| @@ -1912,7 +1912,7 @@ Repeating the command scrolls the completion window." | |||
| 1912 | 1912 | ||
| 1913 | (defun python-try-complete (old) | 1913 | (defun python-try-complete (old) |
| 1914 | "Completion function for Python for use with `hippie-expand'." | 1914 | "Completion function for Python for use with `hippie-expand'." |
| 1915 | (when (eq major-mode 'python-mode) ; though we only add it locally | 1915 | (when (derived-mode-p 'python-mode) ; though we only add it locally |
| 1916 | (unless old | 1916 | (unless old |
| 1917 | (let ((symbol (python-partial-symbol))) | 1917 | (let ((symbol (python-partial-symbol))) |
| 1918 | (he-init-string (- (point) (length symbol)) (point)) | 1918 | (he-init-string (- (point) (length symbol)) (point)) |
| @@ -2218,7 +2218,12 @@ with skeleton expansions for compound statement templates. | |||
| 2218 | (if (featurep 'hippie-exp) | 2218 | (if (featurep 'hippie-exp) |
| 2219 | (set (make-local-variable 'hippie-expand-try-functions-list) | 2219 | (set (make-local-variable 'hippie-expand-try-functions-list) |
| 2220 | (cons 'python-try-complete hippie-expand-try-functions-list))) | 2220 | (cons 'python-try-complete hippie-expand-try-functions-list))) |
| 2221 | ;; Python defines TABs as being 8-char wide. | ||
| 2222 | (set (make-local-variable 'tab-width) 8) | ||
| 2221 | (when python-guess-indent (python-guess-indent)) | 2223 | (when python-guess-indent (python-guess-indent)) |
| 2224 | ;; Let's make it harder for the user to shoot himself in the foot. | ||
| 2225 | (unless (= tab-width python-indent) | ||
| 2226 | (setq indent-tabs-mode nil)) | ||
| 2222 | (set (make-local-variable 'python-command) python-python-command) | 2227 | (set (make-local-variable 'python-command) python-python-command) |
| 2223 | (python-find-imports) | 2228 | (python-find-imports) |
| 2224 | (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode | 2229 | (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode |
| @@ -2227,9 +2232,9 @@ with skeleton expansions for compound statement templates. | |||
| 2227 | 2232 | ||
| 2228 | (custom-add-option 'python-mode-hook 'imenu-add-menubar-index) | 2233 | (custom-add-option 'python-mode-hook 'imenu-add-menubar-index) |
| 2229 | (custom-add-option 'python-mode-hook | 2234 | (custom-add-option 'python-mode-hook |
| 2230 | '(lambda () | 2235 | (lambda () |
| 2231 | "Turn off Indent Tabs mode." | 2236 | "Turn off Indent Tabs mode." |
| 2232 | (set (make-local-variable 'indent-tabs-mode) nil))) | 2237 | (set (make-local-variable 'indent-tabs-mode) nil))) |
| 2233 | (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode) | 2238 | (custom-add-option 'python-mode-hook 'turn-on-eldoc-mode) |
| 2234 | (custom-add-option 'python-mode-hook 'abbrev-mode) | 2239 | (custom-add-option 'python-mode-hook 'abbrev-mode) |
| 2235 | (custom-add-option 'python-mode-hook 'python-setup-brm) | 2240 | (custom-add-option 'python-mode-hook 'python-setup-brm) |