From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn_Lindqvist?= Newsgroups: gmane.emacs.help Subject: Re: Font-lock of comments using comment tokens, does it work? Date: Sun, 7 Jun 2015 05:58:45 +0200 Message-ID: References: <20150605065300.GA26971@tuxteam.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1433649543 2660 80.91.229.3 (7 Jun 2015 03:59:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Jun 2015 03:59:03 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Stefan Monnier To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 07 05:59:02 2015 Return-path: Envelope-to: geh-help-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 1Z1Rjf-0001D7-DO for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Jun 2015 05:58:59 +0200 Original-Received: from localhost ([::1]:53377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1Rje-0006yz-Ip for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Jun 2015 23:58:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1RjV-0006yk-EP for help-gnu-emacs@gnu.org; Sat, 06 Jun 2015 23:58:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z1RjT-00052Y-79 for help-gnu-emacs@gnu.org; Sat, 06 Jun 2015 23:58:49 -0400 Original-Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:37333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z1RjT-00050o-0Q for help-gnu-emacs@gnu.org; Sat, 06 Jun 2015 23:58:47 -0400 Original-Received: by wifx6 with SMTP id x6so53832512wif.0 for ; Sat, 06 Jun 2015 20:58:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=NN3u6+LnKIzs/nhn48kBiVcJx/wNEIT9bAcbMfS2r0k=; b=tPmcslh5NPFp6qyHZGZN35LCqCdJnnzXbyTGTbuyZTJNUFQcXFiGSge/bOkCIyVagw JdBLKTsFEwSCQUQwT7qtZS5/bkyo42IGisW690SnqsuGN0J0IXyiLJiOFkABCvrjgH+0 5Ncl3VaB6C+p71dnl2MNB1n5eBXLEn8rB37tOlHMuBU4h5WczNAv17MEb3Hl+Y0UYY2O cht17YVcCtTYpho6fy1pEcvFlljgG2QhYM2xt+IUiy2i6zHg/eA+ZOtSxp5je6xZ0p9A 4Y6Z3bFqzgKEG4vlYyuwyTbtd2HYGQ/Sa7yjqTujC3xIp5qSjwAxejgZrR46hdH4yq5A OdBQ== X-Received: by 10.181.27.131 with SMTP id jg3mr9698067wid.89.1433649525631; Sat, 06 Jun 2015 20:58:45 -0700 (PDT) Original-Received: by 10.194.24.167 with HTTP; Sat, 6 Jun 2015 20:58:45 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104806 Archived-At: Ok so I finally almost figured it out. The key part was that you must invert the logic so that instead of "unmarking" in syntax-propertize-rules, you use a regexp that adds the comment starter property "<" to the matched strings. Something is bugged with the unmarking approach, it's like it stops looking when it found the comment character. Anyway: (syntax-propertize-rules ("\\(^\\| \\|\t\\)\\(FOO\\|BAR\\)\\($\\| \\|\t\\)" (2 "< "))) Does almost exactly what I want. Amusingly enough the matching is case-INsensitive so bAR, Bar, foo, etc matches the regexp. But it's a small flaw which I can live with. --=20 mvh/best regards Bj=C3=B6rn Lindqvist