From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric James Michael Ritz Newsgroups: gmane.emacs.help Subject: Selective Case-Insensitive With font-lock Date: Sat, 09 Mar 2013 14:27:37 -0500 Message-ID: <513B8D29.1020409@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1362857285 14600 80.91.229.3 (9 Mar 2013 19:28:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Mar 2013 19:28:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 09 20:28:30 2013 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 1UEPRU-0003D3-Ab for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Mar 2013 20:28:28 +0100 Original-Received: from localhost ([::1]:58735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEPR7-0007jM-RU for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Mar 2013 14:28:05 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEPQq-0007Z6-OE for help-gnu-emacs@gnu.org; Sat, 09 Mar 2013 14:27:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEPQj-0001EO-9G for help-gnu-emacs@gnu.org; Sat, 09 Mar 2013 14:27:48 -0500 Original-Received: from mail-yh0-x235.google.com ([2607:f8b0:4002:c01::235]:54018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEPQj-0001DC-3s for help-gnu-emacs@gnu.org; Sat, 09 Mar 2013 14:27:41 -0500 Original-Received: by mail-yh0-f53.google.com with SMTP id q3so431893yhf.12 for ; Sat, 09 Mar 2013 11:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=F97QZa1LD3dlW2fhKWnyPR9BLx4vl/x0GbtccrZokF8=; b=xYad2hUCDRvx666y8yKlDTeKzocQY8Y9B/MQCHlMXxcBiJ1EW/M748cL6qK4xBWJDg DXWNC7kpju9pzt+JT68X4prtYj7YUNetJYEFK78Dz9q5Etoy8il2TuSojgvZBvHqMo4X L1tctomOLFe2dJn2seC2LjLYS0Ej9kM6hnIT+O9dZY6Yxri4w/kO+8tpcQLvsqroW1u+ XuBsC6lllud3slopF7/AFdB3gyni2alxpQvbX22xeDeUjtlaOtcZMtmObgv9G9mcgoLy Rj0Gx2OqCXMTZdKT9UjkPsvogVo01bxl8TTwfFvlVDCic7aWvbwI9YhetrS/sgKfRAyr hj0Q== X-Received: by 10.236.164.65 with SMTP id b41mr1825086yhl.142.1362857259643; Sat, 09 Mar 2013 11:27:39 -0800 (PST) Original-Received: from [192.168.1.102] (75-137-107-71.dhcp.gnvl.sc.charter.com. [75.137.107.71]) by mx.google.com with ESMTPS id k45sm14859567yhd.2.2013.03.09.11.27.38 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 11:27:38 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c01::235 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:89444 Archived-At: Hello all! I am attempting to fix a problem with php-mode but ran into a situation that illuminates the gaps in my understanding of font-lock. So I would greatly appreciate it if someone here could point me in the right direction. First, here is the full code in question: https://raw.github.com/ejmr/php-mode/issue-75/php-mode.el This is the problem I’m trying to address: PHP treats most of its predefined constants in a case-sensitive way, e.g. a programmer cannot substitute ‘e_error’ in place of ‘E_ERROR’ because PHP requires the all-caps version. Since the majority of PHP’s constants have this behavior I set font-lock to disable case-folding (search for ‘setq font-lock-defaults …’). However, there are a small group of constants which PHP accepts in any case. In the code these are the ‘php-magic-constants’ group. So if a user writes ‘__dir__’ instead of ‘__DIR__’ php-mode should treat those as the same thing in terms of syntax highlighting. But I do not know how to tell font-lock to selectively enable case-insensitivity for a small group of regular expressions while enforcing case-sensitivity for the rest. I could rewrite the expressions that need to be case-insensitive in a form like "__[dD][iI][rR]__" but I wanted to first ask if there is a simplier, less tedious solution that I’m unaware of. Thanks in advanced for any pointers and help. -- ejmr 南無妙法蓮華經