[clim-desktop-cvs] CVS clim-desktop

thenriksen thenriksen at common-lisp.net
Thu May 18 21:32:15 UTC 2006


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

Modified Files:
	swine.lisp swine-cmds.lisp climacs.lisp clim-desktop.asd 
Log Message:
Moved Edit Definition into the global Climacs command table.


--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/02 14:40:15	1.5
+++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp	2006/05/18 21:32:15	1.6
@@ -829,16 +829,21 @@
                 (climacs-gui::goto-position (point (climacs-gui::current-window)) offset))
          (pop-find-definition-stack)))))
 
-(defun edit-definition (name syntax)
- (with-slots (package) syntax
-  (let* ((swank::*buffer-package* (or package *package*))
-         (swank::*buffer-readtable* *readtable*)
-         (definitions (swank::find-definitions-for-emacs name)))
-    (cond ((null definitions)
-           (climacs-gui::display-message "No known definitions for: ~A" name)
-           (beep))
-          (t
-           (goto-definition name definitions))))))
+(defun edit-definition (symbol)
+  (flet ((fully-qualified-symbol-name (symbol)
+           (let ((*package* (find-package :keyword)))
+             (format nil "~S" symbol))))
+    (let* ((name (fully-qualified-symbol-name symbol)) (swank::*buffer-package* *package*)
+           (swank::*buffer-readtable* *readtable*)
+           (definitions (swank::find-definitions-for-emacs name)))
+      (cond ((null definitions)
+             (climacs-gui::display-message "No known definitions for: ~A" symbol)
+             (beep))
+            (t
+             (goto-definition name definitions))))))
+
+;; XXX, get Swine into Climacs proper.
+(export 'edit-definition)
 
 (defun goto-definition (name definitions)
  (let* ((pane (climacs-gui::current-window))
--- /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/18 15:07:26	1.11
+++ /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/18 21:32:15	1.12
@@ -140,22 +140,7 @@
                     (form-before syntax (offset point))))
          (this-symbol (when token (token-to-object syntax token))))
     (when (and this-symbol (symbolp this-symbol))
-      (com-edit-definition this-symbol))))
-
-(define-command (com-edit-definition :name t :command-table climacs-gui::global-climacs-table)
-    ((symbol 'symbol
-      :prompt "Edit symbol"))
-  "Edit the definition of a symbol.
-
-If the symbol has been defined more than once (eg. to a function
-as well as a class, or as numerous methods), a
-mouse-click-sensitive list of available definitions will be
-displayed."
-  (flet ((fully-qualified-symbol-name (symbol)
-            (let ((*package* (find-package :keyword)))
-              (format nil "~S" symbol))))
-    (let ((name (fully-qualified-symbol-name symbol)))
-      (edit-definition name (syntax (buffer (current-window)))))))
+      (edit-definition this-symbol))))
 
 (esa:set-key `(com-edit-this-definition)
              'lisp-table
@@ -294,16 +279,6 @@
 
 ;; Translators for clicky goodness:
 
-(define-presentation-to-command-translator edit-definition
-    (symbol com-edit-definition lisp-table
-            :gesture :select
-            :tester ((object presentation)
-                     (declare (ignore object))
-                     (not (eq (presentation-type presentation) 'unknown-symbol)))
-            :documentation "Edit definition")
-    (object)
-    (list object))
-
 (define-command (com-inspect-symbol :name t :command-table lisp-table)
     ((symbol 'symbol :prompt "Inspect symbol"))
   (clouseau:inspector symbol :new-process t))
--- /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp	2006/05/18 15:10:24	1.2
+++ /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp	2006/05/18 21:32:15	1.3
@@ -8,6 +8,30 @@
     ((file 'pathname))
   (find-file file))
 
+;; This command and presentation translator exists here, because we
+;; want it to be completely ubiquitous in Climacs - specifically, we
+;; want to be able to go to the definition of a symbol just by
+;; clicking on any properly `present'ed object.
+(define-command (com-edit-definition :name t :command-table global-climacs-table)
+    ((symbol 'symbol
+      :prompt "Edit symbol"))
+  "Edit the definition of a symbol.
+
+If the symbol has been defined more than once (eg. to a function
+as well as a class, or as numerous methods), a
+mouse-click-sensitive list of available definitions will be
+displayed."
+  (climacs-lisp-syntax:edit-definition symbol))
+
+(define-presentation-to-command-translator edit-definition
+    (symbol com-edit-definition global-climacs-table
+            :gesture :select
+            :tester ((object presentation)
+                     (declare (ignore object))
+                     (not (eq (presentation-type presentation) 'unknown-symbol)))
+            :documentation "Edit definition")
+    (object)
+    (list object))
 
 (define-command (com-inspect-buffer :name "Inspect Buffer" :command-table base-table) ()
 		(clouseau:inspector (buffer (current-window))))
--- /project/clim-desktop/cvsroot/clim-desktop/clim-desktop.asd	2006/03/30 10:33:55	1.3
+++ /project/clim-desktop/cvsroot/clim-desktop/clim-desktop.asd	2006/05/18 21:32:15	1.4
@@ -26,7 +26,7 @@
 	       (:file "clhs-lookup" :depends-on ("abbrev"))
 	       (:file "misc")
 	       (:file "beirc")
-	       (:file "climacs")
+	       (:file "climacs" :depends-on ("swine-cmds"))
 	       (:file "debugger" :depends-on ("EDITME"))
 	       (:file "listener")
 	       (:file "clim-launcher" :depends-on ("packages"))




More information about the Clim-desktop-cvs mailing list