aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2005-10-22 09:02:46 +0000
committerMiles Bader2005-10-22 09:02:46 +0000
commit292f71fe67394186e943783bef808c611699b63c (patch)
tree5f057f4db3b489cd0125645a4478ff78821f2e34
parentc286104c51b4510ead8e92d265a84aa661ddbf97 (diff)
downloademacs-292f71fe67394186e943783bef808c611699b63c.tar.gz
emacs-292f71fe67394186e943783bef808c611699b63c.zip
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-615
Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 142-146) - Update from CVS 2005-10-20 Hiroshi Fujishima <hiroshi.fujishima@gmail.com> (tiny change) * lisp/gnus/mail-source.el (mail-source-fetch-pop): Require pop3. (mail-source-check-pop): Ditto. 2005-10-20 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/rfc2047.el (rfc2047-decode-encoded-words): Fix the handling of errors. 2005-10-19 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-art.el (gnus-treat-strip-trailing-blank-lines) (gnus-treat-strip-leading-blank-lines): Improve doc string. * lisp/gnus/message.el (message-tool-bar-local-item-from-menu): Fix comment. 2005-10-19 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/rfc2047.el (rfc2047-allow-incomplete-encoded-text): New variable. (rfc2047-charset-to-coding-system): New function. (rfc2047-decode-encoded-words): New function. (rfc2047-decode-region): Use them. (rfc2047-decode-cte): Remove. (rfc2047-parse-and-decode): Remove. (rfc2047-decode): Remove. 2005-10-15 Kenichi Handa <handa@m17n.org> * lisp/gnus/rfc2047.el (rfc2047-decode-cte): New function. (rfc2047-decode-region): Change the way to decode successive encoded-words: decode B- or Q-encoding in each encoded-word, concatenate them, and decode it as charset. 2005-10-17 Katsumi Yamaoka <yamaoka@jpl.org> * man/gnus.texi (Document Groups): Remove duplicate item.
-rw-r--r--lisp/gnus/ChangeLog34
-rw-r--r--lisp/gnus/gnus-art.el9
-rw-r--r--lisp/gnus/mail-source.el2
-rw-r--r--lisp/gnus/message.el3
-rw-r--r--lisp/gnus/rfc2047.el170
-rw-r--r--man/ChangeLog4
-rw-r--r--man/gnus.texi10
7 files changed, 153 insertions, 79 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 04213b9fa45..793bd1f4a3b 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,37 @@
12005-10-20 Hiroshi Fujishima <hiroshi.fujishima@gmail.com> (tiny change)
2
3 * mail-source.el (mail-source-fetch-pop): Require pop3.
4 (mail-source-check-pop): Ditto.
5
62005-10-20 Katsumi Yamaoka <yamaoka@jpl.org>
7
8 * rfc2047.el (rfc2047-decode-encoded-words): Fix the handling of
9 errors.
10
112005-10-19 Reiner Steib <Reiner.Steib@gmx.de>
12
13 * gnus-art.el (gnus-treat-strip-trailing-blank-lines)
14 (gnus-treat-strip-leading-blank-lines): Improve doc string.
15
16 * message.el (message-tool-bar-local-item-from-menu): Fix comment.
17
182005-10-19 Katsumi Yamaoka <yamaoka@jpl.org>
19
20 * rfc2047.el (rfc2047-allow-incomplete-encoded-text): New variable.
21 (rfc2047-charset-to-coding-system): New function.
22 (rfc2047-decode-encoded-words): New function.
23 (rfc2047-decode-region): Use them.
24 (rfc2047-decode-cte): Remove.
25 (rfc2047-parse-and-decode): Remove.
26 (rfc2047-decode): Remove.
27
282005-10-15 Kenichi Handa <handa@m17n.org>
29
30 * rfc2047.el (rfc2047-decode-cte): New function.
31 (rfc2047-decode-region): Change the way to decode successive
32 encoded-words: decode B- or Q-encoding in each encoded-word,
33 concatenate them, and decode it as charset.
34
12005-10-17 Chong Yidong <cyd@stupidchicken.com> 352005-10-17 Chong Yidong <cyd@stupidchicken.com>
2 36
3 * gnus-cus.el (gnus-custom-map): New variable. Bind mouse-1 to 37 * gnus-cus.el (gnus-custom-map): New variable. Bind mouse-1 to
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 249325a06f0..98e699cd80c 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1181,7 +1181,10 @@ See Info node `(gnus)Customizing Articles' for details."
1181(defcustom gnus-treat-strip-trailing-blank-lines nil 1181(defcustom gnus-treat-strip-trailing-blank-lines nil
1182 "Strip trailing blank lines. 1182 "Strip trailing blank lines.
1183Valid values are nil, t, `head', `last', an integer or a predicate. 1183Valid values are nil, t, `head', `last', an integer or a predicate.
1184See Info node `(gnus)Customizing Articles' for details." 1184See Info node `(gnus)Customizing Articles' for details.
1185
1186When set to t, it also strips trailing blanks in all MIME parts.
1187Consider to use `last' instead."
1185 :group 'gnus-article-treat 1188 :group 'gnus-article-treat
1186 :link '(custom-manual "(gnus)Customizing Articles") 1189 :link '(custom-manual "(gnus)Customizing Articles")
1187 :type gnus-article-treat-custom) 1190 :type gnus-article-treat-custom)
@@ -1189,7 +1192,9 @@ See Info node `(gnus)Customizing Articles' for details."
1189(defcustom gnus-treat-strip-leading-blank-lines nil 1192(defcustom gnus-treat-strip-leading-blank-lines nil
1190 "Strip leading blank lines. 1193 "Strip leading blank lines.
1191Valid values are nil, t, `head', `last', an integer or a predicate. 1194Valid values are nil, t, `head', `last', an integer or a predicate.
1192See Info node `(gnus)Customizing Articles' for details." 1195See Info node `(gnus)Customizing Articles' for details.
1196
1197When set to t, it also strips trailing blanks in all MIME parts."
1193 :group 'gnus-article-treat 1198 :group 'gnus-article-treat
1194 :link '(custom-manual "(gnus)Customizing Articles") 1199 :link '(custom-manual "(gnus)Customizing Articles")
1195 :type gnus-article-treat-custom) 1200 :type gnus-article-treat-custom)
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 3f3ecc7919f..c31fa6825f4 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -740,6 +740,7 @@ Pass INFO on to CALLBACK."
740 (funcall function mail-source-crash-box)) 740 (funcall function mail-source-crash-box))
741 ;; The default is to use pop3.el. 741 ;; The default is to use pop3.el.
742 (t 742 (t
743 (require 'pop3)
743 (let ((pop3-password password) 744 (let ((pop3-password password)
744 (pop3-maildrop user) 745 (pop3-maildrop user)
745 (pop3-mailhost server) 746 (pop3-mailhost server)
@@ -801,6 +802,7 @@ Pass INFO on to CALLBACK."
801 (function) 802 (function)
802 ;; The default is to use pop3.el. 803 ;; The default is to use pop3.el.
803 (t 804 (t
805 (require 'pop3)
804 (let ((pop3-password password) 806 (let ((pop3-password password)
805 (pop3-maildrop user) 807 (pop3-maildrop user)
806 (pop3-mailhost server) 808 (pop3-mailhost server)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 8ac3bb8cf18..06039347acc 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -6565,9 +6565,8 @@ which specify the range to operate on."
6565 6565
6566(defun message-tool-bar-local-item-from-menu (command icon in-map &optional from-map &rest props) 6566(defun message-tool-bar-local-item-from-menu (command icon in-map &optional from-map &rest props)
6567 ;; We need to make tool bar entries in local keymaps with 6567 ;; We need to make tool bar entries in local keymaps with
6568 ;; `tool-bar-local-item-from-menu' in Emacs > 21.3 6568 ;; `tool-bar-local-item-from-menu' in Emacs >= 22
6569 (if (fboundp 'tool-bar-local-item-from-menu) 6569 (if (fboundp 'tool-bar-local-item-from-menu)
6570 ;; This is for Emacs 21.3
6571 (tool-bar-local-item-from-menu command icon in-map from-map props) 6570 (tool-bar-local-item-from-menu command icon in-map from-map props)
6572 (tool-bar-add-item-from-menu command icon from-map props))) 6571 (tool-bar-add-item-from-menu command icon from-map props)))
6573 6572
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el
index 84c46e936a3..d03a25c4564 100644
--- a/lisp/gnus/rfc2047.el
+++ b/lisp/gnus/rfc2047.el
@@ -812,6 +812,85 @@ it, put the following line in your ~/.gnus.el file:
812(defvar rfc2047-quote-decoded-words-containing-tspecials nil 812(defvar rfc2047-quote-decoded-words-containing-tspecials nil
813 "If non-nil, quote decoded words containing special characters.") 813 "If non-nil, quote decoded words containing special characters.")
814 814
815(defvar rfc2047-allow-incomplete-encoded-text t
816 "*Non-nil means allow incomplete encoded-text in successive encoded-words.
817Dividing of encoded-text in the place other than character boundaries
818violates RFC2047 section 5, while we have a capability to decode it.
819If it is non-nil, the decoder will decode B- or Q-encoding in each
820encoded-word, concatenate them, and decode it by charset. Otherwise,
821the decoder will fully decode each encoded-word before concatenating
822them.")
823
824(defun rfc2047-charset-to-coding-system (charset)
825 "Return coding-system corresponding to MIME CHARSET.
826If your Emacs implementation can't decode CHARSET, return nil."
827 (when (stringp charset)
828 (setq charset (intern (downcase charset))))
829 (when (or (not charset)
830 (eq 'gnus-all mail-parse-ignored-charsets)
831 (memq 'gnus-all mail-parse-ignored-charsets)
832 (memq charset mail-parse-ignored-charsets))
833 (setq charset mail-parse-charset))
834 (let ((cs (mm-coding-system-p (mm-charset-to-coding-system charset))))
835 (cond ((eq cs 'ascii)
836 (setq cs (or (mm-charset-to-coding-system mail-parse-charset)
837 'raw-text)))
838 (cs)
839 ((and charset
840 (listp mail-parse-ignored-charsets)
841 (memq 'gnus-unknown mail-parse-ignored-charsets))
842 (setq cs (mm-charset-to-coding-system mail-parse-charset))))
843 (if (eq cs 'ascii)
844 'raw-text
845 cs)))
846
847(defun rfc2047-decode-encoded-words (words)
848 "Decode successive encoded-words in WORDS and return a decoded string.
849Each element of WORDS looks like (CHARSET ENCODING ENCODED-TEXT
850ENCODED-WORD)."
851 (let (word charset cs encoding text rest)
852 (while words
853 (setq word (pop words))
854 (if (and (or (setq cs (rfc2047-charset-to-coding-system
855 (setq charset (car word))))
856 (progn
857 (message "Unknown charset: %s" charset)
858 nil))
859 (condition-case code
860 (cond ((char-equal ?B (nth 1 word))
861 (setq text (base64-decode-string
862 (rfc2047-pad-base64 (nth 2 word)))))
863 ((char-equal ?Q (nth 1 word))
864 (setq text (quoted-printable-decode-string
865 (mm-subst-char-in-string
866 ?_ ? (nth 2 word) t)))))
867 (error
868 (message "%s" (error-message-string code))
869 nil)))
870 (if (and rfc2047-allow-incomplete-encoded-text
871 (eq cs (caar rest)))
872 ;; Concatenate text of which the charset is the same.
873 (setcdr (car rest) (concat (cdar rest) text))
874 (push (cons cs text) rest))
875 ;; Don't decode encoded-word.
876 (push (cons nil (nth 3 word)) rest)))
877 (while rest
878 (setq words (concat
879 (or (and (setq cs (caar rest))
880 (condition-case code
881 (mm-decode-coding-string (cdar rest) cs)
882 (error
883 (message "%s" (error-message-string code))
884 nil)))
885 (concat (when (cdr rest) " ")
886 (cdar rest)
887 (when (and words
888 (not (eq (string-to-char words) ? )))
889 " ")))
890 words)
891 rest (cdr rest)))
892 words))
893
815;; Fixme: This should decode in place, not cons intermediate strings. 894;; Fixme: This should decode in place, not cons intermediate strings.
816;; Also check whether it needs to worry about delimiting fields like 895;; Also check whether it needs to worry about delimiting fields like
817;; encoding. 896;; encoding.
@@ -826,32 +905,32 @@ it, put the following line in your ~/.gnus.el file:
826 "Decode MIME-encoded words in region between START and END." 905 "Decode MIME-encoded words in region between START and END."
827 (interactive "r") 906 (interactive "r")
828 (let ((case-fold-search t) 907 (let ((case-fold-search t)
829 b e) 908 (eword-regexp (eval-when-compile
909 ;; Ignore whitespace between encoded-words.
910 (concat "[\n\t ]*\\(" rfc2047-encoded-word-regexp
911 "\\)")))
912 b e match words)
830 (save-excursion 913 (save-excursion
831 (save-restriction 914 (save-restriction
832 (narrow-to-region start end) 915 (narrow-to-region start end)
833 (goto-char (point-min)) 916 (goto-char (setq b start))
834 ;; Remove whitespace between encoded words. 917 ;; Look for the encoded-words.
835 (while (re-search-forward 918 (while (setq match (re-search-forward eword-regexp nil t))
836 (eval-when-compile 919 (setq e (match-beginning 1)
837 (concat "\\(" rfc2047-encoded-word-regexp "\\)" 920 end (match-end 0)
838 "\\(\n?[ \t]\\)+" 921 words nil)
839 "\\(" rfc2047-encoded-word-regexp "\\)")) 922 (while match
840 nil t) 923 (push (list (match-string 2) ;; charset
841 (delete-region (goto-char (match-end 1)) (match-beginning 7))) 924 (char-after (match-beginning 4)) ;; encoding
842 ;; Decode the encoded words. 925 (match-string 5) ;; encoded-text
843 (setq b (goto-char (point-min))) 926 (match-string 1)) ;; encoded-word
844 (while (re-search-forward rfc2047-encoded-word-regexp nil t) 927 words)
845 (setq e (match-beginning 0)) 928 ;; Look for the subsequent encoded-words.
846 (insert (rfc2047-parse-and-decode 929 (when (setq match (looking-at eword-regexp))
847 (prog1 930 (goto-char (setq end (match-end 0)))))
848 (match-string 0) 931 ;; Replace the encoded-words with the decoded one.
849 (delete-region e (match-end 0))))) 932 (delete-region e end)
850 (while (looking-at rfc2047-encoded-word-regexp) 933 (insert (rfc2047-decode-encoded-words (nreverse words)))
851 (insert (rfc2047-parse-and-decode
852 (prog1
853 (match-string 0)
854 (delete-region (point) (match-end 0))))))
855 (save-restriction 934 (save-restriction
856 (narrow-to-region e (point)) 935 (narrow-to-region e (point))
857 (goto-char e) 936 (goto-char e)
@@ -957,21 +1036,6 @@ it, put the following line in your ~/.gnus.el file:
957 (mm-decode-coding-string string mail-parse-charset)) 1036 (mm-decode-coding-string string mail-parse-charset))
958 (mm-string-as-multibyte string))))) 1037 (mm-string-as-multibyte string)))))
959 1038
960(defun rfc2047-parse-and-decode (word)
961 "Decode WORD and return it if it is an encoded word.
962Return WORD if it is not not an encoded word or if the charset isn't
963decodable."
964 (if (not (string-match rfc2047-encoded-word-regexp word))
965 word
966 (or
967 (condition-case nil
968 (rfc2047-decode
969 (match-string 1 word)
970 (string-to-char (match-string 3 word))
971 (match-string 4 word))
972 (error word))
973 word))) ; un-decodable
974
975(defun rfc2047-pad-base64 (string) 1039(defun rfc2047-pad-base64 (string)
976 "Pad STRING to quartets." 1040 "Pad STRING to quartets."
977 ;; Be more liberal to accept buggy base64 strings. If 1041 ;; Be more liberal to accept buggy base64 strings. If
@@ -987,36 +1051,6 @@ decodable."
987 (2 (concat string "==")) 1051 (2 (concat string "=="))
988 (3 (concat string "="))))) 1052 (3 (concat string "=")))))
989 1053
990(defun rfc2047-decode (charset encoding string)
991 "Decode STRING from the given MIME CHARSET in the given ENCODING.
992Valid ENCODINGs are the characters \"B\" and \"Q\".
993If your Emacs implementation can't decode CHARSET, return nil."
994 (if (stringp charset)
995 (setq charset (intern (downcase charset))))
996 (if (or (not charset)
997 (eq 'gnus-all mail-parse-ignored-charsets)
998 (memq 'gnus-all mail-parse-ignored-charsets)
999 (memq charset mail-parse-ignored-charsets))
1000 (setq charset mail-parse-charset))
1001 (let ((cs (mm-charset-to-coding-system charset)))
1002 (if (and (not cs) charset
1003 (listp mail-parse-ignored-charsets)
1004 (memq 'gnus-unknown mail-parse-ignored-charsets))
1005 (setq cs (mm-charset-to-coding-system mail-parse-charset)))
1006 (when cs
1007 (when (eq cs 'ascii)
1008 (setq cs (or mail-parse-charset 'raw-text)))
1009 (mm-decode-coding-string
1010 (cond
1011 ((char-equal ?B encoding)
1012 (base64-decode-string
1013 (rfc2047-pad-base64 string)))
1014 ((char-equal ?Q encoding)
1015 (quoted-printable-decode-string
1016 (mm-subst-char-in-string ?_ ? string t)))
1017 (t (error "Invalid encoding: %c" encoding)))
1018 cs))))
1019
1020(provide 'rfc2047) 1054(provide 'rfc2047)
1021 1055
1022;;; arch-tag: a07fe3d4-22b5-4c4a-bd89-b1f82d5d36f6 1056;;; arch-tag: a07fe3d4-22b5-4c4a-bd89-b1f82d5d36f6
diff --git a/man/ChangeLog b/man/ChangeLog
index c8c90922565..1fef69e81a3 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,7 @@
12005-10-17 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus.texi (Document Groups): Remove duplicate item.
4
12005-10-21 Juri Linkov <juri@jurta.org> 52005-10-21 Juri Linkov <juri@jurta.org>
2 6
3 * custom.texi (Examining): Mention accessing the old variable 7 * custom.texi (Examining): Mention accessing the old variable
diff --git a/man/gnus.texi b/man/gnus.texi
index 1a66bd763e0..cbd8554c382 100644
--- a/man/gnus.texi
+++ b/man/gnus.texi
@@ -16753,12 +16753,11 @@ as a newsgroup. Several files types are supported:
16753@table @code 16753@table @code
16754@cindex Babyl 16754@cindex Babyl
16755@cindex Rmail mbox 16755@cindex Rmail mbox
16756
16757@item babyl 16756@item babyl
16758The Babyl (Rmail) mail box. 16757The Babyl (Rmail) mail box.
16758
16759@cindex mbox 16759@cindex mbox
16760@cindex Unix mbox 16760@cindex Unix mbox
16761
16762@item mbox 16761@item mbox
16763The standard Unix mbox file. 16762The standard Unix mbox file.
16764 16763
@@ -16769,13 +16768,9 @@ The MMDF mail box format.
16769@item news 16768@item news
16770Several news articles appended into a file. 16769Several news articles appended into a file.
16771 16770
16772@item rnews
16773@cindex rnews batch files 16771@cindex rnews batch files
16772@item rnews
16774The rnews batch transport format. 16773The rnews batch transport format.
16775@cindex forwarded messages
16776
16777@item forward
16778Forwarded articles.
16779 16774
16780@item nsmail 16775@item nsmail
16781Netscape mail boxes. 16776Netscape mail boxes.
@@ -16792,6 +16787,7 @@ A @acronym{MIME} digest of messages.
16792@item lanl-gov-announce 16787@item lanl-gov-announce
16793Announcement messages from LANL Gov Announce. 16788Announcement messages from LANL Gov Announce.
16794 16789
16790@cindex forwarded messages
16795@item rfc822-forward 16791@item rfc822-forward
16796A message forwarded according to RFC822. 16792A message forwarded according to RFC822.
16797 16793