-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; This program is free software: you can redistribute it and/or modify ;;
-;; it under the terms of the version 3 of the GNU General Public License ;;
-;; as published by the Free Software Foundation. ;;
-;; ;;
-;; This program is distributed in the hope that it will be useful, but ;;
-;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
-;; General Public License for more details. ;;
-;; ;;
-;; You should have received a copy of the GNU General Public License ;;
-;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;
-;; ;;
-;; Written by and Copyright (C) Francois Fleuret ;;
-;; Contact <francois.fleuret@idiap.ch> for comments & bug reports ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; mymail-el
-
-(setq mymail-history-file ("~/.mymail-el-history"))
-
-;; (setq mymail-history '("p francois.fleuret,f 2013"))
+;; Copyright (c) 2013 Francois Fleuret
+;; Written by Francois Fleuret <francois@fleuret.org>
+;;
+;; This file is part of mymail.
+;;
+;; mymail is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License version 3 as
+;; published by the Free Software Foundation.
+;;
+;; mymail is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with mymail. If not, see <http://www.gnu.org/licenses/>.
(defun mymail/vm-visit-folder (param)
-
- ;; (interactive "smymail search: ")
-
- (interactive (list (read-string "mymail search: " nil 'mymail-history)))
-
- (let ((args (mapconcat (lambda (x) (concat "-s " "\"" x "\""))
- (split-string param ",")
- " ")))
- (shell-command (concat "mymail " args " > /tmp/mymail.mbox"))
- )
- (vm-visit-folder "/tmp/mymail.mbox")
- )
+ (interactive (list (read-string "mymail-vm search: " nil 'mymail-vm-history)))
+
+ (let ((n 1)
+ (mbox-name nil)
+ (args (mapconcat
+ (lambda (searche-request) (concat "-s " "\"" searche-request "\""))
+ (split-string param ",")
+ " ")))
+ (while (get-file-buffer (setq mbox-name (format "/tmp/mymail-vm-%d.mbox" n)))
+ (setq n (+ n 1)))
+
+ (shell-command (concat "mymail " args " > " mbox-name))
+ (vm-visit-folder mbox-name t)
+ ))