# HG changeset patch # User Miles Bader # Date 1195451439 0 # Node ID 166a6141ae98c4661b9b36189e0e14da3544cd34 # Parent c24778f268492ee65db3d48ae94efe135560b38b Merge from gnus--devo--0 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-933 diff -r c24778f26849 -r 166a6141ae98 etc/GNUS-NEWS --- a/etc/GNUS-NEWS Mon Nov 19 00:25:31 2007 +0000 +++ b/etc/GNUS-NEWS Mon Nov 19 05:50:39 2007 +0000 @@ -58,7 +58,7 @@ ** International host names (IDNA) can now be decoded inside article bodies using `W i' (`gnus-summary-idna-message'). This requires that GNU Libidn -(`http://www.gnu.org/software/libidn/') has been installed. +() has been installed. ** The non-ASCII group names handling has been much improved. The back ends that fully support non-ASCII group names are now `nntp', `nnml', @@ -106,7 +106,7 @@ ** You can replace MIME parts with external bodies. See `gnus-mime-replace-part' and `gnus-article-replace-part'. *Note MIME -Commands::, *note Using MIME::. +Commands::, *Note Using MIME::. ** The option `mm-fill-flowed' can be used to disable treatment of format=flowed messages. Also, flowed text is disabled when sending @@ -146,7 +146,7 @@ ** The option `message-citation-line-format' controls the format of the "Whomever writes:" line. You need to set `message-citation-line-function' to -`message-insert-formated-citation-line' as well. +`message-insert-formatted-citation-line' as well. * Changes in back ends diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/ChangeLog Mon Nov 19 05:50:39 2007 +0000 @@ -88,6 +88,41 @@ * gnus-demon.el (gnus-demon): * gnus-uu.el (gnus-uu-default-view-rules): Fix typos in docstrings. +2007-11-15 Katsumi Yamaoka + + * nntp.el (nntp-insert-buffer-substring, nntp-copy-to-buffer): New + macros. + (nntp-wait-for, nntp-retrieve-articles, nntp-async-trigger) + (nntp-retrieve-headers-with-xover): Use nntp-insert-buffer-substring to + copy data from unibyte buffer to multibyte current buffer. + (nntp-retrieve-headers, nntp-retrieve-groups); Use nntp-copy-to-buffer + to copy data from unibyte current buffer to multibyte buffer. + (nntp-make-process-buffer): Make process buffer unibyte. + + * pop3.el (pop3-open-server): Fix typo in Lisp code. + +2007-11-14 Denys Duchier (tiny change) + + * pop3.el (pop3-open-server): Accept and process data more robustly at + connexion start to avoid spurious "POP SSL connexion failed" errors. + +2007-11-14 Katsumi Yamaoka + + * gnus-start.el (gnus-active-to-gnus-format): Use unibyte buffer to + read group names. + +2007-11-12 Reiner Steib + + * gnus-msg.el (gnus-confirm-mail-reply-to-news): Adjust :version. + +2007-11-12 Katsumi Yamaoka + + * nnmail.el (nnmail-parse-active): Make group names unibyte. + (nnmail-save-active): Use a unibyte buffer when saving active file, + which may contain non-ASCII group names. + + * nnml.el (nnml-request-group): Decode group names in messages. + 2007-11-05 Reiner Steib * message.el (message-citation-line-function) diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/gnus-msg.el --- a/lisp/gnus/gnus-msg.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/gnus-msg.el Mon Nov 19 05:50:39 2007 +0000 @@ -265,7 +265,7 @@ parameter, which should return non-nil if a confirmation is needed; or a regexp, in which case a confirmation is asked for if the group name matches the regexp." - :version "22.1" + :version "23.0" ;; No Gnus (default changed) :group 'gnus-message :type '(choice (const :tag "No" nil) (const :tag "Yes" t) diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/gnus-start.el --- a/lisp/gnus/gnus-start.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/gnus-start.el Mon Nov 19 05:50:39 2007 +0000 @@ -2103,7 +2103,8 @@ (if (equal method gnus-select-method) (gnus-make-hashtable (count-lines (point-min) (point-max))) - (gnus-make-hashtable 4096))))))) + (gnus-make-hashtable 4096)))))) + group max min) ;; Delete unnecessary lines. (goto-char (point-min)) (cond @@ -2138,8 +2139,12 @@ (insert prefix) (zerop (forward-line 1))))))) ;; Store the active file in a hash table. - (goto-char (point-min)) - (let (group max min) + ;; Use a unibyte buffer in order to make `read' read non-ASCII + ;; group names (which have been encoded) as unibyte strings. + (mm-with-unibyte-buffer + (insert-buffer-substring cur) + (setq cur (current-buffer)) + (goto-char (point-min)) (while (not (eobp)) (condition-case () (progn diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/nnmail.el --- a/lisp/gnus/nnmail.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/nnmail.el Mon Nov 19 05:50:39 2007 +0000 @@ -693,7 +693,7 @@ (setq group (symbol-name group))) (if (and (numberp (setq max (read buffer))) (numberp (setq min (read buffer)))) - (push (list group (cons min max)) + (push (list (mm-string-as-unibyte group) (cons min max)) group-assoc))) (error nil)) (widen) @@ -708,6 +708,7 @@ (let ((coding-system-for-write nnmail-active-file-coding-system)) (when file-name (with-temp-file file-name + (mm-disable-multibyte) (nnmail-generate-active group-assoc))))) (defun nnmail-generate-active (alist) diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/nnml.el --- a/lisp/gnus/nnml.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/nnml.el Mon Nov 19 05:50:39 2007 +0000 @@ -258,7 +258,8 @@ (string-to-number (file-name-nondirectory path))))))) (deffoo nnml-request-group (group &optional server dont-check) - (let ((file-name-coding-system nnmail-pathname-coding-system)) + (let ((file-name-coding-system nnmail-pathname-coding-system) + (decoded (nnml-decoded-group-name group server))) (cond ((not (nnml-possibly-change-directory group server)) (nnheader-report 'nnml "Invalid group (no such directory)")) @@ -268,15 +269,15 @@ ((not (file-directory-p nnml-current-directory)) (nnheader-report 'nnml "%s is not a directory" nnml-current-directory)) (dont-check - (nnheader-report 'nnml "Group %s selected" group) + (nnheader-report 'nnml "Group %s selected" decoded) t) (t (nnheader-re-read-dir nnml-current-directory) (nnmail-activate 'nnml) (let ((active (nth 1 (assoc group nnml-group-alist)))) (if (not active) - (nnheader-report 'nnml "No such group: %s" group) - (nnheader-report 'nnml "Selected group %s" group) + (nnheader-report 'nnml "No such group: %s" decoded) + (nnheader-report 'nnml "Selected group %s" decoded) (nnheader-insert "211 %d %d %d %s\n" (max (1+ (- (cdr active) (car active))) 0) (car active) (cdr active) group))))))) diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/nntp.el --- a/lisp/gnus/nntp.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/nntp.el Mon Nov 19 05:50:39 2007 +0000 @@ -364,6 +364,32 @@ (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) + "Copy string from unibyte current buffer to multibyte buffer." + (if (featurep 'xemacs) + `(copy-to-buffer ,buffer ,start ,end) + `(let ((string (buffer-substring ,start ,end))) + (with-current-buffer ,buffer + (erase-buffer) + (insert (if enable-multibyte-characters + (mm-string-to-multibyte string) + string)) + (goto-char (point-min)) + nil)))) + (defsubst nntp-wait-for (process wait-for buffer &optional decode discard) "Wait for WAIT-FOR to arrive from PROCESS." @@ -409,7 +435,7 @@ (save-excursion (set-buffer buffer) (goto-char (point-max)) - (insert-buffer-substring (process-buffer process)) + (nntp-insert-buffer-substring (process-buffer process)) ;; Nix out "nntp reading...." message. (when nntp-have-messaged (setq nntp-have-messaged nil) @@ -653,7 +679,7 @@ nntp-server-buffer)) (buffer (and process (process-buffer process)))) - ;; When I an able to identify the + ;; When I am able to identify the ;; connection to the server AND I've ;; received NO reponse for ;; nntp-connection-timeout seconds. @@ -738,7 +764,7 @@ (nnheader-fold-continuation-lines) ;; Remove all "\r"'s. (nnheader-strip-cr) - (copy-to-buffer nntp-server-buffer (point-min) (point-max)) + (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max)) 'headers))))) (deffoo nntp-retrieve-groups (groups &optional server) @@ -820,7 +846,8 @@ (if (not nntp-server-list-active-group) (progn - (copy-to-buffer nntp-server-buffer (point-min) (point-max)) + (nntp-copy-to-buffer nntp-server-buffer + (point-min) (point-max)) 'group) ;; We have read active entries, so we just delete the ;; superfluous gunk. @@ -828,7 +855,7 @@ (while (re-search-forward "^[.2-5]" nil t) (delete-region (match-beginning 0) (progn (forward-line 1) (point)))) - (copy-to-buffer nntp-server-buffer (point-min) (point-max)) + (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max)) 'active))))))) (deffoo nntp-retrieve-articles (articles &optional group server) @@ -893,7 +920,7 @@ (narrow-to-region (setq point (goto-char (point-max))) (progn - (insert-buffer-substring buf last-point (cdr entry)) + (nntp-insert-buffer-substring buf last-point (cdr entry)) (point-max))) (setq last-point (cdr entry)) (nntp-decode-text) @@ -1206,7 +1233,7 @@ (format " *server %s %s %s*" nntp-address nntp-port-number (gnus-buffer-exists-p buffer)))) - (mm-enable-multibyte) + (mm-disable-multibyte) (set (make-local-variable 'after-change-functions) nil) (set (make-local-variable 'nntp-process-wait-for) nil) (set (make-local-variable 'nntp-process-callback) nil) @@ -1390,7 +1417,7 @@ (goto-char (point-max)) (save-restriction (narrow-to-region (point) (point)) - (insert-buffer-substring buf start) + (nntp-insert-buffer-substring buf start) (when decode (nntp-decode-text)))))) ;; report it. @@ -1619,7 +1646,7 @@ (when in-process-buffer-p (set-buffer buf) (goto-char (point-max)) - (insert-buffer-substring process-buffer) + (nntp-insert-buffer-substring process-buffer) (set-buffer process-buffer) (erase-buffer) (set-buffer buf)) diff -r c24778f26849 -r 166a6141ae98 lisp/gnus/pop3.el --- a/lisp/gnus/pop3.el Mon Nov 19 00:25:31 2007 +0000 +++ b/lisp/gnus/pop3.el Mon Nov 19 05:50:39 2007 +0000 @@ -242,16 +242,23 @@ mailhost port))) (when process ;; There's a load of info printed that needs deleting. - (while (when (memq (process-status process) '(open run)) - (pop3-accept-process-output process) - (goto-char (point-max)) - (forward-line -1) - (if (looking-at "\\+OK") - (progn - (delete-region (point-min) (point)) - nil) + (let ((again 't)) + ;; repeat until + ;; - either we received the +OK line + ;; - or accept-process-output timed out without getting + ;; anything + (while (and again + (setq again (memq (process-status process) + '(open run)))) + (setq again (pop3-accept-process-output process)) + (goto-char (point-max)) + (forward-line -1) + (cond ((looking-at "\\+OK") + (setq again nil) + (delete-region (point-min) (point))) + ((not again) (pop3-quit process) - (error "POP SSL connexion failed")))) + (error "POP SSL connexion failed"))))) process))) ((eq pop3-stream-type 'starttls) ;; gnutls-cli, openssl don't accept service names