[slime-cvs] CVS /slime

mbaringer mbaringer at common-lisp.net
Sat Feb 18 13:42:38 UTC 2006


Update of /project/slime/cvsroot//slime
In directory common-lisp:/tmp/cvs-serv29758

Modified Files:
	slime.el ChangeLog 
Log Message:


--- /project/slime/cvsroot//slime/slime.el	2006/02/10 17:24:59	1.582
+++ /project/slime/cvsroot//slime/slime.el	2006/02/18 13:42:38	1.583
@@ -7068,18 +7068,30 @@
 
 ;;;; Macroexpansion
 
-(defun slime-eval-macroexpand (expander)
-  (let ((string (slime-sexp-at-point)))
-    (when (not string)
-      (error "No expression at point."))
-    (lexical-let ((package (slime-current-package)))
-      (slime-eval-async 
-       `(,expander ,string)
-       (lambda (expansion)
-         (slime-with-output-to-temp-buffer
-             ("*SLIME macroexpansion*" lisp-mode) package
-           (insert expansion)
-           (font-lock-fontify-buffer)))))))
+(define-minor-mode slime-macroexpansion-minor-mode
+    "SLIME mode for macroexpansion"
+    nil
+  " temp"
+  '(("q" . slime-temp-buffer-quit)
+    ("g" . slime-macroexpand-again)))
+
+(defvar *slime-eval-macroexpand-expression* nil
+  "Specifies the last macroexpansion preformed. This variable
+  specifies both what was expanded and how.")
+
+(defun slime-eval-macroexpand (expander &optional string)
+  (unless string
+    (setf string (slime-sexp-at-point-or-error)))
+  (setf *slime-eval-macroexpand-expression* `(,expander ,string))
+  (lexical-let ((package (slime-current-package)))
+    (slime-eval-async 
+     *slime-eval-macroexpand-expression*
+     (lambda (expansion)
+       (slime-with-output-to-temp-buffer
+           ("*SLIME macroexpansion*" lisp-mode) package
+         (slime-macroexpansion-minor-mode)
+         (insert expansion)
+         (font-lock-fontify-buffer))))))
 
 (defun slime-macroexpand-1 (&optional repeatedly)
   "Display the macro expansion of the form at point.  The form is
@@ -7104,6 +7116,12 @@
   (interactive)
   (slime-eval-macroexpand 'swank:swank-compiler-macroexpand-1))
 
+(defun slime-macroexpand-again ()
+  "Reperform the last macroexpansion."
+  (interactive)
+  (slime-eval-macroexpand (first *slime-eval-macroexpand-expression*)
+                          (second *slime-eval-macroexpand-expression*)))
+
 
 ;;;; Subprocess control
 
@@ -9689,6 +9707,11 @@
   (let ((string (thing-at-point 'sexp)))
     (if string (substring-no-properties string) nil)))
 
+(defun slime-sexp-at-point-or-error ()
+  "Return the sexp at point as a string, othwise signal an error."
+  (or (slime-sexp-at-point)
+      (error "No expression at point.")))
+
 (defun slime-function-called-at-point/line ()
   "Return the name of the function being called at point, provided the
 function call starts on the same line at the point itself."
--- /project/slime/cvsroot//slime/ChangeLog	2006/02/17 01:33:57	1.839
+++ /project/slime/cvsroot//slime/ChangeLog	2006/02/18 13:42:38	1.840
@@ -1,3 +1,19 @@
+2006-02-18  mb  <mb at soma.local>
+
+	* slime.el (slime-macroexpansion-minor-mode): New minor mode for
+	macroexpansion buffer. Exactly like slime-temp-buffer-mode but
+	with slime-macroexpand-again bound to "g".
+	(*slime-eval-macroexpand-expression*): New variable. introduced
+	for slime-macroexpand-again, used by slime-eval-macroexpand as
+	well.
+	(slime-eval-macroexpand): Added optional string argument which
+	defaults to (slime-sexp-at-point-or-error).
+	(slime-macroexpand-again): New function, redoes the last
+	macroexpansion.
+	(slime-sexp-at-point-or-error): New function. Like
+	slime-sexp-at-point but signals an error when slime-sexp-at-point
+	would return nil.
+ 
 2006-02-16  Matthias Koeppe  <mkoeppe at mail.math.uni-magdeburg.de>
 
 	* sbcl-pprint-patch.lisp: New file, adds the annotations feature




More information about the slime-cvs mailing list