From: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
Cc: akopps@Math.Berkeley.EDU
Subject: Re: Bug in metamail
Date: Mon, 9 Dec 2002 20:54:32 +0900 [thread overview]
Message-ID: <200212091154.UAA08391@latour.mse.kyutech.ac.jp> (raw)
In-Reply-To: <E1809Tp-0008MC-00@fencepost.gnu.org> (message from Richard Stallman on Fri, 11 Oct 2002 19:46:05 -0400)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=ISO-2022-JP-2, Size: 5112 bytes --]
From: Richard Stallman <rms@gnu.org>
Date: Fri, 11 Oct 2002 19:46:05 -0400
This is because rmail-ignored-headers includes MIME related headers,
such as "Content-Type:". Simple user level solution is to put the
following code in .emacs. It is much better to remove these headers
from rmail-ignored-headers in the next release of emacs distribution.
Hiding these headers is useful. Most users don't use metamail, and
it would be a shame to give up the useful feature for them.
I think the right fix is that metamail should temporarily unhide the
headers. This is not terribly hard to do--see rmail-redecode-body for
an example:
Unfortunately, metamail.el was not only designed for rmail, but also
for other MUAs. It is not good idea to add such rmail-specific logics
to metamail.el. But instead, I would like you to add the following
two functions which act as interfaces to metamail.el for rmail.
If you think metamail.el is now existing only for rmail, your
proposals could be a solution.
Masanobu UMEDA
----------------------------------------------------------------------
;;; rmailmime.el --- Rmail: MIME message reading.
;; Copyright (C) 1993-1995, 2002 Masanobu UMEDA
;; Author: Masanobu UMEDA <umerin@mse.kyutech.ac.jp>
;; Version: $Header: /a/khaki/usrs/usr2/home/umerin/src/emacs/RCS/rmailmime.el,v 1.13 2002/12/09 11:49:25 umerin Exp $
;; Keywords: mail, mime
;; This file is not part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Usage examples:
;; First of all, define the following autoload entries:
;;
;; (autoload 'rmail-show-mime "rmailmime" "Show MIME messages." t)
;; (autoload 'rmail-convert-mime-header "rmailmime" "Convert MIME header." nil)
;;
;; To convert MIME headers into readable form automatically in Rmail,
;; set the variable rmail-message-filter to the function
;; rmail-convert-mime-header as follows:
;;
;; (setq rmail-message-filter 'rmail-convert-mime-header)
;;
;; To show MIME messages using metamail program in Rmail, bind the
;; command rmail-show-mime to some key in rmail mode. The following
;; example binds it to the key `!':
;;
;; (setq rmail-mode-hook
;; (list
;; (function
;; (lambda ()
;; (local-set-key "!" 'rmail-show-mime)
;; ))))
;;; Code:
(require 'metamail)
;;;###autoload
(defun rmail-show-mime (&optional viewmode)
"Show a MIME message in current buffer using a View mode.
Optional 1st argument VIEWMODE specifies the value of the
EMACS_VIEW_MODE environment variable (defaulted to 1).
The contents of current buffer are not changed at all."
(interactive "p")
(let ((curbuf (current-buffer))
(tmpbuf (get-buffer-create "*metamail*")))
;; Reset a working buffer.
(set-buffer tmpbuf)
(setq buffer-read-only nil)
(erase-buffer)
;; Copy non-pruned headers and body.
(save-excursion
(save-restriction
(set-buffer curbuf)
(let ((msgbeg (rmail-msgbeg rmail-current-message))
(msgend (rmail-msgend rmail-current-message)))
(narrow-to-region msgbeg msgend)
(goto-char (point-min))
(forward-line 2)
(setq msgbeg (point))
(search-forward "\n\n" msgend t)
(copy-to-buffer tmpbuf msgbeg (point))
(set-buffer tmpbuf)
(goto-char (point-max))
(set-buffer curbuf)
;; Skip pruned headers.
(if (search-forward "*** EOOH ***\n")
(search-forward "\n\n" msgend t))
;; Append a body.
(prepend-to-buffer tmpbuf (point) msgend))
))
(view-buffer (current-buffer))
;; We have to process a header part because it has not been
;; processed at all.
(metamail-interpret-header)
(let ((metamail-switches ;Suppress header fields in a body.
(append metamail-switches '("-q"))))
(metamail-interpret-body viewmode))
;;(goto-char (point-min))
))
;;;###autoload
(defun rmail-convert-mime-header ()
"Convert MIME header fields of current message into a readable form.
It is expected to be used as rmail-message-filter in Rmail and
vm-message-filter in VM. Original header is preserved in Rmail."
(interactive)
(save-excursion
;; Convert only when it has Mime-Version header field.
(if (save-restriction
(narrow-to-region (point-min)
(progn
(goto-char (point-min))
(search-forward "\n\n" nil t)
(point)))
(mail-fetch-field "Mime-Version"))
(metamail-interpret-header))))
(provide 'rmailmime)
;;; rmailmime.el ends here
prev parent reply other threads:[~2002-12-09 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-10 8:43 Bug in metamail Richard Stallman
2002-10-10 15:01 ` Masanobu UMEDA
2002-10-11 23:46 ` Richard Stallman
2002-12-09 11:54 ` Masanobu UMEDA [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200212091154.UAA08391@latour.mse.kyutech.ac.jp \
--to=umerin@mse.kyutech.ac.jp \
--cc=akopps@Math.Berkeley.EDU \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.