emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-bug-tracker] bug#7322: closed (Something about python font-lock)


From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#7322: closed (Something about python font-lock)
Date: Mon, 08 Nov 2010 18:56:02 +0000

Your message dated Mon, 08 Nov 2010 13:57:34 -0500
with message-id <address@hidden>
and subject line Re: bug#7322: 23.1; tqs-escape-syntax-error
has caused the GNU bug report #7322,
regarding Something about python font-lock
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
7322: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7322
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 23.1; tqs-escape-syntax-error Date: Wed, 03 Nov 2010 12:47:12 +0100 User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6
Hi,

editing python code, the following code concatenates strings with variables:

"""(beginning-of-form-base \"""" + string1 + """\" \"""" + string2 + """\" nil nil nil nil t))))"""

while " + string1 +" is highlighted correctly, " + string2 + " has string face wrongly.

Also `ppss' falsely indicates being inside a string.

BTW everything is fine with an alternative coding using
singlequotes:

"""(beginning-of-form-base \"""" + string1 + '\" \"' + string2 + """\" nil nil nil nil t))))"""

The bug however exists.

Thanks all


Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/



In GNU Emacs 23.1.1 (i586-suse-linux-gnu, GTK+ Version 2.20.1)
 of 2010-07-05
Windowing system distributor `The X.Org Foundation', version 11.0.10800000
configured using `configure '--with-pop' '--without-hesiod' '--with-kerberos' '--with-kerberos5' '--with-xim' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--with-x' '--with-sound' '--with-sync-input' '--with-xpm' '--with-jpeg' '--with-tiff' '--with-gif' '--with-png' '--with-rsvg' '--with-dbus' '--without-gpm' '--with-x-toolkit=gtk' '--x-includes=/usr/include' '--x-libraries=/usr/lib:/usr/share/X11' '--with-xft' '--with-libotf' '--with-m17n-flt' '--build=i586-suse-linux' 'build_alias=i586-suse-linux' 'CC=gcc-4.3' 'CFLAGS=-fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -std=gnu89 -pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label -Wno-unprototyped-calls -fno-optimize-sibling-calls -DSYSTEM_PURESIZE_EXTRA=55000 -DSITELOAD_PURESIZE_EXTRA=10000 ' 'LDFLAGS=-Wl,-O2 -Wl,--hash-size=65521''

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: de_DE.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Python

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

Recent input:
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <up> <up> <up> <up>
<up> <up> <up> <left> <left> <left> C-j <up> ; ; SPC
<down> <left> C-x C-e C-x C-f p r o g a r <tab> p o
y <tab> <backspace> <backspace> y t <tab> t h <tab>
l i s t <tab> a <tab> <return> <next> <next> <next>
<next> <next> <next> <next> <next> <next> <next> <next>
<next> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <left> <up>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <help-echo>
C-h f p y t h o n m <backspace> - m o d e <return>
C-x 1 M-x r e p o r t - e m a c s - b u <tab> <ret
urn>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark saved where search started
Mark set




--- End Message ---
--- Begin Message --- Subject: Re: bug#7322: 23.1; tqs-escape-syntax-error Date: Mon, 08 Nov 2010 13:57:34 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
>>>>> "Andreas" == Andreas Röhler <address@hidden> writes:

> Hi,

> editing python code, the following code concatenates strings with variables:

> """(beginning-of-form-base \"""" + string1 + """\" \"""" + string2 + """\"
> nil nil nil nil t))))"""

> while " + string1 +" is highlighted correctly, " + string2 + " has string
> face wrongly.

Thanks.  Indeed backslashes weren't recognized properly in this case.
I've installed the patch below in the emacs-23 branch, which seems to
fix this problem.


        Stefan


=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el    2010-08-23 00:44:55 +0000
+++ lisp/progmodes/python.el    2010-11-08 18:53:30 +0000
@@ -170,18 +170,9 @@
   ;; Make outer chars of matching triple-quote sequences into generic
   ;; string delimiters.  Fixme: Is there a better way?
   ;; First avoid a sequence preceded by an odd number of backslashes.
-  `((,(rx (not (any ?\\))
-         ?\\ (* (and ?\\ ?\\))
-         (group (syntax string-quote))
-         (backref 1)
-         (group (backref 1)))
-     (2 ,(string-to-syntax "\"")))     ; dummy
-    (,(rx (group (optional (any "uUrR"))) ; prefix gets syntax property
-         (optional (any "rR"))           ; possible second prefix
-         (group (syntax string-quote))   ; maybe gets property
-         (backref 2)                     ; per first quote
-         (group (backref 2)))            ; maybe gets property
-     (1 (python-quote-syntax 1))
+  `((,(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
+              "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)")
+     (1 (python-quote-syntax 1) nil lax)
      (2 (python-quote-syntax 2))
      (3 (python-quote-syntax 3)))
     ;; This doesn't really help.
@@ -219,9 +210,9 @@
              (eval-when-compile (string-to-syntax "|"))))))
      ;; Consider property for initial char, accounting for prefixes.
      ((or (and (= n 2)                 ; leading quote (not prefix)
-              (= (match-beginning 1) (match-end 1))) ; prefix is null
+              (not (match-end 1)))     ; prefix is null
          (and (= n 1)                  ; prefix
-              (/= (match-beginning 1) (match-end 1)))) ; non-empty
+              (match-end 1)))          ; non-empty
       (let ((font-lock-syntactic-keywords nil))
        (unless (eq 'string (syntax-ppss-context (syntax-ppss)))
          (eval-when-compile (string-to-syntax "|")))))



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]