[Mew-dist 274] Re: How to reply from Gnus-5.3 with mew?
SAKAI Kiyotaka
ksakai at example.com
1996年 12月 12日 (木) 22:03:35 JST
>> In article <11805.849580682 at example.com>, "A. SAGATA" <sagata at example.com> writes:
> で,mew-1.54にあげるついでにmule2.3 on Emacs 19.34.1にあげました.
> どのバージョンのgnusかは,分からないのですが,
> Emacs19.28付属のGnus-5.0.12 から,Emacs19.34付属のGnus-5.3
> のあいだに
> gnus-mail-reply-method
> gnus-mail-forward-method
> gnus-mail-other-window-method
> がの3つの変数が削除されてしまったみたいで,mew-gnusを使って
> うまくgnusからmewでreplyできません.;-(
> 似た名前の変数を探したのですが良く分かりませんでした.
よくよく考えてみたら、gnus-mail-reply-using-mew,
gnus-mail-forward-using-mew は GNUS のインターフェースを通さずに直接使
えばいいことに気がつきました。そこで、mew-gnus.el を以下のようにしてみ
たのですが、どうでしょうか。
# mew-dist に流れた mew-gnus.el に関するパッチはすべて当ててあるはずで
# す。
--
酒井 清隆 (E-mail: ksakai at example.com)
-------------- next part --------------
;;
;; Temporary solution to link Mew to Gnus.
;; This code will be obsolated because Mew supports USENET news soon.
;;
;; (add-hook 'gnus-summary-mode-hook '(lambda () (require 'mew-gnus)))
;; (setq gnus-mail-reply-method 'gnus-mail-reply-using-mew)
;;
;; For GNUS 4.x User
;; (setq gnus-mail-forward-method 'gnus-mail-forward-using-mew)
;; (setq gnus-mail-other-window-method 'gnus-mail-other-window-using-mew)
;; (setq gnus-default-article-saver 'gnus-summary-save-in-mew)
;;
;; For GNUS 5.x User
;; (add-hook
;; 'gnus-summary-mode-hook
;; (function
;; (lambda ()
;; (define-key gnus-summary-mode-map "r" 'mew-gnus-reply)
;; (define-key gnus-summary-mode-map "R" 'mew-gnus-reply-with-citation)
;; (define-key gnus-summary-mode-map "f" 'mew-gnus-mail-forward))))
(eval-when-compile
(progn
(require 'gnus)))
(require 'mew)
(defvar mh-lib "/usr/local/lib/mh")
(defvar mew-gnus-save-fixed-folder nil)
(defun gnus-summary-save-in-mew (&optional folder)
"Save this article to MH folder (using `rcvstore' in MH library).
Optional argument FOLDER specifies folder name."
(interactive)
(gnus-summary-select-article gnus-save-all-headers gnus-save-all-headers)
(gnus-eval-in-buffer-window gnus-article-buffer
(save-restriction
(widen)
(or (and (boundp 'mew-folder-alist) mew-folder-alist)
(setq mew-folder-list (mew-folder-make-list)
mew-folder-alist (mew-folder-make-alist mew-folder-list)))
(let ((folder
(or folder
(mew-input-folder
(or mew-gnus-save-fixed-folder
(or (car (mew-guess-by-alist))
gnus-newsgroup-name)))))
(errbuf (get-buffer-create " *GNUS rcvstore*")))
(unwind-protect
(call-process-region (point-min) (point-max)
(expand-file-name "rcvstore" mh-lib)
nil errbuf nil folder)
(set-buffer errbuf)
(if (zerop (buffer-size))
(message "Article saved in folder: %s" folder)
(message "%s" (buffer-string)))
(kill-buffer errbuf)
(setq gnus-newsgroup-last-folder folder))))))
(defun gnus-mail-reply-using-mew (&optional yank)
(let (from cc subject date to reply-to newsgroups
(buffer
(progn (and (string-match "v5" gnus-version)
(pop-to-buffer gnus-article-buffer))
(current-buffer))))
(save-restriction
(gnus-article-show-all-headers)
(setq from (gnus-fetch-field "from")
subject (let ((subject (gnus-fetch-field "subject")))
(if (and subject
(not (string-match "^[Rr][Ee]:.+$" subject)))
(concat "Re: " subject) subject))
reply-to (gnus-fetch-field "reply-to")
cc (gnus-fetch-field "cc")
newsgroups (or (gnus-fetch-field "followup-to")
(gnus-fetch-field "newsgroups"))
date (gnus-fetch-field "date"))
(setq to (or reply-to from))
(mew-send to (or cc "") subject)
(save-excursion
(goto-char (point-min))
(insert (concat "Newsgroups: " newsgroups "\n")))
(make-variable-buffer-local 'mew-message-citation-buffer)
(setq mew-message-citation-buffer gnus-article-buffer))
(if yank (mew-draft-cite))))
(defun gnus-mail-forward-using-mew (&optional buffer)
"Forward the current message to another user using mew."
(or (bufferp mew-buffer-tmp)
(save-excursion
(mew-set-environment)))
(let* ((buffer
(if (string-match "v5" gnus-version)
(pop-to-buffer (or buffer gnus-article-buffer))
(current-buffer)))
(subject (concat "[" gnus-newsgroup-name "] "
(or (gnus-fetch-field "subject") "")))
(file (mew-draft-get-new))
(mimefolder (mew-draft-to-mime file))
(mimedir (mew-expand-file-name mimefolder)))
(if (null (file-directory-p mimedir))
(mew-make-directory mimedir)
(if (null (mew-directory-empty-p mimedir))
(if (mew-y-or-n-p (format "Mime folder %s is not empty. Delete it? "
mimefolder))
(progn
(call-process "rm" nil nil nil "-rf" mimedir)
(mew-make-directory mimedir)))))
(unwind-protect
(progn
(write-region (point-min) (point-max) (mew-draft-get-new mimefolder))
(delete-other-windows)
(split-window-vertically)
(switch-to-buffer-other-window (find-file-noselect file))
(mew-draft-header subject 'nl)
(mew-draft-mode)
(setq mew-encode-syntax
(mew-encode-syntax-initial-multi (file-name-nondirectory mimedir) 1))
(save-excursion
(mew-draft-prepare-attachments)))
(save-buffer))) ;; to make sure no to use this draft again
(message "Draft is prepared"))
(defun gnus-mail-other-window-using-mew ()
"Compose mail other window using mew."
(or (bufferp mew-buffer-tmp)
(save-excursion
(mew-set-environment)))
(let* ((subject (gnus-fetch-field "subject")))
(delete-other-windows)
(split-window-vertically)
(other-window 1)
(mew-send nil nil subject)
(make-variable-buffer-local 'mew-message-citation-buffer)
(setq mew-message-citation-buffer gnus-article-buffer)))
(defun mew-gnus-reply ()
(interactive)
(gnus-mail-reply-using-mew))
(defun mew-gnus-reply-with-citation ()
(interactive)
(gnus-mail-reply-using-mew t))
(defun mew-gnus-mail-forward ()
(interactive)
(gnus-mail-forward-using-mew gnus-article-buffer))
(provide 'mew-gnus)
;;; mew-gnus.el ends here
Mew-dist メーリングリストの案内