all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christoph <cschol2112@googlemail.com>
To: emacs-devel@gnu.org
Subject: Update keywords/builtins in python.el to Python v2.7 (patch included)
Date: Mon, 05 Jul 2010 14:30:07 -0600	[thread overview]
Message-ID: <4C3240CF.8050100@gmail.com> (raw)

[-- 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


             reply	other threads:[~2010-07-05 20:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05 20:30 Christoph [this message]
2010-07-05 22:50 ` Update keywords/builtins in python.el to Python v2.7 (patch included) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C3240CF.8050100@gmail.com \
    --to=cschol2112@googlemail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.