all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15161: 24.3; python mode highlight annoyance
@ 2013-08-22 11:12 Alexis Roda
  2013-08-27  2:42 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Alexis Roda @ 2013-08-22 11:12 UTC (permalink / raw)
  To: 15161

The symptom is that in the code:

     # no s'ha trobat cap oferta, l'alumne queda sense assignar
     # (alumne.assignacio == None)
     self._logger.info(
          u"no assigna '%s'",
          alumne.id
          )
     alumne.assignacio = None

'alumne.assignacio' isn't properly colorized after visiting the file.

In order to reproduce this behaviour:

emacs -Q /tmp/bugtest.py

type:

# a ==
variable = "value"

save, close and open the file again, the variable identifier isn't
properly highlighted.

Deleting the 'a' or a '=' in the comment produces the right
colorization, but adding them back makes it wrong again.




In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
  of 2013-08-17 on superjul
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description:	Ubuntu 12.04.2 LTS

Configured using:
  `configure '--prefix=/opt/emacs/24.3''

Important settings:
   value of $LANG: ca_ES.UTF-8
   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
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
<down> <down> <return> # SPC a = = <return> s o v e
_ <backspace> <backspace> <backspace> m e _ v a r SPC
= SPC 4 <return> <up> <up> <right> <right> <right>
SPC <end> <return> o t h e r SPC v a r <backspace>
<backspace> <backspace> <backspace> _ v a r SPC = SPC
4 <up> <right> <up> <right> <right> <right> <delete>
SPC <backspace> <end> <backspace> = <left> <left> <end>
<return> # SPC f o o <return> <backspace> <up> <left>
<left> SPC <backspace> <down> C-a C-k C-k M-x r e p
o <tab> r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils help-mode python rx easymenu comint ring
ansi-color time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar 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 minibuffer loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)





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

* bug#15161: 24.3; python mode highlight annoyance
  2013-08-22 11:12 bug#15161: 24.3; python mode highlight annoyance Alexis Roda
@ 2013-08-27  2:42 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-08-27  2:42 UTC (permalink / raw)
  To: Alexis Roda; +Cc: Fabián E. Gallina, 15161-done

> # a ==
> variable = "value"

> save, close and open the file again, the variable identifier isn't
> properly highlighted.

Thanks.  I installed the patch below which should fix it,


        Stefan


=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2013-08-16 05:15:51 +0000
+++ lisp/progmodes/python.el	2013-08-27 02:37:53 +0000
@@ -501,29 +501,24 @@
     (,(lambda (limit)
         (let ((re (python-rx (group (+ (any word ?. ?_)))
                              (? ?\[ (+ (not (any  ?\]))) ?\]) (* space)
-                             assignment-operator)))
-          (when (re-search-forward re limit t)
-            (while (and (python-syntax-context 'paren)
-                        (re-search-forward re limit t)))
-            (if (not (or (python-syntax-context 'paren)
-                         (equal (char-after (point-marker)) ?=)))
-                t
-              (set-match-data nil)))))
+                             assignment-operator))
+              (res nil))
+          (while (and (setq res (re-search-forward re limit t))
+                      (or (python-syntax-context 'paren)
+                          (equal (char-after (point-marker)) ?=))))
+          res))
      (1 font-lock-variable-name-face nil nil))
     ;; support for a, b, c = (1, 2, 3)
     (,(lambda (limit)
         (let ((re (python-rx (group (+ (any word ?. ?_))) (* space)
                              (* ?, (* space) (+ (any word ?. ?_)) (* space))
                              ?, (* space) (+ (any word ?. ?_)) (* space)
-                             assignment-operator)))
-          (when (and (re-search-forward re limit t)
-                     (goto-char (nth 3 (match-data))))
-            (while (and (python-syntax-context 'paren)
-                        (re-search-forward re limit t))
-              (goto-char (nth 3 (match-data))))
-            (if (not (python-syntax-context 'paren))
-                t
-              (set-match-data nil)))))
+                             assignment-operator))
+              (res nil))
+          (while (and (setq res (re-search-forward re limit t))
+                      (goto-char (match-end 1))
+                      (python-syntax-context 'paren)))
+          res))
      (1 font-lock-variable-name-face nil nil))))
 
 (defconst python-syntax-propertize-function






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

end of thread, other threads:[~2013-08-27  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-22 11:12 bug#15161: 24.3; python mode highlight annoyance Alexis Roda
2013-08-27  2:42 ` Stefan Monnier

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.