aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-10-18 11:05:28 +0000
committerDave Love2002-10-18 11:05:28 +0000
commit56e09c0969fc0ce70d3544158b612a77ac55799a (patch)
treeb37db9309e304070b471a030d3c06ebf59f97b15
parent5d54c59d41a9d9471c24134fde8f82cb293d3017 (diff)
downloademacs-56e09c0969fc0ce70d3544158b612a77ac55799a.tar.gz
emacs-56e09c0969fc0ce70d3544158b612a77ac55799a.zip
(mm-mime-mule-charset-alist): Require when compiling.
(mm-auto-save-coding-system): Prefer utf-8-emacs coding system to emacs-mule. (mm-find-mime-charset-region): Fix :mime-charset part. (mm-mule-charset-to-mime-charset, mm-charset-to-coding-system) (mm-mime-charset, mm-find-mime-charset-region): Look for `:mime-charset' property of coding systems before `mime-charset'. (mm-mule4-p, mm-enable-multibyte-mule4, mm-disable-multibyte-mule4) (mm-with-unibyte-current-buffer-mule4): Deleted. (mm-point-at-bol, mm-point-at-eol, mm-insert-byte) (multibyte-char-to-unibyte): New.
-rw-r--r--lisp/gnus/ChangeLog52
-rw-r--r--lisp/gnus/mm-util.el91
2 files changed, 90 insertions, 53 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index d456d3a96b9..317a22c62a0 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,53 @@
12002-10-18 Dave Love <fx@gnu.org>
2
3 * mm-util.el (mm-mime-mule-charset-alist): Require when compiling.
4 (mm-auto-save-coding-system): Prefer utf-8-emacs coding system to
5 emacs-mule.
6 (mm-find-mime-charset-region): Fix :mime-charset part.
7 (mm-mule-charset-to-mime-charset, mm-charset-to-coding-system)
8 (mm-mime-charset, mm-find-mime-charset-region): Look for
9 `:mime-charset' property of coding systems before `mime-charset'.
10 (mm-mule4-p, mm-enable-multibyte-mule4, mm-disable-multibyte-mule4)
11 (mm-with-unibyte-current-buffer-mule4): Deleted.
12 (mm-point-at-bol, mm-point-at-eol, mm-insert-byte)
13 (multibyte-char-to-unibyte): New.
14
15 * rfc2047.el (message-posting-charset): defvar when compiling.
16 (ietf-drums, gnus-util): Don't require.
17 (rfc2047-header-encoding-alist): Add `address-mime' part. Doc
18 fixes.
19 (rfc2047-charset-encoding-alist): Use B for iso-8859-7,
20 iso-8859-8.
21 (rfc2047-q-encoding-alist): Augment header list.
22 (rfc2047-encoding-type): New.
23 (rfc2047-dissect-region): Deleted.
24 (rfc2047-encode-region, rfc2047-encode): Rewritten to take
25 account of rfc2047 rules with respect to rfc2822 tokens and to do
26 encoding in place rather than by passing strings.
27 (rfc2047-encode-message-header): Don't include header name field
28 in encoding. Add `address-mime' case and bind
29 rfc2047-encoding-type for `mime' case.
30 (rfc2047-encode-string): Doc fix.
31 (rfc2047-encode): Use longer chunks for base64.
32 (rfc2047-fold-region): Insert single characters, not strings.
33 (rfc2047-encoded-word-regexp): Wrap in eval-and-compile.
34 (rfc2047-decode-region): Avoid consing regexp in loop.
35
36 * gnus-sum.el (gnus-summary-mode, gnus-summary-display-article)
37 (gnus-summary-select-article, gnus-summary-edit-article): Use
38 mm-{en,dis}able-multibyte, not mm-{en,dis}able-multibyte-mule4.
39
40 * message.el (message-forward-make-body): Use
41 mm-{en,dis}able-multibyte, not mm-{en,dis}able-multibyte-mule4.
42
43 * qp.el (quoted-printable-encode-region): Use mm-insert-byte.
44 Maybe use string-to-multibyte. Avoid find-charset-region. Cope
45 with encoding Emacs 22 eight-bit chars.
46
47 * mm-bodies.el (mm-body-7-or-8): Don't special-case Mule.
48 (mm-encode-body): Just call mm-encode-coding-region in encoding
49 case.
50
12002-10-17 Juanma Barranquero <lektu@terra.es> 512002-10-17 Juanma Barranquero <lektu@terra.es>
2 52
3 * nnweb.el (nnweb-dejanews-create-mapping) 53 * nnweb.el (nnweb-dejanews-create-mapping)
@@ -10972,6 +11022,6 @@
10972;; coding: iso-2022-7bit 11022;; coding: iso-2022-7bit
10973;; End: 11023;; End:
10974 11024
10975 Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. 11025 Copyright (C) 2002 Free Software Foundation, Inc.
10976 Copying and distribution of this file, with or without modification, 11026 Copying and distribution of this file, with or without modification,
10977 are permitted provided the copyright notice and this notice are preserved. 11027 are permitted provided the copyright notice and this notice are preserved.
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index e540558e75e..1bfa63663c9 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -24,7 +24,9 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(eval-when-compile (require 'cl)) 27(eval-when-compile
28 (require 'cl)
29 (defvar mm-mime-mule-charset-alist))
28(require 'mail-prsvr) 30(require 'mail-prsvr)
29 31
30(eval-and-compile 32(eval-and-compile
@@ -70,7 +72,11 @@
70 string))) 72 string)))
71 (string-as-unibyte . identity) 73 (string-as-unibyte . identity)
72 (string-as-multibyte . identity) 74 (string-as-multibyte . identity)
73 (multibyte-string-p . ignore)))) 75 (multibyte-string-p . ignore)
76 (point-at-bol . line-beginning-position)
77 (point-at-eol . line-end-position)
78 (insert-byte . insert-char)
79 (multibyte-char-to-unibyte . identity))))
74 80
75(eval-and-compile 81(eval-and-compile
76 (defalias 'mm-char-or-char-int-p 82 (defalias 'mm-char-or-char-int-p
@@ -117,6 +123,7 @@
117 ,@(unless (mm-coding-system-p 'gb2312) 123 ,@(unless (mm-coding-system-p 'gb2312)
118 '((gb2312 . cn-gb-2312))) 124 '((gb2312 . cn-gb-2312)))
119 ;; ISO-8859-15 is very similar to ISO-8859-1. 125 ;; ISO-8859-15 is very similar to ISO-8859-1.
126 ;; But this is just wrong. --fx
120 ,@(unless (mm-coding-system-p 'iso-8859-15) ; Emacs 21 defines it. 127 ,@(unless (mm-coding-system-p 'iso-8859-15) ; Emacs 21 defines it.
121 '((iso-8859-15 . iso-8859-1))) 128 '((iso-8859-15 . iso-8859-1)))
122 ;; Windows-1252 is actually a superset of Latin-1. See also 129 ;; Windows-1252 is actually a superset of Latin-1. See also
@@ -128,6 +135,10 @@
128 ;; Windows-1250 is a variant of Latin-2 heavily used by Microsoft 135 ;; Windows-1250 is a variant of Latin-2 heavily used by Microsoft
129 ;; Outlook users in Czech republic. Use this to allow reading of their 136 ;; Outlook users in Czech republic. Use this to allow reading of their
130 ;; e-mails. cp1250 should be defined by M-x codepage-setup. 137 ;; e-mails. cp1250 should be defined by M-x codepage-setup.
138
139 ;; This is not TRT, the MIME name, windows-1250, should be an
140 ;; alias, and cp1250 should have a mime-charset property, per
141 ;; code-page.el. -- fx
131 ,@(if (and (not (mm-coding-system-p 'windows-1250)) 142 ,@(if (and (not (mm-coding-system-p 'windows-1250))
132 (mm-coding-system-p 'cp1250)) 143 (mm-coding-system-p 'cp1250))
133 '((windows-1250 . cp1250))) 144 '((windows-1250 . cp1250)))
@@ -153,6 +164,11 @@
153 164
154(defvar mm-auto-save-coding-system 165(defvar mm-auto-save-coding-system
155 (cond 166 (cond
167 ((mm-coding-system-p 'utf-8-emacs)
168 (if (memq system-type '(windows-nt ms-dos ms-windows))
169 (if (mm-coding-system-p 'utf-8-emacs-dos)
170 'utf-8-emacs-dos mm-binary-coding-system)
171 'utf-8-emacs))
156 ((mm-coding-system-p 'emacs-mule) 172 ((mm-coding-system-p 'emacs-mule)
157 (if (memq system-type '(windows-nt ms-dos ms-windows)) 173 (if (memq system-type '(windows-nt ms-dos ms-windows))
158 (if (mm-coding-system-p 'emacs-mule-dos) 174 (if (mm-coding-system-p 'emacs-mule-dos)
@@ -231,9 +247,11 @@
231 'nconc 247 'nconc
232 (mapcar 248 (mapcar
233 (lambda (cs) 249 (lambda (cs)
234 (when (and (coding-system-get cs 'mime-charset) 250 (when (and (or (coding-system-get cs :mime-charset) ; Emacs 22
251 (coding-system-get cs 'mime-charset))
235 (not (eq t (coding-system-get cs 'safe-charsets)))) 252 (not (eq t (coding-system-get cs 'safe-charsets))))
236 (list (cons (coding-system-get cs 'mime-charset) 253 (list (cons (or (coding-system-get cs :mime-charset)
254 (coding-system-get cs 'mime-charset))
237 (delq 'ascii 255 (delq 'ascii
238 (coding-system-get cs 'safe-charsets)))))) 256 (coding-system-get cs 'safe-charsets))))))
239 (sort-coding-systems (coding-system-list 'base-only)))))) 257 (sort-coding-systems (coding-system-list 'base-only))))))
@@ -281,6 +299,7 @@ prefer iso-2022-jp to japanese-shift-jis:
281 '(iso-2022-jp iso-2022-jp-2 japanese-shift-jis utf-8)) 299 '(iso-2022-jp iso-2022-jp-2 japanese-shift-jis utf-8))
282") 300")
283 301
302;; Why on earth was this broken out? -- fx
284(defvar mm-use-find-coding-systems-region 303(defvar mm-use-find-coding-systems-region
285 (fboundp 'find-coding-systems-region) 304 (fboundp 'find-coding-systems-region)
286 "Use `find-coding-systems-region' to find proper coding systems.") 305 "Use `find-coding-systems-region' to find proper coding systems.")
@@ -296,7 +315,8 @@ prefer iso-2022-jp to japanese-shift-jis:
296 (dolist (cs (find-coding-systems-for-charsets (list charset))) 315 (dolist (cs (find-coding-systems-for-charsets (list charset)))
297 (unless mime 316 (unless mime
298 (when cs 317 (when cs
299 (setq mime (coding-system-get cs 'mime-charset))))) 318 (setq mime (or (coding-system-get cs :mime-charset)
319 (coding-system-get cs 'mime-charset))))))
300 mime) 320 mime)
301 (let ((alist mm-mime-mule-charset-alist) 321 (let ((alist mm-mime-mule-charset-alist)
302 out) 322 out)
@@ -345,7 +365,8 @@ used as the line break code type of the coding system."
345 ;; Do we need -lbt? 365 ;; Do we need -lbt?
346 (dolist (c (mm-get-coding-system-list)) 366 (dolist (c (mm-get-coding-system-list))
347 (if (and (null cs) 367 (if (and (null cs)
348 (eq charset (coding-system-get c 'mime-charset))) 368 (eq charset (or (coding-system-get c :mime-charset)
369 (coding-system-get c 'mime-charset))))
349 (setq cs c))) 370 (setq cs c)))
350 cs)))) 371 cs))))
351 372
@@ -357,12 +378,7 @@ used as the line break code type of the coding system."
357 (boundp 'default-enable-multibyte-characters) 378 (boundp 'default-enable-multibyte-characters)
358 default-enable-multibyte-characters 379 default-enable-multibyte-characters
359 (fboundp 'set-buffer-multibyte)) 380 (fboundp 'set-buffer-multibyte))
360 "Emacs mule.") 381 "True in Emacs with Mule.")
361
362 (defvar mm-mule4-p (and mm-emacs-mule
363 (fboundp 'charsetp)
364 (not (charsetp 'eight-bit-control)))
365 "Mule version 4.")
366 382
367 (if mm-emacs-mule 383 (if mm-emacs-mule
368 (defun mm-enable-multibyte () 384 (defun mm-enable-multibyte ()
@@ -377,21 +393,7 @@ non-nil. This is a no-op in XEmacs."
377 "Unset the multibyte flag of in the current buffer. 393 "Unset the multibyte flag of in the current buffer.
378This is a no-op in XEmacs." 394This is a no-op in XEmacs."
379 (set-buffer-multibyte nil)) 395 (set-buffer-multibyte nil))
380 (defalias 'mm-disable-multibyte 'ignore)) 396 (defalias 'mm-disable-multibyte 'ignore)))
381
382 (if mm-mule4-p
383 (defun mm-enable-multibyte-mule4 ()
384 "Enable multibyte in the current buffer.
385Only used in Emacs Mule 4."
386 (set-buffer-multibyte t))
387 (defalias 'mm-enable-multibyte-mule4 'ignore))
388
389 (if mm-mule4-p
390 (defun mm-disable-multibyte-mule4 ()
391 "Disable multibyte in the current buffer.
392Only used in Emacs Mule 4."
393 (set-buffer-multibyte nil))
394 (defalias 'mm-disable-multibyte-mule4 'ignore)))
395 397
396(defun mm-preferred-coding-system (charset) 398(defun mm-preferred-coding-system (charset)
397 ;; A typo in some Emacs versions. 399 ;; A typo in some Emacs versions.
@@ -408,7 +410,7 @@ If the charset is `composition', return the actual one."
408 (setq charset 'ascii) 410 (setq charset 'ascii)
409 ;; charset-after is fake in some Emacsen. 411 ;; charset-after is fake in some Emacsen.
410 (setq charset (and (fboundp 'char-charset) (char-charset char))) 412 (setq charset (and (fboundp 'char-charset) (char-charset char)))
411 (if (eq charset 'composition) 413 (if (eq charset 'composition) ; Mule 4
412 (let ((p (or pos (point)))) 414 (let ((p (or pos (point))))
413 (cadr (find-charset-region p (1+ p)))) 415 (cadr (find-charset-region p (1+ p))))
414 (if (and charset (not (memq charset '(ascii eight-bit-control 416 (if (and charset (not (memq charset '(ascii eight-bit-control
@@ -440,8 +442,10 @@ If the charset is `composition', return the actual one."
440 ;; This exists in Emacs 20. 442 ;; This exists in Emacs 20.
441 (or 443 (or
442 (and (mm-preferred-coding-system charset) 444 (and (mm-preferred-coding-system charset)
443 (coding-system-get 445 (or (coding-system-get
444 (mm-preferred-coding-system charset) 'mime-charset)) 446 (mm-preferred-coding-system charset) :mime-charset)
447 (coding-system-get
448 (mm-preferred-coding-system charset) 'mime-charset)))
445 (and (eq charset 'ascii) 449 (and (eq charset 'ascii)
446 'us-ascii) 450 'us-ascii)
447 (mm-preferred-coding-system charset) 451 (mm-preferred-coding-system charset)
@@ -510,7 +514,9 @@ charset, and a longer list means no appropriate charset."
510 (setq systems (delq 'compound-text systems)) 514 (setq systems (delq 'compound-text systems))
511 (unless (equal systems '(undecided)) 515 (unless (equal systems '(undecided))
512 (while systems 516 (while systems
513 (let ((cs (coding-system-get (pop systems) 'mime-charset))) 517 (let* ((head (pop systems))
518 (cs (or (coding-system-get head :mime-charset)
519 (coding-system-get head 'mime-charset))))
514 (if cs 520 (if cs
515 (setq systems nil 521 (setq systems nil
516 charsets (list cs)))))) 522 charsets (list cs))))))
@@ -541,7 +547,7 @@ Use unibyte mode for this."
541(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body)) 547(put 'mm-with-unibyte-buffer 'edebug-form-spec '(body))
542 548
543(defmacro mm-with-unibyte-current-buffer (&rest forms) 549(defmacro mm-with-unibyte-current-buffer (&rest forms)
544 "Evaluate FORMS with current current buffer temporarily made unibyte. 550 "Evaluate FORMS with current buffer temporarily made unibyte.
545Also bind `default-enable-multibyte-characters' to nil. 551Also bind `default-enable-multibyte-characters' to nil.
546Equivalent to `progn' in XEmacs" 552Equivalent to `progn' in XEmacs"
547 (let ((multibyte (make-symbol "multibyte")) 553 (let ((multibyte (make-symbol "multibyte"))
@@ -560,25 +566,6 @@ Equivalent to `progn' in XEmacs"
560(put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0) 566(put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
561(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body)) 567(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
562 568
563(defmacro mm-with-unibyte-current-buffer-mule4 (&rest forms)
564 "Evaluate FORMS there like `progn' in current buffer.
565Mule4 only."
566 (let ((multibyte (make-symbol "multibyte"))
567 (buffer (make-symbol "buffer")))
568 `(if mm-mule4-p
569 (let ((,multibyte enable-multibyte-characters)
570 (,buffer (current-buffer)))
571 (unwind-protect
572 (let (default-enable-multibyte-characters)
573 (set-buffer-multibyte nil)
574 ,@forms)
575 (set-buffer ,buffer)
576 (set-buffer-multibyte ,multibyte)))
577 (let (default-enable-multibyte-characters)
578 ,@forms))))
579(put 'mm-with-unibyte-current-buffer-mule4 'lisp-indent-function 0)
580(put 'mm-with-unibyte-current-buffer-mule4 'edebug-form-spec '(body))
581
582(defmacro mm-with-unibyte (&rest forms) 569(defmacro mm-with-unibyte (&rest forms)
583 "Eval the FORMS with the default value of `enable-multibyte-characters' nil, ." 570 "Eval the FORMS with the default value of `enable-multibyte-characters' nil, ."
584 `(let (default-enable-multibyte-characters) 571 `(let (default-enable-multibyte-characters)
@@ -655,7 +642,7 @@ Mule4 only."
655A buffer may be modified in several ways after reading into the buffer due 642A buffer may be modified in several ways after reading into the buffer due
656to advanced Emacs features, such as file-name-handlers, format decoding, 643to advanced Emacs features, such as file-name-handlers, format decoding,
657find-file-hooks, etc. 644find-file-hooks, etc.
658If INHIBIT is non-nil, inhibit mm-inhibit-file-name-handlers. 645If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'.
659 This function ensures that none of these modifications will take place." 646 This function ensures that none of these modifications will take place."
660 (let ((format-alist nil) 647 (let ((format-alist nil)
661 (auto-mode-alist (if inhibit nil (mm-auto-mode-alist))) 648 (auto-mode-alist (if inhibit nil (mm-auto-mode-alist)))