Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. @michalmarczyk michalmarczyk revised this gist Mar 28, 2010. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion clojure-font-lock-setup.el
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,7 @@
    (add-text-properties slime-repl-prompt-start-mark (point-max)
    '(font-lock-face slime-repl-prompt-face
    rear-nonsticky
    (font-lock-face read-only intangible))))))
    (slime-repl-prompt
    read-only
    font-lock-face
    intangible))))))
  2. @michalmarczyk michalmarczyk revised this gist Mar 28, 2010. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion clojure-font-lock-setup.el
    Original file line number Diff line number Diff line change
    @@ -46,4 +46,5 @@
    (let ((inhibit-read-only t))
    (add-text-properties slime-repl-prompt-start-mark (point-max)
    '(font-lock-face slime-repl-prompt-face
    rear-nonsticky (font-lock-face read-only))))))
    rear-nonsticky
    (font-lock-face read-only intangible))))))
  3. @michalmarczyk michalmarczyk revised this gist Mar 28, 2010. 1 changed file with 16 additions and 2 deletions.
    18 changes: 16 additions & 2 deletions clojure-font-lock-setup.el
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,20 @@

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

    (defadvice slime-repl-emit (after sr-emit-ad activate)
    (with-current-buffer (slime-output-buffer)
    (add-text-properties slime-output-start slime-output-end
    '(font-lock-face slime-repl-output-face
    rear-nonsticky (font-lock-face)))))

    (defadvice slime-repl-insert-prompt (after sr-prompt-ad activate)
    (with-current-buffer (slime-output-buffer)
    (let ((inhibit-read-only t))
    (add-text-properties slime-repl-prompt-start-mark (point-max)
    '(font-lock-face slime-repl-prompt-face
    rear-nonsticky (font-lock-face read-only))))))
  4. @michalmarczyk michalmarczyk created this gist Mar 19, 2010.
    35 changes: 35 additions & 0 deletions clojure-font-lock-setup.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ;;; all code in this function lifted from the clojure-mode function
    ;;; from clojure-mode.el
    (defun clojure-font-lock-setup ()
    (interactive)
    (set (make-local-variable 'lisp-indent-function)
    'clojure-indent-function)
    (set (make-local-variable 'lisp-doc-string-elt-property)
    'clojure-doc-string-elt)
    (set (make-local-variable 'font-lock-multiline) t)

    (add-to-list 'font-lock-extend-region-functions
    'clojure-font-lock-extend-region-def t)

    (when clojure-mode-font-lock-comment-sexp
    (add-to-list 'font-lock-extend-region-functions
    'clojure-font-lock-extend-region-comment t)
    (make-local-variable 'clojure-font-lock-keywords)
    (add-to-list 'clojure-font-lock-keywords
    'clojure-font-lock-mark-comment t)
    (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil))

    (setq font-lock-defaults
    '(clojure-font-lock-keywords ; keywords
    nil nil
    (("+-*/.<>=!?$%_&~^:@" . "w")) ; syntax alist
    nil
    (font-lock-mark-block-function . mark-defun)
    (font-lock-syntactic-face-function
    . lisp-font-lock-syntactic-face-function))))

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