From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.bugs Subject: bug#16915: 24.3.50; [ruby-mode] Comments in regexps using the extended syntax are not font-locked properly Date: Sun, 2 Mar 2014 13:03:14 +0200 Message-ID: References: <87y50to93u.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="53130ff2_5c482a97_209" X-Trace: ger.gmane.org 1393758253 8334 80.91.229.3 (2 Mar 2014 11:04:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Mar 2014 11:04:13 +0000 (UTC) Cc: 16915@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 02 12:04:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WK4Bv-0004Gi-Dm for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Mar 2014 12:04:19 +0100 Original-Received: from localhost ([::1]:35022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WK4Bv-0003sH-0u for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Mar 2014 06:04:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WK4Bm-0003s0-HF for bug-gnu-emacs@gnu.org; Sun, 02 Mar 2014 06:04:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WK4Be-0001Mg-Au for bug-gnu-emacs@gnu.org; Sun, 02 Mar 2014 06:04:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WK4Be-0001MT-5u for bug-gnu-emacs@gnu.org; Sun, 02 Mar 2014 06:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WK4Bd-00049O-JP for bug-gnu-emacs@gnu.org; Sun, 02 Mar 2014 06:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bozhidar Batsov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Mar 2014 11:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16915 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16915-submit@debbugs.gnu.org id=B16915.139375819315895 (code B ref 16915); Sun, 02 Mar 2014 11:04:01 +0000 Original-Received: (at 16915) by debbugs.gnu.org; 2 Mar 2014 11:03:13 +0000 Original-Received: from localhost ([127.0.0.1]:47470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WK4Aq-00048I-Dx for submit@debbugs.gnu.org; Sun, 02 Mar 2014 06:03:12 -0500 Original-Received: from mail-ea0-f171.google.com ([209.85.215.171]:57250) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WK4An-000486-V7 for 16915@debbugs.gnu.org; Sun, 02 Mar 2014 06:03:10 -0500 Original-Received: by mail-ea0-f171.google.com with SMTP id n15so2302173ead.30 for <16915@debbugs.gnu.org>; Sun, 02 Mar 2014 03:03:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type; bh=SNyJ7SS5RqwnfRhBHyy4NDVE1SBP1HJWaTVRtuA51R4=; b=xvKW5eaoWv6DEM9yiJ2DNVHhFUGMtDwuv50uIqUp8NNVbzbURP6Et9VbxyTM7WNulA RuR/WVhILWSasm2U43gBaEqgwMm0pWWdgL/tXFZdgwnVnivypMGtMliaJr9KhyuGjgaI RUtnK+DP2mq+Khl8SmZdO8Cutc+1eKLNK5TjdcmuvM+PJWhNxmI/TuI8e3h6IEqT0+mQ OEmvaxbVIsECHZOIsjJ77L0D8ZDz2AyclnpttWRL/nqb1x6evubtxG8kjigF978mXcMe BGjsjivVd9SRFFGWQQ6wzJTzjF0sAUA23nMp2IihXZX06NnSHQE00nzJKsUJdkPPzbLc Qu5g== X-Received: by 10.14.215.133 with SMTP id e5mr872814eep.103.1393758188833; Sun, 02 Mar 2014 03:03:08 -0800 (PST) Original-Received: from [10.0.1.3] (93-152-182-45.ddns.onlinedirect.bg. [93.152.182.45]) by mx.google.com with ESMTPSA id m1sm35186810een.7.2014.03.02.03.03.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 02 Mar 2014 03:03:08 -0800 (PST) In-Reply-To: <87y50to93u.fsf@yandex.ru> X-Mailer: sparrow 1.6.4 (build 1178) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:86472 Archived-At: --53130ff2_5c482a97_209 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday, March 2, 2014 at 12:19 AM, Dmitry Gutov wrote: > Bozhidar Batsov = writes: > =20 > > In most editors/IDEs code like this > > =20 > > regexp =3D / > > start =23 some text > > =5Cs =23 white space char > > (group) =23 first group > > (=3F:alt1=7Calt2) =23 some alternation > > end > > /x > > =20 > > will have the comments font-locked as comments, because comments are > > allowed in the extended regexp literal syntax (/x). It would be nice > > if this was taken into account in ruby-mode as well. > > =20 > =20 > =20 > Not sure how to implement it best. > =20 > Ideally, we'd have a new kind of syntax instead of strings (native > regexp support=3F), which would make font-lock fontify comments inside.= > =20 > Or maybe a modifier on the string syntax=3F Native regexp support is preferable IMO. After all - regexps are not stri= ngs. If they were treated differently we=E2=80=99d also be able to have e= xtra highlighting for things like named groups, quantifiers, regexp class= es, etc. I guess, however, that this would require a lot of work. > =20 > Of course, we could just scan the contents of every regexp, look for an= y > hash character that doesn't look like it starts interpolation, and > forcibly fontify the text from it till the end of line. > =20 > =20 --53130ff2_5c482a97_209 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
On Su= nday, March 2, 2014 at 12:19 AM, Dmitry Gutov wrote:
Bozhidar Batsov <bozhidar=40batsov.com> writes:

In most editors/= IDEs code like this

regexp =3D /
sta= rt =23 some text
=5Cs =23 white space char=
(group) =23 first group
(=3F:alt1=7Calt2) = =23 some alternation
end
/x

will have the comments font-locked as comments, because comments are
allowed in the extended regexp literal syntax (/x). It would be n= ice
if this was taken into account in ruby-mode as well.
<= /div>

Not sure how to implement it best.<= /div>

Ideally, we'd have a new kind of syntax instead = of strings (native
regexp support=3F), which would make font-lo= ck fontify comments inside.

Or maybe a modifier = on the string syntax=3F
Native = regexp support is preferable IMO. After all - regexps are not strings. If= they were treated differently we=E2=80=99d also be able to have extra hi= ghlighting for things like named groups, quantifiers, regexp classes, etc= . I guess, however, that this would require a lot of work.

Of course, we could just scan the contents of every regexp, look for any=
hash character that doesn't look like it starts interpolation,= and
forcibly fontify the text from it till the end of line.
=20 =20 =20 =20 =20

--53130ff2_5c482a97_209--