From 20b61c6553e731a356504c84ad690c32f7c71596 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 12 Feb 2002 03:26:41 +0000 Subject: [PATCH] Synch with latest snapshot of Oort Gnus (the CVS server is currently down). * mm-view.el: Require `gnus-mailcap' rather than `mailcap'. * nnheader.el (mm-with-unibyte-buffer): Bind `default-mc-flag' instead of `mc-flag'. (nnheader-with-unibyte-current-buffer): New macro. (mm-with-unibyte-current-buffer): Alias to `nnheader-with-unibyte-current-buffer'. (nnheader-guess-mime-charset): New macro. (mm-guess-mime-charset): Alias to `nnheader-guess-mime-charset'. (shell-command-to-string): New function for old Emacsen. * lpath.el: Don't fbind `shell-command-to-string'. --- ChangeLog | 15 +++++++++++ GNUS-NEWS | 6 +++++ lisp/ChangeLog | 36 ++++++++++++++++++++++++++ lisp/gnus-art.el | 42 +++++++++++++++++++++++++++--- lisp/gnus-soup.el | 26 +++++++++++++------ lisp/gnus-start.el | 3 ++- lisp/gnus-sum.el | 2 ++ lisp/gnus.el | 6 ++--- lisp/lpath.el | 3 +-- lisp/mm-util.el | 25 ++++++++++++++++++ lisp/mm-view.el | 2 +- lisp/nnheader.el | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++-- lisp/nnrss.el | 10 ++++++- texi/ChangeLog | 10 +++++++ texi/gnus-ja.texi | 18 +++++++++++++ texi/gnus.texi | 19 ++++++++++++++ 16 files changed, 274 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32d1f11..2b1b428 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2002-02-12 Katsumi Yamaoka + + * lisp/mm-view.el: Require `gnus-mailcap' rather than `mailcap'. + + * lisp/nnheader.el (mm-with-unibyte-buffer): Bind `default-mc-flag' + instead of `mc-flag'. + (nnheader-with-unibyte-current-buffer): New macro. + (mm-with-unibyte-current-buffer): Alias to + `nnheader-with-unibyte-current-buffer'. + (nnheader-guess-mime-charset): New macro. + (mm-guess-mime-charset): Alias to `nnheader-guess-mime-charset'. + (shell-command-to-string): New function for old Emacsen. + + * lisp/lpath.el: Don't fbind `shell-command-to-string'. + 2002-02-09 TSUCHIYA Masatoshi * lisp/gnus-namazu.el (gnus-namazu/group-alist): Abolished. diff --git a/GNUS-NEWS b/GNUS-NEWS index d794171..fafbbf1 100644 --- a/GNUS-NEWS +++ b/GNUS-NEWS @@ -8,6 +8,12 @@ For older news, see Gnus info node "New Features". * Changes in Oort Gnus +** gnus-default-charset + +The default value is determined from the current-language-environment +variable, instead of 'iso-8859-1. Also the ".*" item in +gnus-group-charset-alist is removed. + ** gnus-posting-styles Add a new format of match like diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c9a1abf..ea2a774 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,39 @@ +2002-02-09 ShengHuo ZHU + + * gnus-soup.el (gnus-soup-send-packet): Send news and mail + directly instead of calling message-send-mail. + + * gnus-start.el (gnus-read-descriptions-file): Use + gnus-default-charset. + + * mm-util.el (mm-guess-mime-charset): New function. + + * gnus.el (gnus-default-charset): Use it. + (gnus-group-charset-alist): Remove .*, Let gnus-default-charset be + the default. + +2002-02-08 ShengHuo ZHU + + * gnus-art.el (gnus-treat-display-grey-xface): New variable. + (article-display-x-face): Use it. Disable grey xface, if + uncompface is not found. + + * message.el (message-mode): Don't enable multibyte on an indirect + buffer. + + * nnrss.el (nnrss-content-function): New variable. + (nnrss-request-article): Use it. + +2002-02-08 ShengHuo ZHU + + * gnus.el: Add article-unsplit-urls. + * gnus-sum.el: Ditto. + * gnus-art.el (gnus-treat-strip-cr): New variable. + (gnus-treatment-function-alist): Use it. + (article-unsplit-urls): New function. + (gnus-article-make-menu-bar): Use it. + From: Michael Cook + 2002-02-08 ShengHuo ZHU * gnus-agent.el (gnus-agent-braid-nov): Find the first article to diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 5641f05..9e94d1f 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -908,6 +908,13 @@ See Info node `(gnus)Customizing Articles' for details." :group 'gnus-article-treat :type gnus-article-treat-custom) +(defcustom gnus-treat-unsplit-urls nil + "Remove newlines from within URLs. +Valid values are nil, t, `head', `last', an integer or a predicate. +See Info node `(gnus)Customizing Articles' for details." + :group 'gnus-article-treat + :type gnus-article-treat-custom) + (defcustom gnus-treat-leading-whitespace nil "Remove leading whitespace in headers. Valid values are nil, t, `head', `last', an integer or a predicate. @@ -1155,6 +1162,16 @@ even if you are using Emacs 21+. It has no effect on XEmacs." "Internal variable used to say whether `smiley-mule' is loaded (whether smiley functions are not overridden by `smiley').") +(defcustom gnus-treat-display-grey-xface + (and (string-match "^0x" (shell-command-to-string "uncompface")) + t) + "Display grey X-Face headers. +Valid values are nil, t." + :group 'gnus-article-treat + :version "21.3" + :type 'boolean) +(put 'gnus-treat-display-grey-xface 'highlight t) + (defcustom gnus-treat-display-smileys (if (or (and (featurep 'xemacs) (featurep 'xpm)) @@ -1315,6 +1332,7 @@ It is a string, such as \"PGP\". If nil, ask user." (gnus-treat-fill-article gnus-article-fill-cited-article) (gnus-treat-fill-long-lines gnus-article-fill-long-lines) (gnus-treat-strip-cr gnus-article-remove-cr) + (gnus-treat-unsplit-urls gnus-article-unsplit-urls) (gnus-treat-date-ut gnus-article-date-ut) (gnus-treat-date-local gnus-article-date-local) (gnus-treat-date-english gnus-article-date-english) @@ -2039,10 +2057,14 @@ unfolded." (set-buffer gnus-original-article-buffer)) (save-restriction (mail-narrow-to-head) - (while (gnus-article-goto-header "x-face\\(-[0-9]+\\)?") - (when (match-beginning 2) - (setq grey t)) - (push (mail-header-field-value) x-faces)) + (let ((regexp + (if gnus-treat-display-grey-xface + "x-face\\(-[0-9]+\\)?" + "x-face"))) + (while (gnus-article-goto-header regexp) + (when (match-beginning 2) + (setq grey t)) + (push (mail-header-field-value) x-faces))) (setq from (message-fetch-field "from")))) (if grey (let ((xpm (gnus-convert-gray-x-face-to-xpm x-faces)) @@ -2252,6 +2274,16 @@ If READ-CHARSET, ask for a coding system." (let ((buffer-read-only nil)) (rfc1843-decode-region (point-min) (point-max))))) +(defun article-unsplit-urls () + "Remove the newlines that some other mailers insert into URLs." + (interactive) + (save-excursion + (let ((buffer-read-only nil)) + (goto-char (point-min)) + (while (re-search-forward + "^\\(\\(https?\\|ftp\\)://\\S-+\\)\n\\(\\S-+\\)" nil t) + (replace-match "\\1\\3" t))))) + (defun article-wash-html (&optional read-charset) "Format an html article. If READ-CHARSET, ask for a coding system." @@ -3422,6 +3454,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is article-de-base64-unreadable article-decode-HZ article-wash-html + article-unsplit-urls article-hide-list-identifiers article-hide-pgp article-strip-banner @@ -3527,6 +3560,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is ["Remove carriage return" gnus-article-remove-cr t] ["Remove leading whitespace" gnus-article-remove-leading-whitespace t] ["Treat html" gnus-article-wash-html t] + ["Remove newlines from within URLs" gnus-article-unsplit-urls t] ["Decode HZ" gnus-article-decode-HZ t])) ;; Note "Commands" menu is defined in gnus-sum.el for consistency diff --git a/lisp/gnus-soup.el b/lisp/gnus-soup.el index 9b974a8..10bb7ef 100644 --- a/lisp/gnus-soup.el +++ b/lisp/gnus-soup.el @@ -541,25 +541,35 @@ Return whether the unpacking was successful." (match-beginning 1) (match-end 1))))) (switch-to-buffer tmp-buf) (erase-buffer) + (set-buffer-multibyte nil) (insert-buffer-substring msg-buf beg end) - (goto-char (point-min)) - (search-forward "\n\n") - (forward-char -1) - (insert mail-header-separator) - (setq message-user-agent (gnus-extended-version)) (cond ((string= (gnus-soup-reply-kind (car replies)) "news") (gnus-message 5 "Sending news message to %s..." (mail-fetch-field "newsgroups")) (sit-for 1) (let ((message-syntax-checks - 'dont-check-for-anything-just-trust-me)) - (funcall message-send-news-function))) + 'dont-check-for-anything-just-trust-me) + (method (if (message-functionp message-post-method) + (funcall message-post-method) + message-post-method)) + result) + (run-hooks 'message-send-news-hook) + (gnus-open-server method) + (message "Sending news with %s..." + (gnus-server-string method)) + (unless (let ((mail-header-separator "")) + (gnus-request-post method)) + (message "Couldn't send message via news: %s" + (nnheader-get-report (car method)))))) ((string= (gnus-soup-reply-kind (car replies)) "mail") (gnus-message 5 "Sending mail to %s..." (mail-fetch-field "to")) (sit-for 1) - (message-send-mail)) + (let ((mail-header-separator "")) + (mm-with-unibyte-current-buffer + (funcall (or message-send-mail-real-function + message-send-mail-function))))) (t (error "Unknown reply kind"))) (set-buffer msg-buf) diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el index 5b94c70..9fb8a95 100644 --- a/lisp/gnus-start.el +++ b/lisp/gnus-start.el @@ -2874,7 +2874,8 @@ The backup file \".newsrc.eld_\" will be created before re-reading." (name (symbol-name group)) (charset (or (gnus-group-name-charset method name) - (gnus-parameter-charset name)))) + (gnus-parameter-charset name) + gnus-default-charset))) (when (and str charset (featurep 'mule)) (setq str (decode-coding-string str charset))) (set group str))) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index e0267c2..1cf7a8d 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -1758,6 +1758,7 @@ increase the score of each group you read." "c" gnus-article-remove-cr "Z" gnus-article-decode-HZ "h" gnus-article-wash-html + "u" gnus-article-unsplit-urls "f" gnus-article-display-x-face "l" gnus-summary-stop-page-breaking "r" gnus-summary-caesar-message @@ -1967,6 +1968,7 @@ increase the score of each group you read." ["Unfold headers" gnus-article-treat-unfold-headers t] ["Fold newsgroups" gnus-article-treat-fold-newsgroups t] ["Html" gnus-article-wash-html t] + ["URLs" gnus-article-unsplit-urls t] ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t] ["HZ" gnus-article-decode-HZ t]) ("Output" diff --git a/lisp/gnus.el b/lisp/gnus.el index 5dd5e86..9cec1de 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -1648,8 +1648,7 @@ Use with caution.") ("\\(^\\|:\\)han\\>" euc-kr) ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5) ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr) - ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1) - (".*" iso-8859-1)) + ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)) :variable-document "Alist of regexps (to match group names) and default charsets to be used when reading." :variable-group gnus-charset @@ -1809,7 +1808,7 @@ face." :group 'gnus-agent :type 'boolean) -(defcustom gnus-default-charset 'iso-8859-1 +(defcustom gnus-default-charset (mm-guess-mime-charset) "Default charset assumed to be used when viewing non-ASCII characters. This variable is overridden on a group-to-group basis by the gnus-group-charset-alist variable and is only used on groups not @@ -2191,6 +2190,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.") gnus-article-display-x-face gnus-article-decode-HZ gnus-article-wash-html + gnus-article-unsplit-urls gnus-article-hide-pgp gnus-article-hide-pem gnus-article-hide-signature gnus-article-strip-leading-blank-lines gnus-article-date-local diff --git a/lisp/lpath.el b/lisp/lpath.el index 7bb0c43..1fa0f5f 100644 --- a/lisp/lpath.el +++ b/lisp/lpath.el @@ -130,8 +130,7 @@ '((coding-system-get coding-system-to-mime-charset compose-mail file-name-extension find-coding-systems-for-charsets find-coding-systems-region - function-max-args get-charset-property shell-command-to-string - smiley-encode-buffer))) + function-max-args get-charset-property smiley-encode-buffer))) (t '((function-max-args smiley-encode-buffer)))))) (maybe-fbind (car functions-variables)) diff --git a/lisp/mm-util.el b/lisp/mm-util.el index d2d1b5a..3a58cb5 100644 --- a/lisp/mm-util.el +++ b/lisp/mm-util.el @@ -758,6 +758,31 @@ If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers." (let ((cs (mm-detect-coding-region start end))) cs))) +(defun mm-guess-mime-charset () + "Guess the default MIME charset from the language environment." + (let ((language-info + (and (boundp 'current-language-environment) + (assoc current-language-environment + language-info-alist))) + item) + (cond + ((null language-info) + 'iso-8859-1) + ((setq item + (cadr + (or (assq 'coding-priority language-info) + (assq 'coding-system language-info)))) + (if (fboundp 'coding-system-get) + (or (coding-system-get item 'mime-charset) + item) + item)) + ((setq item (car (last (assq 'charset language-info)))) + (if (eq item 'ascii) + 'iso-8859-1 + (mm-mime-charset item))) + (t + 'iso-8859-1)))) + (provide 'mm-util) ;;; mm-util.el ends here diff --git a/lisp/mm-view.el b/lisp/mm-view.el index 4a71760..a28c5ff 100644 --- a/lisp/mm-view.el +++ b/lisp/mm-view.el @@ -25,7 +25,7 @@ (eval-when-compile (require 'cl)) (require 'mail-parse) -(require 'mailcap) +(require 'gnus-mailcap) (require 'mm-bodies) (require 'mm-decode) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 24bc755..22c9cee 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -158,13 +158,75 @@ This variable is a substitute for `mm-text-coding-system-for-write'.") (defmacro nnheader-with-unibyte-buffer (&rest forms) "Create a temporary buffer, and evaluate FORMS there like `progn'. Use unibyte mode for this." - `(let (default-enable-multibyte-characters mc-flag) + `(let (default-enable-multibyte-characters default-mc-flag) (with-temp-buffer ,@forms))) (put 'nnheader-with-unibyte-buffer 'lisp-indent-function 0) (put 'nnheader-with-unibyte-buffer 'edebug-form-spec '(body)) (put 'mm-with-unibyte-buffer 'lisp-indent-function 0) (put 'mm-with-unibyte-buffer 'edebug-form-spec '(body)) - (defalias 'mm-with-unibyte-buffer 'nnheader-with-unibyte-buffer)) + (defalias 'mm-with-unibyte-buffer 'nnheader-with-unibyte-buffer) + + ;; Should keep track of `mm-with-unibyte-current-buffer' in mm-util.el. + (defmacro nnheader-with-unibyte-current-buffer (&rest forms) + "Evaluate FORMS with current current buffer temporarily made unibyte. +Also bind `default-enable-multibyte-characters' to nil. +Equivalent to `progn' in XEmacs" + (let ((multibyte (make-symbol "multibyte")) + (buffer (make-symbol "buffer"))) + (cond ((featurep 'xemacs) + `(let (default-enable-multibyte-characters) + ,@forms)) + ((boundp 'MULE) + `(let ((,multibyte mc-flag) + (,buffer (current-buffer))) + (unwind-protect + (let (default-enable-multibyte-characters default-mc-flag) + (setq mc-flag nil) + ,@forms) + (set-buffer ,buffer) + (setq mc-flag ,multibyte)))) + (t + `(let ((,multibyte enable-multibyte-characters) + (,buffer (current-buffer))) + (unwind-protect + (let (default-enable-multibyte-characters) + (set-buffer-multibyte nil) + ,@forms) + (set-buffer ,buffer) + (set-buffer-multibyte ,multibyte))))))) + (put 'nnheader-with-unibyte-current-buffer 'lisp-indent-function 0) + (put 'nnheader-with-unibyte-current-buffer 'edebug-form-spec '(body)) + (put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0) + (put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body)) + (defalias 'mm-with-unibyte-current-buffer + 'nnheader-with-unibyte-current-buffer) + + ;; Should keep track of `mm-guess-mime-charset' in mm-util.el. + (defun nnheader-guess-mime-charset () + "Guess the default MIME charset from the language environment." + (let ((language-info + (and (boundp 'current-language-environment) + (assoc current-language-environment + language-info-alist))) + item) + (cond + ((null language-info) + 'iso-8859-1) + ((setq item + (cadr + (or (assq 'coding-priority language-info) + (assq 'coding-system language-info)))) + (if (fboundp 'coding-system-get) + (or (coding-system-get item 'mime-charset) + item) + item)) + ((setq item (car (last (assq 'charset language-info)))) + (if (eq item 'ascii) + 'iso-8859-1 + (charsets-to-mime-charset (list item)))) + (t + 'iso-8859-1)))) + (defalias 'mm-guess-mime-charset 'nnheader-guess-mime-charset)) ;; mail-parse stuff. (unless (featurep 'mail-parse) @@ -1460,6 +1522,13 @@ find-file-hooks, etc. (message "%s(Y/n) Yes" prompt) t))) +(defun-maybe shell-command-to-string (command) + "Execute shell command COMMAND and return its output as a string." + (with-output-to-string + (with-current-buffer + standard-output + (call-process shell-file-name nil t nil shell-command-switch command)))) + (when (featurep 'xemacs) (require 'nnheaderxm)) diff --git a/lisp/nnrss.el b/lisp/nnrss.el index 126b3d0..7221e5b 100644 --- a/lisp/nnrss.el +++ b/lisp/nnrss.el @@ -173,6 +173,12 @@ To use the description in headers, put this name into `nnmail-extra-headers'.") "Field name used for URL. To use the description in headers, put this name into `nnmail-extra-headers'.") +(defvar nnrss-content-function nil + "A function which is called in `nnrss-request-article'. +The arguments are (ENTRY GROUP ARTICLE). +ENTRY is the record of the current headline. GROUP is the group name. +ARTICLE is the article number of the current headline.") + (nnoo-define-basics nnrss) ;;; Interface functions @@ -264,7 +270,9 @@ To use the description in headers, put this name into `nnmail-extra-headers'.") (insert "\n\n") (fill-region point (point)))) (if (nth 2 e) - (insert (nth 2 e) "\n"))))) + (insert (nth 2 e) "\n")) + (if nnrss-content-function + (funcall nnrss-content-function e group article))))) (cond (err (nnheader-report 'nnrss err)) diff --git a/texi/ChangeLog b/texi/ChangeLog index f96bb77..2ab3a18 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,13 @@ +2002-02-09 ShengHuo ZHU + + * gnus.texi (Group Parameters): Addition. + From: Steinar Bang + +2002-02-08 ShengHuo ZHU + + * gnus.texi (Article Washing): Addition. + From: Michael Cook + 2002-02-06 ShengHuo ZHU * gnus.texi (Gnus Unplugged): Use (setq gnus-agent t). diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 2bb7ce7..e9a9dcc 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -2999,6 +2999,15 @@ Sieve}$B!#(B @code{gnus-show-threads} $B$O!"$=$N35N,%P%C%U%!$NCf$N%m!<%+%kJQ?t$K$J$j!"(B form $B$N(B @code{nil} $B$O$=$3$GI>2A$5$l$^$9!#(B +@vindex gnus-list-identifiers +$B$3$N5!G=$NMQES$N0l$D$O!"5-;v$NBjL>Ms$+$i%a!<%j%s%0%j%9%H$NI8<1%?%0$r$O$.(B +$B$K(B @samp{DOC-BOOK-APPS:} $B$H$$$&%?%0$r;}$C$F$$$k$J$i$P!"$=$N%0%k!<%W(B +$B$N%0%k!<%W%Q%i%a!<%?$K(B @code{(gnus-list-identifiers "DOCBOOK-APPS:")} $B$r(B +$BF~$l$k$3$H$K$h$C$F!"$=$N%0%k!<%W$N35N,%P%C%U%!$KI=<($5$l$k5-;v$NBjL>$+$i(B +$B%?%0$r$O$.