[slime-cvs] CVS slime

CVS User heller heller at common-lisp.net
Mon Aug 10 19:30:33 UTC 2009


Update of /project/slime/cvsroot/slime
In directory cl-net:/tmp/cvs-serv28603

Modified Files:
	ChangeLog slime.el 
Log Message:
Minor refactoring.

* slime.el (slime-insert-note-group): Factored out from
slime-insert-compilation-log.
(slime-goto-location-position): Can't use goto-line.

--- /project/slime/cvsroot/slime/ChangeLog	2009/08/10 19:30:22	1.1831
+++ /project/slime/cvsroot/slime/ChangeLog	2009/08/10 19:30:32	1.1832
@@ -1,5 +1,10 @@
 2009-08-10  Helmut Eller  <heller at common-lisp.net>
 
+	* slime.el (slime-insert-note-group): Factored out from
+	slime-insert-compilation-log.
+	(slime-goto-location-position): Can't use goto-line.
+
+2009-08-10  Helmut Eller  <heller at common-lisp.net>
 	Separate context info from compiler message text.
 
 	* swank-backend.lisp (compiler-condition): Add a new slot
--- /project/slime/cvsroot/slime/slime.el	2009/08/10 19:30:22	1.1210
+++ /project/slime/cvsroot/slime/slime.el	2009/08/10 19:30:33	1.1211
@@ -2966,28 +2966,33 @@
         (dolist (notes grouped-notes)
           (let ((loc (gethash (first notes) canonicalized-locs-table))
                 (start (point)))
-            (insert (slime-canonicalized-location-to-string loc) ":\n")
-            (dolist (note notes)
-              (insert "  ")
-              (insert (slime-severity-label (slime-note.severity note)) ": ")
-              (slime-insert-block
-               (concat (slime-note.message note)
-                       (let ((ctx (slime-note.source-context note)))
-                         (if ctx (format "\n%s" ctx))))
-               4)
-              (insert "\n"))
+            (insert (slime-canonicalized-location-to-string loc) ":")
+            (slime-insert-note-group notes)
             (insert "\n")
             (slime-make-note-overlay (first notes) start (1- (point))))))
       (compilation-mode)
       (set (make-local-variable 'compilation-skip-threshold) 0)
       (setq next-error-last-buffer (current-buffer)))))
 
-(defun slime-insert-block (string indentation)
-  "Insert TEXT.  If it takes multiple lines, indent it."
-  (cond ((string-match "\n" string)
-         (insert "\n")
-         (slime-with-rigid-indentation indentation (insert string)))
-        (t (insert string))))
+(defun slime-insert-note-group (notes)
+  "Insert a group of compiler messages."
+  (insert "\n")
+  (dolist (note notes)
+    (insert "  " (slime-severity-label (slime-note.severity note)) ": ")
+    (let ((start (point)))
+      (insert (slime-note.message note))
+      (let ((ctx (slime-note.source-context note)))
+        (if ctx (insert "\n" ctx)))
+      (slime-indent-block start 4))
+    (insert "\n")))
+
+(defun slime-indent-block (start column)
+  "If the region back to START isn't a one-liner indent it."
+  (when (< start (line-beginning-position))
+    (save-excursion 
+      (goto-char start) 
+      (insert "\n"))
+    (slime-indent-rigidly start (point) column)))
 
 (defun slime-canonicalized-location (location)
   "Takes a `slime-location' and returns a list consisting of
@@ -3427,7 +3432,8 @@
      (goto-char start)
      (forward-char offset))
     ((:line start &optional column)
-     (goto-line start)
+     (goto-char (point-min))
+     (beginning-of-line start)
      (cond (column (move-to-column column))
            (t (skip-chars-forward " \t"))))
     ((:function-name name)





More information about the slime-cvs mailing list