From 0683d2414d4de8626f7c46f59937f9bef27302ce Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 4 Nov 2004 08:12:39 +0000 Subject: [PATCH] Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-66 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-68 Update from CVS 2004-11-04 Katsumi Yamaoka * lisp/gnus/gnus-art. (gnus-article-edit-article): Don't associate the article buffer with a draft file. This is a temporary measure against the 2004-08-22 change to gnus-article-edit-mode. 2004-11-02 Katsumi Yamaoka * lisp/gnus/html2text.el (html2text-get-attr): Remove unused argument `tag'. (html2text-format-tags): Remove unused variable `attr'. * lisp/gnus/mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of after-load-alist. * lisp/gnus/mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 entry. From Ilya N. Golubev . (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is loaded under XEmacs. (): Don't make duplicated entries in mm-mime-mule-charset-alist. * lisp/gnus/mm-util.el (mm-coding-system-p): Return a coding-system. (mm-mime-mule-charset-alist): Use shift_jis instead of iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new entries for the mime charsets iso-2022-jp-3 and shift_jis. (mm-coding-system-priorities): Use shift_jis and iso-8859-1 instead of japanese-shift-jis and iso-latin-1 respectively in order to share the default value with both Emacs and XEmacs-mule. (mm-mule-charset-to-mime-charset): Make mm-coding-system-priorities effective. (mm-sort-coding-systems-predicate): Canonicalize coding-systems while predicating of candidates upon the priorities. 2004-11-02 Katsumi Yamaoka * man/emacs-mime.texi (Encoding Customization): Fix mm-coding-system-priorities entry. --- lisp/gnus/ChangeLog | 32 +++++++++++++ lisp/gnus/gnus-art.el | 5 +- lisp/gnus/html2text.el | 7 ++- lisp/gnus/mm-util.el | 106 +++++++++++++++++++++++++++-------------- man/ChangeLog | 5 ++ man/emacs-mime.texi | 8 ++-- 6 files changed, 119 insertions(+), 44 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index df6fa771f87..0b93724e9e5 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,35 @@ +2004-11-04 Katsumi Yamaoka + + * gnus-art. (gnus-article-edit-article): Don't associate the + article buffer with a draft file. This is a temporary measure + against the 2004-08-22 change to gnus-article-edit-mode. + +2004-11-02 Katsumi Yamaoka + + * html2text.el (html2text-get-attr): Remove unused argument `tag'. + (html2text-format-tags): Remove unused variable `attr'. + + * mm-util.el (mm-enrich-utf-8-by-mule-ucs): Fix cleaning of + after-load-alist. + + * mm-util.el (mm-mime-mule-charset-alist): Add the windows-1251 + entry. From Ilya N. Golubev . + (mm-enrich-utf-8-by-mule-ucs): New function run when Mule-UCS is + loaded under XEmacs. + (): Don't make duplicated entries in mm-mime-mule-charset-alist. + + * mm-util.el (mm-coding-system-p): Return a coding-system. + (mm-mime-mule-charset-alist): Use shift_jis instead of + iso-2022-jp-2 for the katakana-jisx0201 mule charset; add new + entries for the mime charsets iso-2022-jp-3 and shift_jis. + (mm-coding-system-priorities): Use shift_jis and iso-8859-1 + instead of japanese-shift-jis and iso-latin-1 respectively in + order to share the default value with both Emacs and XEmacs-mule. + (mm-mule-charset-to-mime-charset): Make + mm-coding-system-priorities effective. + (mm-sort-coding-systems-predicate): Canonicalize coding-systems + while predicating of candidates upon the priorities. + 2004-11-01 Reiner Steib * gnus-msg.el (gnus-summary-resend-default-address): Add :version. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index d12186ca370..c0266300983 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -5651,7 +5651,10 @@ groups." "Start editing the contents of the current article buffer." (let ((winconf (current-window-configuration))) (set-buffer gnus-article-buffer) - (gnus-article-edit-mode) + (let ((message-auto-save-directory + ;; Don't associate the article buffer with a draft file. + nil)) + (gnus-article-edit-mode)) (funcall start-func) (set-buffer-modified-p nil) (gnus-configure-windows 'edit-article) diff --git a/lisp/gnus/html2text.el b/lisp/gnus/html2text.el index 7decfc8adb1..ef05af9bae6 100644 --- a/lisp/gnus/html2text.el +++ b/lisp/gnus/html2text.el @@ -144,7 +144,7 @@ formatting, and then moved afterward.") "Get value of ATTRIBUTE from LIST." (nth 1 (assoc attribute list))) -(defun html2text-get-attr (p1 p2 tag) +(defun html2text-get-attr (p1 p2) (goto-char p1) (re-search-forward " +[^ ]" p2 t) (let* ((attr-string (buffer-substring-no-properties (1- (point)) (1- p2))) @@ -320,7 +320,7 @@ formatting, and then moved afterward.") ;; If someone can explain how to make the URL clickable I will surely ;; improve upon this. ;; Maybe `goto-addr.el' can be used here. - (let* ((attr-list (html2text-get-attr p1 p2 "a")) + (let* ((attr-list (html2text-get-attr p1 p2)) (href (html2text-attr-value attr-list "href"))) (delete-region p1 p4) (when href @@ -418,8 +418,7 @@ See the documentation for that variable." (point-max) t) (let ((p1) (p2 (point)) - (p3) (p4) - (attr (match-string 1))) + (p3) (p4)) (search-backward "<" (point-min) t) (setq p1 (point)) (re-search-forward (format "" tag) (point-max) t) diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index b68b4ec584c..382133a027e 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -123,13 +123,16 @@ (defun mm-coding-system-p (cs) "Return non-nil if CS is a symbol naming a coding system. -In XEmacs, also return non-nil if CS is a coding system object." +In XEmacs, also return non-nil if CS is a coding system object. +If CS is available, return CS itself in Emacs, and return a coding +system object in XEmacs." (if (fboundp 'find-coding-system) (find-coding-system cs) (if (fboundp 'coding-system-p) - (coding-system-p cs) + (when (coding-system-p cs) + cs) ;; Is this branch ever actually useful? - (memq cs (mm-get-coding-system-list))))) + (car (memq cs (mm-get-coding-system-list)))))) (defvar mm-charset-synonym-alist `( @@ -219,12 +222,12 @@ In XEmacs, also return non-nil if CS is a coding system object." (big5 chinese-big5-1 chinese-big5-2) (tibetan tibetan) (thai-tis620 thai-tis620) + (windows-1251 cyrillic-iso8859-5) (iso-2022-7bit ethiopic arabic-1-column arabic-2-column) (iso-2022-jp-2 latin-iso8859-1 greek-iso8859-7 latin-jisx0201 japanese-jisx0208-1978 chinese-gb2312 japanese-jisx0208 - korean-ksc5601 japanese-jisx0212 - katakana-jisx0201) + korean-ksc5601 japanese-jisx0212) (iso-2022-int-1 latin-iso8859-1 greek-iso8859-7 latin-jisx0201 japanese-jisx0208-1978 chinese-gb2312 japanese-jisx0208 @@ -239,6 +242,9 @@ In XEmacs, also return non-nil if CS is a coding system object." chinese-cns11643-3 chinese-cns11643-4 chinese-cns11643-5 chinese-cns11643-6 chinese-cns11643-7) + (iso-2022-jp-3 latin-jisx0201 japanese-jisx0208-1978 japanese-jisx0208 + japanese-jisx0213-1 japanese-jisx0213-2) + (shift_jis latin-jisx0201 katakana-jisx0201 japanese-jisx0208) ,(if (or (not (fboundp 'charsetp)) ;; non-Mule case (charsetp 'unicode-a) (not (mm-coding-system-p 'mule-utf-8))) @@ -249,24 +255,47 @@ In XEmacs, also return non-nil if CS is a coding system object." (coding-system-get 'mule-utf-8 'safe-charsets))))) "Alist of MIME-charset/MULE-charsets.") -;; Correct by construction, but should be unnecessary: -;; XEmacs hates it. -(when (and (not (featurep 'xemacs)) - (fboundp 'coding-system-list) - (fboundp 'sort-coding-systems)) - (setq mm-mime-mule-charset-alist - (apply - 'nconc - (mapcar - (lambda (cs) - (when (and (or (coding-system-get cs :mime-charset) ; Emacs 22 - (coding-system-get cs 'mime-charset)) - (not (eq t (coding-system-get cs 'safe-charsets)))) - (list (cons (or (coding-system-get cs :mime-charset) - (coding-system-get cs 'mime-charset)) - (delq 'ascii - (coding-system-get cs 'safe-charsets)))))) - (sort-coding-systems (coding-system-list 'base-only)))))) +(defun mm-enrich-utf-8-by-mule-ucs () + "Make the `utf-8' MIME charset usable by the Mule-UCS package. +This function will run when the `un-define' module is loaded under +XEmacs, and fill the `utf-8' entry in `mm-mime-mule-charset-alist' +with Mule charsets. It is completely useless for Emacs." + (unless (cdr (delete '(mm-enrich-utf-8-by-mule-ucs) + (assoc "un-define" after-load-alist))) + (setq after-load-alist + (delete '("un-define") after-load-alist))) + (when (boundp 'unicode-basic-translation-charset-order-list) + (condition-case nil + (let ((val (delq + 'ascii + (copy-sequence + (symbol-value + 'unicode-basic-translation-charset-order-list)))) + (elem (assq 'utf-8 mm-mime-mule-charset-alist))) + (if elem + (setcdr elem val) + (setq mm-mime-mule-charset-alist + (nconc mm-mime-mule-charset-alist + (list (cons 'utf-8 val)))))) + (error)))) + +;; Correct by construction, but should be unnecessary for Emacs: +(if (featurep 'xemacs) + (eval-after-load "un-define" '(mm-enrich-utf-8-by-mule-ucs)) + (when (and (fboundp 'coding-system-list) + (fboundp 'sort-coding-systems)) + (let ((css (sort-coding-systems (coding-system-list 'base-only))) + cs mime mule alist) + (while css + (setq cs (pop css) + mime (or (coding-system-get cs :mime-charset) ; Emacs 22 + (coding-system-get cs 'mime-charset))) + (when (and mime + (not (eq t (setq mule + (coding-system-get cs 'safe-charsets)))) + (not (assq mime alist))) + (push (cons mime (delq 'ascii mule)) alist))) + (setq mm-mime-mule-charset-alist (nreverse alist))))) (defvar mm-hack-charsets '(iso-8859-15 iso-2022-jp-2) "A list of special charsets. @@ -332,16 +361,20 @@ mail with multiple parts is preferred to sending a Unicode one.") "Return the MIME charset corresponding to the given Mule CHARSET." (if (and (fboundp 'find-coding-systems-for-charsets) (fboundp 'sort-coding-systems)) - (let (mime) - (dolist (cs (sort-coding-systems - (copy-sequence - (find-coding-systems-for-charsets (list charset))))) - (unless mime - (when cs - (setq mime (or (coding-system-get cs :mime-charset) - (coding-system-get cs 'mime-charset)))))) + (let ((css (sort (sort-coding-systems + (find-coding-systems-for-charsets (list charset))) + 'mm-sort-coding-systems-predicate)) + cs mime) + (while (and (not mime) + css) + (when (setq cs (pop css)) + (setq mime (or (coding-system-get cs :mime-charset) + (coding-system-get cs 'mime-charset))))) mime) - (let ((alist mm-mime-mule-charset-alist) + (let ((alist (mapcar (lambda (cs) + (assq cs mm-mime-mule-charset-alist)) + (sort (mapcar 'car mm-mime-mule-charset-alist) + 'mm-sort-coding-systems-predicate))) out) (while alist (when (memq charset (cdar alist)) @@ -534,11 +567,14 @@ This affects whether coding conversion should be attempted generally." (let ((priorities (mapcar (lambda (cs) ;; Note: invalid entries are dropped silently - (and (coding-system-p cs) + (and (setq cs (mm-coding-system-p cs)) (coding-system-base cs))) mm-coding-system-priorities))) - (> (length (memq a priorities)) - (length (memq b priorities))))) + (and (setq a (mm-coding-system-p a)) + (if (setq b (mm-coding-system-p b)) + (> (length (memq (coding-system-base a) priorities)) + (length (memq (coding-system-base b) priorities))) + t)))) (defun mm-find-mime-charset-region (b e &optional hack-charsets) "Return the MIME charsets needed to encode the region between B and E. diff --git a/man/ChangeLog b/man/ChangeLog index f80bb2fc502..22ac03e8677 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2004-11-02 Katsumi Yamaoka + + * emacs-mime.texi (Encoding Customization): Fix + mm-coding-system-priorities entry. + 2004-11-03 Jan Dj,Ad(Brv * frames.texi (Dialog Boxes): diff --git a/man/emacs-mime.texi b/man/emacs-mime.texi index d60e40ebbd0..c128ed096c3 100644 --- a/man/emacs-mime.texi +++ b/man/emacs-mime.texi @@ -814,12 +814,12 @@ by using the @code{encoding} @acronym{MML} tag (@pxref{MML Definition}). @vindex mm-coding-system-priorities Prioritize coding systems to use for outgoing messages. The default is @code{nil}, which means to use the defaults in Emacs. It is a list of -coding system symbols (aliases of coding systems does not work, use -@kbd{M-x describe-coding-system} to make sure you are not specifying -an alias in this variable). For example, if you have configured Emacs +coding system symbols (aliases of coding systems are also allowed, use +@kbd{M-x describe-coding-system} to make sure you are specifying correct +coding system names). For example, if you have configured Emacs to prefer UTF-8, but wish that outgoing messages should be sent in ISO-8859-1 if possible, you can set this variable to -@code{(iso-latin-1)}. You can override this setting on a per-message +@code{(iso-8859-1)}. You can override this setting on a per-message basis by using the @code{charset} @acronym{MML} tag (@pxref{MML Definition}). @item mm-content-transfer-encoding-defaults -- 2.39.2