 ;; contents of the code-completion buffer with the new code-completion results
 ;; and ensures that the buffer is visible.
 (defun clang-completion-sentinel (proc event)
-  (let* ((all-lines (split-string clang-result-string "\n"))
-         (completion-lines (filter 'is-completion-line all-lines)))
-    (if (consp completion-lines)
-        (progn
-         ;; Erase the process buffer.
-         (let ((cur (current-buffer)))
-           (set-buffer (process-buffer proc))
-           (goto-char (point-min))
-           (erase-buffer)
-           (set-buffer cur))
-         
-         ;; Display the process buffer.
-         (display-buffer (process-buffer proc))
-         
-         ;; Insert the code-completion string into the process buffer.
-         (with-current-buffer (process-buffer proc)
-           (insert (mapconcat 'identity completion-lines "\n")))
-         ))))
+  (fill-buffer (process-buffer proc)))
 
 (defun clang-complete ()
   (let* ((cc-point (concat (buffer-file-name)

;;
;;   (load-library "clang-completion-mode")
;;
;; Finally, to try Clang-based code completion in a particular buffer,
;; use M-x clang-completion-mode. When "Clang-CC" shows up in the mode
;; line, Clang's code-completion is enabled.
;;
;; Clang's code completion is based on parsing the complete source

  (or (string-match "OVERLOAD:" line)
      (string-match (concat "COMPLETION: " clang-completion-substring) line)))


;; re-process the completions when further input narrows the field
(defun clang-completion-display (buffer)
  (fill-buffer buffer))

(defun fill-buffer (buffer)
  (let* ((all-lines (split-string clang-result-string "\n"))
         (completion-lines (filter 'is-completion-line all-lines)))
    (if (consp completion-lines)
