Extending the Utility


Extending color-coded with your own homegrown macros is easy. Consider the WHILE macro:


Ordinarily the symbol WHILE would be styled like any other generic text:


To have it styled like a :cl function, you would make this call to the DEFSTYLE macro:


The results looks like this:


To give WHILE a unique style you would make this call:


The results would then look like this:


By supplying a bit more information in the DEFSTYLE call your user-defined macros will be inserted in the preference dialog, where they can be edited and saved in the usual manner. To do this with the WHILE macro, you would do the following:




The new dialog entry looks like this:




Currently DEFSTYLE is not exported. Put your extensions at the end of color-coded-defstyle.lisp.


Textual Represenations

The second parameter to a defstyle call is a list of function names. The list describes the structure of the form. These styling functions do pretty much what they sound like they should do. There is also some control-x control-d documentation.

The best way to determine what functions you need to use for your extensions is to look at the built-in styles which have similar structures. If, for example, your macro creates variables, look at the DEFSTYLE call for LET or DO. These are in color-coded-defstyle.lisp


DEFSTYLE keywords

:doc and :sample-code
These two are used by DEFSTYLE to determine whether or not a style should be inserted in the prefs dialog. If you supply values, the style will be inserted; otherwise it will not. The WHILE example above demonstrates both cases.


The keywords below offer some flexibility in defining a style at the expense of complexity. They are all optional. If you don't supply any of them the style-item-variable will initially receive *generic-text-style*. Then you can set a specific style by editing it and saving it in the prefs dialog. (You must supply :doc and :sample-code arguments to DEFSTYLE in this case)

It will probably be useful to look at how the built-in styles use these keywords, or just take a look at the definition of the DEFSTYLE macro in color-coded.lisp. All of these options can be over-ridden by the style you create and save in the prefs dialog.

:default-style
This is a specification for the default style of the macro name. It is only used if the preference file does not exist or is defective.

:default-symbol-style
This is a specification for the default style of the symbol defined by the macro. It is only used if the preference file does not exist or is defective.

:inherits-style
This is a second level default. It is only valid if you don't specify a :style-accessor. If the style-item-variable is NIL (either because you didn't specify a default, or you clicked the "use generic" button in the prefs dialog) then this value will be used.

:inherits-symbol-style
This is a second level default. It is only valid if you don't specify a :symbol-style-accessor. If the style-item-variable is NIL (either because you didn't specify a default, or you clicked the "use generic" button in the prefs dialog) then this value will be used.

:style-accessor
This is a second level default. If the style-item-variable is NIL (either because you didn't specify a default, or you clicked the "use generic" button in the prefs dialog) then this function will be called, producing the spec.

:symbol-style-accessor
This is a second level default. If the style-item-variable is NIL (either because you didn't specify a default, or you clicked the "use generic" button in the prefs dialog) then this function will be called, producing the spec.