Hello.
I've started using SLIME, and so far I feel that it's a great environment.
I have noticed that when I define my own macros and functions, SLIME knows their syntax. If I do:
(my-function-name
SLIME will show the syntax at the minibuffer.
Now, since SLIME knows about my own macros/functions, I wonder if it is possible for it to also do syntax highlighting for them? (Perhaps in a different color from the standard Lisp keywords?)
On a related not, I see that some Lisp identifiers (do, dotimes, etc) are highlighted, but some are not. From what I can see, only those that are related to control flow are highlighted. Am I right? And is that possible to get the rest of the identifiers highlighted?
Thank you! J.
Jeronimo Pellegrini j_p@aleph0.info writes:
I have noticed that when I define my own macros and functions, SLIME knows their syntax. If I do:
(my-function-name
SLIME will show the syntax at the minibuffer.
(For the record: that is when SLIME-AUTODOC-MODE is T.)
Now, since SLIME knows about my own macros/functions, I wonder if it is possible for it to also do syntax highlighting for them? (Perhaps in a different color from the standard Lisp keywords?)
On a related not, I see that some Lisp identifiers (do, dotimes, etc) are highlighted, but some are not. From what I can see, only those that are related to control flow are highlighted. Am I right? And is that possible to get the rest of the identifiers highlighted?
Syntax highlighting is called `font-lock' (or fontifying) in Emacs; and fontifying is defined by Emacs, and as such completely orthogonal to Slime. Look at the end of the file `font-lock.el' (or .el.gz) within your Emacs distribution. (Especially `lisp-font-lock-keywords-2'.)
In general, only standard macros and special forms are highlighted specially. I've got the following in my ~/.emacs, however:
(font-lock-add-keywords 'lisp-mode '(("(\(\(define-\|do-\|with-\)\(\s_\|\w\)*\)" 1 font-lock-keyword-face)))
So all symbols beginning with `define-', `do-', or `with-' are highlighted specially. (As these should denote macros.)
You may like that, too!
-T.
On Mon, Jun 04, 2007 at 10:10:06AM +0200, Tobias C. Rittweiler wrote:
Jeronimo Pellegrini j_p@aleph0.info writes:
I have noticed that when I define my own macros and functions, SLIME knows their syntax. If I do:
(my-function-name
SLIME will show the syntax at the minibuffer.
(For the record: that is when SLIME-AUTODOC-MODE is T.)
Ah, yes. I did add that to my .emacs...
Syntax highlighting is called `font-lock' (or fontifying) in Emacs; and fontifying is defined by Emacs, and as such completely orthogonal to Slime. Look at the end of the file `font-lock.el' (or .el.gz) within your Emacs distribution. (Especially `lisp-font-lock-keywords-2'.)
Ok... So SLIME doesn't interact with that in any way, I guess?
In general, only standard macros and special forms are highlighted specially. I've got the following in my ~/.emacs, however:
(font-lock-add-keywords 'lisp-mode '(("(\(\(define-\|do-\|with-\)\(\s_\|\w\)*\)" 1 font-lock-keyword-face)))
So all symbols beginning with `define-', `do-', or `with-' are highlighted specially. (As these should denote macros.)
This is great! I'm using it now, and it already helps with some symbols that I define which start with "do-".
But I was thinking that maybe SLIME could dynamically add keywords to be highlighted?
Like, whenever SLIME saw a (defmacro foo ...), it would add "foo" to the keyword list? That would be wonderful!
Thanks! J.
Jeronimo Pellegrini j_p@aleph0.info writes:
But I was thinking that maybe SLIME could dynamically add keywords to be highlighted?
It is possible, but has not been done as of yet. In fact, most of the relevant code is there already, because indentation of &BODY forms is dynamically added for macros. So use the Source, Jeronimo. :-)
-T.