2000-12-21 09:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 21 Dec 2000 14:39:24 +0000 (14:39 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 21 Dec 2000 14:39:24 +0000 (14:39 +0000)
* gnus-art.el (gnus-mime-*): handle may be nil.

* gnus-sum.el (gnus-summary-mode): Turn on gnus-mailing-list-mode.

lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-ml.el
lisp/gnus-sum.el

index 74b6731..57b434b 100644 (file)
@@ -1,5 +1,9 @@
 2000-12-21 09:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
+       * gnus-art.el (gnus-mime-*): handle may be nil.
+
+       * gnus-sum.el (gnus-summary-mode): Turn on gnus-mailing-list-mode.
+
        * gnus.el (gnus-group-remove-excess-properties): Not defined
        in gnus-xmas.
 
index 816c32a..4141999 100644 (file)
@@ -3124,19 +3124,20 @@ If ALL-HEADERS is non-nil, no headers are hidden."
          (mail-parse-ignored-charsets 
           (with-current-buffer gnus-summary-buffer
             gnus-newsgroup-ignored-charsets)))
-      (mm-remove-parts handles)
-      (goto-char (point-min))
-      (or (search-forward "\n\n") (goto-char (point-max)))
-      (let (buffer-read-only)
-       (delete-region (point) (point-max)))
-      (mm-display-parts handles))))
+      (when handles
+       (mm-remove-parts handles)
+       (goto-char (point-min))
+       (or (search-forward "\n\n") (goto-char (point-max)))
+       (let (buffer-read-only)
+         (delete-region (point) (point-max)))
+       (mm-display-parts handles)))))
 
 (defun gnus-mime-save-part-and-strip ()
   "Save the MIME part under point then replace it with an external body."
   (interactive)
   (gnus-article-check-buffer)
   (let* ((data (get-text-property (point) 'gnus-data)) 
-        (file (mm-save-part data))
+        (file (and data (mm-save-part data)))
         param)
     (when file
       (with-current-buffer (mm-handle-buffer data)
@@ -3195,21 +3196,24 @@ If ALL-HEADERS is non-nil, no headers are hidden."
   (interactive)
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
-    (mm-save-part data)))
+    (when data
+      (mm-save-part data))))
 
 (defun gnus-mime-pipe-part ()
   "Pipe the MIME part under point to a process."
   (interactive)
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
-    (mm-pipe-part data)))
+    (when data
+      (mm-pipe-part data))))
 
 (defun gnus-mime-view-part ()
   "Interactively choose a viewing method for the MIME part under point."
   (interactive)
   (gnus-article-check-buffer)
   (let ((data (get-text-property (point) 'gnus-data)))
-    (mm-interactively-view-part data)))
+    (when data
+      (mm-interactively-view-part data))))
 
 (defun gnus-mime-view-part-as-type-internal ()
   (gnus-article-check-buffer)
@@ -3229,38 +3233,41 @@ If ALL-HEADERS is non-nil, no headers are hidden."
          (gnus-mime-view-part-as-type-internal))))
   (gnus-article-check-buffer)
   (let ((handle (get-text-property (point) 'gnus-data)))
-    (gnus-mm-display-part
-     (mm-make-handle (mm-handle-buffer handle)
-                    (cons mime-type (cdr (mm-handle-type handle)))
-                    (mm-handle-encoding handle)
-                    (mm-handle-undisplayer handle)
-                    (mm-handle-disposition handle)
-                    (mm-handle-description handle)
-                    (mm-handle-cache handle)
-                    (mm-handle-id handle)))))
-
+    (when handle
+      (gnus-mm-display-part
+       (mm-make-handle (mm-handle-buffer handle)
+                      (cons mime-type (cdr (mm-handle-type handle)))
+                      (mm-handle-encoding handle)
+                      (mm-handle-undisplayer handle)
+                      (mm-handle-disposition handle)
+                      (mm-handle-description handle)
+                      (mm-handle-cache handle)
+                      (mm-handle-id handle))))))
+  
 (defun gnus-mime-copy-part (&optional handle)
   "Put the the MIME part under point into a new buffer."
   (interactive)
   (gnus-article-check-buffer)
   (let* ((handle (or handle (get-text-property (point) 'gnus-data)))
-        (contents (mm-get-part handle))|
-        (base (file-name-nondirectory
-               (or
-                (mail-content-type-get (mm-handle-type handle) 'name)
-                (mail-content-type-get (mm-handle-type handle)
-                                       'filename)
-                "*decoded*")))
-        (buffer (generate-new-buffer base)))
-    (switch-to-buffer buffer)
-    (insert contents)
-    ;; We do it this way to make `normal-mode' set the appropriate mode.
-    (unwind-protect
-       (progn
-         (setq buffer-file-name (expand-file-name base))
-         (normal-mode))
-      (setq buffer-file-name nil))
-    (goto-char (point-min))))
+        (contents (and handle (mm-get-part handle)))
+        (base (and handle 
+                   (file-name-nondirectory
+                    (or
+                     (mail-content-type-get (mm-handle-type handle) 'name)
+                     (mail-content-type-get (mm-handle-type handle)
+                                            'filename)
+                     "*decoded*"))))
+        (buffer (and base (generate-new-buffer base))))
+    (when contents
+      (switch-to-buffer buffer)
+      (insert contents)
+      ;; We do it this way to make `normal-mode' set the appropriate mode.
+      (unwind-protect
+         (progn
+           (setq buffer-file-name (expand-file-name base))
+           (normal-mode))
+       (setq buffer-file-name nil))
+      (goto-char (point-min)))))
 
 (defun gnus-mime-inline-part (&optional handle arg)
   "Insert the MIME part under point into the current buffer."
@@ -3270,30 +3277,31 @@ If ALL-HEADERS is non-nil, no headers are hidden."
         contents charset
         (b (point))
         buffer-read-only)
-    (if (and (not arg) (mm-handle-undisplayer handle))
-       (mm-remove-part handle)
-      (setq contents (mm-get-part handle))
-      (cond
-       ((not arg)
-       (setq charset (or (mail-content-type-get
-                          (mm-handle-type handle) 'charset)
-                         gnus-newsgroup-charset)))
-       ((numberp arg)
-       (if (mm-handle-undisplayer handle)
-           (mm-remove-part handle))
-       (setq charset
-             (or (cdr (assq arg 
-                            gnus-summary-show-article-charset-alist))
-                 (read-coding-system "Charset: ")))))
-      (forward-line 2)
-      (mm-insert-inline handle
-                       (if (and charset 
-                                (setq charset (mm-charset-to-coding-system 
-                                               charset))
-                                (not (eq charset 'ascii)))
-                           (mm-decode-coding-string contents charset)
-                         contents))
-      (goto-char b))))
+    (when handle
+      (if (and (not arg) (mm-handle-undisplayer handle))
+         (mm-remove-part handle)
+       (setq contents (mm-get-part handle))
+       (cond
+        ((not arg)
+         (setq charset (or (mail-content-type-get
+                            (mm-handle-type handle) 'charset)
+                           gnus-newsgroup-charset)))
+        ((numberp arg)
+         (if (mm-handle-undisplayer handle)
+             (mm-remove-part handle))
+         (setq charset
+               (or (cdr (assq arg 
+                              gnus-summary-show-article-charset-alist))
+                   (read-coding-system "Charset: ")))))
+       (forward-line 2)
+       (mm-insert-inline handle
+                         (if (and charset 
+                                  (setq charset (mm-charset-to-coding-system 
+                                                 charset))
+                                  (not (eq charset 'ascii)))
+                             (mm-decode-coding-string contents charset)
+                           contents))
+       (goto-char b)))))
 
 (defun gnus-mime-view-part-as-charset (&optional handle arg)
   "Insert the MIME part under point into the current buffer."
@@ -3303,14 +3311,15 @@ If ALL-HEADERS is non-nil, no headers are hidden."
         contents charset
         (b (point))
         buffer-read-only)
-    (if (mm-handle-undisplayer handle)
-       (mm-remove-part handle))
-    (let ((gnus-newsgroup-charset
-          (or (cdr (assq arg 
-                         gnus-summary-show-article-charset-alist))
-              (read-coding-system "Charset: ")))
+    (when handle
+      (if (mm-handle-undisplayer handle)
+         (mm-remove-part handle))
+      (let ((gnus-newsgroup-charset
+            (or (cdr (assq arg 
+                           gnus-summary-show-article-charset-alist))
+                (read-coding-system "Charset: ")))
          (gnus-newsgroup-ignored-charsets 'gnus-all))
-      (gnus-article-press-button))))
+       (gnus-article-press-button)))))
 
 (defun gnus-mime-externalize-part (&optional handle)
   "View the MIME part under point with an external viewer."
@@ -3323,9 +3332,10 @@ If ALL-HEADERS is non-nil, no headers are hidden."
         (mail-parse-ignored-charsets 
          (save-excursion (set-buffer gnus-summary-buffer)
                          gnus-newsgroup-ignored-charsets)))
-    (if (mm-handle-undisplayer handle)
-       (mm-remove-part handle)
-      (mm-display-part handle))))
+    (when handle
+      (if (mm-handle-undisplayer handle)
+         (mm-remove-part handle)
+       (mm-display-part handle)))))
 
 (defun gnus-mime-internalize-part (&optional handle)
   "View the MIME part under point with an internal viewer.
@@ -3339,9 +3349,10 @@ In no internal viewer is available, use an external viewer."
         (mail-parse-ignored-charsets 
          (save-excursion (set-buffer gnus-summary-buffer)
                          gnus-newsgroup-ignored-charsets)))
-    (if (mm-handle-undisplayer handle)
-       (mm-remove-part handle)
-      (mm-display-part handle))))
+    (when handle
+      (if (mm-handle-undisplayer handle)
+         (mm-remove-part handle)
+       (mm-display-part handle)))))
 
 (defun gnus-mime-action-on-part (&optional action)
   "Do something with the MIME attachment at \(point\)."
index 5eb0fd0..eff1b77 100644 (file)
 
 ;; implement (small subset of) RFC 2369
 
-;;; Usage:
-
-;; (add-hook 'gnus-summary-mode-hook 'turn-on-gnus-mailing-list-mode)
-
 ;;; Code:
 
 (require 'gnus)
index 28cbdb4..0900558 100644 (file)
@@ -42,6 +42,7 @@
 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
 (autoload 'gnus-cache-write-active "gnus-cache")
 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
+(autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
 (autoload 'mm-uu-dissect "mm-uu")
 
 (defcustom gnus-kill-summary-on-exit t
@@ -2224,6 +2225,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)
+  (turn-on-gnus-mailing-list-mode)
   (mm-enable-multibyte-mule4)
   (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
   (gnus-update-summary-mark-positions))