[slime-devel] Re: SLIME User Survey

Helmut Eller e9626484 at stud3.tuwien.ac.at
Sun Jun 20 13:49:18 UTC 2004


Luke Gorrie <luke at bluetail.com> writes:

> This would be good. Right now I don't know of the right mechanism by
> which to do it. Anyone have ideas?

The code below works in Emacs but I was unable to get it to work in
XEmacs.  Evaluating reader conditionals doesn't work so well if the
file isn't written for the connected Lisp, e.g. the wrong expressions
will be highlighted in CMUCL sources files, if you are connected to
ACL.


(defvar slime-highlight-suppressed-forms t
  "*If true then highlight reader conditionalized forms where the test
evaluates to false.")

(defun slime-search-suppressed-forms (limit)
  "Find reader conditionalized forms where the test is false."
  (when (and slime-highlight-suppressed-forms
             (slime-connected-p)
	     (re-search-forward "#[-+]" limit t))
    (ignore-errors
      (let* ((char (char-before))
             (e (read (current-buffer)))
             (val (slime-eval-feature-conditional e)))
        (when (<= (point) limit)
          (if (or (and (eq char ?+) (not val))
                  (and (eq char ?-) val))
              (let ((start (point)))
                (forward-sexp)
                (assert (<= (point) limit))
                (let ((md (match-data)))
                  (fill md nil)
                  (setf (first md) start)
                  (setf (second md) (point))
                  (set-match-data md)
                  t))
            (slime-search-suppressed-forms limit)))))))

(defun slime-activate-font-lock-magic ()
  (font-lock-add-keywords
   'lisp-mode
   '((slime-search-suppressed-forms 0 font-lock-comment-face t))))




More information about the slime-devel mailing list