Wash HZ.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 15 Dec 1999 04:44:13 +0000 (04:44 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 15 Dec 1999 04:44:13 +0000 (04:44 +0000)
lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-sum.el
lisp/gnus.el
lisp/rfc1843.el

index 8b06a79..b528c5e 100644 (file)
@@ -1,3 +1,9 @@
+1999-12-14 23:37:44  Shenghuo ZHU  <zsh@cs.rochester.edu>
+
+       * rfc1843.el (rfc1843-decode-region): Use
+       buffer-substring-no-properties.
+       * gnus-art.el (article-decode-HZ): New function.
+
 1999-12-14 22:07:26  Shenghuo ZHU  <zsh@cs.rochester.edu>
 
        * nnheader.el (nnheader-translate-file-chars): Only in full path.
index 2ea5188..b642692 100644 (file)
@@ -1484,6 +1484,17 @@ or not."
          (when charset
            (mm-decode-body charset)))))))
 
+(eval-when-compile
+  (require 'rfc1843))
+
+(defun article-decode-HZ ()
+  "Translate a HZ-encoded article."
+  (interactive)
+  (require 'rfc1843)
+  (save-excursion
+    (let ((buffer-read-only nil))
+      (rfc1843-decode-region (point-min) (point-max)))))
+
 (defun article-hide-list-identifiers ()
   "Remove list identifies from the Subject header.
 The `gnus-list-identifiers' variable specifies what to do."
@@ -2415,6 +2426,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
      article-remove-cr
      article-display-x-face
      article-de-quoted-unreadable
+     article-decode-HZ
      article-mime-decode-quoted-printable
      article-hide-list-identifiers
      article-hide-pgp
@@ -2498,7 +2510,8 @@ If variable `gnus-use-long-file-name' is non-nil, it is
        ["Hide citation" gnus-article-hide-citation t]
        ["Treat overstrike" gnus-article-treat-overstrike t]
        ["Remove carriage return" gnus-article-remove-cr t]
-       ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]))
+       ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
+       ["Decode HZ" gnus-article-decode-HZ t]))
 
     ;; Note "Commands" menu is defined in gnus-sum.el for consistency
 
index 60955e4..3ea6812 100644 (file)
@@ -1692,7 +1692,8 @@ increase the score of each group you read."
               ["Add buttons to head" gnus-article-add-buttons-to-head t]
               ["Stop page breaking" gnus-summary-stop-page-breaking t]
               ["Verbose header" gnus-summary-verbose-headers t]
-              ["Toggle header" gnus-summary-toggle-header t])
+              ["Toggle header" gnus-summary-toggle-header t]
+             ["HZ" gnus-article-decode-HZ t])
              ("Output"
               ["Save in default format" gnus-summary-save-article t]
               ["Save in file" gnus-summary-save-article-file t]
index 2430dfc..608b6d9 100644 (file)
@@ -1753,6 +1753,7 @@ gnus-newsrc-hashtb should be kept so that both hold the same information.")
       gnus-article-treat-overstrike 
       gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
       gnus-article-display-x-face gnus-article-de-quoted-unreadable
+      gnus-article-decode-HZ
       gnus-article-hide-pgp
       gnus-article-hide-pem gnus-article-hide-signature
       gnus-article-strip-leading-blank-lines gnus-article-date-local
index f9f3888..8ccd601 100644 (file)
 (require 'mm-util)
 
 (defvar rfc1843-word-regexp
-  "~\\({\\([\041-\167][\041-\176]\\| \\)+\\(~}\\|$\\)")
+  "~\\({\\([\041-\167][\041-\176]\\| \\)+\\)\\(~}\\|$\\)")
 
 (defvar rfc1843-word-regexp-strictly
-  "~\\({\\([\041-\167][\041-\176]\\)+\\(~}\\|$\\)")
+  "~\\({\\([\041-\167][\041-\176]\\)+\\)\\(~}\\|$\\)")
 
 (defvar rfc1843-hzp-word-regexp
   "~\\({\\([\041-\167][\041-\176]\\| \\)+\\|\
@@ -86,7 +86,10 @@ ftp://ftp.math.psu.edu/pub/simpson/chinese/hzp/hzp.doc"
            (while (re-search-forward (if rfc1843-decode-hzp
                                          rfc1843-hzp-word-regexp
                                        rfc1843-word-regexp) (point-max) t)
-             (setq str (match-string 1))
+             ;;; Text with extents may cause XEmacs crash
+             (setq str (buffer-substring-no-properties 
+                        (match-beginning 1)
+                        (match-end 1)))
              (setq firstc (aref str 0))
              (insert (mm-decode-coding-string
                       (rfc1843-decode