Update of /project/clim-desktop/cvsroot/clim-desktop In directory clnet:/tmp/cvs-serv27804
Modified Files: swine.lisp Log Message: Fixed issue with symbol-completion and invalid package designators.
--- /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/05/30 23:09:44 1.15 +++ /project/clim-desktop/cvsroot/clim-desktop/swine.lisp 2006/05/30 23:22:39 1.16 @@ -61,6 +61,11 @@ (or (form-around syntax (offset mark)) (form-before syntax (offset mark))))
+(defun usable-package (package-designator) + "Return a usable package based on `package-designator'." + (or (find-package package-designator) + *package*)) + (defun macroexpand-token (syntax token &optional (all nil)) (let* ((string (token-string syntax token)) (expression (read-from-string string)) @@ -999,25 +1004,23 @@ (climacs-gui::delete-window *swine-completion-pane*) (setf *swine-completion-pane* nil)))
- (defun show-completions-by-fn (fn symbol) - (with-slots (package) (syntax (buffer (climacs-gui::current-window))) - (climacs-gui::display-message (format nil "~a completions" symbol)) - (let* ((swank-result (funcall fn symbol (package-name (or package *package*)))) +(defun show-completions-by-fn (fn symbol) + (with-slots (package) (syntax (buffer (climacs-gui::current-window))) + (climacs-gui::display-message (format nil "~a completions" symbol)) + (let* ((swank-result (funcall fn symbol (package-name (usable-package package)))) (set (first swank-result)) (longest (second swank-result)))
- (cond ((<= (length set) 1) - (clear-completions)) - (t (let ((stream (or *swine-completion-pane* - (climacs-gui::typeout-window "Simple Completions")))) - (setf *swine-completion-pane* stream) - (window-clear stream) - (format stream "~{~A~%~}" set)))) + (cond ((<= (length set) 1) + (clear-completions)) + (t (let ((stream (or *swine-completion-pane* + (climacs-gui::typeout-window "Simple Completions")))) + (setf *swine-completion-pane* stream) + (window-clear stream) + (format stream "~{~A~%~}" set))))
- (climacs-gui::display-message (format nil "Longest is ~a|" longest)) - longest))) - - + (climacs-gui::display-message (format nil "Longest is ~a|" longest)) + longest)))
(defun show-completions (symbol) (show-completions-by-fn #'swank::completions symbol)) @@ -1025,21 +1028,21 @@ (defun show-simple-completions (symbol) (show-completions-by-fn #'swank::simple-completions symbol))
- (defun show-fuzzy-completions (symbol) - (with-slots (package) (syntax (buffer (climacs-gui::current-window))) - (climacs-gui::display-message (format nil "~a completions" symbol)) - (let* ((set (swank::fuzzy-completions symbol (package-name (or package *package*)) 10)) - (best (caar set))) +(defun show-fuzzy-completions (symbol) + (with-slots (package) (syntax (buffer (climacs-gui::current-window))) + (climacs-gui::display-message (format nil "~a completions" symbol)) + (let* ((set (swank::fuzzy-completions symbol (package-name (usable-package package)) 10)) + (best (caar set)))
- (cond ((<= (length set) 1) - (clear-completions)) - (t (let ((stream (or *swine-completion-pane* - (climacs-gui::typeout-window "Simple Completions")))) - (setf *swine-completion-pane* stream) - (window-clear stream) - (loop for completed-string in set - do (format stream "~{~A ~}~%" completed-string))))) + (cond ((<= (length set) 1) + (clear-completions)) + (t (let ((stream (or *swine-completion-pane* + (climacs-gui::typeout-window "Simple Completions")))) + (setf *swine-completion-pane* stream) + (window-clear stream) + (loop for completed-string in set + do (format stream "~{~A ~}~%" completed-string)))))
- (climacs-gui::display-message (format nil "Best is ~a|" best)) - best))) + (climacs-gui::display-message (format nil "Best is ~a|" best)) + best)))