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: Font-lock of comments using comment tokens, does it work? Date: Wed, 3 Jun 2015 18:46:55 +0200 Message-ID: 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 1433357695 32488 80.91.229.3 (3 Jun 2015 18:54:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jun 2015 18:54:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 03 20:54:47 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 1Z0DoN-0008FV-9q for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 20:54:47 +0200 Original-Received: from localhost ([::1]:37268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0DoM-0003fy-EQ for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 14:54:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Boi-0006oW-Iq for help-gnu-emacs@gnu.org; Wed, 03 Jun 2015 12:47:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0Bof-0003A1-Jk for help-gnu-emacs@gnu.org; Wed, 03 Jun 2015 12:47:00 -0400 Original-Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:36980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0Bof-00039O-Cu for help-gnu-emacs@gnu.org; Wed, 03 Jun 2015 12:46:57 -0400 Original-Received: by wifw1 with SMTP id w1so29392060wif.0 for ; Wed, 03 Jun 2015 09:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=mvCmEamIf8VVx7vLZJSruLNcwXB7XwWcp5jLfH80UT8=; b=ybhNb6C2J6YlyAQlmBnADAUR5ohkau0GSlyRWkhVKrACar2VylD86dxABLzR2K6C99 OHQALagw9xrQDKsD0iBYEm4UQWNyJO0fkco3qOXA5g0g6Dy8aoXvysc/p7a6b/NN5qJz UZewZmQhPyIvwFL4HAKy57aekdpt9AjJdgL/avv+MVntnVYDi3g8R7Sp5l74HhzSfP9B qS+Gs2E6Cy0h2svqvSefGKJuoRzaLLHF+FYzgoYO4FpFqJxE34hOexC7S7APcRhvAe2O jC2Epbxt7OHWXNMql7O7B5Sfgoty9vvBoHjgjHn06CCUq663943V7vmDyYQKFsaMlCw6 Yi7Q== X-Received: by 10.180.84.6 with SMTP id u6mr43653467wiy.87.1433350015833; Wed, 03 Jun 2015 09:46:55 -0700 (PDT) Original-Received: by 10.194.24.167 with HTTP; Wed, 3 Jun 2015 09:46:55 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::230 X-Mailman-Approved-At: Wed, 03 Jun 2015 14:54:37 -0400 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:104734 Archived-At: Hello emacs, I have a really complicated font-locking problem I'm trying to solve for a major mode. It's like I've tried everything but nothing works. Here is the question I asked on Stack Overflow and got some help with but it didn't go all the way: http://stackoverflow.com/questions/29973458/avoid-font-locking-interfering-= inside-of-comments I want to font-lock to understand that two short strings, e.g FOO and BAR are the comment tokens. The tokens themselves should be font-locked as comments and everything following them until the end of line should also be comments. The problem is that the strings only start comments if they are free-standing tokens. So on these four lines there are comments: random code FOO random comment stuff BAR comment "with stuff" BAR FOO BAR FOO On these four lines there are NO comments: FOObar random come BARFOO random code random code xyFOOzw random code "with string FOO " etc ... Because the comment tokens are not separate. I'm suspecting that I've found a limitation in emacs font-locking and that this is impossible to get completely right. I'd love to be proven wrong though. :) --=20 mvh/best regards Bj=C3=B6rn Lindqvist