how to get font-lock to work in swank repl buffer

Showing 1-6 of 6 messages
how to get font-lock to work in swank repl buffer bsmith.occs 1/19/12 1:52 PM
I'm trying to get syntax highlighting (font-lock) to work in the
repl buffer provided by slime as described here:
https://github.com/technomancy/swank-clojure

(add-hook 'slime-repl-mode-hook
          (defun clojure-mode-slime-font-lock ()
            (let (font-lock-mode)
              (clojure-mode-font-lock-setup))))

The results are not visibly different from having not added this
slime-repl-mode-hook.

Once the repl buffer is open, I can get font-lock to work by
doing this manually:

M-x clojure-mode-font-lock-setup
M-x font-lock-mode (turning it off)
M-x font-lock-mode (turning it back on)

What am I misunderstanding?

I'm running:

 - Emacs 24.0.91.1
 - clojure-mode 1.11.5
 - slime 20100404.1
 - slime-repl 20100404
 - clojure 1.3.0
 - clojure-maven-plugin 1.3.8
 - swank-clojure 1.3.4

Incidentally, what's with this strange form of let?

  (let (font-lock-mode) ;; <- shouldn't this bind variables?
    (clojure-mode-font-lock-setup))

// Ben

Re: how to get font-lock to work in swank repl buffer Max Penet 1/19/12 3:08 PM
Hello,

This should do it:

(add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup)

On Jan 19, 10:52 pm, Ben Smith-Mannschott <bsmith.o...@gmail.com>
wrote:
Re: how to get font-lock to work in swank repl buffer Max Penet 1/19/12 3:14 PM
Well it *should*, now that I think of it, I am not using clojure-jack-
in so it might be different.
Re: how to get font-lock to work in swank repl buffer Jack Moffitt 1/19/12 3:45 PM
The instructions in the git repo don't work for me either, but

> M-x clojure-mode-font-lock-setup
> M-x font-lock-mode (turning it off)
> M-x font-lock-mode (turning it back on)

does. The suggested (add-hook 'slime-repl-mode-hook
'clojure-mode-font-lock-setup) does not work either.

You can automate the manual workaround with this:

(add-hook 'slime-repl-mode-hook
               (lambda ()
                 (clojure-mode-font-lock-setup)
                 (font-lock-mode)
                 (font-lock-mode)))

jack.

Re: how to get font-lock to work in swank repl buffer Daniel Janus 1/20/12 2:53 AM
On Thursday, January 19, 2012 9:52:44 PM UTC, bsmith.occs wrote:
 

Incidentally, what's with this strange form of let?

  (let (font-lock-mode) ;; <- shouldn't this bind variables?
    (clojure-mode-font-lock-setup))

In Common Lisp (and presumably in Emacs Lisp as well), 'let' takes an additional pair of parens around each name/value pair. This allows for a shortcut: (let (a) body) is equivalent to (let ((a nil)) body).

Sorry for the offtopic,
- Daniel 
Re: how to get font-lock to work in swank repl buffer bsmith.occs 1/20/12 12:03 PM
On Fri, Jan 20, 2012 at 00:45, Jack Moffitt <ja...@metajack.im> wrote:
> (add-hook 'slime-repl-mode-hook
>               (lambda ()
>                 (clojure-mode-font-lock-setup)
>                 (font-lock-mode)
>                 (font-lock-mode)))

Excellent! This worked for me.

Many thanks for the tip.

// ben