[slime-cvs] CVS update: slime/slime.el
Helmut Eller
heller at common-lisp.net
Thu Dec 22 21:21:47 UTC 2005
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv12477
Modified Files:
slime.el
Log Message:
(slime-highlight-edits-compile-hook): Remove overlays also from
surrounding whitespace.
(slime-highlight-edits): Save match data.
(slime-only-whitespace-p): New function.
Date: Thu Dec 22 22:21:46 2005
Author: heller
Index: slime/slime.el
diff -u slime/slime.el:1.573 slime/slime.el:1.574
--- slime/slime.el:1.573 Thu Dec 22 17:03:32 2005
+++ slime/slime.el Thu Dec 22 22:21:45 2005
@@ -5412,11 +5412,13 @@
(slime-remove-edits (point-min) (point-max)))
(defun slime-highlight-edits (beg end &optional len)
- (when (and (slime-connected-p)
- (not (slime-inside-comment-p beg end)))
- (let ((overlay (make-overlay beg end)))
- (overlay-put overlay 'face 'slime-highlight-edits-face)
- (overlay-put overlay 'slime-edit t))))
+ (save-match-data
+ (when (and (slime-connected-p)
+ (not (slime-inside-comment-p beg end))
+ (not (slime-only-whitespace-p beg end)))
+ (let ((overlay (make-overlay beg end)))
+ (overlay-put overlay 'face 'slime-highlight-edits-face)
+ (overlay-put overlay 'slime-edit t)))))
(defun slime-remove-edits (start end)
"Delete the existing Slime edit hilights in the current buffer."
@@ -5430,15 +5432,30 @@
(defun slime-highlight-edits-compile-hook (start end)
(when slime-highlight-edits-mode
- (slime-remove-edits start end)))
+ (let ((start (save-excursion (goto-char start)
+ (skip-chars-backward " \t\n\r")
+ (point)))
+ (end (save-excursion (goto-char end)
+ (skip-chars-forward " \t\n\r")
+ (point))))
+ (slime-remove-edits start end))))
(defun slime-inside-comment-p (beg end)
"Is the region from BEG to END in a comment?"
- (let* ((hs-c-start-regexp ";\\|#|")
- (comment (hs-inside-comment-p)))
- (and comment
- (destructuring-bind (cbeg cend) comment
- (and (<= cbeg beg) (<= end cend))))))
+ (save-excursion
+ (goto-char beg)
+ (let* ((hs-c-start-regexp ";\\|#|")
+ (comment (hs-inside-comment-p)))
+ (and comment
+ (destructuring-bind (cbeg cend) comment
+ (<= end cend))))))
+
+(defun slime-only-whitespace-p (beg end)
+ "Contains the region from BEG to END only whitespace?"
+ (save-excursion
+ (goto-char beg)
+ (skip-chars-forward " \n\t\r" end)
+ (<= end (point))))
;;;; Completion
More information about the slime-cvs
mailing list