[mcclim-cvs] CVS mcclim/Drei

thenriksen thenriksen at common-lisp.net
Mon Nov 19 22:16:47 UTC 2007


Update of /project/mcclim/cvsroot/mcclim/Drei
In directory clnet:/tmp/cvs-serv25861/Drei

Modified Files:
	core-commands.lisp core.lisp drei-redisplay.lisp drei.lisp 
	lisp-syntax-commands.lisp search-commands.lisp 
Log Message:
As it turns out, a lot of Drei code still used (current-window), which
is now actually the current window (imagine that), and not the Drei
instance. Fixed.


--- /project/mcclim/cvsroot/mcclim/Drei/core-commands.lisp	2007/11/19 20:28:43	1.5
+++ /project/mcclim/cvsroot/mcclim/Drei/core-commands.lisp	2007/11/19 22:16:47	1.6
@@ -39,7 +39,7 @@
 will replace the object after the point. 
 When overwrite is off (the default), objects are inserted at point. 
 In both cases point is positioned after the new object."
-  (with-slots (overwrite-mode) (current-window)
+  (with-slots (overwrite-mode) *drei-instance*
     (setf overwrite-mode (not overwrite-mode))))
 
 (set-key 'com-overwrite-mode
@@ -48,7 +48,7 @@
 
 (defun set-fill-column (column)
   (if (> column 1)
-      (setf (auto-fill-column (current-window)) column)
+      (setf (auto-fill-column *drei-instance*) column)
       (progn (beep) (display-message "Set Fill Column requires an explicit argument."))))
 
 (define-command (com-set-fill-column :name t :command-table fill-table)
@@ -126,29 +126,26 @@
                          :name t
                          :command-table ,command-table)
            ((count 'integer :prompt ,(concat "Number of " plural)))
-           ,(if (not (null move-point))
-                (concat "Place point and mark around the current " noun ".
+         ,(if (not (null move-point))
+              (concat "Place point and mark around the current " noun ".
 Put point at the beginning of the current " noun ", and mark at the end. 
 With a positive numeric argument, put mark that many " plural " forward. 
 With a negative numeric argument, put point at the end of the current 
 " noun " and mark that many " plural " backward. 
 Successive invocations extend the selection.")
-                (concat "Place mark at the next " noun " end.
+              (concat "Place mark at the next " noun " end.
 With a positive numeric argument, place mark at the end of 
 that many " plural " forward. With a negative numeric argument, 
 place mark at the beginning of that many " plural " backward. 
 
 Successive invocations extend the selection."))
-         (let* ((pane (current-window))
-                (point (point pane))
-                (mark (mark pane)))
-           (unless (eq (command-name *previous-command*) 'com-mark-word)
-             (setf (offset mark) (offset point))
-             ,(when (not (null move-point))
-                    `(if (plusp count)
-                         (,backward point (syntax (buffer pane)))
-                         (,forward point (syntax (buffer pane))))))
-           (,forward mark (syntax (buffer pane)) count))))))
+         (unless (eq (command-name *previous-command*) 'com-mark-word)
+           (setf (offset (mark)) (offset (point)))
+           ,(when (not (null move-point))
+                  `(if (plusp count)
+                       (,backward (point) (current-syntax))
+                       (,forward (point) (current-syntax)))))
+         (,forward (mark) (current-syntax) (current-buffer) count)))))
 
 (define-mark-unit-command word marking-table)
 (define-mark-unit-command expression marking-table)
@@ -224,7 +221,7 @@
                    (tab-space-count (view *drei-instance*))))
 
 (define-command (com-indent-line :name t :command-table indent-table) ()
-  (indent-current-line (current-window) (point)))
+  (indent-current-line *drei-instance* (point)))
 
 (set-key 'com-indent-line
 	 'indent-table
@@ -239,7 +236,7 @@
   (insert-object (point) #\Newline)
   (update-syntax (current-buffer)
                  (syntax (current-buffer)))
-  (indent-current-line (current-window) (point)))
+  (indent-current-line *drei-instance* (point)))
 
 (set-key 'com-newline-and-indent
 	 'indent-table
@@ -248,7 +245,7 @@
 (define-command (com-indent-region :name t :command-table indent-table) ()
   "Indent every line of the current region as specified by the
 syntax for the buffer."
-  (indent-region (current-window) (point) (mark)))
+  (indent-region *drei-instance* (point) (mark)))
 
 (define-command (com-delete-indentation :name t :command-table indent-table) ()
   "Join current line to previous non-blank line.
@@ -264,8 +261,8 @@
 	 '((#\^ :shift :meta)))
 
 (define-command (com-auto-fill-mode :name t :command-table fill-table) ()
-  (setf (auto-fill-mode (current-window))
-        (not (auto-fill-mode (current-window)))))
+  (setf (auto-fill-mode *drei-instance*)
+        (not (auto-fill-mode *drei-instance*))))
 
 (define-command (com-fill-paragraph :name t :command-table fill-table) ()
   (let* ((syntax (syntax (current-buffer)))
@@ -301,7 +298,7 @@
 	 '((:home :control)))
 
 (define-command (com-page-down :name t :command-table movement-table) ()
-  (page-down (current-window)))
+  (page-down *drei-instance*))
 
 (set-key 'com-page-down
 	 'movement-table
@@ -312,7 +309,7 @@
 	 '((:next)))
 
 (define-command (com-page-up :name t :command-table movement-table) ()
-  (page-up (current-window)))
+  (page-up *drei-instance*))
 
 (set-key 'com-page-up
 	 'movement-table
@@ -542,7 +539,7 @@
   (let* ((syntax (syntax (current-buffer))))
     (with-accessors ((original-prefix original-prefix)
                      (prefix-start-offset prefix-start-offset)
-                     (dabbrev-expansion-mark dabbrev-expansion-mark)) (current-window)
+                     (dabbrev-expansion-mark dabbrev-expansion-mark)) *drei-instance*
        (flet ((move () (cond ((beginning-of-buffer-p dabbrev-expansion-mark)
 			      (setf (offset dabbrev-expansion-mark)
 				    (offset (point)))
@@ -634,8 +631,8 @@
 
 (define-command (com-visible-region :name t :command-table marking-table) ()
   "Toggle the visibility of the region in the current pane."
-  (setf (region-visible-p (current-window))
-        (not (region-visible-p (current-window)))))
+  (setf (region-visible-p *drei-instance*)
+        (not (region-visible-p *drei-instance*))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; 
--- /project/mcclim/cvsroot/mcclim/Drei/core.lisp	2007/11/19 20:28:43	1.6
+++ /project/mcclim/cvsroot/mcclim/Drei/core.lisp	2007/11/19 22:16:47	1.7
@@ -18,22 +18,18 @@
 ;;; Misc stuff
 
 (defun possibly-fill-line ()
-  (let* ((pane (current-window))
-         (buffer (buffer pane)))
-    (when (auto-fill-mode pane)
-      (let* ((fill-column (auto-fill-column pane))
-             (point (point pane))
-             (offset (offset point))
-             (tab-width (tab-space-count (stream-default-view pane)))
-             (syntax (syntax buffer)))
-        (when (>= (buffer-display-column buffer offset tab-width)
-                  (1- fill-column))
-          (fill-line point
-                     (lambda (mark)
-                       (syntax-line-indentation mark tab-width syntax))
-                     fill-column
-                     tab-width
-                     (syntax buffer)))))))
+  (when (auto-fill-mode *drei-instance*)
+    (let* ((fill-column (auto-fill-column *drei-instance*))
+           (offset (offset (point)))
+           (tab-width (tab-space-count (view *drei-instance*))))
+      (when (>= (buffer-display-column (current-buffer) offset tab-width)
+                (1- fill-column))
+        (fill-line (point)
+                   (lambda (mark)
+                     (syntax-line-indentation mark tab-width (current-syntax)))
+                   fill-column
+                   tab-width
+                   (current-syntax))))))
 
 (defun back-to-indentation (mark syntax)
   (beginning-of-line mark)
@@ -42,17 +38,16 @@
      do (forward-object mark)))
 
 (defun insert-character (char)
-  (let* ((window (current-window))
-	 (point (point window)))
-    (unless (constituentp char)
-      (possibly-expand-abbrev point))
-    (when (whitespacep (syntax (buffer window)) char)
-      (possibly-fill-line))
-    (if (and (slot-value window 'overwrite-mode) (not (end-of-line-p point)))
-	(progn
-	  (delete-range point)
-	  (insert-object point char))
-	(insert-object point char))))
+  (unless (constituentp char)
+    (possibly-expand-abbrev (point)))
+  (when (whitespacep (syntax (current-buffer)) char)
+    (possibly-fill-line))
+  (if (and (slot-value *drei-instance* 'overwrite-mode)
+           (not (end-of-line-p (point))))
+      (progn
+        (delete-range (point))
+        (insert-object (point) char))
+      (insert-object (point) char)))
 
 (defun delete-horizontal-space (mark syntax &optional (backward-only-p nil))
   (let ((mark2 (clone-mark mark)))
@@ -65,9 +60,9 @@
 	    do (forward-object mark2)))
     (delete-region mark mark2)))
 
-(defun indent-current-line (pane point)
-  (let* ((buffer (buffer pane))
-         (view (stream-default-view pane))
+(defun indent-current-line (drei point)
+  (let* ((buffer (buffer drei))
+         (view (view drei))
          (tab-space-count (tab-space-count view))
          (indentation (syntax-line-indentation point
                                                tab-space-count
@@ -164,11 +159,13 @@
 ;;; 
 ;;; Indentation
 
-(defun indent-region (pane mark1 mark2)
-  "Indent all lines in the region delimited by `mark1' and `mark2'
-   according to the rules of the active syntax in `pane'."
-  (let* ((buffer (buffer pane))
-         (view (clim:stream-default-view pane))
+(defun indent-region (drei mark1 mark2)
+  "Indent all lines in the region delimited by `mark1' and
+`mark2' according to the rules of the active syntax in
+`drei'. `Mark1' and `mark2' will not be modified by this
+function."
+  (let* ((buffer (buffer drei))
+         (view (view drei))
          (tab-space-count (tab-space-count view))
          (tab-width (and (indent-tabs-mode buffer)
                          tab-space-count))
--- /project/mcclim/cvsroot/mcclim/Drei/drei-redisplay.lisp	2007/08/24 13:04:40	1.8
+++ /project/mcclim/cvsroot/mcclim/Drei/drei-redisplay.lisp	2007/11/19 22:16:47	1.9
@@ -396,15 +396,15 @@
         (reposition-pane pane))))
   (adjust-pane-bot pane))
 
-(defun page-down (pane)
-  (with-slots (top bot) pane
+(defun page-down (drei)
+  (with-slots (top bot) drei
     (when (mark> (size (buffer bot)) bot)
       (setf (offset top) (offset bot))
       (beginning-of-line top)
-      (setf (offset (point pane)) (offset top)))))
+      (setf (offset (point drei)) (offset top)))))
 
-(defun page-up (pane)
-  (with-slots (top bot) pane
+(defun page-up (drei)
+  (with-slots (top bot) drei
     (when (> (offset top) 0)
       (let ((nb-lines-in-region (number-of-lines-in-region top bot)))
         (setf (offset bot) (offset top))
@@ -413,8 +413,8 @@
            while (> (offset top) 0)
            do (decf (offset top))
            (beginning-of-line top))
-        (setf (offset (point pane)) (offset bot))
-        (beginning-of-line (point pane))))))
+        (setf (offset (point drei)) (offset bot))
+        (beginning-of-line (point drei))))))
 
 (defgeneric fix-pane-viewport (pane))
 
--- /project/mcclim/cvsroot/mcclim/Drei/drei.lisp	2007/11/19 20:28:43	1.17
+++ /project/mcclim/cvsroot/mcclim/Drei/drei.lisp	2007/11/19 22:16:47	1.18
@@ -538,14 +538,14 @@
   "Prompt for a command name and arguments, then run it."
   (let ((item (handler-case
                   (accept
-                   `(command :command-table ,(command-table (current-window)))
+                   `(command :command-table ,(command-table *drei-instance*))
                    ;; this gets erased immediately anyway
                    :prompt "" :prompt-mode :raw)
                 ((or command-not-accessible command-not-present) ()
                   (beep)
                   (display-message "No such command")
                   (return-from com-drei-extended-command nil)))))
-    (execute-drei-command (current-window) item)))
+    (execute-drei-command *drei-instance* item)))
 
 (set-key 'com-drei-extended-command
          'exclusive-gadget-table
@@ -562,12 +562,12 @@
   "This method allows users of Drei to extend syntaxes with new,
 app-specific commands, as long as they inherit from a Drei class
 and specialise a method for it."
-  (additional-command-tables (current-window) command-table))
+  (additional-command-tables *drei-instance* command-table))
 
 (defmethod command-table-inherit-from ((table drei-command-table))
   (let ((syntax-table (command-table (current-syntax))))
     (append `(,syntax-table)
-            (additional-command-tables (current-window) table)
+            (additional-command-tables *drei-instance* table)
             (when (use-editor-commands-p syntax-table)
               '(editor-table)))))
 
@@ -760,21 +760,21 @@
   ;; at, for example, the buffer level, after all.
   `(handler-case (progn , at body)
      (user-condition-mixin (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (offset-before-beginning (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (offset-after-end (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (motion-before-beginning (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (motion-after-end (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (no-expression (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (no-such-operation (c)
-       (handle-drei-condition (current-window) c))
+       (handle-drei-condition *drei-instance* c))
      (buffer-read-only (c)
-       (handle-drei-condition (current-window) c))))
+       (handle-drei-condition *drei-instance* c))))
 
 (defmacro with-bound-drei-special-variables ((drei-instance &key
                                                             (kill-ring nil kill-ring-p)
--- /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax-commands.lisp	2007/11/19 20:28:43	1.8
+++ /project/mcclim/cvsroot/mcclim/Drei/lisp-syntax-commands.lisp	2007/11/19 22:16:47	1.9
@@ -55,50 +55,40 @@
     ()
   "Fill paragraph at point. Will have no effect unless there is a
 string at point."
-  (let* ((pane (current-window))
-         (buffer (buffer pane))
-         (implementation (implementation buffer))
-         (syntax (syntax buffer))
-         (token (form-around syntax (offset (point pane))))
-         (fill-column (auto-fill-column pane))
-         (tab-width (tab-space-count (stream-default-view pane))))
+  (let* ((buffer-implementation (implementation (current-buffer)))
+         (token (form-around (current-syntax) (offset (point))))
+         (fill-column (auto-fill-column *drei-instance*))
+         (tab-width (tab-space-count (view *drei-instance*))))
     (when (form-string-p token)
       (with-accessors ((offset1 start-offset) 
                        (offset2 end-offset)) token
         (fill-region (make-instance 'standard-right-sticky-mark
-                                    :buffer implementation
+                                    :buffer buffer-implementation
                                     :offset offset1)
                      (make-instance 'standard-right-sticky-mark
-                                    :buffer implementation
+                                    :buffer buffer-implementation
                                     :offset offset2)
                      #'(lambda (mark)
-                         (syntax-line-indentation mark tab-width syntax))
+                         (syntax-line-indentation (point) tab-width (current-syntax)))
                      fill-column
                      tab-width
-                     syntax
+                     (current-syntax)
                      t)))))
 
 (define-command (com-indent-expression :name t :command-table lisp-table)
     ((count 'integer :prompt "Number of expressions"))
-  (let* ((pane (current-window))
-         (point (point pane))
-         (mark (clone-mark point))
-         (syntax (syntax (buffer pane))))
+  (let ((mark (point)))
     (if (plusp count)
-        (loop repeat count do (forward-expression mark syntax))
-        (loop repeat (- count) do (backward-expression mark syntax)))
-    (indent-region pane (clone-mark point) mark)))
+        (loop repeat count do (forward-expression mark (current-syntax)))
+        (loop repeat (- count) do (backward-expression mark (current-syntax))))
+    (indent-region *drei-instance* (point) mark)))
 
 (define-command (com-lookup-arglist-for-this-symbol :command-table lisp-table)
     ()
   "Show argument list for symbol at point."
-  (let* ((pane (current-window))
-         (buffer (buffer pane))
-         (syntax (syntax buffer))
-         (mark (point pane))
-         (token (this-form syntax mark)))
+  (let* ((token (this-form (current-syntax) (point))))
     (if (and token (form-token-p token))
-        (com-lookup-arglist (form-to-object syntax token))
+        (com-lookup-arglist (form-to-object (current-syntax) token))
         (display-message "Could not find symbol at point."))))
 
 (define-command (com-lookup-arglist :name t :command-table lisp-table)
@@ -143,16 +133,12 @@
 First indents the line.  If the line was already indented,
 completes the symbol.  If there's no symbol at the point, shows
 the arglist for the most recently enclosed operator."
-  (let* ((pane (current-window))
-         (point (point pane))
-         (old-offset (offset point)))
-    (indent-current-line pane point)
+  (let ((old-offset (offset (point))))
+    (indent-current-line *drei-instance* (point))
     (when (= old-offset
-             (offset point))
-      (let* ((buffer (buffer pane))
-             (syntax (syntax buffer)))
-        (or (complete-symbol-at-mark syntax point nil)
-            (show-arglist-for-form-at-mark point syntax))))))
+             (offset (point)))
+      (or (complete-symbol-at-mark (current-syntax) (point) nil)
+          (show-arglist-for-form-at-mark (point) (current-syntax))))))
 
 (define-presentation-to-command-translator lookup-symbol-arglist
     (symbol com-lookup-arglist lisp-table
--- /project/mcclim/cvsroot/mcclim/Drei/search-commands.lisp	2007/11/19 20:28:43	1.3
+++ /project/mcclim/cvsroot/mcclim/Drei/search-commands.lisp	2007/11/19 22:16:47	1.4
@@ -61,7 +61,7 @@
     ((string 'string :prompt "String Search"))
   "Prompt for a string and search forward for it.
 If found, leaves point after string. If not, leaves point where it is."
-  (simple-search-forward (current-window)
+  (simple-search-forward *drei-instance*
                         #'(lambda (mark)
                             (search-forward mark string
                              :test (case-relevant-test string)))))
@@ -70,7 +70,7 @@
     ((string 'string :prompt "Reverse String Search"))
   "Prompt for a string and search backward for it.
 If found, leaves point before string. If not, leaves point where it is."
-  (simple-search-backward (current-window)
+  (simple-search-backward *drei-instance*
                         #'(lambda (mark)
                             (search-backward mark string
                              :test (case-relevant-test string)))))
@@ -83,7 +83,7 @@
     ((word 'string :prompt "Search word"))
   "Prompt for a whitespace delimited word and search forward for it.
 If found, leaves point after the word. If not, leaves point where it is."
-  (simple-search-forward (current-window)
+  (simple-search-forward *drei-instance*
                         #'(lambda (mark)
                             (search-word-forward mark word))))
 
@@ -91,7 +91,7 @@
     ((word 'string :prompt "Search word"))
   "Prompt for a whitespace delimited word and search backward for it.
 If found, leaves point before the word. If not, leaves point where it is."
-  (simple-search-backward (current-window)
+  (simple-search-backward *drei-instance*
                         #'(lambda (mark)
                             (search-backward mark word))))
 
@@ -173,7 +173,7 @@
 
 (define-command (com-isearch-forward :name t :command-table search-table) ()
   (display-message "Isearch: ")
-  (isearch-command-loop (current-window) t))
+  (isearch-command-loop *drei-instance* t))
 
 (set-key 'com-isearch-forward
 	 'search-table
@@ -181,14 +181,14 @@
 
 (define-command (com-isearch-backward :name t :command-table search-table) ()
   (display-message "Isearch backward: ")
-  (isearch-command-loop (current-window) nil))
+  (isearch-command-loop *drei-instance* nil))
 
 (set-key 'com-isearch-backward
 	 'search-table
 	 '((#\r :control)))
 
 (defun isearch-append-char (char)
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
          (string (concatenate 'string
                               (search-string (first states))
                               (string char)))
@@ -196,7 +196,7 @@
          (forwardp (search-forward-p (first states))))
     (unless (or forwardp (end-of-buffer-p mark))
       (incf (offset mark)))
-    (isearch-from-mark (current-window) mark string forwardp)))
+    (isearch-from-mark *drei-instance* mark string forwardp)))
 
 (define-command (com-isearch-append-char :name t :command-table isearch-drei-table) ()
   (isearch-append-char *current-gesture*))
@@ -205,7 +205,7 @@
   (isearch-append-char #\Newline))
 
 (defun isearch-append-text (movement-function)
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
 	 (start (clone-mark (point)))
 	 (mark (clone-mark (search-mark (first states))))
 	 (forwardp (search-forward-p (first states))))
@@ -219,7 +219,7 @@
 						  point-offset))))
       (unless (or forwardp (end-of-buffer-p mark))
 	(incf (offset mark) (- point-offset start-offset)))
-      (isearch-from-mark (current-window) mark string forwardp))))
+      (isearch-from-mark *drei-instance* mark string forwardp))))
 
 (define-command (com-isearch-append-word :name t :command-table isearch-drei-table) ()
   (isearch-append-text #'(lambda (mark) (forward-word mark (current-syntax)))))
@@ -228,7 +228,7 @@
   (isearch-append-text #'end-of-line))
 
 (define-command (com-isearch-append-kill :name t :command-table isearch-drei-table) ()
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
 	 (yank (handler-case (kill-ring-yank *kill-ring*)
                  (empty-kill-ring ()
                    "")))
@@ -239,50 +239,49 @@
 	 (forwardp (search-forward-p (first states))))
     (unless (or forwardp (end-of-buffer-p mark))
       (incf (offset mark) (length yank)))
-    (isearch-from-mark (current-window) mark string forwardp)))
+    (isearch-from-mark *drei-instance* mark string forwardp)))
 
 (define-command (com-isearch-delete-char :name t :command-table isearch-drei-table) ()
-  (let* ((pane (current-window)))
-    (cond ((null (second (isearch-states pane)))
-	   (display-message "Isearch: ")
-           (beep))
-          (t
-           (pop (isearch-states pane))
-           (loop until (endp (rest (isearch-states pane)))
-                 until (search-success-p (first (isearch-states pane)))
-                 do (pop (isearch-states pane)))
-           (let ((state (first (isearch-states pane))))
-             (setf (offset (point pane))
-                   (if (search-forward-p state)
-                       (+ (offset (search-mark state))
-                          (length (search-string state)))
-                       (- (offset (search-mark state))
-                          (length (search-string state)))))
-	     (display-message "Isearch~:[ backward~;~]: ~A"
-			      (search-forward-p state)
-			      (display-string (search-string state))))))))
+  (cond ((null (second (isearch-states *drei-instance*)))
+         (display-message "Isearch: ")
+         (beep))
+        (t
+         (pop (isearch-states *drei-instance*))
+         (loop until (endp (rest (isearch-states *drei-instance*)))
+            until (search-success-p (first (isearch-states *drei-instance*)))
+            do (pop (isearch-states *drei-instance*)))
+         (let ((state (first (isearch-states *drei-instance*))))
+           (setf (offset (point *drei-instance*))
+                 (if (search-forward-p state)
+                     (+ (offset (search-mark state))
+                        (length (search-string state)))
+                     (- (offset (search-mark state))
+                        (length (search-string state)))))
+           (display-message "Isearch~:[ backward~;~]: ~A"
+                            (search-forward-p state)
+                            (display-string (search-string state)))))))
 
 (define-command (com-isearch-search-forward :name t :command-table isearch-drei-table) ()
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
          (string (if (null (second states))
-                     (isearch-previous-string (current-window))
+                     (isearch-previous-string *drei-instance*)
                      (search-string (first states))))
          (mark (clone-mark (point))))
-    (isearch-from-mark (current-window) mark string t)))
+    (isearch-from-mark *drei-instance* mark string t)))
 
 (define-command (com-isearch-search-backward :name t :command-table isearch-drei-table) ()
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
          (string (if (null (second states))
-                     (isearch-previous-string (current-window))
+                     (isearch-previous-string *drei-instance*)
                      (search-string (first states))))
          (mark (clone-mark (point))))
-    (isearch-from-mark (current-window) mark string nil)))
+    (isearch-from-mark *drei-instance* mark string nil)))
 
 (define-command (com-isearch-exit :name t :command-table isearch-drei-table) ()
-  (let* ((states (isearch-states (current-window)))
+  (let* ((states (isearch-states *drei-instance*))
 	 (string (search-string (first states)))
 	 (search-forward-p (search-forward-p (first states))))
-    (setf (isearch-mode (current-window)) nil)
+    (setf (isearch-mode *drei-instance*) nil)
     (when (string= string "")
       (execute-frame-command *application-frame*
 			     (funcall
@@ -351,7 +350,7 @@
         t))))
 
 (define-command (com-query-replace :name t :command-table search-table) ()
-  (let* ((drei (current-window))
+  (let* ((drei *drei-instance*)
          (old-state (query-replace-state drei))
          (old-string1 (when old-state (string1 old-state)))
          (old-string2 (when old-state (string2 old-state)))
@@ -402,8 +401,7 @@
 	 '((#\% :shift :meta)))
 
 (define-command (com-query-replace-replace :name t :command-table query-replace-drei-table) ()
-  (let* ((pane (current-window))
-         (state (query-replace-state pane)))
+  (let ((state (query-replace-state *drei-instance*)))
     (with-accessors ((string1 string1)
                      (string2 string2)
                      (occurrences occurrences)
@@ -419,14 +417,13 @@
         (if (query-replace-find-next-match state)
             (display-message "Replace ~A with ~A:"
                              string1 string2)
-            (setf (query-replace-mode pane) nil))))))
+            (setf (query-replace-mode *drei-instance*) nil))))))
 
 (define-command (com-query-replace-replace-and-quit
 		 :name t
 		 :command-table query-replace-drei-table)
     ()
-  (let* ((pane (current-window))
-         (state (query-replace-state pane)))
+  (let ((state (query-replace-state *drei-instance*)))
     (with-accessors ((string1 string1)
                      (string2 string2)
                      (occurrences occurrences)
@@ -439,14 +436,13 @@
                             string2
                             (no-upper-p string1))
         (incf occurrences)
-        (setf (query-replace-mode pane) nil)))))
+        (setf (query-replace-mode *drei-instance*) nil)))))
 
 (define-command (com-query-replace-replace-all
 		 :name t
 		 :command-table query-replace-drei-table)
     ()
-  (let* ((pane (current-window))
-         (state (query-replace-state pane)))
+  (let ((state (query-replace-state *drei-instance*)))
     (with-accessors ((string1 string1)
                      (string2 string2)
                      (occurrences occurrences)
@@ -460,20 +456,19 @@
                                    (no-upper-p string1))
                (incf occurrences)
                while (query-replace-find-next-match state)
-               finally (setf (query-replace-mode pane) nil))))))
+               finally (setf (query-replace-mode *drei-instance*) nil))))))
 
 (define-command (com-query-replace-skip :name t :command-table query-replace-drei-table) ()
-  (let* ((pane (current-window))
-         (state (query-replace-state pane)))
+  (let ((state (query-replace-state *drei-instance*)))
     (with-accessors ((string1 string1)
                      (string2 string2)) state
       (if (query-replace-find-next-match state)
           (display-message "Replace ~A with ~A:"
                            string1 string2)
-          (setf (query-replace-mode pane) nil)))))
+          (setf (query-replace-mode *drei-instance*) nil)))))
 
 (define-command (com-query-replace-exit :name t :command-table query-replace-drei-table) ()
-  (setf (query-replace-mode (current-window)) nil))
+  (setf (query-replace-mode *drei-instance*) nil))
 
 (defun query-replace-set-key (gesture command)
   (add-command-to-command-table command 'query-replace-drei-table
@@ -509,7 +504,7 @@
 			:delimiter-gestures nil
 			:activation-gestures
 			'(:newline :return))))
-    (simple-search-forward (current-window)
+    (simple-search-forward *drei-instance*
                         #'(lambda (mark)
                             (re-search-forward mark (normalise-minibuffer-regex string))))))
 
@@ -518,7 +513,7 @@
 			:delimiter-gestures nil
 			:activation-gestures
 			'(:newline :return))))
-    (simple-search-backward (current-window)
+    (simple-search-backward *drei-instance*
                         #'(lambda (mark)
                             (re-search-backward mark (normalise-minibuffer-regex string))))))
 




More information about the Mcclim-cvs mailing list