all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
@ 2011-05-08 22:56 Steve Chapel
  2011-05-11 22:13 ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Chapel @ 2011-05-08 22:56 UTC (permalink / raw
  To: 8639

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=gene
 ric -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)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
  2011-05-08 22:56 bug#8639: 23.2; emacs python mode should colorize nonlocal keyword Steve Chapel
@ 2011-05-11 22:13 ` Juanma Barranquero
  2011-05-13 12:29   ` Steve Chapel
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2011-05-11 22:13 UTC (permalink / raw
  To: Steve Chapel; +Cc: 8639

On Mon, May 9, 2011 at 00:56, Steve Chapel <schapel@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
  2011-05-11 22:13 ` Juanma Barranquero
@ 2011-05-13 12:29   ` Steve Chapel
  2011-05-13 12:45     ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Chapel @ 2011-05-13 12:29 UTC (permalink / raw
  To: Juanma Barranquero; +Cc: 8639

On 05/11/2011 06:13 PM, Juanma Barranquero wrote:
> On Mon, May 9, 2011 at 00:56, Steve Chapel<schapel@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8639: 23.2; emacs python mode should colorize nonlocal keyword
  2011-05-13 12:29   ` Steve Chapel
@ 2011-05-13 12:45     ` Juanma Barranquero
  0 siblings, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2011-05-13 12:45 UTC (permalink / raw
  To: Steve Chapel; +Cc: 8639-done

On Fri, May 13, 2011 at 14:29, Steve Chapel <schapel@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-13 12:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-08 22:56 bug#8639: 23.2; emacs python mode should colorize nonlocal keyword Steve Chapel
2011-05-11 22:13 ` Juanma Barranquero
2011-05-13 12:29   ` Steve Chapel
2011-05-13 12:45     ` Juanma Barranquero

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.