[clim-desktop-cvs] CVS clim-desktop

thenriksen thenriksen at common-lisp.net
Tue May 30 20:38:58 UTC 2006


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

Modified Files:
	swine.lisp swine-cmds.lisp 
Log Message:
Factored selection of "this" form into an inventively named
`this-form' function.


--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/28 16:48:46	1.13
+++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/30 20:38:58	1.14
@@ -55,6 +55,12 @@
                                 (expression-at-mark mark syntax)
                                 :preserve)))
 
+(defun this-form (mark syntax)
+  "Return a form at mark. This function defines which
+  forms the COM-FOO-this commands affect."
+  (or (form-around syntax (offset mark))
+      (form-before syntax (offset mark))))
+
 (defun macroexpand-token (syntax token &optional (all nil))
   (let* ((string (token-string syntax token))
          (expression (read-from-string string))
@@ -865,8 +871,7 @@
             (,form-sym
              ;; Find a form with a valid (fboundp) operator.
              (let ((immediate-form
-                    (or (form-before ,syntax-value-sym (offset ,mark-value-sym))
-                        (form-around ,syntax-value-sym (offset ,mark-value-sym)))))
+                    (this-form (offset ,mark-value-sym) ,syntax-value-sym)))
                ;; Recurse upwards until we find a form with a valid
                ;; operator. This could be improved a lot, as we could
                ;; inspect the lambda list of the found operator and
--- /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/28 16:48:46	1.17
+++ /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/30 20:38:58	1.18
@@ -152,8 +152,7 @@
   (let* ((buffer (buffer (current-window)))
          (point (point (current-window)))
          (syntax (syntax buffer))
-         (token (or (form-around syntax (offset point))
-                    (form-before syntax (offset point))))
+         (token (this-form point syntax))
          (this-symbol (when token (token-to-object syntax token))))
     (when (and this-symbol (symbolp this-symbol))
       (edit-definition this-symbol))))
@@ -194,8 +193,7 @@
          (buffer (buffer pane))
          (syntax (syntax buffer))
          (mark (point pane))
-         (token (or (form-before syntax (offset mark))
-                    (form-around syntax (offset mark)))))
+         (token (this-form mark syntax)))
     (if (and token (typep token 'complete-token-lexeme))
         (com-lookup-arglist (token-to-object syntax token))
         (esa:display-message "Could not find symbol at point."))))




More information about the Clim-desktop-cvs mailing list