| 141 | | (set-buffer (tq-buffer tq)) |
|---|
| 142 | | (if (= 0 (buffer-size)) () |
|---|
| 143 | | (if (tq-queue-empty tq) |
|---|
| 144 | | (let ((buf (generate-new-buffer "*spurious*"))) |
|---|
| 145 | | (copy-to-buffer buf (point-min) (point-max)) |
|---|
| 146 | | (delete-region (point-min) (point)) |
|---|
| 147 | | (pop-to-buffer buf nil) |
|---|
| 148 | | (error "Spurious communication from process %s, see buffer %s" |
|---|
| 149 | | (process-name (tq-process tq)) |
|---|
| 150 | | (buffer-name buf))) |
|---|
| 151 | | (goto-char (point-min)) |
|---|
| 152 | | (if (re-search-forward (tq-queue-head-regexp tq) nil t) |
|---|
| 153 | | (let ((answer (buffer-substring (point-min) (point)))) |
|---|
| 154 | | (delete-region (point-min) (point)) |
|---|
| 155 | | (unwind-protect |
|---|
| 156 | | (condition-case nil |
|---|
| 157 | | (funcall (tq-queue-head-fn tq) |
|---|
| 158 | | (tq-queue-head-closure tq) |
|---|
| 159 | | answer) |
|---|
| 160 | | (error nil)) |
|---|
| 161 | | (tq-queue-pop tq)) |
|---|
| 162 | | (tq-process-buffer tq)))))) |
|---|
| | 143 | (let ((buffer (tq-buffer tq))) |
|---|
| | 144 | (when (buffer-live-p buffer) |
|---|
| | 145 | (set-buffer buffer) |
|---|
| | 146 | (if (= 0 (buffer-size)) () |
|---|
| | 147 | (if (tq-queue-empty tq) |
|---|
| | 148 | (let ((buf (generate-new-buffer "*spurious*"))) |
|---|
| | 149 | (copy-to-buffer buf (point-min) (point-max)) |
|---|
| | 150 | (delete-region (point-min) (point)) |
|---|
| | 151 | (pop-to-buffer buf nil) |
|---|
| | 152 | (error "Spurious communication from process %s, see buffer %s" |
|---|
| | 153 | (process-name (tq-process tq)) |
|---|
| | 154 | (buffer-name buf))) |
|---|
| | 155 | (goto-char (point-min)) |
|---|
| | 156 | (if (re-search-forward (tq-queue-head-regexp tq) nil t) |
|---|
| | 157 | (let ((answer (buffer-substring (point-min) (point)))) |
|---|
| | 158 | (delete-region (point-min) (point)) |
|---|
| | 159 | (unwind-protect |
|---|
| | 160 | (condition-case nil |
|---|
| | 161 | (funcall (tq-queue-head-fn tq) |
|---|
| | 162 | (tq-queue-head-closure tq) |
|---|
| | 163 | answer) |
|---|
| | 164 | (error nil)) |
|---|
| | 165 | (tq-queue-pop tq)) |
|---|
| | 166 | (tq-process-buffer tq)))))))) |
|---|