From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Riel Newsgroups: gmane.emacs.help Subject: Re: Basic font-lock without font-locking double-quoted strings Date: Thu, 19 Dec 2013 21:00:15 -0800 Message-ID: <20131219210015.3df76c82@gauss> References: <87r498fjuc.fsf@nl106-137-194.student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1387515655 3280 80.91.229.3 (20 Dec 2013 05:00:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Dec 2013 05:00:55 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 20 06:00:59 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 1VtsCn-0004er-Pg for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Dec 2013 06:00:57 +0100 Original-Received: from localhost ([::1]:47738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtsCn-0004VO-Ey for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Dec 2013 00:00:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtsCG-0004KG-8k for help-gnu-emacs@gnu.org; Fri, 20 Dec 2013 00:00:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtsCA-00005g-EC for help-gnu-emacs@gnu.org; Fri, 20 Dec 2013 00:00:24 -0500 Original-Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:55170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtsCA-00005W-BM for help-gnu-emacs@gnu.org; Fri, 20 Dec 2013 00:00:18 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=GGzZdJT2oJO+GUpSCk/8YQ==:17 a=CmBJ7QsR23cA:10 a=05ChyHeVI94A:10 a=A67dEwaWxOsA:10 a=kj9zAlcOel0A:10 a=ayC55rCoAAAA:8 a=KGjhK52YXX0A:10 a=DQrQlq1BVzUA:10 a=JM6YbTEvPS7mUsiQSd0A:9 a=CjuIK1q_8ugA:10 a=GGzZdJT2oJO+GUpSCk/8YQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 66.75.5.27 Original-Received: from [66.75.5.27] ([66.75.5.27:55381] helo=gauss) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id F0/06-11872-0EEC3B25; Fri, 20 Dec 2013 05:00:17 +0000 In-Reply-To: <87r498fjuc.fsf@nl106-137-194.student.uu.se> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 75.180.132.120 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:95108 Archived-At: On Fri, 20 Dec 2013 01:26:26 +0100 Emanuel Berg wrote: > Joe Riel writes: > > > Why would the following minimal mode > > > > (define-derived-mode msdbg-mode fundamental-mode (setq > > font-lock-keywords '(("EA" > > . font-lock-warning-face)))) > > Does that work at all? Yes. One solution was to set font-lock-keywords-only to t. That can be done when assigning to font-lock-defaults. My solution was different; I don't need font-lock mode, so called (font-lock-mode -1) to turn it off, then coded a loop to fontify what I needed (the mode is just for viewing). > > According to the help, it should look like this: > > (define-derived-mode article-mode sgml-mode "Article" > "Major mode for editing technical articles." > (setq case-fold-search nil)) > > But strings are highlighted in fundamental-mode > (font-look-face-face) so at least that makes sense. > > You'll have to wait for a better answer, but the below > code (the only mode I did) might interest you. When I > did it, I was told on this list not to make it a > generic mode but to derive from fundamental-mode, > however, I didn't do that - first the keywords, then > create the mode. > > (defvar fpscalc-keywords > '(("\\(!.*$\\)" . 'fpscalc-comment) > ("\\(semaphore\\)\\((\\)\\([[:word:]]+\\)\\(\\, \\)\\([[:word:]]+\\)" > (1 'fpscalc-semaphore-keyword) > (3 'fpscalc-semaphore-name) > (5 'fpscalc-task-name-and-index) ) > ("declarations\\|initialise\\|semaphores\\|formulas" . 'fpscalc-program-parts) > ("sigma\\|floor\\|ceiling\\|min\\|max" . 'fpscalc-math-functions) > ("lp\\|ep\\|hp\\|all" . 'fpscalc-task-priority-sets) > ("\\([[:word:]]\\)\\(\\[\\)\\(i\\)\\(\\]\\)" > (1 'fpscalc-variable-name) > (3 'fpscalc-i-task) ) > ("\\([[:word:]]\\)\\(\\[\\)\\(j\\)\\(\\]\\)" > (1 'fpscalc-variable-name) > (3 'fpscalc-j-task)) > ("\\([[:word:]]\\)\\(\\[\\)\\(.*\\)\\(\\]\\)" > (1 'fpscalc-variable-name) > (3 'fpscalc-task-name-and-index)) > ("\\(system \\)\\(.* \\)" > (1 'fpscalc-system-keyword) > (2 'fpscalc-system-name)) > ("\\(scalar\\|indexed\\|priority\\|blocking\\)\\( \\)+\\(\\(\\([[:word:]]\\( *\\, *\\)?\\)\\)*\\)" > (1 'fpscalc-variable-type) > (3 'fpscalc-variable-name)) > ("\\(tasks +\\)\\(\\(\\([[:word:]]\\( *\\, *\\)?\\)\\)*\\)" > (1 'fpscalc-tasks-keyword) > (2 'fpscalc-task-name-and-index)) > )) > > (define-generic-mode > 'fpscalc-mode > '("!") > nil > fpscalc-keywords > '("\\.fps\\'") > '((lambda () > (progn > (setq indent-line-function 'fpscalc-indent-line) > (local-set-key "\C-c\C-c" 'compute) ))) > "Major mode for .fps files and the fpscalc tool.") > -- Joe Riel