 (defun merlin-phrase-goto (command indice)
   "Go to the phrase indicated by COMMAND to the end INDICE.
 Returns the position."
-  (let ((r (merlin-send-command (list 'boundary command))))
-    (unless (equal r 'null)
-      (merlin-goto-point (elt r indice))
-      (point))))
+  (message "phrase: TODO"))
+  ; (let ((result (merlin-send-command (list 'boundary command))))
+  ;   (unless (equal result 'null)
+  ;     (merlin-goto-point (elt result indice))
+  ;     (point))))
 
 (defun merlin-phrase-next (&optional point)
   "Go to the beginning of the next phrase."
   (interactive)
-  (unless point (setq point (point)))
-  (merlin-sync-to-point point)
-  (cond
-    ((merlin-phrase-goto 'next 0))
-    ((progn (merlin-tell-definitions 2)
-            (goto-char (merlin-seek-exact point))
-            (merlin-phrase-goto 'next 0)))
-    (t (goto-char (point-max)))))
+  (message "phrase: TODO"))
+  ; (unless point (setq point (point)))
+  ; (merlin-sync-to-point point)
+  ; (cond
+  ;   ((merlin-phrase-goto 'next 0))
+  ;   ((progn (merlin-tell-definitions 2)
+  ;           (goto-char (merlin-seek-exact point))
+  ;           (merlin-phrase-goto 'next 0)))
+  ;   (t (goto-char (point-max)))))
 
 (defun merlin-phrase-prev ()
   "Go to the beginning of the previous phrase."
   (interactive)
-  (let ((point (point)))
-    (merlin-sync-to-point)
-    (if (equal point (merlin-phrase-goto 'current 0))
-        (merlin-phrase-goto 'prev 0))))
+  (message "phrase: TODO"))
+  ; (let ((point (point)))
+  ;   (merlin-sync-to-point)
+  ;   (if (equal point (merlin-phrase-goto 'current 0))
+  ;       (merlin-phrase-goto 'prev 0))))
 
 (defun merlin-to-point ()
   "Update merlin to the current point, reporting errors."

        (delete-overlay merlin-lock-zone-margin-overlay))
      (when merlin-highlight-overlay
        (delete-overlay merlin-highlight-overlay))
      ;;(merlin-error-delete-overlays) 
     )))

(defun merlin-after-save ()

   "Return content of buffer between two-point or empty string if points are not valid"
   (if (< start end) (buffer-substring-no-properties start end) ""))

(defun merlin-tell-piece (start end)
  "Send raw content to merlin.
START and END are positions in the buffer and delimits the content to be sent."
  (let ((content (merlin-buffer-substring start end)))
    (if (string-equal content "")
        (merlin-send-command (list 'tell 'start)
        (merlin-send-command (list 'tell 'source content))))))

(defun merlin-tell-till-end-of-recursion (path)
  "Feed merlin with as much content as it needs starting from (POINT).
To be called only when merlin is waiting for input (e.g. after a `tell source'
or `tell definitions')."
  (let ((curr (point))
        (chunk 10))
    (forward-line chunk)
    (while (and (merlin-path-is-recursive path)
                (< curr (point-max)))
      (setq path (merlin-path-common-prefix
                  path (cdr (merlin-tell-piece curr (point)))))
      (setq curr (point))
      (forward-line chunk)
      (when (< chunk 20000)
        (setq chunk (* chunk 2))))))

(defun merlin-tell-to-point (&optional point)
  "Makes sure the buffer is synchronized on merlin-side at least up to POINT."
  (save-excursion
    (unless point
      (setq point (point)))
    (unless (merlin-is-last-user-p)
      (merlin-rewind))
    (merlin-seek-before point)
    (let* ((result (merlin-parse-position (merlin-send-command '(tell start))))
           (start  (car result))
           (path   (cdr result)))
      (setq path (merlin-path-common-prefix
                  path (cdr (merlin-tell-piece start point))))
      (goto-char point)
      (merlin-tell-till-end-of-recursion path))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; POINT SYNCHRONIZATION ;;
