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.
This commit is contained in:
Skip Montanaro 2003-12-18 21:53:33 +00:00
parent 828f847d66
commit 302e550403

View file

@ -358,10 +358,45 @@ support for features needed by `python-mode'.")
(kw2 (mapconcat 'identity (kw2 (mapconcat 'identity
'("else:" "except:" "finally:" "try:") '("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 (list
;; keywords ;; keywords
(cons (concat "\\b\\(" kw1 "\\)\\b[ \n\t(]") 1) (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. ;; block introducing keywords with immediately following colons.
;; Yes "except" is in both lists. ;; Yes "except" is in both lists.
(cons (concat "\\b\\(" kw2 "\\)[ \n\t(]") 1) (cons (concat "\\b\\(" kw2 "\\)[ \n\t(]") 1)
@ -2867,11 +2902,18 @@ A `nomenclature' is a fancy way of saying AWordWithMixedCaseNotUnderscores."
(mapconcat 'identity newcmd " "))))) (mapconcat 'identity newcmd " ")))))
(list (list
(read-shell-command "Run pychecker like this: " (if (fboundp 'read-shell-command)
(if last (read-shell-command "Run pychecker like this: "
last (if last
default) last
'py-pychecker-history)))) 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) (save-some-buffers (not py-ask-about-save) nil)
(compile-internal command "No more errors")) (compile-internal command "No more errors"))