Index: /branches/event-ide/ccl/cocoa-ide/cocoa-editor.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/cocoa-editor.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/cocoa-editor.lisp	(revision 7898)
@@ -321,21 +321,14 @@
 ;;; offset on the appropriate line.
 (defun move-hemlock-mark-to-absolute-position (mark cache abspos)
+  ;; TODO: figure out if updating the cache matters, and if not, use hi:move-to-absolute-position.
   (let* ((hi::*current-buffer* (buffer-cache-buffer cache)))
     (multiple-value-bind (line idx) (update-line-cache-for-index cache abspos)
       #+debug
       (#_NSLog #@"Moving point from current pos %d to absolute position %d"
-               :int (mark-absolute-position mark)
+               :int (hi:mark-absolute-position mark)
                :int abspos)
       (hemlock::move-to-position mark idx line)
       #+debug
-      (#_NSLog #@"Moved mark to %d" :int (mark-absolute-position mark)))))
-
-;;; Return the absolute position of the mark in the containing buffer.
-;;; This doesn't use the caching mechanism, so it's always linear in the
-;;; number of preceding lines.
-(defun mark-absolute-position (mark)
-  (let* ((hi::*current-buffer* (hi::line-%buffer (hi::mark-line mark)))
-         (pos (hi::mark-charpos mark)))
-    (+ (hi::get-line-origin (hi::mark-line mark)) pos)))
+      (#_NSLog #@"Moved mark to %d" :int (hi:mark-absolute-position mark)))))
 
 ;;; Return the length of the abstract string, i.e., the number of
@@ -701,4 +694,20 @@
       (#/replaceCharactersInRange:withString: self r string))))
 
+;; In theory (though not yet in practice) we allow for a buffer to be shown in multiple
+;; windows, and any change to a buffer through one window has to be reflected in all of
+;; them.  Once hemlock really supports multiple views of a buffer, it will have some
+;; mechanims to ensure that.
+;; In Cocoa, we get some messages for the buffer (i.e. the document or the textstorage)
+;; with no reference to a view.  There used to be code here that tried to do special-
+;; case stuff for all views on the buffer, but that's not necessary, because as long
+;; as hemlock doesn't support it, there will only be one view, and as soon as hemlock
+;; does support it, will take care of updating all other views.  So all we need is to
+;; get our hands on one of the views and do whatever it is through it.
+(defun front-view-for-buffer (buffer)
+  (loop
+     with win-arr =  (#/orderedWindows *NSApp*)
+     for i from 0 below (#/count win-arr) as w = (#/objectAtIndex: win-arr i)
+     thereis (and (eq (hemlock-buffer w) buffer) (hemlock-view w))))
+
 (objc:defmethod (#/replaceCharactersInRange:withString: :void)
     ((self hemlock-text-storage) (r :<NSR>ange) string)
@@ -709,10 +718,5 @@
 	 (length (pref r :<NSR>ange.length))
 	 (lisp-string (if (> (#/length string) 0) (lisp-string-from-nsstring string)))
-	 ;; In theory (though not yet in practice) we allow for a buffer to be shown in multiple
-	 ;; windows, and this change has to affect all the windows.  That's true for all changes
-	 ;; to a buffer, so once hemlock supports multiple views of a buffer, it will have some
-	 ;; way to update all the views.  So just pick any one window here and let hemlock take
-	 ;; care of the rest.
-	 (view (loop for w in (windows) thereis (and (eq (hemlock-buffer w) buffer) (hemlock-view w)))))
+	 (view (front-view-for-buffer buffer)))
     (when view
       (hi::handle-hemlock-event view #'(lambda ()
@@ -1011,5 +1015,5 @@
                      #+debug (#_NSLog #@"enable blink, forward")
                      (setf (text-view-blink-location self)
-                           (1- (mark-absolute-position temp))
+                           (1- (hi:mark-absolute-position temp))
                            (text-view-blink-enabled self) #$YES)))))
               ((eql (hi::previous-character point) #\))
@@ -1020,5 +1024,5 @@
                      #+debug (#_NSLog #@"enable blink, backward")
                      (setf (text-view-blink-location self)
-                           (mark-absolute-position temp)
+                           (hi:mark-absolute-position temp)
                            (text-view-blink-enabled self) #$YES))))))))))
 
@@ -1243,10 +1247,10 @@
                             (hi::with-mark ((m2 m1))
                               (when (hemlock::list-offset m2 1)
-                                (ns:init-ns-range r index (- (mark-absolute-position m2) index))
+                                (ns:init-ns-range r index (- (hi:mark-absolute-position m2) index))
                                 (return-from HANDLED r))))
                            ((eql (hi::previous-character m1) #\))
                             (hi::with-mark ((m2 m1))
                               (when (hemlock::list-offset m2 -1)
-                                (ns:init-ns-range r (mark-absolute-position m2) (- index (mark-absolute-position m2)))
+                                (ns:init-ns-range r (hi:mark-absolute-position m2) (- index (hi:mark-absolute-position m2)))
                                 (return-from HANDLED r))))))))))))
        (call-next-method proposed g)
@@ -1323,5 +1327,5 @@
              ;; In all cases, activate Hemlock selection.
              (unless still-selecting
-                (let* ((pointpos (mark-absolute-position point))
+                (let* ((pointpos (hi:mark-absolute-position point))
                        (selection-end (+ location len))
                        (mark (hi::copy-mark point :right-inserting)))
@@ -2029,6 +2033,6 @@
     (let* ((document (hi::buffer-document buffer))
 	   (textstorage (if document (slot-value document 'textstorage)))
-           (pos (mark-absolute-position (hi::region-start region)))
-           (n (- (mark-absolute-position (hi::region-end region)) pos)))
+           (pos (hi:mark-absolute-position (hi::region-start region)))
+           (n (- (hi:mark-absolute-position (hi::region-end region)) pos)))
       (perform-edit-change-notification textstorage
                                         (@selector #/noteHemlockAttrChangeAtPosition:length:)
@@ -2054,5 +2058,5 @@
 	   (textstorage (if document (slot-value document 'textstorage))))
       (when textstorage
-        (let* ((pos (mark-absolute-position mark)))
+        (let* ((pos (hi:mark-absolute-position mark)))
           (when (eq (hi::mark-%kind mark) :left-inserting)
 	    ;; Make up for the fact that the mark moved forward with the insertion.
@@ -2071,5 +2075,5 @@
             (perform-edit-change-notification textstorage
                                               (@selector #/noteHemlockModificationAtPosition:length:)
-                                              (mark-absolute-position mark)
+                                              (hi:mark-absolute-position mark)
                                               n)))))
   
@@ -2080,5 +2084,5 @@
 	   (textstorage (if document (slot-value document 'textstorage))))
       (when textstorage
-        (let* ((pos (mark-absolute-position mark)))
+        (let* ((pos (hi:mark-absolute-position mark)))
           (perform-edit-change-notification textstorage
                                             (@selector #/noteHemlockDeletionAtPosition:length:)
@@ -2297,5 +2301,5 @@
          (textstorage (slot-value self 'textstorage))
          (point (hi::buffer-point buffer))
-         (pointpos (mark-absolute-position point)))
+         (pointpos (hi:mark-absolute-position point)))
     (#/beginEditing textstorage)
     (#/edited:range:changeInLength:
@@ -2639,5 +2643,5 @@
       ;; If point is not on screen, move it.
       (let* ((point (hi::current-point))
-	     (point-pos (mark-absolute-position point)))
+	     (point-pos (hi:mark-absolute-position point)))
 	(multiple-value-bind (win-pos win-len) (window-visible-range tv)
 	  (unless (and (<= win-pos point-pos) (< point-pos (+ win-pos win-len)))
@@ -2763,5 +2767,5 @@
 	 (hi::*current-buffer* buffer)
          (point (hi::buffer-point buffer))
-         (pointpos (mark-absolute-position point))
+         (pointpos (hi:mark-absolute-position point))
          (location pointpos)
          (len 0))
@@ -2769,5 +2773,5 @@
       (let* ((mark (hi::buffer-%mark buffer)))
         (when mark
-          (let* ((markpos (mark-absolute-position mark)))
+          (let* ((markpos (hi:mark-absolute-position mark)))
             (if (< markpos pointpos)
               (setq location markpos len (- pointpos markpos))
@@ -2852,57 +2856,37 @@
 
 
-(defun find-definition-in-document (name indicator document)
-  (let* ((buffer (hemlock-document-buffer document))
-	 (hi::*current-buffer* buffer))
-    (hemlock::find-definition-in-buffer buffer name indicator)))
-
-
-(defstatic *edit-definition-id-map* (make-id-map))
-
-;;; Need to force things to happen on the main thread.
-(defclass cocoa-edit-definition-request (ns:ns-object)
-    ((name-id :foreign-type :int)
-     (info-id :foreign-type :int))
-  (:metaclass ns:+ns-object))
-
-(objc:defmethod #/initWithName:info:
-    ((self cocoa-edit-definition-request)
-     (name :int) (info :int))
-  (#/init self)
-  (setf (slot-value self 'name-id) name
-        (slot-value self 'info-id) info)
-  self)
-
-(objc:defmethod (#/editDefinition: :void)
-    ((self hemlock-document-controller) request)
-  (let* ((name (id-map-free-object *edit-definition-id-map* (slot-value request 'name-id)))
-         (info (id-map-free-object *edit-definition-id-map* (slot-value request 'info-id))))
-    (destructuring-bind (indicator . pathname) info
-      (let* ((namestring (native-translated-namestring pathname))
-             (url (#/initFileURLWithPath:
-                   (#/alloc ns:ns-url)
-                   (%make-nsstring namestring)))
-             (document (#/openDocumentWithContentsOfURL:display:error:
-                        self
-                        url
-                        nil
-                        +null-ptr+)))
-        (unless (%null-ptr-p document)
-          (if (= (#/count (#/windowControllers document)) 0)
-            (#/makeWindowControllers document))
-          (find-definition-in-document name indicator document)
-          (update-hemlock-selection (slot-value document 'textstorage))
-          (#/showWindows document))))))
+(defun cocoa-edit-definition (name info)
+  (assume-cocoa-thread)
+  (destructuring-bind (indicator . pathname) info
+    (invoke-in-file-buffer pathname #'(lambda ()
+                                        (hemlock::find-definition-in-buffer name indicator)))))
+
+(defun invoke-in-file-buffer (pathname thunk)
+  "Find file PATHNAME, and invoke thunk in it, typically to set initial selection"
+  (assume-cocoa-thread)
+  (let* ((namestring (native-translated-namestring pathname))
+         (url (#/initFileURLWithPath:
+               (#/alloc ns:ns-url)
+               (%make-nsstring namestring)))
+         (document (#/openDocumentWithContentsOfURL:display:error:
+                    (#/sharedDocumentController ns:ns-document-controller)
+                    url
+                    nil
+                    +null-ptr+)))
+    (when (%null-ptr-p document)
+      ;; TODO: get the system error message above!
+      (error "Couldn't open ~s" pathname))
+    #+GZ (log-debug "~&Opened Document ~s, buffer ~s, view ~s"
+                    document (hemlock-buffer document) (front-view-for-buffer (hemlock-buffer document)))
+    (when (= (#/count (#/windowControllers document)) 0)
+      (#/makeWindowControllers document))
+    (let* ((buffer (hemlock-buffer document))
+           (hi::*current-buffer* buffer))
+      (funcall thunk))
+    (update-hemlock-selection (slot-value document 'textstorage))
+    (#/showWindows document)))
 
 (defun hemlock-ext:edit-single-definition (name info)
-  (let* ((request (make-instance 'cocoa-edit-definition-request
-                                 :with-name (assign-id-map-id *edit-definition-id-map* name)
-                                 :info (assign-id-map-id *edit-definition-id-map* info))))
-    (#/performSelectorOnMainThread:withObject:waitUntilDone:
-     (#/sharedDocumentController ns:ns-document-controller)
-     (@selector #/editDefinition:)
-     request
-     t)))
-
+  (execute-in-cocoa-thread #'(lambda () (cocoa-edit-definition name info))))
 
 (defun hemlock-ext:open-sequence-dialog (&key title sequence action (printer #'prin1))
@@ -2950,5 +2934,26 @@
    t))
 
-
+(defmethod hemlock-edit-from-filename (file)
+  (assume-cocoa-thread)
+  (check-type file (or string pathname))
+  (let* ((document-controller (#/sharedDocumentController hemlock-document-controller)))
+    (let* ((url (pathname-to-url file))
+	   ;; The default implementation of this method checks to see if the document is
+	   ;; already open according to documentForURL:, and if it is not open determines
+	   ;; the type of the document, invokes makeDocumentWithContentsOfURL:ofType:error:
+	   ;; to instantiate it, then invokes addDocument: to record its opening, and sends
+	   ;; the document makeWindowControllers and showWindows messages.  If the document
+	   ;; is already open, it is just sent a showWindows message.
+	   ;; If not successful, the method returns nil after setting outError to point to
+	   ;; an NSError object that encapsulates the reason why the document could not be opened.
+	   (doc (#/openDocumentWithContentsOfURL:display:error:
+		 document-controller
+		 url
+		 #$YES
+		 +null-ptr+)))
+      (when (%null-ptr-p doc)
+	;; TODO: should pass in a place to put error and show here.
+	(error "Failed to open ~s" file)))))
+  
 ;;; Enable CL:ED
 (defun cocoa-edit (&optional arg)
@@ -2964,27 +2969,5 @@
            #+no (unless (probe-file arg)
                   (ccl::touch arg))
-           (with-autorelease-pool
-             (let* ((url (pathname-to-url arg))
-                    (signature (#/methodSignatureForSelector:
-                                document-controller
-                                (@selector #/openDocumentWithContentsOfURL:display:error:)))
-                    (invocation (#/invocationWithMethodSignature: ns:ns-invocation
-                                                                  signature)))
-             
-               (#/setTarget: invocation document-controller)
-               (#/setSelector: invocation (@selector #/openDocumentWithContentsOfURL:display:error:))
-               (rlet ((p :id)
-                      (q :<BOOL>)
-                      (perror :id +null-ptr+))
-                 (setf (pref p :id) url
-                       (pref q :<BOOL>) #$YES)
-                 (#/setArgument:atIndex: invocation p 2)
-                 (#/setArgument:atIndex: invocation q 3)
-                 (#/setArgument:atIndex: invocation perror 4)
-                 (#/performSelectorOnMainThread:withObject:waitUntilDone:
-                  invocation
-                  (@selector #/invoke)
-                  +null-ptr+
-                  t)))))
+           (execute-in-cocoa-thread #'(lambda () (hemlock-edit-from-filename arg))))
           ((ccl::valid-function-name-p arg)
            (hemlock::edit-definition arg))
Index: /branches/event-ide/ccl/cocoa-ide/cocoa-grep.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/cocoa-grep.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/cocoa-grep.lisp	(revision 7898)
@@ -7,37 +7,8 @@
 (defvar *grep-program* "grep")
 
-(defclass cocoa-edit-grep-line-request (ns:ns-object)
-  ((file-id :foreign-type :int)
-   (line-num :foreign-type :int))
-  (:metaclass ns:+ns-object))
-
-(objc:defmethod #/initWithFile:line:
-		((self cocoa-edit-grep-line-request) (file :int) (line :int))
-  (#/init self)
-  (setf (slot-value self 'file-id) file
-	(slot-value self 'line-num) line)
-  self)
-
-(objc:defmethod (#/editGrepLine: :void)
-    ((self hemlock-document-controller) request)
-  (let* ((file (id-map-free-object *edit-definition-id-map* (slot-value request 'file-id)))
-	 (line-num (slot-value request 'line-num))
-	 (namestring (native-translated-namestring file))
-	 (url (#/initFileURLWithPath:
-	       (#/alloc ns:ns-url)
-	       (%make-nsstring namestring)))
-	 (document (#/openDocumentWithContentsOfURL:display:error:
-		    self
-		    url
-		    nil
-		    +null-ptr+)))
-    (unless (%null-ptr-p document)
-      (when (= (#/count (#/windowControllers document)) 0)
-	(#/makeWindowControllers document))
-      (let* ((buffer (hemlock-document-buffer document))
-	     (hi::*current-buffer* buffer))
-	(edit-grep-line-in-buffer line-num))
-      (update-hemlock-selection (slot-value document 'textstorage))
-      (#/showWindows document))))
+(defun cocoa-edit-grep-line (file line-num)
+  (assume-cocoa-thread)
+  (invoke-in-file-buffer file #'(lambda () 
+                                  (edit-grep-line-in-buffer line-num))))
 
 (defun edit-grep-line-in-buffer (line-num)
@@ -60,12 +31,6 @@
   (multiple-value-bind (file line-num) (parse-grep-line line)
     (when file
-      (let* ((request (make-instance 'cocoa-edit-grep-line-request
-				     :with-file (assign-id-map-id *edit-definition-id-map* file)
-				     :line line-num)))
-	(#/performSelectorOnMainThread:withObject:waitUntilDone:
-	 (#/sharedDocumentController ns:ns-document-controller)
-	 (@selector #/editGrepLine:)
-	 request
-	 t)))))
+      (execute-in-cocoa-thread #'(lambda ()
+                                   (cocoa-edit-grep-line file line-num))))))
 
 (defun grep-comment-line-p (line)
Index: /branches/event-ide/ccl/cocoa-ide/cocoa-listener.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/cocoa-listener.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/cocoa-listener.lisp	(revision 7898)
@@ -371,6 +371,6 @@
          (protected-region (hi::buffer-protected-region buffer)))
     (if protected-region
-      (let* ((prot-start (mark-absolute-position (hi::region-start protected-region)))
-             (prot-end (mark-absolute-position (hi::region-end protected-region))))
+      (let* ((prot-start (hi:mark-absolute-position (hi::region-start protected-region)))
+             (prot-end (hi:mark-absolute-position (hi::region-end protected-region))))
         (not (or (and (>= range-start prot-start)
                       (< range-start prot-end))
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/bindings.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/bindings.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/bindings.lisp	(revision 7898)
@@ -83,4 +83,7 @@
 (bind-key "Abort Command" #k"control-g")
 (bind-key "Abort Command" #k"control-G")
+(bind-key "Abort Command" #k"control-x control-g")
+(bind-key "Abort Command" #k"control-x control-G")
+
 
 (bind-key "Process File Options" #k"control-x m" :global)
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/cocoa-hemlock.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/cocoa-hemlock.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/cocoa-hemlock.lisp	(revision 7898)
@@ -75,7 +75,7 @@
       (format t "~& style ~d ~d [~s]/ ~d [~s] ~a"
               (font-mark-font start)
-              (gui::mark-absolute-position start)
+              (mark-absolute-position start)
               (mark-%kind start)
-              (gui::mark-absolute-position end)
+              (mark-absolute-position end)
               (mark-%kind end)
               (eq r (buffer-active-font-region buffer))))))
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/echo.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/echo.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/echo.lisp	(revision 7898)
@@ -494,4 +494,5 @@
    :help help))
 
+#+not-yet
 (defun prompt-for-y-or-n (&key ((:must-exist must-exist) t)
 			       (default nil defaultp)
@@ -526,9 +527,7 @@
 ;;;; Key-event and key prompting.
 
+#+not-yet
 (defun prompt-for-key-event (&key (prompt "Key-event: ") (change-window t))
   "Prompts for a key-event."
-  (prompt-for-key-event* prompt change-window))
-
-(defun prompt-for-key-event* (prompt change-window)
   (if change-window
     (with-echo-area-window
@@ -539,4 +538,5 @@
      (recursive-get-key-event *editor-input* t))))
 
+#+not-yet
 (defun prompt-for-key (&key ((:must-exist must-exist) t)
 			    default default-string
@@ -587,4 +587,5 @@
      (force-output *echo-area-stream*))))
 
+#+not-yet
 (defun prompt-for-command-key ()
   (with-echo-area-window
@@ -599,5 +600,4 @@
 	   (unless (eq res :prefix)
 	     (return (values (copy-seq prompt-key) res)))))))))
-
 
 
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/edit-defs.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/edit-defs.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/edit-defs.lisp	(revision 7898)
@@ -296,25 +296,26 @@
            (match-context-for-indicator start end package indicator)))))
     
-(defun find-definition-in-buffer (buffer name indicator)
-  (setf (hi::buffer-region-active buffer) nil)
-  (when (symbolp name)
-    (let* ((string (string name))
-           (len (length string))
-           (pattern (get-search-pattern (string name) :forward))
-           (mark (copy-mark (buffer-start-mark buffer)))
-           (package (or
-                     (find-package
-                      (variable-value 'current-package :buffer buffer))
-                     *package*)))
-      (or
-       (loop
-         (let* ((won (find-pattern mark pattern)))
-           (unless won
-             (return))
-           (when (match-definition-context mark name indicator package)
-             (backward-up-list mark)
-             (move-mark (buffer-point buffer) mark)
-             (return t))
-          (unless (character-offset mark len)
-            (return))))
-       (beep)))))
+(defun find-definition-in-buffer (name indicator)
+  (let ((buffer (current-buffer)))
+    (setf (hi::buffer-region-active buffer) nil)
+    (when (symbolp name)
+      (let* ((string (string name))
+             (len (length string))
+             (pattern (get-search-pattern (string name) :forward))
+             (mark (copy-mark (buffer-start-mark buffer)))
+             (package (or
+                       (find-package
+                        (variable-value 'current-package :buffer buffer))
+                       *package*)))
+        (or
+         (loop
+           (let* ((won (find-pattern mark pattern)))
+             (unless won
+               (return))
+             (when (match-definition-context mark name indicator package)
+               (backward-up-list mark)
+               (move-mark (buffer-point buffer) mark)
+               (return t))
+             (unless (character-offset mark len)
+               (return))))
+         (beep))))))
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/htext1.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/htext1.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/htext1.lisp	(revision 7898)
@@ -439,4 +439,36 @@
     mark))
 
+(defun mark-absolute-position (mark)
+  (+ (get-line-origin (mark-line mark))
+     (mark-charpos mark)))
+
+(defun move-to-absolute-position (mark position)
+  (with-mark ((m (buffer-start-mark (mark-buffer mark))))
+    (when (character-offset m position)
+      (move-mark mark m))))
+
+(defun mark-column (mark)
+  (let ((column 0)
+        (tab-spaces (value hemlock::spaces-per-tab))
+        (line (mark-line mark))
+        (charpos (mark-charpos mark)))
+    (multiple-value-bind (chars gap-start gap-end)
+                         (if (current-open-line-p line)
+                           (values (current-open-chars)
+                                   (current-left-open-pos)
+                                   (current-right-open-pos))
+                           (values (line-chars line) charpos charpos))
+      (when (< gap-start charpos)
+        (incf charpos (- gap-end gap-start)))
+      (loop with pos = 0
+        do (when (eql pos gap-start) (setq pos gap-end))
+        while (< pos charpos)
+        do (incf column (if (eql (schar chars pos) #\tab)
+                          (- tab-spaces (mod column tab-spaces))
+                          1))
+        do (incf pos))
+      column)))
+
+
 
 ;;;; Regions.
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/isearchcoms.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/isearchcoms.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/isearchcoms.lisp	(revision 7898)
@@ -133,4 +133,5 @@
   (let* ((iss (make-isearch-state :direction direction
 				  :start-region (current-region-info))))
+    (push-buffer-mark (copy-mark (current-point)))
     (setf (value i-search-state) iss)
     (%i-search-message iss)))
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/morecoms.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/morecoms.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/morecoms.lisp	(revision 7898)
@@ -356,8 +356,6 @@
     (let ((point (current-point-unless-selection)))
       (when point
-        (with-mark ((m point))
-          (unless (character-offset (buffer-start m) p)
-            (buffer-end m))
-          (move-mark point m))))))
+	(unless (move-to-absolute-position point p)
+	  (buffer-end point))))))
 
 (defcommand "What Cursor Position" (p)
@@ -366,15 +364,13 @@
   (declare (ignore p))
   (let* ((point (current-point))
-         (current-line (mark-line point)))
-    (let* ((line-number (do* ((l 1 (1+ l))
-                              (mark-line (line-previous (mark-line point)) (line-previous mark-line)))
-                             ((null mark-line) l)))
-             (charpos (mark-charpos point))
-             (abspos (+ (hi::get-line-origin current-line) charpos))
-             (char (next-character point))
-             (size (count-characters (buffer-region (current-buffer)))))
-        (message "Char: ~s point = ~d of ~d(~d%) line ~d column ~d"
-                 char abspos size (round (/ (* 100 abspos) size)) line-number charpos))))
-
+	 (line-number (do* ((l 1 (1+ l))
+			    (mark-line (line-previous (mark-line point)) (line-previous mark-line)))
+			   ((null mark-line) l)))
+	 (charpos (mark-charpos point))
+	 (abspos (mark-absolute-position point))
+	 (char (next-character point))
+	 (size (count-characters (buffer-region (current-buffer)))))
+    (message "Char: ~s point = ~d of ~d(~d%) line ~d column ~d"
+	     char abspos size (round (/ (* 100 abspos) size)) line-number charpos)))
 
 ;;;; Page commands & stuff.
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/package.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/package.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/package.lisp	(revision 7898)
@@ -31,4 +31,5 @@
    #:mark-kind
    #:mark-buffer
+   #:mark-absolute-position
    #:previous-character
    #:next-character
@@ -37,4 +38,5 @@
    #:delete-mark
    #:move-to-position
+   #:move-to-absolute-position
    #:move-mark
    #:line-start
@@ -505,5 +507,6 @@
    ;; htext1.lisp
    #:line-length #:line-buffer #:line-string #:line-character #:mark #:mark-kind
-   #:copy-mark #:delete-mark #:move-to-position #:region #:make-empty-region
+   #:copy-mark #:delete-mark #:move-to-position #:mark-absolute-position
+   #:move-to-absolute-position #:region #:make-empty-region
    #:start-line-p #:end-line-p #:empty-line-p #:blank-line-p #:blank-before-p
    #:blank-after-p #:same-line-p #:mark< #:mark<= #:mark> #:mark>= #:mark= #:mark/=
Index: /branches/event-ide/ccl/cocoa-ide/hemlock/src/struct.lisp
===================================================================
--- /branches/event-ide/ccl/cocoa-ide/hemlock/src/struct.lisp	(revision 7897)
+++ /branches/event-ide/ccl/cocoa-ide/hemlock/src/struct.lisp	(revision 7898)
@@ -37,7 +37,4 @@
   following the mark.")
 
-;; This used to return window position, but for now that's disabled.
-(defun mark-column (mark)
-  (mark-charpos mark))
 
 (defstruct (font-mark (:print-function
