[slime-cvs] CVS slime

CVS User trittweiler trittweiler at common-lisp.net
Fri Dec 5 20:01:54 UTC 2008


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

Modified Files:
	slime.el ChangeLog 
Log Message:

* slime.el (slime-macroexpansion-minor-mode-map): Bind keybindings
  of `undo' to `slime-macroexpansion-undo'.
  (slime-show-macroexpansion): Renamed to
  `slime-initialize-macroexpansion-buffer'
  (slime-initialize-macroexpansion-buffer): Make sure that the user
  can't undo past the initial insertion.
  (slime-macroexpand-undo): New function. Tries to undo-only.


--- /project/slime/cvsroot/slime/slime.el	2008/12/05 18:53:13	1.1069
+++ /project/slime/cvsroot/slime/slime.el	2008/12/05 20:01:54	1.1070
@@ -6415,13 +6415,8 @@
            (define-key slime-macroexpansion-minor-mode-map mapping to))))
   (remap 'slime-macroexpand-1 'slime-macroexpand-1-inplace)
   (remap 'slime-macroexpand-all 'slime-macroexpand-all-inplace)
-  (remap 'advertised-undo 
-         '(lambda (&optional arg)
-            (interactive)
-            (let ((inhibit-read-only t))
-              (when (fboundp 'slime-remove-edits)
-                (slime-remove-edits (point-min) (point-max)))
-              (undo arg)))))
+  (remap 'advertised-undo 'slime-macroexpand-undo)
+  (remap 'undo 'slime-macroexpand-undo))
 
 (defun slime-sexp-at-point-for-macroexpansion ()
   "Essentially like SLIME-SEXP-AT-POINT-OR-ERROR, but behaves a
@@ -6452,11 +6447,12 @@
                     (car (slime-sexp-at-point-for-macroexpansion)))))
     (setq slime-eval-macroexpand-expression `(,expander ,string))
     (slime-eval-async slime-eval-macroexpand-expression
-                      #'slime-show-macroexpansion)))
+                      #'slime-initialize-macroexpansion-buffer)))
 
-(defun slime-show-macroexpansion (expansion &optional buffer)
+(defun slime-initialize-macroexpansion-buffer (expansion &optional buffer)
   (pop-to-buffer (or buffer (slime-create-macroexpansion-buffer)))
-  (let ((inhibit-read-only t))
+  (let ((inhibit-read-only t)
+        (buffer-undo-list t)) ; Make the initial insertion not be undoable.
     (erase-buffer)
     (insert expansion)
     (goto-char (point-min))
@@ -6535,9 +6531,21 @@
   "Reperform the last macroexpansion."
   (interactive)
   (slime-eval-async slime-eval-macroexpand-expression 
-                    (slime-rcurry #'slime-show-macroexpansion
+                    (slime-rcurry #'slime-initialize-macroexpansion-buffer
                                   (current-buffer))))
 
+(defun slime-macroexpand-undo (&optional arg)
+  (interactive)
+  (flet ((undo-only (arg)
+           ;; Emacs 22.x introduced `undo-only' which works by binding
+           ;; `undo-no-redo' to t. We do it this way so we don't break
+           ;; prior Emacs versions.
+           (let ((undo-no-redo t)) (undo arg))))
+    (let ((inhibit-read-only t))
+      (when (fboundp 'slime-remove-edits)
+        (slime-remove-edits (point-min) (point-max)))
+      (undo-only arg))))
+
 
 ;;;; Subprocess control
 
--- /project/slime/cvsroot/slime/ChangeLog	2008/12/05 18:53:14	1.1591
+++ /project/slime/cvsroot/slime/ChangeLog	2008/12/05 20:01:54	1.1592
@@ -1,5 +1,15 @@
 2008-12-05  Tobias C. Rittweiler  <tcr at freebits.de>
 
+	* slime.el (slime-macroexpansion-minor-mode-map): Bind keybindings
+	of `undo' to `slime-macroexpansion-undo'.
+	(slime-show-macroexpansion): Renamed to
+	`slime-initialize-macroexpansion-buffer'
+	(slime-initialize-macroexpansion-buffer): Make sure that the user
+	can't undo past the initial insertion.
+	(slime-macroexpand-undo): New function. Tries to undo-only.
+
+2008-12-05  Tobias C. Rittweiler  <tcr at freebits.de>
+
 	* slime.el (slime-trace-query): SPEC argument can be a symbol.
 
 2008-12-02  Tobias C. Rittweiler  <tcr at freebits.de>





More information about the slime-cvs mailing list