Function: dictionary-connection-read

dictionary-connection-read is a byte-compiled function defined in dictionary-connection.el.gz.

Signature

(dictionary-connection-read CONNECTION DELIMITER)

Documentation

Read data from CONNECTION until DELIMITER is found inside the buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/net/dictionary-connection.el.gz
(defun dictionary-connection-read (connection delimiter)
  "Read data from CONNECTION until DELIMITER is found inside the buffer."
  (unless (eq (dictionary-connection-status connection) 'up)
    (error "Connection is not up"))
  (let ((case-fold-search nil)
	match-end)
    (with-current-buffer (dictionary-connection-buffer connection)
      (goto-char (dictionary-connection-read-point connection))
      ;; Wait until there is enough data
      (while (not (search-forward-regexp delimiter nil t))
	(accept-process-output (dictionary-connection-process connection) 3)
	(goto-char (dictionary-connection-read-point connection)))
      (setq match-end (point))
      ;; Return the result
      (let ((result (buffer-substring (dictionary-connection-read-point connection)
				      match-end)))
	(dictionary-connection-set-read-point connection match-end)
	result))))