summaryrefslogtreecommitdiffstats
path: root/Misc/python-mode.el
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2003-12-18 21:53:33 (GMT)
committerSkip Montanaro <skip@pobox.com>2003-12-18 21:53:33 (GMT)
commit302e550403cb3c53d22c1e1974451ef51931d99c (patch)
treeb95e8353f20ef5ddb62ce61c35e1cbac0d889495 /Misc/python-mode.el
parent828f847d66b98fa60a18356bebdeaf7d4c87fed2 (diff)
downloadcpython-302e550403cb3c53d22c1e1974451ef51931d99c.zip
cpython-302e550403cb3c53d22c1e1974451ef51931d99c.tar.gz
cpython-302e550403cb3c53d22c1e1974451ef51931d99c.tar.bz2
Sync with python-mode project. Adds two changes:
* in py-checker-run, fall back to read-string if read-shell-command (XEmacs-specific) is not available. * highlight variables would mask builtins as if they were keywords.
Diffstat (limited to 'Misc/python-mode.el')
-rw-r--r--Misc/python-mode.el52
1 files changed, 47 insertions, 5 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index f2ba5e0..202541c 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -358,10 +358,45 @@ support for features needed by `python-mode'.")
(kw2 (mapconcat 'identity
'("else:" "except:" "finally:" "try:")
"\\|"))
+ (kw3 (mapconcat 'identity
+ '("ArithmeticError" "AssertionError"
+ "AttributeError" "DeprecationWarning" "EOFError"
+ "Ellipsis" "EnvironmentError" "Exception" "False"
+ "FloatingPointError" "FutureWarning" "IOError"
+ "ImportError" "IndentationError" "IndexError"
+ "KeyError" "KeyboardInterrupt" "LookupError"
+ "MemoryError" "NameError" "None" "NotImplemented"
+ "NotImplementedError" "OSError" "OverflowError"
+ "OverflowWarning" "PendingDeprecationWarning"
+ "ReferenceError" "RuntimeError" "RuntimeWarning"
+ "StandardError" "StopIteration" "SyntaxError"
+ "SyntaxWarning" "SystemError" "SystemExit"
+ "TabError" "True" "TypeError" "UnboundLocalError"
+ "UnicodeDecodeError" "UnicodeEncodeError"
+ "UnicodeError" "UnicodeTranslateError"
+ "UserWarning" "ValueError" "Warning"
+ "ZeroDivisionError" "__debug__"
+ "__import__" "__name__" "abs" "apply" "basestring"
+ "bool" "buffer" "callable" "chr" "classmethod"
+ "cmp" "coerce" "compile" "complex" "copyright"
+ "delattr" "dict" "dir" "divmod"
+ "enumerate" "eval" "execfile" "exit" "file"
+ "filter" "float" "getattr" "globals" "hasattr"
+ "hash" "hex" "id" "input" "int" "intern"
+ "isinstance" "issubclass" "iter" "len" "license"
+ "list" "locals" "long" "map" "max" "min" "object"
+ "oct" "open" "ord" "pow" "property" "range"
+ "raw_input" "reduce" "reload" "repr" "round"
+ "setattr" "slice" "staticmethod" "str" "sum"
+ "super" "tuple" "type" "unichr" "unicode" "vars"
+ "xrange" "zip")
+ "\\|"))
)
(list
;; keywords
(cons (concat "\\b\\(" kw1 "\\)\\b[ \n\t(]") 1)
+ ;; builtins when they don't appear as object attributes
+ (cons (concat "\\(\\b\\|[.]\\)\\(" kw3 "\\)\\b[ \n\t(]") 2)
;; block introducing keywords with immediately following colons.
;; Yes "except" is in both lists.
(cons (concat "\\b\\(" kw2 "\\)[ \n\t(]") 1)
@@ -2867,11 +2902,18 @@ A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
(mapconcat 'identity newcmd " ")))))
(list
- (read-shell-command "Run pychecker like this: "
- (if last
- last
- default)
- 'py-pychecker-history))))
+ (if (fboundp 'read-shell-command)
+ (read-shell-command "Run pychecker like this: "
+ (if last
+ last
+ default)
+ 'py-pychecker-history)
+ (read-string "Run pychecker like this: "
+ (if last
+ last
+ default)
+ 'py-pychecker-history))
+ )))
(save-some-buffers (not py-ask-about-save) nil)
(compile-internal command "No more errors"))