[mew-dist 19329] Re: 一括添付

Hideyuki SHIRAI ( 白井秀行 ) shirai at example.com
2001年 10月 15日 (月) 19:59:36 JST


From: KOIE Hidetaka (鯉江英隆) <hide at example.com> さん曰く
Subject: [mew-dist 19328] Re: 一括添付
Message-ID: <01Oct15.191833jst.29575 at example.com>
Date: Mon, 15 Oct 2001 19:20:04 +0900

鯉江> 感謝! いいかんじです。

ども。

鯉江> 無条件にswitch-to-bufferしてますが、
鯉江> 画面をsplitして作業しているときにはうれしくないので
鯉江> set-bufferがよいのではないでしょうか。

なるほど、そうですね。それも含めて version up。

# けど、*やっつけ* でやっているのは変らず。。。

(add-hook 'dired-mode-hook
	  (lambda ()
	    (define-key dired-mode-map "\C-c\C-m" 'dired-do-mew-attach-copy)))

(add-hook 'mew-draft-mode-hook
	  (lambda ()
	    (define-key mew-draft-attach-map "M" 'mew-attach-from-dired)))

(defvar dired-mew-attach-copy-files nil)

(defun dired-do-mew-attach-copy (&optional arg)
  (interactive "P")
  (when (featurep 'mew)
    (or (featurep 'dired-aux) (require 'dired-aux))
    (setq dired-mew-attach-copy-files nil)
    (dired-map-over-marks-check
     (function dired-mew-attach-copy) arg 'mew-attach-copy t)
    (when dired-mew-attach-copy-files
      (let ((draft (mew-max-draft-buffer)) buf file)
	(if (null draft)
	    (message "No draft buffer exists!")
	  (setq buf (mew-input-buffer draft))
	  (if (null (get-buffer buf))
	      (message "No such draft buffer!")
	    (if (get-buffer-window buf)
		(select-window (get-buffer-window buf))
	      (switch-to-buffer buf))
	    (if (null (mew-draft-p))
		(message "draft folder!")
	      (unless (mew-attach-p) (mew-draft-prepare-attachments))
	      (goto-char (mew-attach-begin))
	      (when (re-search-forward " +\\([1-9][.0-9]*\\) +\\(\\.\\)" nil t)
		(goto-char (match-beginning 2))
		(sit-for 0)
		(if (y-or-n-p (format "Attach files at \"%s\" ? " (mew-match 1)))
		    (mew-attach-from-dired)
		  (message
		   (substitute-command-keys
		    "Move cursor and press '\\<mew-draft-attach-map>\\[mew-attach-from-dired]'")))))))))))

(defun dired-mew-attach-copy ()
  (let ((file (dired-get-filename)))
    (if (file-readable-p file)
	(progn
	  (setq dired-mew-attach-copy-files (cons file dired-mew-attach-copy-files))
	  nil)
      t)))

(defun mew-attach-from-dired ()
  (interactive)
  (if (mew-attach-not-line012-1)
      (when dired-mew-attach-copy-files
	(let (file)
	  (while (setq file (car dired-mew-attach-copy-files))
	    (mew-attach-copy file (file-name-nondirectory file))
	    (setq dired-mew-attach-copy-files (cdr dired-mew-attach-copy-files)))))
    (message "Can not attach from dired here")))

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



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