* 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
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 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 0 siblings, 2 replies; 8+ messages in thread From: Glenn Morris @ 2010-07-05 22:50 UTC (permalink / raw) To: Christoph; +Cc: emacs-devel Please include a ChangeLog entry. This is especially necessary since you have whitespace changes, which makes it hard to see what you actually changed. 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 2010-07-05 22:50 ` Glenn Morris @ 2010-07-05 23:14 ` Deniz Dogan 2010-07-06 1:49 ` Christoph 1 sibling, 0 replies; 8+ messages in thread From: Deniz Dogan @ 2010-07-05 23:14 UTC (permalink / raw) To: Glenn Morris; +Cc: Christoph, emacs-devel 2010/7/6 Glenn Morris <rgm@gnu.org>: > > Please include a ChangeLog entry. This is especially necessary since > you have whitespace changes, which makes it hard to see what you > actually changed. > This is especially necessary in this case since the indentation has changed and therefore deciphering what keywords were added is quite unclear from reading just the patch. -- Deniz Dogan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 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 1 sibling, 2 replies; 8+ messages in thread From: Christoph @ 2010-07-06 1:49 UTC (permalink / raw) To: Glenn Morris; +Cc: emacs-devel [-- 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 2010-07-06 1:49 ` Christoph @ 2010-07-06 17:28 ` Chong Yidong 2010-07-07 4:47 ` Glenn Morris 1 sibling, 0 replies; 8+ messages in thread From: Chong Yidong @ 2010-07-06 17:28 UTC (permalink / raw) To: Christoph; +Cc: emacs-devel Christoph <cschol2112@googlemail.com> writes: > Is a mixture of tabs and spaces allowed? This is the default for all Emacs source files, and the default behavior for Emacs. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 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 1 sibling, 1 reply; 8+ messages in thread From: Glenn Morris @ 2010-07-07 4:47 UTC (permalink / raw) To: Christoph; +Cc: emacs-devel Christoph wrote: > By bug list you mean bug-gnu-emacs? Yep. > 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. No need to be a slave to alphabetical order. Applied to emacs-23. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 2010-07-07 4:47 ` Glenn Morris @ 2010-07-07 12:21 ` Christoph 2010-07-07 13:47 ` Davis Herring 0 siblings, 1 reply; 8+ messages in thread From: Christoph @ 2010-07-07 12:21 UTC (permalink / raw) To: Glenn Morris; +Cc: emacs-devel On 7/6/2010 10:47 PM, Glenn Morris wrote: > Christoph wrote: > >> By bug list you mean bug-gnu-emacs? > > Yep. OK. I will send patches like this to bug-gnu-emacs then. Do I open a bug report for every patch or do I just send it to the list directly? >> 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. > > No need to be a slave to alphabetical order. dir(__builtin__) in Python spits these out in alphabetical order so I think it makes sense to keep that for future updates. Ideally, it would be formatted as one keyword per line. > Applied to emacs-23. Thanks! Christoph ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Update keywords/builtins in python.el to Python v2.7 (patch included) 2010-07-07 12:21 ` Christoph @ 2010-07-07 13:47 ` Davis Herring 0 siblings, 0 replies; 8+ messages in thread From: Davis Herring @ 2010-07-07 13:47 UTC (permalink / raw) To: Christoph; +Cc: emacs-devel > OK. I will send patches like this to bug-gnu-emacs then. Do I open a bug > report for every patch or do I just send it to the list directly? Writing to that list creates a bug report. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping. ^ 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.