Commit 9f5e78f7 authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen Committed by Katsumi Yamaoka
Browse files

nnheader.el (nnheader-insert-buffer-substring): Renamed from nntp- and moved...

nnheader.el (nnheader-insert-buffer-substring): Renamed from nntp- and moved from that file for reuse.
parent bafcf6a5
2011-05-02 Lars Magne Ingebrigtsen <larsi@gnus.org> 2011-05-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
   
* nnheader.el (nnheader-insert-buffer-substring): Renamed from nntp-
and moved from that file for reuse.
* pop3.el (pop3-open-server): Error messages are "-ERR". * pop3.el (pop3-open-server): Error messages are "-ERR".
   
2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org> 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
......
...@@ -1099,6 +1099,19 @@ See `find-file-noselect' for the arguments." ...@@ -1099,6 +1099,19 @@ See `find-file-noselect' for the arguments."
backend-marks))))) backend-marks)))))
backend-marks) backend-marks)
(defmacro nnheader-insert-buffer-substring (buffer &optional start end)
"Copy string from unibyte buffer to multibyte current buffer."
(if (featurep 'xemacs)
`(insert-buffer-substring ,buffer ,start ,end)
`(if enable-multibyte-characters
(insert (with-current-buffer ,buffer
(mm-string-to-multibyte
,(if (or start end)
`(buffer-substring (or ,start (point-min))
(or ,end (point-max)))
'(buffer-string)))))
(insert-buffer-substring ,buffer ,start ,end))))
(when (featurep 'xemacs) (when (featurep 'xemacs)
(require 'nnheaderxm)) (require 'nnheaderxm))
......
...@@ -545,7 +545,7 @@ textual parts.") ...@@ -545,7 +545,7 @@ textual parts.")
(nnimap-get-whole-article article)) (nnimap-get-whole-article article))
(let ((buffer (current-buffer))) (let ((buffer (current-buffer)))
(with-current-buffer (or to-buffer nntp-server-buffer) (with-current-buffer (or to-buffer nntp-server-buffer)
(nntp-insert-buffer-substring buffer) (nnheader-insert-buffer-substring buffer)
(nnheader-ms-strip-cr))) (nnheader-ms-strip-cr)))
(cons group article))))))) (cons group article)))))))
......
...@@ -364,19 +364,6 @@ be restored and the command retried." ...@@ -364,19 +364,6 @@ be restored and the command retried."
(throw 'nntp-with-open-group-error t)) (throw 'nntp-with-open-group-error t))
(defmacro nntp-insert-buffer-substring (buffer &optional start end)
"Copy string from unibyte buffer to multibyte current buffer."
(if (featurep 'xemacs)
`(insert-buffer-substring ,buffer ,start ,end)
`(if enable-multibyte-characters
(insert (with-current-buffer ,buffer
(mm-string-to-multibyte
,(if (or start end)
`(buffer-substring (or ,start (point-min))
(or ,end (point-max)))
'(buffer-string)))))
(insert-buffer-substring ,buffer ,start ,end))))
(defmacro nntp-copy-to-buffer (buffer start end) (defmacro nntp-copy-to-buffer (buffer start end)
"Copy string from unibyte current buffer to multibyte buffer." "Copy string from unibyte current buffer to multibyte buffer."
(if (featurep 'xemacs) (if (featurep 'xemacs)
...@@ -434,7 +421,7 @@ be restored and the command retried." ...@@ -434,7 +421,7 @@ be restored and the command retried."
(unless discard (unless discard
(with-current-buffer buffer (with-current-buffer buffer
(goto-char (point-max)) (goto-char (point-max))
(nntp-insert-buffer-substring (process-buffer process)) (nnheader-insert-buffer-substring (process-buffer process))
;; Nix out "nntp reading...." message. ;; Nix out "nntp reading...." message.
(when nntp-have-messaged (when nntp-have-messaged
(setq nntp-have-messaged nil) (setq nntp-have-messaged nil)
...@@ -996,7 +983,7 @@ command whose response triggered the error." ...@@ -996,7 +983,7 @@ command whose response triggered the error."
(narrow-to-region (narrow-to-region
(setq point (goto-char (point-max))) (setq point (goto-char (point-max)))
(progn (progn
(nntp-insert-buffer-substring buf last-point (cdr entry)) (nnheader-insert-buffer-substring buf last-point (cdr entry))
(point-max))) (point-max)))
(setq last-point (cdr entry)) (setq last-point (cdr entry))
(nntp-decode-text) (nntp-decode-text)
...@@ -1472,7 +1459,7 @@ password contained in '~/.nntp-authinfo'." ...@@ -1472,7 +1459,7 @@ password contained in '~/.nntp-authinfo'."
(goto-char (point-max)) (goto-char (point-max))
(save-restriction (save-restriction
(narrow-to-region (point) (point)) (narrow-to-region (point) (point))
(nntp-insert-buffer-substring buf start) (nnheader-insert-buffer-substring buf start)
(when decode (when decode
(nntp-decode-text)))))) (nntp-decode-text))))))
;; report it. ;; report it.
...@@ -1700,7 +1687,7 @@ password contained in '~/.nntp-authinfo'." ...@@ -1700,7 +1687,7 @@ password contained in '~/.nntp-authinfo'."
(when in-process-buffer-p (when in-process-buffer-p
(set-buffer buf) (set-buffer buf)
(goto-char (point-max)) (goto-char (point-max))
(nntp-insert-buffer-substring process-buffer) (nnheader-insert-buffer-substring process-buffer)
(set-buffer process-buffer) (set-buffer process-buffer)
(erase-buffer) (erase-buffer)
(set-buffer buf)) (set-buffer buf))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment