10

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.

  • There are two common approaches: (1) obtain a list of files and loop down the list -- e.g., 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 advanced elisp modifications. Most people stick to dired-mode and dired-get-marked-files and there is a way to operate upon multiple open dired-mode buffers. – lawlist Aug 6 '15 at 15:53
  • @lawlist Thanks. I'd like a file list approach indeed. I obviously don't want to write a lisp loop every time so my aim is to have a command. I'm not sure yet what the interface should look like. I'll think a bit more about and write code it if no ready-made solutions exists. – YoungFrog Aug 7 '15 at 17:36
18

Open 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.

  • I wish there was a similar setup as this one for mu4e – Andre Jul 22 at 14:13
-1

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

  • An example chunk would be helpful – Dieter.Wilhelm May 20 '18 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.