[mew-dist 29547] Re: Q: attach file by drag&drop

moto kawasaki moto at example.com
2012年 12月 30日 (日) 20:20:20 JST


早速どうもありがとうございます。質問をした川崎です。

教えていただいたコードを ~/.mew.el に追記した所、うまくいきました。

報告方々御礼まで

-- 
moto kawasaki <moto at example.com>

From: Hideyuki SHIRAI (白井秀行) <shirai at example.com>
To: mew-dist at example.com
Subject: [mew-dist 29546] Re: Q: attach file by drag&drop
Date:Sun, 30 Dec 2012 16:38:03 +0900 (JST)
Message-ID: <20121230.163803.263897839297922185.1BF46D at example.com>

shirai> こんにちは。最近 MBA 使っている白井です。
shirai> 
shirai> From: moto kawasaki <moto at example.com> さん曰く
shirai> Subject: [mew-dist 29545] Q: attach file by drag&drop
shirai> Message-ID: <20121230.113312.117957834876184743.moto at example.com>
shirai> Date: Sun, 30 Dec 2012 11:33:12 +0900 (JST)
shirai> 
shirai> > 最近、OS/Emacs/Mew のバージョンを上げたのですが、昔の環境ではできてい
shirai> > たところの
shirai> > 
shirai> >     Mew でメイル作成中にファイルをドラッグ&ドロップすれば、
shirai> >     そのファイルが添付される
shirai> > 
shirai> > ができなくて困っております。
shirai> > 解決策があれば教えてくださいませ。
shirai> > # C-c C-a からファイルを添付することは可能です。
shirai> > 
shirai> > 今の環境は次のとおりです。
shirai> > 
shirai> >     OS:     Mac OS X 10.7.5 (Darwin 11.4.2 x86_64)
shirai> >     Emacs:  GNU Emacs 24.2.50.2 (x86_64-apple-darwin11.4.2, NS
shirai> >             apple-appkit-1138.51) of 2012-10-13
shirai> >     Mew:    Mew version 6.5
shirai> 
shirai> OSX だと drag & drop が ns-drag-file という key で ns-find-file
shirai> に割り当てられているからの様ですね。OSX のことをよくわかっていな
shirai> いので見落としがあるような気もしますが、
shirai> 
shirai> (add-hook
shirai>  'mew-draft-mode-hook
shirai>  (lambda ()
shirai>    (define-key mew-draft-body-map [ns-drag-file] 'mew-draft-ns-attach-file)
shirai>    (define-key mew-draft-header-map [ns-drag-file] 'mew-draft-ns-attach-file)
shirai>    (define-key mew-draft-attach-map [ns-drag-file] 'mew-draft-ns-attach-file)))
shirai> 
shirai> (defun mew-draft-ns-attach-file ()
shirai>   "File attach with the `ns-input-file' as argument."
shirai>   (interactive)
shirai>   (let* ((from (file-truename
shirai> 		(expand-file-name (pop ns-input-file)
shirai> 				  command-line-default-directory)))
shirai> 	 (to (file-name-nondirectory from)))
shirai>     (when from
shirai>       (unless (mew-attach-p)
shirai> 	(mew-draft-prepare-attachments))
shirai>       (goto-char (point-max))
shirai>       (forward-line -2)
shirai>       (mew-attach-next)
shirai>       (cond
shirai>        ((file-directory-p from)
shirai> 	(message "Directory cannot be attached"))
shirai>        (t
shirai> 	(mew-attach-copy from to))))))
shirai> 
shirai> で(とりあえずは)出来ました。
shirai> 
shirai> -- 
shirai> 白井秀行 (mailto:shirai at example.com)


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