* Selective Case-Insensitive With font-lock
@ 2013-03-09 19:27 Eric James Michael Ritz
0 siblings, 0 replies; only message in thread
From: Eric James Michael Ritz @ 2013-03-09 19:27 UTC (permalink / raw)
To: help-gnu-emacs
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
南無妙法蓮華經
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-03-09 19:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-09 19:27 Selective Case-Insensitive With font-lock Eric James Michael Ritz
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.