Update of /project/clim-desktop/cvsroot/clim-desktop In directory clnet:/tmp/cvs-serv21320
Modified Files: swine.lisp swine-cmds.lisp Log Message: Added `evaluating-interactively' macro for providing error messages when Climacs cannot convert some some text to code for evaluation or compilation, added usage of this macro to Eval Region and Compile Definition.
--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/06/03 17:50:56 1.22 +++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/06/03 18:14:42 1.23 @@ -150,6 +150,11 @@ `(let ((,package-sym (usable-package (slot-value ,syntax 'package)))) ,@body))
+(defmacro evaluating-interactively (&body body) + `(handler-case (progn ,@body) + (end-of-file () + (esa:display-message "Unbalanced parentheses in form.")))) + ;;; Real code:
(defun macroexpand-token (syntax token &optional (all nil)) @@ -192,11 +197,7 @@ (offset start) (offset end))) (values (multiple-value-list - (handler-case (eval-string string) - (error (condition) - (progn (beep) - (esa:display-message "~A" condition) - (return-from eval-region nil)))))) + (eval-string string))) ;; Enclose each set of values in {}. (result (apply #'format nil "~{{~:[No values~;~:*~{~S~^,~}~]}~}" values))) --- /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp 2006/06/01 23:21:29 1.20 +++ /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp 2006/06/03 18:14:42 1.21 @@ -82,8 +82,9 @@ (point (point (current-window)))) (when (mark> mark point) (rotatef mark point)) - (eval-region mark point - (syntax (buffer (current-window)))))) + (evaluating-interactively + (eval-region mark point + (syntax (buffer (current-window)))))))
(esa:set-key 'com-eval-region 'lisp-table @@ -92,9 +93,10 @@ (define-command (com-compile-definition :name t :command-table lisp-table) () "Compile and load definition at point." - (compile-definition-interactively (point (current-window)) - (current-window) - (syntax (buffer (current-window))))) + (evaluating-interactively + (compile-definition-interactively (point (current-window)) + (current-window) + (syntax (buffer (current-window))))))
(esa:set-key 'com-compile-definition 'lisp-table
clim-desktop-cvs@common-lisp.net