gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

additions to rmime.el


From: Francesco Potorti`
Subject: additions to rmime.el
Date: Wed, 24 Apr 2002 10:13:40 +0200

This is the current list of advices that I use with rmime.

rmail-forward is the latest addition, after that I was burned by a
forwarded mail which was entirely composed of base 64 encoded text.

Probably removing all text properties is overkill, but it seems that
it works this way.

(defadvice rmail-forward (after rmime activate)
  "Forward what you see.  This means to remove text properties from
the text to forward after it has been inserted in the mail buffer."
  (save-excursion
    (goto-char (mail-text-start))
    (let* ((start (point))
           (end (point-max))
           (result (buffer-substring-no-properties start end)))
      (delete-region start end)
      (insert result))))

(defadvice rmail-resend (around rmime activate)
  "Temporarily disable rmime-mode and show headers before resending."
  (let ((headers-were-pruned (rmail-msg-is-pruned))
        (rmime-mode-was-on rmime-mode)
        (hook-was-there (memq 'rmime-format rmail-show-message-hook)))
    (unwind-protect
        (progn
          (if rmime-mode-was-on (rmime-cancel))
          (if hook-was-there (remove-hook 'rmail-show-message-hook 
'rmime-format))
          (if headers-were-pruned (rmail-toggle-header -1))
          ad-do-it)
      (if headers-were-pruned (rmail-toggle-header 1))
      (if hook-was-there (add-hook 'rmail-show-message-hook 'rmime-format))
      (if rmime-mode-was-on (rmime-format))
      )))

(defadvice rmail-retry-failure (around rmime activate)
  "Temporarily disable rmime-mode and show headers before retrying."
  (let ((rmime-mode-was-on rmime-mode)
        (hook-was-there (memq 'rmime-format rmail-show-message-hook)))
    (unwind-protect
        (progn
          (if rmime-mode-was-on (rmime-cancel))
          (if hook-was-there (remove-hook 'rmail-show-message-hook 
'rmime-format))
          ad-do-it)
      (if hook-was-there (add-hook 'rmail-show-message-hook 'rmime-format))
      (if rmime-mode-was-on (rmime-format))
      )))

(defadvice rmail-sort-messages (around rmime activate)
  "Temporarily disable rmime-mode and show headers before sorting."
  (let ((rmime-mode-was-on rmime-mode)
        (hook-was-there (memq 'rmime-format rmail-show-message-hook)))
    (unwind-protect
        (progn
          (if rmime-mode-was-on (rmime-cancel))
          (if hook-was-there (remove-hook 'rmail-show-message-hook 
'rmime-format))
          ad-do-it)
      (if hook-was-there (add-hook 'rmail-show-message-hook 'rmime-format))
      (if rmime-mode-was-on (rmime-format))
      )))

(defadvice rmail-output (around rmime activate)
  "Temporarily set rmime-clean-files to t before writing."
  (let ((rmime-clean-files t))
    ad-do-it
    ))

(defadvice rmail-toggle-header (after rmime activate)
  "When all headers are visible, MIME structure also is."
  (if (interactive-p)
      (if (rmail-msg-is-pruned)
          (rmime-format)
        (rmime-cancel))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]