From thenriksen at common-lisp.net Wed Jan 23 20:01:46 2008 From: thenriksen at common-lisp.net (thenriksen) Date: Wed, 23 Jan 2008 15:01:46 -0500 (EST) Subject: [clim-desktop-cvs] CVS clim-desktop Message-ID: <20080123200146.E1A60763B8@common-lisp.net> Update of /project/clim-desktop/cvsroot/clim-desktop In directory clnet:/tmp/cvs-serv28332 Modified Files: climacs.lisp Log Message: Removed stuff that has been partially/completely moved to Climacs. --- /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp 2007/12/27 19:11:09 1.18 +++ /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp 2008/01/23 20:01:46 1.19 @@ -24,87 +24,9 @@ 'base-table '((#\c :control) (#\d :control) (#\s :control))) -;; The following code relates to calling Climacs from other applications. +;; The following only works if CL:ED invokes Climacs. -(defmacro with-climacs-frame ((frame-symbol) &body body) - (let ((frame-manager-sym (gensym))) - `(let ((,frame-manager-sym (find-frame-manager))) - (when ,frame-manager-sym - (let ((,frame-symbol (find-if (lambda (x) (typep x 'climacs)) - (frame-manager-frames ,frame-manager-sym)))) - , at body))))) - -(defun ensure-climacs () - "Ensure Climacs is running, start it in a new process if it -isn't." - (with-climacs-frame (frame) - (unless frame - (climacs :new-process t) - ;; FIXME: The new frame must be ready, this is a hack. - (sleep 1)))) - -(defgeneric edit-in-climacs (thing &key &allow-other-keys) - (:documentation "Edit thing in Climacs, start Climacs if is not - running.") - (:method :before (thing &key &allow-other-keys) - (declare (ignore thing)) - (ensure-climacs))) - -(defmethod edit-in-climacs ((thing pathname) &key &allow-other-keys) - (when (wild-pathname-p thing) - (error 'file-error :pathname thing - "Cannot edit wild pathname.")) - (with-climacs-frame (frame) - (when frame - (execute-frame-command - frame `(esa-io::com-find-file ,thing))))) - -(defmethod edit-in-climacs ((thing string) &key &allow-other-keys) - ;; Hope it is a pathname. - (edit-in-climacs (pathname thing))) - -(defmethod edit-in-climacs ((thing symbol) &key type &allow-other-keys) - (with-climacs-frame (frame) - (when frame - (execute-frame-command - frame `(com-edit-definition-of-type ,thing ,type))))) - -;; These commands should only be called from within Climacs: - -(define-command (com-edit-definition :command-table global-climacs-table) - ((symbol 'symbol - :prompt "Edit symbol")) - "Edit the definition of a symbol as a given type. - -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." - (drei-lisp-syntax:edit-definition symbol)) - -(define-command (com-edit-definition-of-type :command-table global-climacs-table) - ((symbol 'symbol - :prompt "Edit symbol") - (type 'symbol)) - "Edit the definition of a symbol as a given type." - (drei-lisp-syntax:edit-definition symbol type)) - -;; Redefine (ed) -(handler-bind ((#+sbcl sb-ext:package-lock-violation - #+cmucl lisp::package-locked-error - #-sbcl simple-error - #'(lambda (c) - (declare (ignore c)) - (invoke-restart 'continue)))) - (defun ed (&optional foo) - (if (not (null foo)) - (edit-in-climacs foo) - (progn - (ensure-climacs) - (with-climacs-frame (frame) - (raise-frame frame)))))) - -;; The following commands can be safely called from outside Climacs: +;; The following commands can be safely called from outside the editor: (define-command (com-edit-symbol-definition :name t :command-table global-command-table) ((symbol 'symbol @@ -115,19 +37,7 @@ as well as a class, or as numerous methods), a mouse-click-sensitive list of available definitions will be displayed." - (edit-in-climacs symbol)) - -(define-command (com-edit-class-definition :name t :command-table global-command-table) - ((symbol 'symbol - :prompt "Edit symbol")) - "Edit the class definition of a symbol." - (edit-in-climacs symbol :type 'class)) - -(define-command (com-edit-function-definition :name t :command-table global-command-table) - ((symbol 'symbol - :prompt "Edit symbol")) - "Edit the function definition of a symbol." - (edit-in-climacs symbol :type 'function)) + (ed symbol)) (define-command (com-edit-in-climacs :command-table global-command-table) ((thing t)) @@ -144,7 +54,7 @@ (list object)) (define-presentation-to-command-translator global-edit-class-name-definition-translator - (class-name com-edit-class-definition global-command-table + (class-name com-edit-symbol-definition global-command-table :gesture :edit :documentation "Edit Class Definition") (object) From thenriksen at common-lisp.net Sun Jan 27 22:58:11 2008 From: thenriksen at common-lisp.net (thenriksen) Date: Sun, 27 Jan 2008 17:58:11 -0500 (EST) Subject: [clim-desktop-cvs] CVS clim-desktop Message-ID: <20080127225811.0FB4274016@common-lisp.net> Update of /project/clim-desktop/cvsroot/clim-desktop In directory clnet:/tmp/cvs-serv3547 Modified Files: climacs.lisp Log Message: Replaced call to ED-IN-CLIMACS by ED. --- /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp 2008/01/23 20:01:46 1.19 +++ /project/clim-desktop/cvsroot/clim-desktop/climacs.lisp 2008/01/27 22:58:10 1.20 @@ -41,7 +41,7 @@ (define-command (com-edit-in-climacs :command-table global-command-table) ((thing t)) - (edit-in-climacs thing)) + (ed thing)) (define-presentation-to-command-translator global-edit-symbol-definition-translator (symbol com-edit-symbol-definition global-command-table