From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: case-insensitive regexp for fontlock specification Date: Tue, 12 Aug 2008 19:51:30 -0600 Message-ID: References: <87vdy6wm3u.fsf@DEBLAP1.BeNet> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218592338 18181 80.91.229.12 (13 Aug 2008 01:52:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Aug 2008 01:52:18 +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 Aug 13 03:53:09 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KT5Xu-0004C8-Ho for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2008 03:53:07 +0200 Original-Received: from localhost ([127.0.0.1]:33912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KT5Wy-0004fF-39 for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Aug 2008 21:52:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KT5Wd-0004eA-Jk for help-gnu-emacs@gnu.org; Tue, 12 Aug 2008 21:51:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KT5Wc-0004dp-U1 for help-gnu-emacs@gnu.org; Tue, 12 Aug 2008 21:51:47 -0400 Original-Received: from [199.232.76.173] (port=59124 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KT5Wc-0004de-Il for help-gnu-emacs@gnu.org; Tue, 12 Aug 2008 21:51:46 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:53954 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KT5Wc-00018s-HV for help-gnu-emacs@gnu.org; Tue, 12 Aug 2008 21:51:46 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KT5WR-0000CJ-1w for help-gnu-emacs@gnu.org; Wed, 13 Aug 2008 01:51:35 +0000 Original-Received: from c-67-161-145-183.hsd1.co.comcast.net ([67.161.145.183]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Aug 2008 01:51:35 +0000 Original-Received: from kevin.d.rodgers by c-67-161-145-183.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Aug 2008 01:51:35 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 122 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-67-161-145-183.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) In-Reply-To: <87vdy6wm3u.fsf@DEBLAP1.BeNet> X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56535 Archived-At: Joe Bloggs wrote: > Hi, I am writing a major mode for editing SPSS files. > I am following the tutorial on this webpage: > http://renormalist.net/cgi-bin/twiki/view/Renormalist/EmacsLanguageModeCreationTutorial > > The keyword matching for font-lock should be case-insensitive. > Is there an easy way to specify this? > At the moment I have the following (abbreviated): > > (defconst spss-font-lock-keywords-1 > (list > '("\\<\\(if\\|followed\\|by\\|some\\|other\\|keywords\\)\\>" . font-lock-keyword-face) > "Minimal highlighting expressions for spss mode.") > > which only matches lower case. I could change it like this for example: > > (defconst spss-font-lock-keywords-1 > (list > '("\\<\\([iI][fF]\\|followed\\|by\\|some\\|other\\|keywords\\)\\>" . font-lock-keyword-face) > "Minimal highlighting expressions for spss mode.") > > to make it match if, If, iF & IF, but to make that change for every keyword would take ages. `M-x apropos RET font SPC lock SPC case RET' shows: font-lock-keywords-case-fold-search Variable: *Non-nil means the patterns in `font-lock-keywords' are case-insensitive. Following the Variable link shows: ,----[ C-h v font-lock-keywords-case-fold-search RET ] | font-lock-keywords-case-fold-search is a variable defined in `font-lock.el'. | Its value is nil | | Automatically becomes buffer-local when set in any fashion. | | | Documentation: | *Non-nil means the patterns in `font-lock-keywords' are case-insensitive. | This is normally set via `font-lock-defaults'. | | [back] `---- Following the font-lock-defaults link shows: ,----[ C-h v font-lock-defaults RET ] | font-lock-defaults is a variable defined in `font-core.el'. | Its value is nil | | Automatically becomes buffer-local when set in any fashion. | | | Documentation: | Defaults for Font Lock mode specified by the major mode. | Defaults should be of the form: | | (KEYWORDS [KEYWORDS-ONLY [CASE-FOLD [SYNTAX-ALIST [SYNTAX-BEGIN ...]]]]) | | KEYWORDS may be a symbol (a variable or function whose value is the keywords to | use for fontification) or a list of symbols. If KEYWORDS-ONLY is non-nil, | syntactic fontification (strings and comments) is not performed. | If CASE-FOLD is non-nil, the case of the keywords is ignored when fontifying. | If SYNTAX-ALIST is non-nil, it should be a list of cons pairs of the form | (CHAR-OR-STRING . STRING) used to set the local Font Lock syntax table, for | keyword and syntactic fontification (see `modify-syntax-entry'). | | If SYNTAX-BEGIN is non-nil, it should be a function with no args used to move | backwards outside any enclosing syntactic block, for syntactic fontification. | Typical values are `beginning-of-line' (i.e., the start of the line is known to | be outside a syntactic block), or `beginning-of-defun' for programming modes or | `backward-paragraph' for textual modes (i.e., the mode-dependent function is | known to move outside a syntactic block). If nil, the beginning of the buffer | is used as a position outside of a syntactic block, in the worst case. | | These item elements are used by Font Lock mode to set the variables | `font-lock-keywords', `font-lock-keywords-only', | `font-lock-keywords-case-fold-search', `font-lock-syntax-table' and | `font-lock-beginning-of-syntax-function', respectively. | | Further item elements are alists of the form (VARIABLE . VALUE) and are in no | particular order. Each VARIABLE is made buffer-local before set to VALUE. | | Currently, appropriate variables include `font-lock-mark-block-function'. | If this is non-nil, it should be a function with no args used to mark any | enclosing block of text, for fontification via M-o M-o. | Typical values are `mark-defun' for programming modes or `mark-paragraph' for | textual modes (i.e., the mode-dependent function is known to put point and mark | around a text block relevant to that mode). | | Other variables include that for syntactic keyword fontification, | `font-lock-syntactic-keywords' and those for buffer-specialized fontification | functions, `font-lock-fontify-buffer-function', | `font-lock-unfontify-buffer-function', `font-lock-fontify-region-function', | `font-lock-unfontify-region-function', and `font-lock-inhibit-thing-lock'. | | [back] `---- Emacs is the extensible, customizable, *self-documenting* real-time display editor. -- Kevin Rodgers Denver, Colorado, USA