diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:23 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:23 -0300 |
| commit | 0f55249e18cab573efe672d907d6d9936beb4f1c (patch) | |
| tree | 8dfad86018c1b47101b4e7e10ce6df7a0e254588 | |
| parent | 77afb61ab38a795508b0e7767442ae8fea64fbc2 (diff) | |
| download | emacs-0f55249e18cab573efe672d907d6d9936beb4f1c.tar.gz emacs-0f55249e18cab573efe672d907d6d9936beb4f1c.zip | |
Use defcustom with :safe whenever is possible.
| -rw-r--r-- | lisp/progmodes/python.el | 85 |
1 files changed, 58 insertions, 27 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3f53d25e0d3..55d854ca8a1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -486,7 +486,8 @@ It makes underscores and dots word constituent chars.") | |||
| 486 | (defcustom python-indent-guess-indent-offset t | 486 | (defcustom python-indent-guess-indent-offset t |
| 487 | "Non-nil tells Python mode to guess `python-indent-offset' value." | 487 | "Non-nil tells Python mode to guess `python-indent-offset' value." |
| 488 | :type 'boolean | 488 | :type 'boolean |
| 489 | :group 'python) | 489 | :group 'python |
| 490 | :safe 'booleanp) | ||
| 490 | 491 | ||
| 491 | (defvar python-indent-current-level 0 | 492 | (defvar python-indent-current-level 0 |
| 492 | "Current indentation level `python-indent-line-function' is using.") | 493 | "Current indentation level `python-indent-line-function' is using.") |
| @@ -1017,8 +1018,11 @@ With negative argument, move backward repeatedly to start of sentence." | |||
| 1017 | 1018 | ||
| 1018 | ;;; Shell integration | 1019 | ;;; Shell integration |
| 1019 | 1020 | ||
| 1020 | (defvar python-shell-buffer-name "Python" | 1021 | (defcustom python-shell-buffer-name "Python" |
| 1021 | "Default buffer name for Python interpreter.") | 1022 | "Default buffer name for Python interpreter." |
| 1023 | :type 'string | ||
| 1024 | :group 'python | ||
| 1025 | :safe 'stringp) | ||
| 1022 | 1026 | ||
| 1023 | (defcustom python-shell-interpreter "python" | 1027 | (defcustom python-shell-interpreter "python" |
| 1024 | "Default Python interpreter for shell." | 1028 | "Default Python interpreter for shell." |
| @@ -1026,8 +1030,11 @@ With negative argument, move backward repeatedly to start of sentence." | |||
| 1026 | :group 'python | 1030 | :group 'python |
| 1027 | :safe 'stringp) | 1031 | :safe 'stringp) |
| 1028 | 1032 | ||
| 1029 | (defvar python-shell-internal-buffer-name "Python Internal" | 1033 | (defcustom python-shell-internal-buffer-name "Python Internal" |
| 1030 | "Default buffer name for the Internal Python interpreter.") | 1034 | "Default buffer name for the Internal Python interpreter." |
| 1035 | :type 'string | ||
| 1036 | :group 'python | ||
| 1037 | :safe 'stringp) | ||
| 1031 | 1038 | ||
| 1032 | (defcustom python-shell-interpreter-args "-i" | 1039 | (defcustom python-shell-interpreter-args "-i" |
| 1033 | "Default arguments for the Python interpreter." | 1040 | "Default arguments for the Python interpreter." |
| @@ -1049,7 +1056,7 @@ It should not contain a caret (^) at the beginning." | |||
| 1049 | :group 'python | 1056 | :group 'python |
| 1050 | :safe 'stringp) | 1057 | :safe 'stringp) |
| 1051 | 1058 | ||
| 1052 | (defcustom python-shell-prompt-output-regexp nil | 1059 | (defcustom python-shell-prompt-output-regexp "" |
| 1053 | "Regular Expression matching output prompt of python shell. | 1060 | "Regular Expression matching output prompt of python shell. |
| 1054 | It should not contain a caret (^) at the beginning." | 1061 | It should not contain a caret (^) at the beginning." |
| 1055 | :type 'string | 1062 | :type 'string |
| @@ -1067,9 +1074,9 @@ It should not contain a caret (^) at the beginning." | |||
| 1067 | "Seconds to wait for process output before code setup. | 1074 | "Seconds to wait for process output before code setup. |
| 1068 | If output is received before the especified time then control is | 1075 | If output is received before the especified time then control is |
| 1069 | returned in that moment and not after waiting." | 1076 | returned in that moment and not after waiting." |
| 1070 | :type 'number | 1077 | :type 'integer |
| 1071 | :group 'python | 1078 | :group 'python |
| 1072 | :safe 'numberp) | 1079 | :safe 'integerp) |
| 1073 | 1080 | ||
| 1074 | (defcustom python-shell-process-environment nil | 1081 | (defcustom python-shell-process-environment nil |
| 1075 | "List of enviroment variables for Python shell. | 1082 | "List of enviroment variables for Python shell. |
| @@ -1486,7 +1493,7 @@ This function takes the list of setup code to send from the | |||
| 1486 | 1493 | ||
| 1487 | ;;; Shell completion | 1494 | ;;; Shell completion |
| 1488 | 1495 | ||
| 1489 | (defvar python-shell-completion-setup-code | 1496 | (defcustom python-shell-completion-setup-code |
| 1490 | "try: | 1497 | "try: |
| 1491 | import readline | 1498 | import readline |
| 1492 | except ImportError: | 1499 | except ImportError: |
| @@ -1507,11 +1514,17 @@ else: | |||
| 1507 | except NameError: | 1514 | except NameError: |
| 1508 | pass | 1515 | pass |
| 1509 | return completions" | 1516 | return completions" |
| 1510 | "Code used to setup completion in inferior Python processes.") | 1517 | "Code used to setup completion in inferior Python processes." |
| 1518 | :type 'string | ||
| 1519 | :group 'python | ||
| 1520 | :safe 'stringp) | ||
| 1511 | 1521 | ||
| 1512 | (defvar python-shell-completion-string-code | 1522 | (defcustom python-shell-completion-string-code |
| 1513 | "';'.join(__COMPLETER_all_completions('''%s'''))\n" | 1523 | "';'.join(__COMPLETER_all_completions('''%s'''))\n" |
| 1514 | "Python code used to get a string of completions separated by semicolons.") | 1524 | "Python code used to get a string of completions separated by semicolons." |
| 1525 | :type 'string | ||
| 1526 | :group 'python | ||
| 1527 | :safe 'stringp) | ||
| 1515 | 1528 | ||
| 1516 | (defun python-shell-completion--get-completions (input process) | 1529 | (defun python-shell-completion--get-completions (input process) |
| 1517 | "Retrieve available completions for INPUT using PROCESS." | 1530 | "Retrieve available completions for INPUT using PROCESS." |
| @@ -1569,14 +1582,17 @@ to complete." | |||
| 1569 | 1582 | ||
| 1570 | ;;; PDB Track integration | 1583 | ;;; PDB Track integration |
| 1571 | 1584 | ||
| 1572 | (defvar python-pdbtrack-stacktrace-info-regexp | 1585 | (defcustom python-pdbtrack-stacktrace-info-regexp |
| 1573 | "> %s(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" | 1586 | "> %s(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" |
| 1574 | "Regular Expression matching stacktrace information. | 1587 | "Regular Expression matching stacktrace information. |
| 1575 | Used to extract the current line and module beign inspected. The | 1588 | Used to extract the current line and module being inspected. The |
| 1576 | regexp should not start with a caret (^) and can contain a string | 1589 | regexp should not start with a caret (^) and can contain a string |
| 1577 | placeholder (\%s) which is replaced with the filename beign | 1590 | placeholder (\%s) which is replaced with the filename beign |
| 1578 | inspected (so other files in the debugging process are not | 1591 | inspected (so other files in the debugging process are not |
| 1579 | opened)") | 1592 | opened)" |
| 1593 | :type 'string | ||
| 1594 | :group 'python | ||
| 1595 | :safe 'stringp) | ||
| 1580 | 1596 | ||
| 1581 | (defvar python-pdbtrack-tracking-buffers '() | 1597 | (defvar python-pdbtrack-tracking-buffers '() |
| 1582 | "Alist containing elements of form (#<buffer> . #<buffer>). | 1598 | "Alist containing elements of form (#<buffer> . #<buffer>). |
| @@ -1822,11 +1838,11 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'." | |||
| 1822 | This happens when pressing \"if<SPACE>\", for example, to prompt for | 1838 | This happens when pressing \"if<SPACE>\", for example, to prompt for |
| 1823 | the if condition." | 1839 | the if condition." |
| 1824 | :type 'boolean | 1840 | :type 'boolean |
| 1825 | :group 'python) | 1841 | :group 'python |
| 1842 | :safe 'booleanp) | ||
| 1826 | 1843 | ||
| 1827 | (defvar python-skeleton-available '() | 1844 | (defvar python-skeleton-available '() |
| 1828 | "Internal list of available skeletons.") | 1845 | "Internal list of available skeletons.") |
| 1829 | (make-variable-buffer-local 'inferior-python-mode-current-file) | ||
| 1830 | 1846 | ||
| 1831 | (define-abbrev-table 'python-mode-abbrev-table () | 1847 | (define-abbrev-table 'python-mode-abbrev-table () |
| 1832 | "Abbrev table for Python mode." | 1848 | "Abbrev table for Python mode." |
| @@ -1948,7 +1964,7 @@ The skeleton will be bound to python-skeleton-NAME." | |||
| 1948 | 1964 | ||
| 1949 | ;;; FFAP | 1965 | ;;; FFAP |
| 1950 | 1966 | ||
| 1951 | (defvar python-ffap-setup-code | 1967 | (defcustom python-ffap-setup-code |
| 1952 | "def __FFAP_get_module_path(module): | 1968 | "def __FFAP_get_module_path(module): |
| 1953 | try: | 1969 | try: |
| 1954 | import os | 1970 | import os |
| @@ -1958,11 +1974,17 @@ The skeleton will be bound to python-skeleton-NAME." | |||
| 1958 | return path | 1974 | return path |
| 1959 | except: | 1975 | except: |
| 1960 | return ''" | 1976 | return ''" |
| 1961 | "Python code to get a module path.") | 1977 | "Python code to get a module path." |
| 1978 | :type 'string | ||
| 1979 | :group 'python | ||
| 1980 | :safe 'stringp) | ||
| 1962 | 1981 | ||
| 1963 | (defvar python-ffap-string-code | 1982 | (defcustom python-ffap-string-code |
| 1964 | "__FFAP_get_module_path('''%s''')\n" | 1983 | "__FFAP_get_module_path('''%s''')\n" |
| 1965 | "Python code used to get a string with the path of a module.") | 1984 | "Python code used to get a string with the path of a module." |
| 1985 | :type 'string | ||
| 1986 | :group 'python | ||
| 1987 | :safe 'stringp) | ||
| 1966 | 1988 | ||
| 1967 | (defun python-ffap-module-path (module) | 1989 | (defun python-ffap-module-path (module) |
| 1968 | "Function for `ffap-alist' to return path for MODULE." | 1990 | "Function for `ffap-alist' to return path for MODULE." |
| @@ -1986,9 +2008,12 @@ The skeleton will be bound to python-skeleton-NAME." | |||
| 1986 | 2008 | ||
| 1987 | ;;; Code check | 2009 | ;;; Code check |
| 1988 | 2010 | ||
| 1989 | (defvar python-check-command | 2011 | (defcustom python-check-command |
| 1990 | "pychecker --stdlib" | 2012 | "pychecker --stdlib" |
| 1991 | "Command used to check a Python file.") | 2013 | "Command used to check a Python file." |
| 2014 | :type 'string | ||
| 2015 | :group 'python | ||
| 2016 | :safe 'stringp) | ||
| 1992 | 2017 | ||
| 1993 | (defvar python-check-custom-command nil | 2018 | (defvar python-check-custom-command nil |
| 1994 | "Internal use.") | 2019 | "Internal use.") |
| @@ -2014,7 +2039,7 @@ Runs COMMAND, a shell command, as if by `compile'. See | |||
| 2014 | 2039 | ||
| 2015 | ;;; Eldoc | 2040 | ;;; Eldoc |
| 2016 | 2041 | ||
| 2017 | (defvar python-eldoc-setup-code | 2042 | (defcustom python-eldoc-setup-code |
| 2018 | "def __PYDOC_get_help(obj): | 2043 | "def __PYDOC_get_help(obj): |
| 2019 | try: | 2044 | try: |
| 2020 | import inspect | 2045 | import inspect |
| @@ -2045,11 +2070,17 @@ Runs COMMAND, a shell command, as if by `compile'. See | |||
| 2045 | exec('print doc') | 2070 | exec('print doc') |
| 2046 | except SyntaxError: | 2071 | except SyntaxError: |
| 2047 | print(doc)" | 2072 | print(doc)" |
| 2048 | "Python code to setup documentation retrieval.") | 2073 | "Python code to setup documentation retrieval." |
| 2074 | :type 'string | ||
| 2075 | :group 'python | ||
| 2076 | :safe 'stringp) | ||
| 2049 | 2077 | ||
| 2050 | (defvar python-eldoc-string-code | 2078 | (defcustom python-eldoc-string-code |
| 2051 | "__PYDOC_get_help('''%s''')\n" | 2079 | "__PYDOC_get_help('''%s''')\n" |
| 2052 | "Python code used to get a string with the documentation of an object.") | 2080 | "Python code used to get a string with the documentation of an object." |
| 2081 | :type 'string | ||
| 2082 | :group 'python | ||
| 2083 | :safe 'stringp) | ||
| 2053 | 2084 | ||
| 2054 | (defun python-eldoc--get-doc-at-point (&optional force-input force-process) | 2085 | (defun python-eldoc--get-doc-at-point (&optional force-input force-process) |
| 2055 | "Internal implementation to get documentation at point. | 2086 | "Internal implementation to get documentation at point. |