2000-10-07 15:49:39 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 7 Oct 2000 19:18:19 +0000 (19:18 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Sat, 7 Oct 2000 19:18:19 +0000 (19:18 +0000)
* mm-util.el (mm-enable-multibyte-mule4): New.
(mm-disable-multibyte-mule4): New.
* gnus-sum.el (gnus-summary-mode): Use it.
(gnus-summary-select-article): Ditto.
(gnus-summary-goto-article): Use enable multibyte.
* rfc2047.el (rfc2047-decode): Use unibyte.

2000-10-07 15:42:59  ShengHuo ZHU  <zsh@cs.rochester.edu>

* gnus-logic.el (gnus-advanced-string): Use "" if nil.

lisp/ChangeLog
lisp/gnus-logic.el
lisp/gnus-sum.el
lisp/mm-util.el
lisp/rfc2047.el

index 34cec10..ece2f98 100644 (file)
@@ -1,3 +1,16 @@
+2000-10-07 15:49:39  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * mm-util.el (mm-enable-multibyte-mule4): New.
+       (mm-disable-multibyte-mule4): New.
+       * gnus-sum.el (gnus-summary-mode): Use it.
+       (gnus-summary-select-article): Ditto.
+       (gnus-summary-goto-article): Use enable multibyte.
+       * rfc2047.el (rfc2047-decode): Use unibyte.
+
+2000-10-07 15:42:59  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-logic.el (gnus-advanced-string): Use "" if nil.
+
 2000-10-07 10:31:05  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * rfc2047.el (rfc2047-q-encode-region): Better calculation of
index 56964ff..03b1c1c 100644 (file)
   (let* ((type (or type 's))
         (case-fold-search (not (eq (downcase (symbol-name type))
                                    (symbol-name type))))
-        (header (aref gnus-advanced-headers index)))
+        (header (or (aref gnus-advanced-headers index) "")))
     (cond
      ((memq type '(r R regexp Regexp))
       (string-match match header))
index bfb0d34..3fcae79 100644 (file)
@@ -2103,7 +2103,7 @@ The following commands are available:
   (make-local-hook 'pre-command-hook)
   (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
   (gnus-run-hooks 'gnus-summary-mode-hook)
-  (mm-enable-multibyte)
+  (mm-enable-multibyte-mule4)
   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
   (gnus-update-summary-mark-positions))
 
@@ -5896,12 +5896,12 @@ be displayed."
          (progn
            (when (gnus-buffer-live-p gnus-article-buffer)
              (with-current-buffer gnus-article-buffer
-               (mm-enable-multibyte)))
+               (mm-enable-multibyte-mule4)))
            (gnus-summary-display-article article all-headers)
            (when (gnus-buffer-live-p gnus-article-buffer)
-             (with-current-buffer gnus-article-buffer
+              (with-current-buffer gnus-article-buffer
                (if (not gnus-article-decoded-p) ;; a local variable
-                   (mm-disable-multibyte))))
+                   (mm-disable-multibyte-mule4))))
            (when (or all-headers gnus-show-all-headers)
              (gnus-article-show-all-headers))
            (gnus-article-set-window-start
@@ -6241,6 +6241,9 @@ is a number, it is the line the article is to be displayed on."
             gnus-newsgroup-limit))
     current-prefix-arg
     t))
+  (when (gnus-buffer-live-p gnus-article-buffer)
+    (with-current-buffer gnus-article-buffer
+      (mm-enable-multibyte-mule4)))
   (prog1
       (if (and (stringp article)
               (string-match "@" article))
@@ -7833,7 +7836,7 @@ groups."
        (gnus-summary-show-article t)
        (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
          (with-current-buffer gnus-article-buffer
-           (mm-enable-multibyte)))
+           (mm-enable-multibyte-mule4)))
        (if (equal gnus-newsgroup-name "nndraft:drafts")
            (setq raw t))
        (gnus-article-edit-article
index 5ce3dee..8b9b8c8 100644 (file)
@@ -227,6 +227,22 @@ used as the line break code type of the coding system."
   (when (fboundp 'set-buffer-multibyte)
     (set-buffer-multibyte nil)))
 
+(defsubst mm-enable-multibyte-mule4 ()
+  "Enable multibyte in the current buffer.
+Only used in Emacs Mule 4."
+  (when (and (fboundp 'set-buffer-multibyte)
+             (boundp 'enable-multibyte-characters)
+            (default-value 'enable-multibyte-characters)
+            (not (charsetp 'eight-bit-control)))
+    (set-buffer-multibyte t)))
+
+(defsubst mm-disable-multibyte-mule4 ()
+  "Disable multibyte in the current buffer.
+Only used in Emacs Mule 4."
+  (when (and (fboundp 'set-buffer-multibyte)
+            (not (charsetp 'eight-bit-control)))
+    (set-buffer-multibyte nil)))
+
 (defun mm-preferred-coding-system (charset)
   ;; A typo in some Emacs versions.
   (or (get-charset-property charset 'prefered-coding-system)
@@ -341,7 +357,7 @@ See also `with-temp-file' and `with-output-to-string'."
   (let ((multibyte (make-symbol "multibyte")))
     `(if (or (featurep 'xemacs)
             (not (fboundp 'set-buffer-multibyte))
-            (charsetp 'eight-bit-control))
+            (charsetp 'eight-bit-control)) ;; For Emacs Mule 4 only.
         (progn
           ,@forms)
        (let ((,multibyte (default-value 'enable-multibyte-characters)))
index 5c2e127..77a02cd 100644 (file)
@@ -294,8 +294,7 @@ Should be called narrowed to the head of the message."
       (while (not (eobp))
        (cond
         ((memq (char-after) '(?  ?\t))
-         ;; Break after LWSP.
-         (setq break (1+ (point))))
+         (setq break (point)))
         ((and (not break)
               (looking-at "=\\?"))
          (setq break (point)))
@@ -429,15 +428,17 @@ If your Emacs implementation can't decode CHARSET, it returns nil."
       (when (and (eq cs 'ascii)
                 mail-parse-charset)
        (setq cs mail-parse-charset))
-      (mm-decode-coding-string
-       (cond
-       ((equal "B" encoding)
-        (base64-decode-string string))
-       ((equal "Q" encoding)
-        (quoted-printable-decode-string
-         (mm-replace-chars-in-string string ?_ ? )))
-       (t (error "Invalid encoding: %s" encoding)))
-       cs))))
+      (mm-with-unibyte-current-buffer 
+       ;; In Emacs Mule 4, decoding UTF-8 should be in unibyte mode.
+       (mm-decode-coding-string
+        (cond
+         ((equal "B" encoding)
+          (base64-decode-string string))
+         ((equal "Q" encoding)
+          (quoted-printable-decode-string
+           (mm-replace-chars-in-string string ?_ ? )))
+         (t (error "Invalid encoding: %s" encoding)))
+        cs)))))
 
 (provide 'rfc2047)