[clim-desktop-cvs] CVS clim-desktop

thenriksen thenriksen at common-lisp.net
Thu May 18 15:07:30 UTC 2006


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

Modified Files:
	swine-cmds.lisp 
Log Message:
Added Edit This Definition command and removed that functionality from
Edit Definition. Fixed name of Inspect Symbol command.


--- /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/15 14:18:57	1.10
+++ /project/clim-desktop/cvsroot/clim-desktop/swine-cmds.lisp	2006/05/18 15:07:26	1.11
@@ -129,13 +129,22 @@
     (presentation)
     (list (presentation-object presentation)))
 
-;; This command is a bit convoluted because we want to invoke it as a
-;; normal command, by a keystroke (where it automatically picks up a
-;; symbol name from the buffer) and by presentation translators. If
-;; NIL is passed as the symbol, the command will try looking up a
-;; symbol at the current point in the buffer.
-(define-command (com-edit-definition :name t :command-table lisp-table)
-    ((symbol 'symbol :prompt "Edit symbol"))
+(define-command (com-edit-this-definition :command-table lisp-table)
+    ()
+  "Edit definition of the symbol at point.
+If there is no symbol at point, this is a no-op."
+  (let* ((buffer (buffer (current-window)))
+         (point (point (current-window)))
+         (syntax (syntax buffer))
+         (token (or (form-around syntax (offset point))
+                    (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
@@ -143,20 +152,14 @@
 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 (or (when symbol
-                     (if (symbolp symbol)
-                         (fully-qualified-symbol-name symbol)
-                         symbol))
-                   (symbol-name-at-mark (point (current-window))
-                                        (syntax (buffer (current-window))))
-                   (fully-qualified-symbol-name (accept 'symbol :prompt "Edit symbol")))))
-     (edit-definition name (syntax (buffer (current-window)))))))
+            (let ((*package* (find-package :keyword)))
+              (format nil "~S" symbol))))
+    (let ((name (fully-qualified-symbol-name symbol)))
+      (edit-definition name (syntax (buffer (current-window)))))))
 
-(esa:set-key  '(com-edit-definition nil)
-	      'lisp-table
-	      '((#\. :meta)))
+(esa:set-key `(com-edit-this-definition)
+             'lisp-table
+             '((#\. :meta)))
 
 (define-command (com-return-from-definition :name t :command-table lisp-table)
     ()
@@ -302,7 +305,7 @@
     (list object))
 
 (define-command (com-inspect-symbol :name t :command-table lisp-table)
-    ((symbol 'symbol :prompt "Edit symbol"))
+    ((symbol 'symbol :prompt "Inspect symbol"))
   (clouseau:inspector symbol :new-process t))
 
 (define-presentation-to-command-translator inspect-symbol




More information about the Clim-desktop-cvs mailing list