[slime-devel] Re: slime-display-edit-hilights

Peter Seibel peter at gigamonkeys.com
Tue Dec 20 17:30:14 UTC 2005


Peter Seibel <peter at gigamonkeys.com> writes:

> "Stefan Kamphausen" <skampi at gmx.net> writes:

>> For todays work I will remove the in-comment-p call in
>> self-insert-function and I hope for some help of you guys.
>
> Should be coming soon.

Try this patch. This also provides a kludgy but, I think, real fix to
turn off edited-code hilighting in the REPL (the old fix seems to get
undone after you load a lisp buffer. See the comment below for my
understanding as to why.

-Peter

Index: ChangeLog
===================================================================
RCS file: /project/slime/cvsroot/slime/ChangeLog,v
retrieving revision 1.823
diff -u -r1.823 ChangeLog
--- ChangeLog	20 Dec 2005 00:25:58 -0000	1.823
+++ ChangeLog	20 Dec 2005 17:27:45 -0000
@@ -1,3 +1,8 @@
+2005-12-20  Peter Seibel  <peter at gigamonkeys.com>
+
+	* slime.el (slime-in-comment-p): Renamed from in-comment-p and
+	made perhaps more portable.
+
 2005-12-20  Marco Baringer  <mb at bese.it>
 
 	When inspecting classes, methods and generic functions show all
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.572
diff -u -r1.572 slime.el
--- slime.el	20 Dec 2005 00:13:24 -0000	1.572
+++ slime.el	20 Dec 2005 17:27:55 -0000
@@ -9890,17 +9890,29 @@
   (self-insert-command 1)
   (when (and slime-display-edit-hilights
              (slime-connected-p)
-             (not (in-comment-p)))
+             (not (eq 'slime-repl-mode major-mode))
+             (not (slime-in-comment-p)))
     (let ((overlay (make-overlay (- (point) 1) (point))))
       (flet ((putp (name value) (overlay-put overlay name value)))
         (putp 'face 'slime-display-edit-face)
         (putp 'slime-edit t)))))
 
-(defun in-comment-p ()
-  (nth 4 (syntax-ppss (point))))
+(defun slime-in-comment-p ()
+  (let ((lim (or (save-excursion
+                   (beginning-of-defun)
+                   (point))
+                 (point-min))))
+    (nth 4 (parse-partial-sexp lim (point)))))
 
 (add-hook 'slime-mode-hook
           (lambda ()
+            ;; This is a nice idea but there's apparently some level
+            ;; of sharing of keymaps between slime-repl-mode and
+            ;; lisp-mode. Consequently after you load a lisp buffer
+            ;; these changes show through to the REPL. I've moved the
+            ;; test for slime-repl-mode to slime-self-insert-command
+            ;; above for the moment but there's probably a more classy
+            ;; way to fix this. --Peter Seibel
             (unless (eq 'slime-repl-mode major-mode)
               (dotimes (i 127)
                 (when (> i 31)                

-- 
Peter Seibel           * peter at gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/




More information about the slime-devel mailing list