all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Subject: bug#7322: 23.1; tqs-escape-syntax-error
Date: Mon, 08 Nov 2010 13:57:34 -0500	[thread overview]
Message-ID: <jwv7hgnskz2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4CD14BC0.80709@easy-emacs.de> ("Andreas Röhler"'s message of "Wed, 03 Nov 2010 12:47:12 +0100")

>>>>> "Andreas" == Andreas Röhler <andreas.roehler@easy-emacs.de> 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 "|")))))






      reply	other threads:[~2010-11-08 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 11:47 bug#7322: 23.1; tqs-escape-syntax-error Andreas Röhler
2010-11-08 18:57 ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv7hgnskz2.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=andreas.roehler@easy-emacs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.