1;;; gnus-mh.el --- mh-e interface for Gnus 2 3;; Copyright (C) 1994-2021 Free Software Foundation, Inc. 4 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 6;; Lars Magne Ingebrigtsen <larsi@gnus.org> 7;; Keywords: news 8 9;; This file is part of GNU Emacs. 10 11;; GNU Emacs is free software: you can redistribute it and/or modify 12;; it under the terms of the GNU General Public License as published by 13;; the Free Software Foundation, either version 3 of the License, or 14;; (at your option) any later version. 15 16;; GNU Emacs is distributed in the hope that it will be useful, 17;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19;; GNU General Public License for more details. 20 21;; You should have received a copy of the GNU General Public License 22;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. 23 24;;; Commentary: 25 26;;; Send mail using mh-e. 27 28;; The following mh-e interface is all cooperative works of 29;; tanaka@flab.fujitsu.CO.JP (TANAKA Hiroshi), kawabe@sra.CO.JP 30;; (Yoshikatsu Kawabe), and shingu@casund.cpr.canon.co.jp (Toshiaki 31;; SHINGU). 32 33;;; Code: 34 35(require 'gnus) 36(require 'mh-e) 37(require 'mh-comp) 38(require 'gnus-msg) 39(require 'gnus-sum) 40 41(defvar mh-lib-progs) 42 43(defcustom gnus-rcvstore-options nil 44 "Options that are passed to rcvstore, or nil. 45These are used when saving articles to an MH folder." 46 :version "26.1" 47 :group 'gnus-article 48 :type '(repeat string)) 49 50(defun gnus-summary-save-article-folder (&optional arg) 51 "Append the current article to an mh folder. 52If N is a positive number, save the N next articles. 53If N is a negative number, save the N previous articles. 54If N is nil and any articles have been marked with the process mark, 55save those articles instead." 56 (interactive "P") 57 (require 'gnus-art) 58 (let ((gnus-default-article-saver 'gnus-summary-save-in-folder)) 59 (gnus-summary-save-article arg))) 60 61(defun gnus-summary-save-in-folder (&optional folder) 62 "Save this article to MH folder (using `rcvstore' in MH library). 63Optional argument FOLDER specifies folder name." 64 ;; Thanks to yuki@flab.Fujitsu.JUNET and ohm@kaba.junet. 65 (mh-find-path) 66 (let ((folder 67 (cond ((and (eq folder 'default) 68 gnus-newsgroup-last-folder) 69 gnus-newsgroup-last-folder) 70 (folder folder) 71 (t (mh-prompt-for-folder 72 "Save article in" 73 (funcall gnus-folder-save-name gnus-newsgroup-name 74 gnus-current-headers gnus-newsgroup-last-folder) 75 t)))) 76 (errbuf (gnus-get-buffer-create " *Gnus rcvstore*")) 77 ;; Find the rcvstore program. 78 (exec-path (cond 79 ((and (boundp 'mh-lib-progs) mh-lib-progs) 80 (cons mh-lib-progs exec-path)) 81 (mh-lib (cons mh-lib exec-path)) 82 (t exec-path)))) 83 (with-current-buffer gnus-original-article-buffer 84 (save-restriction 85 (widen) 86 (unwind-protect 87 (apply 88 #'call-process-region 89 (point-min) (point-max) "rcvstore" nil errbuf nil folder 90 gnus-rcvstore-options) 91 (set-buffer errbuf) 92 (if (zerop (buffer-size)) 93 (message "Article saved in folder: %s" folder) 94 (message "%s" (buffer-string))) 95 (kill-buffer errbuf)))) 96 (setq gnus-newsgroup-last-folder folder))) 97 98(defun gnus-Folder-save-name (newsgroup headers &optional last-folder) 99 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER. 100If variable `gnus-use-long-file-name' is nil, it is +News.group. 101Otherwise, it is like +news/group." 102 (or last-folder 103 (concat "+" 104 (if gnus-use-long-file-name 105 (gnus-capitalize-newsgroup newsgroup) 106 (gnus-newsgroup-directory-form newsgroup))))) 107 108(defun gnus-folder-save-name (newsgroup headers &optional last-folder) 109 "Generate folder name from NEWSGROUP, HEADERS, and optional LAST-FOLDER. 110If variable `gnus-use-long-file-name' is nil, it is +news.group. 111Otherwise, it is like +news/group." 112 (or last-folder 113 (concat "+" 114 (if gnus-use-long-file-name 115 newsgroup 116 (gnus-newsgroup-directory-form newsgroup))))) 117 118(provide 'gnus-mh) 119 120;;; gnus-mh.el ends here 121