all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Update keywords/builtins in python.el to Python v2.7 (patch included)
@ 2010-07-05 20:30 Christoph
  2010-07-05 22:50 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph @ 2010-07-05 20:30 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

Hi,

Python v2.7 was released yesterday.

I saw that python.el was out of date in regards to fontifying of 
keywords and builtins referencing v2.5.1.

The attached patch will bring python.el up to date with the latest 
release of 2.7.

Note, that I not only updated the builtins but also checked for any 
other keywords that might have been added (there were none) and updated 
the referenced version accordingly, for example in l.96.

Christoph

[-- Attachment #2: python_keywords_builtins_v2_7.txt --]
[-- Type: text/plain, Size: 5167 bytes --]

=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2010-02-27 00:19:50 +0000
+++ lisp/progmodes/python.el	2010-07-05 20:13:59 +0000
@@ -93,7 +93,7 @@
 
 (defvar python-font-lock-keywords
   `(,(rx symbol-start
-	 ;; From v 2.5 reference, § keywords.
+	 ;; From v 2.7 reference, § keywords.
 	 ;; def and class dealt with separately below
 	 (or "and" "as" "assert" "break" "continue" "del" "elif" "else"
 	     "except" "exec" "finally" "for" "from" "global" "if"
@@ -102,7 +102,7 @@
              ;; Not real keywords, but close enough to be fontified as such
              "self" "True" "False")
 	 symbol-end)
-    (,(rx symbol-start "None" symbol-end)	; see § Keywords in 2.5 manual
+    (,(rx symbol-start "None" symbol-end)	; see § Keywords in 2.7 manual
      . font-lock-constant-face)
     ;; Definitions
     (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
@@ -117,47 +117,47 @@
 					    (0+ "." (1+ (or word ?_)))))
      (1 font-lock-type-face))
     ;; Built-ins.  (The next three blocks are from
-    ;; `__builtin__.__dict__.keys()' in Python 2.5.1.)  These patterns
+    ;; `__builtin__.__dict__.keys()' in Python 2.7)  These patterns
     ;; are debateable, but they at least help to spot possible
     ;; shadowing of builtins.
     (,(rx symbol-start (or
 	  ;; exceptions
-	  "ArithmeticError" "AssertionError" "AttributeError"
-	  "BaseException" "DeprecationWarning" "EOFError"
-	  "EnvironmentError" "Exception" "FloatingPointError"
-	  "FutureWarning" "GeneratorExit" "IOError" "ImportError"
-	  "ImportWarning" "IndentationError" "IndexError" "KeyError"
-	  "KeyboardInterrupt" "LookupError" "MemoryError" "NameError"
-	  "NotImplemented" "NotImplementedError" "OSError"
-	  "OverflowError" "PendingDeprecationWarning" "ReferenceError"
-	  "RuntimeError" "RuntimeWarning" "StandardError"
-	  "StopIteration" "SyntaxError" "SyntaxWarning" "SystemError"
-	  "SystemExit" "TabError" "TypeError" "UnboundLocalError"
-	  "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError"
-	  "UnicodeTranslateError" "UnicodeWarning" "UserWarning"
-	  "ValueError" "Warning" "ZeroDivisionError") symbol-end)
+     "ArithmeticError" "AssertionError" "AttributeError"
+     "BaseException" "BufferError" "BytesWarning"
+     "DeprecationWarning" "EOFError" "EnvironmentError"
+     "Exception" "FloatingPointError" "FutureWarning"
+     "GeneratorExit" "IOError" "ImportError"
+     "ImportWarning" "IndentationError" "IndexError"
+     "KeyError" "KeyboardInterrupt" "LookupError"
+     "MemoryError" "NameError" "NotImplemented"
+     "NotImplementedError" "OSError" "OverflowError"
+     "PendingDeprecationWarning" "ReferenceError"
+     "RuntimeError" "RuntimeWarning" "StandardError"
+     "StopIteration" "SyntaxError" "SyntaxWarning"
+     "SystemError" "SystemExit" "TabError"
+     "TypeError" "UnboundLocalError" "UnicodeDecodeError"
+     "UnicodeEncodeError" "UnicodeError" "UnicodeTranslateError"
+     "UnicodeWarning" "UserWarning" "ValueError"
+     "Warning" "WindowsError" "ZeroDivisionError") symbol-end)
      . font-lock-type-face)
     (,(rx (or line-start (not (any ". \t"))) (* (any " \t")) symbol-start
 	  (group (or
 	  ;; callable built-ins, fontified when not appearing as
 	  ;; object attributes
-	  "abs" "all" "any" "apply" "basestring" "bool" "buffer" "callable"
-	  "chr" "classmethod" "cmp" "coerce" "compile" "complex"
-	  "copyright" "credits" "delattr" "dict" "dir" "divmod"
-	  "enumerate" "eval" "execfile" "exit" "file" "filter" "float"
-	  "frozenset" "getattr" "globals" "hasattr" "hash" "help"
-	  "hex" "id" "input" "int" "intern" "isinstance" "issubclass"
-	  "iter" "len" "license" "list" "locals" "long" "map" "max"
-	  "min" "object" "oct" "open" "ord" "pow" "property" "quit"
-	  "range" "raw_input" "reduce" "reload" "repr" "reversed"
-	  "round" "set" "setattr" "slice" "sorted" "staticmethod"
-	  "str" "sum" "super" "tuple" "type" "unichr" "unicode" "vars"
-	  "xrange" "zip")) symbol-end)
+     "abs" "all" "any" "apply" "basestring" "bin" "bool" "buffer"
+     "bytearray" "bytes" "callable" "chr" "classmethod" "cmp"
+     "coerce" "compile" "complex" "copyright" "credits" "delattr"
+     "dict" "dir" "divmod" "enumerate" "eval" "execfile" "exit"
+     "file" "filter" "float" "format" "frozenset" "getattr" "globals"
+     "hasattr" "hash" "help" "hex" "id" "input" "int" "intern"
+     "isinstance" "issubclass" "iter" "len" "license" "list" "locals"
+     "long" "map" "max" "memoryview" "min" "next" "object" "oct"
+     "open" "ord" "pow" "print" "property" "quit" "range" "raw_input"
+     "reduce" "reload" "repr" "reversed" "round" "set" "setattr"
+     "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple"
+     "type" "unichr" "unicode" "vars" "xrange" "zip")) symbol-end)
      (1 font-lock-builtin-face))
     (,(rx symbol-start (or
 	  ;; other built-ins
 	  "True" "False" "None" "Ellipsis"
-	  "_" "__debug__" "__doc__" "__import__" "__name__") symbol-end)
+	  "_" "__debug__" "__doc__" "__import__" "__name__" "__package__")
+     symbol-end)
      . font-lock-builtin-face)))
 
 (defconst python-font-lock-syntactic-keywords


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-07 13:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-05 20:30 Update keywords/builtins in python.el to Python v2.7 (patch included) Christoph
2010-07-05 22:50 ` Glenn Morris
2010-07-05 23:14   ` Deniz Dogan
2010-07-06  1:49   ` Christoph
2010-07-06 17:28     ` Chong Yidong
2010-07-07  4:47     ` Glenn Morris
2010-07-07 12:21       ` Christoph
2010-07-07 13:47         ` Davis Herring

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.