From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.help Subject: Re: Trouble fontifying /** ... */ Date: Tue, 13 Jan 2009 19:18:16 -0800 (PST) Organization: http://groups.google.com Message-ID: <32501463-47d1-4553-9961-c4654cffffeb@v15g2000yqn.googlegroups.com> References: <9e66205f-0f64-47da-8eef-b351311beba6@d42g2000prb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1231904449 12678 80.91.229.12 (14 Jan 2009 03:40:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Jan 2009 03:40:49 +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 Jan 14 04:42:01 2009 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 1LMwdg-0000oT-N7 for geh-help-gnu-emacs@m.gmane.org; Wed, 14 Jan 2009 04:41:56 +0100 Original-Received: from localhost ([127.0.0.1]:52178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMwcQ-00082s-83 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Jan 2009 22:40:38 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v15g2000yqn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 121 Original-NNTP-Posting-Host: 60.234.132.53 Original-X-Trace: posting.google.com 1231903096 12478 127.0.0.1 (14 Jan 2009 03:18:16 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 14 Jan 2009 03:18:16 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v15g2000yqn.googlegroups.com; posting-host=60.234.132.53; posting-account=SVVH0AoAAABplEQzMkIR3gU7a0gK8IuF User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:165986 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:61312 Archived-At: On Jan 10, 2:21=A0am, Xah Lee wrote: > On Jan 8, 8:54=A0pm, Davin Pearson wrote: > > > I have invented a language called SJS that it a mixture of Pascal and > > Java for easier learning of the Java language. =A0In sjs-mode > > I would like the following code: > > > /** > > =A0 I am a Javadoc-style comment. > > */ > > > To be fontified in font-lock-doc-face but I cannot find an elegant way > > to do this. =A0What follows is some Emacs version information, > > via report-emacs-bug: > > your question is a FAQ but without much polished answer. Here is my existing code. The trouble with it is that it sometimes highlights the keyword end in font-lock-type-face. This is a problem with inheriting from the java major mode. (defun sjs-mode () =20 (interactive) (font-lock-mode 0) (kill-all-local- variables) (java- mode) (setq major-mode 'sjs- mode) (setq mode-name "SJS") (set-syntax-table sjs-mode-syntax- table) (use-local-map sjs-mode- map) (local-set-key "\t" 'sjs-- tab) (local-set-key [(meta control \\)] 'sjs--meta-control- backslash) (abbrev-mode 1) (setq local-abbrev-table java-mode-abbrev- table) (font-lock-add- keywords =20 nil =20 '( ("\\<\\(assert\\|begin\\|end\\|function\\|var\\|classVar\\| instanceVariable\\|property\\|method\\|constructor\\|until\\|then\\|and \\|or\\)\\>" (1 'font-lock-keyword-face nil)) ("\\<\\(beginMain\\|endMain\\)\\>" 0 'font-lock-keyword-face nil) ("\\<\\(null\\|true\\|false\\)\\>" 1 'font-lock-constant-face nil) ("\\<\\(abstract\\|break\\|byte\\|case\\|catch\\|class\\|const\\| continue\\|default\\|do\\|else\\|extends\\|final\\|finally\\|for\\|goto \\|if\\|implements\\|import\\|instanceof\\|interface\\|native\\|new\\| package\\|private\\|protected\\|public\\|return\\|static\\|super\\| switch\\|synchronized\\|this\\|throw\\|throws\\|transient\\|try\\| volatile\\|while\\|null\\)\\>" 1 'font-lock-keyword-face nil) ("\\" 0 'font-lock-type-face nil) ("\\<\\(boolean\\|char\\|int\\|long\\|short\\|float\\|double\\| void\\)\\>" 0 'font-lock-type-face nil t) )) (font-lock-mode 3) ) > If your comment syntax is more complex, you cannot use syntax table > for it. You have to use font-lock-syntactic-keywords, and also you'll > need to implement your own comment-dwim. > =95 How To Add Comment Handling In Your Major Mode > http://xahlee.org/emacs/elisp_comment_handling.html > > See also Rick (rgb)'s experience, at > > =95http://groups.google.com/group/gnu.emacs.help/browse_frm/thread/465e9.= .. > > =95http://groups.google.com/group/comp.emacs/browse_frm/thread/c1b7de448.= .. Could you give me some more information as to how to proceed. I am stuck.