At 12:54 PM 4/14/00 -0400, you wrote:
>Does anyone understand JDE's Java font lock mode (which I believe is
>derived from andersl) well enough to help me with the following?
>

It's derived from font-lock.el.

>I often use the following style in method headers to highlight the fact
>that a method can return null:
>
>   public String /* or null */ getProperty (String key) { 
>      if ( properties == null )
>         try { 
>            properties = new Properties();
>
properties.load(Collagen.class.getResourceAsStream("/properties")); 
>         } catch (IOException e) { System.err.println(e); }
>      return properties.getProperty(key);
>   }
>
>Unfortunately, the method name in this case does not get colorized
properly.  
>It seems to me that it would be generally correct for _all_ the regular
expressions
>to allow arbitrary /*...*/ comments between tokens.  However, I would settle
>for a single fix to this case.
>

1. Select a Java source buffer.

2. Type C-h v font-lock-keywords

Emacs displays the regular expressions used in jde-mode to match keywords
to be fontified. Each regular expression is paired with the face used to
highlight it. Search the list for font-lock-function-name-face. The regular
expression paired with this face is the one used to find method names in
the Java source buffer. You could modify it to do what you want and then
add the modified version via the font-lock-add-keywords function (see below).


>Thanks in advance.   -CR
>
>P.S. While I have the ear of someone who knows these regular expressions
inside
>out, there is another small extension I could use help with:
>
>I am using a preprocessor to make a few simple extensions to the Java syntax
>in which:
>
>(1) I have a number of keywords, such as "myclass" and "hisclass",
>    which are used syntactically the same as "class", and I would like them
>    to be colorized the same as "class", e.g.,
>
>    public myclass Foo { 
>    ...
>    }
>
>    public hisclass Bar {
>    ...
>    }
>
>(2) I have a number of keywords, such as "myprivate" and "hisprivate",
>    which are used syntactically the same as "private", and I would like them
>    to be colorized the same as "private", e.g., 
>
>    public myclass Foo { 
>       myprivate int i;
>       hisprivate float f;
>       ...
>    }
>
>Can someone tell me where in the maze of regexp's I can add "myclass",
>"hisclass", and "myfield", "hisfield" to get the appropriate effect?
>

Add the following to your jde-mode hook function:

   (font-lock-add-keywords 
    nil
    '(("\\<his\\(class\\|private\\)\\|my\\(class\\|private\\)\\>" .
font-lock-keyword-face)))
   (font-lock-fontify-buffer)

>Btw, I notice there is already a provision for
>java-font-lock-extra-types.  Maybe the general way to do this would be
>to add java-font-lock-extra-type-keywords and

No. This variable specifies a list of regular expressions for recognizing
user-defined types. The default expression recognizes types that conform to
the convention that user-defined type names begin with capital letters. You
would use this variable to specify some other, or additional, convention,
e.g., that type names begin with @.

>java-font-lock-extra-type-specs ?
>

I'm not familiar with this variable.

- Paul

------------------------------------------------------------
TECH SUPPORT POLICY

I respond only to requests that contain a complete problem report. The
easiest way to ensure that your report is complete is to include the output
of the JDE->Help->Submit Problem Report command in your request. 

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

JDE website: http://sunsite.auc.dk/jde/

JDE mailing list archive: 
http://www.mail-archive.com/[email protected]/maillist.html



Reply via email to