[Mew-dist 11356] Re: how to delete forever a specific message?

Hideyuki SHIRAI ( 白井秀行 ) shirai at example.com
1999年 11月 17日 (水) 16:16:27 JST


From: Masaki SHIGEMORI <shige2 at example.com> さん曰く
Subject: [Mew-dist 11350] Re: how to delete forever a specific message?
Message-ID: <3831FFA3262.5FACSHIGE2 at example.com>
Date: Wed, 17 Nov 1999 10:06:44 +0900

重森> 常時だと困るのです…通常は +trash に移動で良いので

重森> また、
重森> (setq mew-msg-rm-policy 'uselist)
重森> でもうまくないです。というのは、+inbox に届いたメールを順々に見ていっ
重森> て、これは +trash 行き、これは即刻削除、…という風にしたいのです。

でっちあげてみました。^^;;;

「C-u なし」でカーソルのある message、「C-u あり」で "*" mark の
message を消します。

# y-or-n は聞くようにしていますが、あまりに危険なので実験してか
# ら本番をお願いします。

## 個人的には Mew の配下以外に作るゴミ箱に mv する方が安心かな?
## と思います。

(defun mew-summary-remove-message (&optional arg)
  "Remove messages immediately."
  (interactive "P")
  (mew-summary-only
   (let* ((fld (buffer-name))
	  (dir (mew-expand-folder fld))
	  msgs file)
     (save-excursion
       (if (mew-folder-remotep fld)
	   (message "This command can be used in Local folder.")
	 (if arg
	     (setq msgs (mew-summary-mark-collect
			 mew-mark-review (point-min) (point-max)))
	   (setq msgs (list (mew-summary-message-number))))
	 (if (or (null msgs)
		 (not (file-directory-p dir)))
	     (message "No messages remove.")
	   (if (not (y-or-n-p (format "Remove messages (%s) ? "
				      (mapconcat
				       (function
					(lambda (msg)
					  (format "%s" msg)))
				       msgs ","))))
	       (message "No messages remove.")
	     (goto-char (point-min))
	     (mapcar
	      (function
	       (lambda (msg)
		 (setq file (expand-file-name msg dir))
		 (if (and (file-readable-p file)
			  (file-writable-p file))
		     (progn
		       (delete-file file)
		       (if (or (and (not arg)
				    (re-search-forward
				     (concat "^ *" msg " +") nil t))
			       (and arg
				    (re-search-forward
				     (concat "^ *"
					     msg
					     (regexp-quote
					      (char-to-string mew-mark-review)))
				     nil t)))
			   (mew-elet
			    (mew-mark-delete-line)))))))
	      msgs)
	     (mew-summary-folder-cache-save fld)
	     (set-buffer-modified-p nil)
	     (message "Remove messages done."))))))))

-- 
白井秀行 (mailto:shirai at example.com)



Mew-dist メーリングリストの案内