Gnus development mailing list
 help / color / mirror / Atom feed
From: Toby Speight <streapadair@gmx.net>
Subject: Re: Making Gnus more worm-safe
Date: 08 May 2000 15:32:18 +0100	[thread overview]
Message-ID: <u3dnt9kp9.fsf@lanber.cam.eu.citrix.com> (raw)
In-Reply-To: <87hfcdwnwi.fsf@deneb.cygnus.argh.org>

[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]

Florian> Florian Weimer <URL:mailto:fw@deneb.cygnus.argh.org>

0> In article <87hfcdwnwi.fsf@deneb.cygnus.argh.org>, Florian wrote:

Florian> I'd suggest the following change to mailcap.el:
Florian>
Florian> -      ("emacs-lisp"
Florian> -       (viewer . mailcap-maybe-eval)
Florian> -       (type   . "application/emacs-lisp"))
Florian>
Florian> This feature is just too dangerous to be enabled by default.
Florian>
Florian> If there aren't any objections, I'll remove it.


Instead of `mailcap-maybe-eval', I use the following function to
display elisp parts highlighted with the usual font-locking:

.gnus> (defun mm-display-elisp-inline (handle)
.gnus>   (let (text)
.gnus>     (with-temp-buffer
.gnus>       (mm-insert-part handle)
.gnus>       (emacs-lisp-mode)
.gnus>       (font-lock-fontify-buffer)
.gnus>       (setq text (buffer-string)))
.gnus>     (mm-insert-inline handle text)))

Perhaps it's possible to do this without invoking (emacs-lisp-mode),
by `let'ing the appropriate font-lock variables instead.

Could we make this the default?

In fact, you might consider all of the following:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Viewers for elisp and diffs --]
[-- Type: text/x-emacs-lisp, Size: 1212 bytes --]


(defun mm-display-patch-inline (handle)
  (let (text)
    (with-temp-buffer
      (mm-insert-part handle)
      (diff-mode)
      (font-lock-fontify-buffer)
      (setq text (buffer-string)))
    (mm-insert-inline handle text)))

(defun mm-display-elisp-inline (handle)
  (let (text)
    (with-temp-buffer
      (mm-insert-part handle)
      (emacs-lisp-mode)
      (font-lock-fontify-buffer)
      (setq text (buffer-string)))
    (mm-insert-inline handle text)))


(defun mm-add-new-type (type displayer test auto-display inlined attachment-override)
  (push (list type displayer test) mm-inline-media-tests)
  (if auto-display
      (push type mm-automatic-display))
  (if inlined
      (push type mm-inlined-types))
  (if attachment-override
      (push type mm-attachment-override-types)))

(eval-after-load "mm-decode"
  '(progn
     (mm-add-new-type "text/x-patch"        'mm-display-patch-inline '(fboundp 'diff-mode) t t t)
     (mm-add-new-type "application/x-patch" 'mm-display-patch-inline '(fboundp 'diff-mode) t t t)
     (mm-add-new-type "text/x-emacs-lisp"      'mm-display-elisp-inline 'identity t t t)
     (mm-add-new-type "application/emacs-lisp" 'mm-display-elisp-inline 'identity t t t)))

      parent reply	other threads:[~2000-05-08 14:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-05  5:45 Florian Weimer
2000-05-05  7:14 ` Pavel Janík ml.
2000-05-05  9:30   ` Florian Weimer
2000-05-05  7:23 ` William M. Perry
2000-05-05  9:39   ` Florian Weimer
2000-05-05 10:05     ` Kai Großjohann
2000-05-05 10:52       ` Florian Weimer
2000-05-05  8:21 ` Hrvoje Niksic
2000-05-05  9:10   ` Bjørn Mork
2000-05-05  9:33     ` Kai Großjohann
2000-05-05 10:14     ` Hrvoje Niksic
2000-05-05 11:05       ` Bjørn Mork
2000-05-05 11:52         ` Hrvoje Niksic
2000-05-05 18:07       ` Felix Lee
2000-05-05 19:28         ` Bruce Stephens
2000-05-05 20:54           ` Kai Großjohann
2000-05-06 19:26             ` Michael Harnois
2000-05-06 21:10               ` Kai Großjohann
2000-05-06  7:25         ` Florian Weimer
2000-05-05  9:40   ` Florian Weimer
2000-05-05 10:14     ` Hrvoje Niksic
2000-05-06  7:28       ` Florian Weimer
2000-05-06 10:41         ` Bud Rogers
2000-05-05 10:47 ` Per Abrahamsen
2000-05-05 14:11   ` Laura Conrad
2000-05-05 20:49   ` Laura Conrad
2000-05-08  0:15   ` Brian May
2000-05-08 13:57     ` Alan Shutko
2000-05-08 17:20     ` Florian Weimer
2000-05-08  6:48   ` Soeren Laursen
2000-12-04  4:21   ` Greg Stark
2000-12-04 19:16     ` Prefer text/x-emacs-lisp to application/x-emacs-lisp? Raja R Harinath
2000-12-05 11:28       ` Per Abrahamsen
2000-05-08 14:32 ` Toby Speight [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=u3dnt9kp9.fsf@lanber.cam.eu.citrix.com \
    --to=streapadair@gmx.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).