To attach one file when in message-mode (e.g. when posting from Gnus), one does C-c C-a
. What's the recommended way for attaching multiple files ?
Repeating C-c C-a
can become tiresome after a while, because it asks three questions everytime.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityOpen the directory in dired
with C-x 4 d and type M-x turn-on-gnus-dired-mode
. Then mark the required files with m (or whatever) and type C-c RET C-a. The files can now be attached to an already opened message buffer or assigned to a new one.
Attach a file in Emacs is basically just insert a chunk of string containing file paths, you can use yasnippet to create chunks for you.
Here are the steps:
in shell, use find/ls to create the files list to attach
use cli clip tool (putclip on cygwin, pbpaste on Mac, xsel/xclip on linux) to transfer the files list to the yasnippet
mapcar
-- and attach once per element; or, (2) create a loop that automatically prompts yes/no to attach another, and no breaks the loop. I prefer the file list approach, and I use a real tree-view file manager for Emacs (to simultaneously select marked files in multiple directories to be attached); however, that requires advancedelisp
modifications. Most people stick todired-mode
anddired-get-marked-files
and there is a way to operate upon multiple opendired-mode
buffers.