From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christoph Newsgroups: gmane.emacs.devel Subject: Re: Update keywords/builtins in python.el to Python v2.7 (patch included) Date: Mon, 05 Jul 2010 19:49:26 -0600 Message-ID: <4C328BA6.90406@gmail.com> References: <4C3240CF.8050100@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090308020301010007080402" X-Trace: dough.gmane.org 1278381005 19021 80.91.229.12 (6 Jul 2010 01:50:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Jul 2010 01:50:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 06 03:50:03 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OVxIH-0007lp-0p for ged-emacs-devel@m.gmane.org; Tue, 06 Jul 2010 03:49:58 +0200 Original-Received: from localhost ([127.0.0.1]:59522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVxIE-0001MS-Lp for ged-emacs-devel@m.gmane.org; Mon, 05 Jul 2010 21:49:50 -0400 Original-Received: from [140.186.70.92] (port=35126 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVxI4-0001KY-Fg for emacs-devel@gnu.org; Mon, 05 Jul 2010 21:49:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVxI2-0002OL-W3 for emacs-devel@gnu.org; Mon, 05 Jul 2010 21:49:40 -0400 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:42624) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVxHv-0002M3-4P; Mon, 05 Jul 2010 21:49:31 -0400 Original-Received: by gyf1 with SMTP id 1so3631755gyf.0 for ; Mon, 05 Jul 2010 18:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=CkKmIoefP9d6eAmrVrRSu7jU3eu5G+u5Jy8ksWdNiZs=; b=baOtzeTKi5OSbo8dmLe8zOePxwAthH20Df6/9ZYo9jOKc854GButoIKVLNrZSGI/Ea OqOjnz6CTUWkb3+4lOetUx/V8ESPBx1SncXAxp7QYpD28irvetsrsVHIUPCPLQNRj4sb Cvzqb3MooTUSzXknd+VNm5BGWDGQE7KTCgIZM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=SrgqL6/1X8zH8eUWyrJYrzUvj1sYwP24c7atS81vRcqJaU7h7e9NoefXQRL85X00gg T8nIiHc6DevGO8zjtWMG0+usAyWMc9KdNbM/ky7mtkmPBOStyDVK2s45+bhUBmaTwXIa FFfzRpNCBTCdXQTXrogpHv4SfNyzIvo20ozw4= Original-Received: by 10.101.107.8 with SMTP id j8mr4917631anm.166.1278380969578; Mon, 05 Jul 2010 18:49:29 -0700 (PDT) Original-Received: from [192.168.1.5] (97-122-127-13.hlrn.qwest.net [97.122.127.13]) by mx.google.com with ESMTPS id o7sm45317920and.13.2010.07.05.18.49.27 (version=SSLv3 cipher=RC4-MD5); Mon, 05 Jul 2010 18:49:28 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126811 Archived-At: This is a multi-part message in MIME format. --------------090308020301010007080402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 7/5/2010 4:50 PM, Glenn Morris wrote: > > Please include a ChangeLog entry. This is especially necessary since > you have whitespace changes, which makes it hard to see what you > actually changed. I actually didn't mean to change the whitespace. It seems python.el uses a mixture of spaces and tabs. It's a pain to reproduce some of the indenting the way it is done in the original file. indent-region changes the indenting even more (moves everything further to the right), but I assume the current indenting is done to keep it within 80 columns. Is a mixture of tabs and spaces allowed? Maybe someone should convert the tabs to spaces. > Also, I keep saying this, but I strongly advise people to post patches > like this to the bug list, since then they are much less likely to get > forgotten / overlooked. I used to forward things there, but have given > up. If you post things here, you basically rely on people keeping > things in their inbox until dealt with. By bug list you mean bug-gnu-emacs? I have attached a revised patch minimizing impact on original code and a changelog entry. Hope this helps clarifying the changes. The callable builtins section is a pain, because of the original formatting. Christoph --------------090308020301010007080402 Content-Type: text/plain; name="python_Changelog.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="python_Changelog.txt" === modified file 'ChangeLog' --- ChangeLog 2010-07-02 12:55:51 +0000 +++ ChangeLog 2010-07-06 01:34:00 +0000 @@ -1,3 +1,9 @@ +2010-07-05 Christoph Scholtes + + * python.el: Add support for new keywords & builtins in Python v2.7. + New builtins: BufferError, BytesWarning, WindowsError + New callable builtins: bin, bytearray, bytes, format, memoryview, next, print + 2010-07-02 Jan Djärv * configure.in: Remove define __P. --------------090308020301010007080402 Content-Type: text/plain; name="python_keywords_builtins_v2_7.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="python_keywords_builtins_v2_7.txt" === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2010-02-27 00:19:50 +0000 +++ lisp/progmodes/python.el 2010-07-06 01:29:10 +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,15 +117,16 @@ (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" + "BaseException" "BufferError" "BytesWarning" + "DeprecationWarning" "EOFError" "EnvironmentError" + "Exception" "FloatingPointError" "FutureWarning" + "GeneratorExit" "IOError" "ImportError" "ImportWarning" "IndentationError" "IndexError" "KeyError" "KeyboardInterrupt" "LookupError" "MemoryError" "NameError" "NotImplemented" "NotImplementedError" "OSError" @@ -135,29 +136,30 @@ "SystemExit" "TabError" "TypeError" "UnboundLocalError" "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError" "UnicodeTranslateError" "UnicodeWarning" "UserWarning" - "ValueError" "Warning" "ZeroDivisionError") symbol-end) + "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 --------------090308020301010007080402--