From: Christoph <cschol2112@googlemail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Update keywords/builtins in python.el to Python v2.7 (patch included)
Date: Mon, 05 Jul 2010 19:49:26 -0600 [thread overview]
Message-ID: <4C328BA6.90406@gmail.com> (raw)
In-Reply-To: <cs630t7dcp.fsf@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]
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
[-- Attachment #2: python_Changelog.txt --]
[-- Type: text/plain, Size: 479 bytes --]
=== 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 <cschol2112@gmail.com>
+
+ * 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 <jan.h.d@swipnet.se>
* configure.in: Remove define __P.
[-- Attachment #3: python_keywords_builtins_v2_7.txt --]
[-- Type: text/plain, Size: 4351 bytes --]
=== 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
next prev parent reply other threads:[~2010-07-06 1:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C328BA6.90406@gmail.com \
--to=cschol2112@googlemail.com \
--cc=emacs-devel@gnu.org \
--cc=rgm@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).