diff options
| author | Richard M. Stallman | 1996-02-09 20:47:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-09 20:47:07 +0000 |
| commit | cb4c9483a3f2b7e2c0100630f0adc24c353c9da2 (patch) | |
| tree | 668e51c01c9e62a00b61fff01bdbef35e6ad8a4e | |
| parent | 9fa09c65d3323c4db7a7bfcac33f2ce46f00c771 (diff) | |
| download | emacs-cb4c9483a3f2b7e2c0100630f0adc24c353c9da2.tar.gz emacs-cb4c9483a3f2b7e2c0100630f0adc24c353c9da2.zip | |
(nntp-send-region-to-server): Use a temporary buffer to
send text to the server.
| -rw-r--r-- | lisp/nntp.el | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/lisp/nntp.el b/lisp/nntp.el index 4577fe52585..b6a49ee5888 100644 --- a/lisp/nntp.el +++ b/lisp/nntp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; nntp.el --- nntp access for Gnus | 1 | ;;; nntp.el --- nntp access for Gnus |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1987,88,89,90,92,93,94,95 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1987,88,89,90,92,93,94,95,96 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> | 5 | ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> |
| 6 | ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no> | 6 | ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no> |
| @@ -1019,36 +1019,28 @@ It will prompt for a password." | |||
| 1019 | (process-send-string nntp-server-process cmd))) | 1019 | (process-send-string nntp-server-process cmd))) |
| 1020 | 1020 | ||
| 1021 | (defun nntp-send-region-to-server (begin end) | 1021 | (defun nntp-send-region-to-server (begin end) |
| 1022 | "Send current buffer region (from BEGIN to END) to news server." | 1022 | "Send the current buffer region (from BEGIN to END) to the server." |
| 1023 | (save-excursion | 1023 | (save-excursion |
| 1024 | ;; We have to work in the buffer associated with NNTP server | 1024 | (let ((cur (current-buffer))) |
| 1025 | ;; process because of NEmacs hack. | 1025 | ;; Copy the buffer over to the send buffer. |
| 1026 | (copy-to-buffer nntp-server-buffer begin end) | 1026 | (set-buffer (get-buffer-create " *nntp send*")) |
| 1027 | (set-buffer nntp-server-buffer) | 1027 | (buffer-disable-undo (current-buffer)) |
| 1028 | (setq begin (point-min)) | 1028 | (erase-buffer) |
| 1029 | (setq end (point-max)) | 1029 | (insert-buffer-substring cur begin end) |
| 1030 | ;; `process-send-region' does not work if text to be sent is very | 1030 | (save-excursion |
| 1031 | ;; large. I don't know maximum size of text sent correctly. | 1031 | (set-buffer cur) |
| 1032 | (let ((last nil) | 1032 | (erase-buffer)) |
| 1033 | (size 100)) ;Size of text sent at once. | 1033 | ;; `process-send-region' does not work if the text to be sent is very |
| 1034 | (save-restriction | 1034 | ;; large, so we send it piecemeal. |
| 1035 | (narrow-to-region begin end) | 1035 | (let ((last (point-min)) |
| 1036 | (goto-char begin) | 1036 | (size 100)) ;Size of text sent at once. |
| 1037 | (while (not (eobp)) | 1037 | (while (/= last (point-max)) |
| 1038 | ;;(setq last (min end (+ (point) size))) | 1038 | (process-send-region |
| 1039 | ;; NEmacs gets confused if character at `last' is Kanji. | 1039 | nntp-server-process |
| 1040 | (setq last (save-excursion | 1040 | last (setq last (min (+ last size) (point-max)))) |
| 1041 | (goto-char (min end (+ (point) size))) | 1041 | ;; Read any output from the server. May be unnecessary. |
| 1042 | (or (eobp) (forward-char 1)) ;Adjust point | 1042 | (accept-process-output))) |
| 1043 | (point))) | 1043 | (kill-buffer (current-buffer))))) |
| 1044 | (process-send-region nntp-server-process (point) last) | ||
| 1045 | ;; I don't know whether the next codes solve the known | ||
| 1046 | ;; problem of communication error of GNU Emacs. | ||
| 1047 | (accept-process-output) | ||
| 1048 | ;;(sit-for 0) | ||
| 1049 | (goto-char last)))) | ||
| 1050 | ;; We cannot erase buffer, because reply may be received. | ||
| 1051 | (delete-region begin end))) | ||
| 1052 | 1044 | ||
| 1053 | (defun nntp-open-server-semi-internal (server &optional service) | 1045 | (defun nntp-open-server-semi-internal (server &optional service) |
| 1054 | "Open SERVER. | 1046 | "Open SERVER. |