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

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

rmime mod: bind C-c C-w to "write attachment"


From: Thien-Thi Nguyen
Subject: rmime mod: bind C-c C-w to "write attachment"
Date: Sun, 10 Mar 2002 17:08:15 -0800

do you use rmime.el?  do you want the ability to to write an attachment
somewhere (in addition to interacting w/ it in the rmail buffer)?  the
following "extends" rmime-interact (through re-implementationg, ugh) to
bind `C-c C-w' to do just this.

i'm posting this here since digging through rmime design to conclude at
the re-implementation requirement (note backtick) was slightly traumatic
and i just want to s{h,c,qu,p}are the pain....

(actually, i like rmime design; who needs GNUS? :-)

thi

______________________________________________________
;;; (also sent to <address@hidden> 2002-02-18)
(defun rmime-interact (keymap function &rest arguments)
  (let ((action (make-symbol "rmime-interaction")))
    (fset action (list 'lambda nil '(interactive)
                       (list 'apply (list 'quote function)
                             (list 'quote arguments))))
    (define-key keymap "\C-c\C-c" action)
    (define-key keymap "\C-c\C-w" `(lambda ()
                                     (interactive)
                                     (apply 'ttn-rmime-write ',arguments)))))

(defun ttn-rmime-write (content type encoding)
  (let ((filename (read-file-name
                   "Write to file: " nil nil nil
                   (let ((try (assoc "name" (rmime-parameters type))))
                     (when try (cdr try)))))
        (coding-system-for-read 'no-conversion)
        (coding-system-for-write 'no-conversion)
        (require-final-newline nil))
    (find-file filename)
    (erase-buffer)
    (rmime-insert-content t encoding content)
    (save-buffer)
    (kill-buffer (current-buffer))))



reply via email to

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