(entity-buffer): Must move to (point-min) before search boundary
[elisp/gnus.git-] / lisp / mmgnus.el
1 ;;; mmgnus.el --- MIME entity implementation for gnus-article
2
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: MIME, multimedia, mail, news
7
8 ;; This file is part of Chao-gnus.
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Code:
26
27 (require 'mmbuffer)
28
29 (mm-define-backend gnus (generic))
30
31 (mm-define-method entity-buffer ((entity gnus))
32   ;; (if (with-current-buffer gnus-summary-buffer
33   ;;       (eq gnus-current-article (mail-header-number entity)))
34   ;;     ...)
35   (unless (mime-entity-header-start-internal entity)
36     (set-buffer gnus-original-article-buffer)
37     (mime-entity-set-header-start-internal entity (point-min))
38     (mime-entity-set-body-end-internal entity (point-max))
39     (goto-char (point-min))
40     (if (re-search-forward "^$" nil t)
41         (progn
42           (mime-entity-set-header-end-internal entity (match-end 0))
43           (mime-entity-set-body-start-internal
44            entity
45            (if (= (mime-entity-header-end-internal entity)
46                   (mime-entity-body-end-internal entity))
47                (mime-entity-body-end-internal entity)
48              (1+ (mime-entity-header-end-internal entity))
49              ))
50           )
51       (mime-entity-set-header-end-internal entity (point-min))
52       (mime-entity-set-body-start-internal entity (point-min))
53       ))
54   gnus-original-article-buffer)
55
56
57 ;;; @ end
58 ;;;
59
60 (provide 'mmgnus)
61
62 ;;; mmgnus.el ends here