GNU bug report logs - #8639
23.2; emacs python mode should colorize nonlocal keyword

Previous Next

Package: emacs;

Reported by: Steve Chapel <schapel <at> umich.edu>

Date: Sun, 8 May 2011 23:47:01 UTC

Severity: minor

Found in version 23.2

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8639 in the body.
You can then email your comments to 8639 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8639; Package emacs. (Sun, 08 May 2011 23:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve Chapel <schapel <at> umich.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 08 May 2011 23:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steve Chapel <schapel <at> umich.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; emacs python mode should colorize nonlocal keyword
Date: Sun, 08 May 2011 18:56:18 -0400
When editing a Python source file, the nonlocal keyword is not colorized
as are other keywords. The following program is an example:

#!/usr/bin/python3

def foo():
    i = 1
    def bar():
        nonlocal i
        return i + 1
    return bar

print(foo()())



In GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.21.4)
 of 2010-07-08 on x86-10.phx2.fedoraproject.org
configured using `configure  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-optimize-sibling-calls''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 2 6 0 1 ; 0 c ESC x r e p TAB DEL DEL DEL 
b u g TAB TAB DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL 
DEL DEL DEL DEL r e p o r t TAB RET

Recent messages:
("emacs" "hop4_2.py")
Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message idna sendmail regexp-opt ecomplete rfc822
mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap
mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader
gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit
mailheader canlock sha1 hex-util hashcash mail-utils emacsbug help-mode
view python-21 python easymenu comint ring tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8639; Package emacs. (Wed, 11 May 2011 22:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 8639 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Steve Chapel <schapel <at> umich.edu>
Cc: 8639 <at> debbugs.gnu.org
Subject: Re: bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
Date: Thu, 12 May 2011 00:13:17 +0200
On Mon, May 9, 2011 at 00:56, Steve Chapel <schapel <at> umich.edu> wrote:

> When editing a Python source file, the nonlocal keyword is not colorized
> as are other keywords.

It's easy to fix (see below), but "nonlocal" is a Python 3.X keyword,
and python-mode does not really support Python 3 at this point, so I
suppose that's not the only inconvenience you find when editing Python
3 code.

    Juanma



=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2011-04-22 18:44:26 +0000
+++ lisp/progmodes/python.el	2011-05-11 22:08:51 +0000
@@ -100,5 +100,7 @@
 	     "raise" "return" "try" "while" "with" "yield"
              ;; Not real keywords, but close enough to be fontified as such
-             "self" "True" "False")
+             "self" "True" "False"
+             ;; Python 3
+             "nonlocal")
 	 symbol-end)
     (,(rx symbol-start "None" symbol-end)	; see § Keywords in 2.7 manual




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8639; Package emacs. (Fri, 13 May 2011 12:30:02 GMT) Full text and rfc822 format available.

Message #11 received at 8639 <at> debbugs.gnu.org (full text, mbox):

From: Steve Chapel <schapel <at> umich.edu>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8639 <at> debbugs.gnu.org
Subject: Re: bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
Date: Fri, 13 May 2011 08:29:30 -0400
On 05/11/2011 06:13 PM, Juanma Barranquero wrote:
> On Mon, May 9, 2011 at 00:56, Steve Chapel<schapel <at> umich.edu>  wrote:
>
>> When editing a Python source file, the nonlocal keyword is not colorized
>> as are other keywords.
> It's easy to fix (see below), but "nonlocal" is a Python 3.X keyword,
> and python-mode does not really support Python 3 at this point, so I
> suppose that's not the only inconvenience you find when editing Python
> 3 code.
I've programmed thousands of lines of Python 3 code over the past year, 
nearly exclusively in emacs, and this is the only problem I've noticed. 
Perhaps there are others I'm not aware of.

Thanks for the patch!

-- Steve




Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Fri, 13 May 2011 12:47:02 GMT) Full text and rfc822 format available.

Notification sent to Steve Chapel <schapel <at> umich.edu>:
bug acknowledged by developer. (Fri, 13 May 2011 12:47:03 GMT) Full text and rfc822 format available.

Message #16 received at 8639-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Steve Chapel <schapel <at> umich.edu>
Cc: 8639-done <at> debbugs.gnu.org
Subject: Re: bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
Date: Fri, 13 May 2011 14:45:48 +0200
On Fri, May 13, 2011 at 14:29, Steve Chapel <schapel <at> umich.edu> wrote:

> I've programmed thousands of lines of Python 3 code over the past year,
> nearly exclusively in emacs, and this is the only problem I've noticed.
> Perhaps there are others I'm not aware of.

OK, the patch is tiny and harmless and won't hinder any future work to
adapt to Python 3, so I've committed it to the emacs-23 branch.

    Juanma




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Jun 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 343 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.