[clim-desktop-cvs] CVS clim-desktop

thenriksen thenriksen at common-lisp.net
Fri May 19 10:00:53 UTC 2006


Update of /project/clim-desktop/cvsroot/clim-desktop
In directory clnet:/tmp/cvs-serv26918

Modified Files:
	swine.lisp swine-cmds.lisp 
Log Message:
Simplified Eval Last Expression command.


--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/18 22:13:24	1.7
+++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/19 10:00:52	1.8
@@ -78,19 +78,6 @@
       (insert-sequence point expansion-string)
       (insert-object point #\Newline))))
 
-(defun last-expression (mark syntax)
- "Returns the expression before MARK"
- (let ((m (clone-mark mark)))
-   (backward-expression m syntax)
-   (buffer-substring (buffer mark) (offset m) (offset mark))))
-
-(defun eval-last-expression-with-swank (mark syntax)
- (with-slots (package) syntax
-    (let* ((swank::*buffer-package* (or package *package*))
-           (swank::*buffer-readtable* *readtable*)
-           (message (swank::interactive-eval (last-expression mark syntax))))
-      (climacs-gui::display-message message))))
-
 (defun eval-region-with-swank (start end syntax)
  (with-slots (package) syntax
     (let* ((swank::*buffer-package* (or package *package*))
--- /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/18 22:13:24	1.13
+++ /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/19 10:00:52	1.14
@@ -26,12 +26,19 @@
 (in-package :climacs-lisp-syntax)
 
 (define-command (com-eval-last-expression :name t :command-table lisp-table)
-    ()
+    ((insertp 'boolean :prompt "Insert?"))
   "Evaluate the expression before point."
-  (eval-last-expression-with-swank (point (current-window))
-				   (syntax (buffer (current-window)))))
+  (let* ((syntax (syntax (buffer (current-window))))
+         (mark (point (current-window)))
+         (token (form-before syntax (offset mark))))
+    (if token
+        (let ((*package* (slot-value syntax 'package)))
+          (climacs-gui::com-eval-expression
+           (read-from-string (token-string syntax token))
+           insertp))
+        (esa:display-message "Nothing to evaluate."))))
 
-(esa:set-key 'com-eval-last-expression
+(esa:set-key `(com-eval-last-expression ,esa:*numeric-argument-p*)
 	     'lisp-table
 	     '((#\c :control) (#\e :control)))
 




More information about the Clim-desktop-cvs mailing list