From 302e550403cb3c53d22c1e1974451ef51931d99c Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Thu, 18 Dec 2003 21:53:33 +0000 Subject: 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. --- Misc/python-mode.el | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file 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")) -- cgit v0.12