]> granicus.if.org Git - python/commitdiff
Sync with python-mode project. Adds two changes:
authorSkip Montanaro <skip@pobox.com>
Thu, 18 Dec 2003 21:53:33 +0000 (21:53 +0000)
committerSkip Montanaro <skip@pobox.com>
Thu, 18 Dec 2003 21:53:33 +0000 (21:53 +0000)
* 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

index f2ba5e0cd1b1bb986d58b7c052130788d168cba8..202541cd9fd084bb12cefdea8e785afbdf558f9e 100644 (file)
@@ -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"))