]> git.cworth.org Git - notmuch-wiki/commitdiff
Add how to attach files from command line
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 19 Nov 2010 09:56:37 +0000 (10:56 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 19 Nov 2010 09:56:37 +0000 (10:56 +0100)
emacstips.mdwn

index 5f483355b2579d57fd36124953a2a44489f8514e..9c5c3d87b115295ec9cb70da7369acae90e73967 100644 (file)
@@ -70,6 +70,20 @@ from a file manager into a mail composition window to have it attached
 (assuming you are using emacs with X support).  At least in Ubuntu it
 works by dragging from the file manager without any modifications.
 
+And for those who prefer working from command line, the following
+script opens new emacs window with empty message and attaches files
+mentioned as script arguments. (Note: The script expects that you have
+`(server-start)` in your .emacs)
+
+    #!/bin/sh
+    attach_cmds=""
+    while [ "$1" ]; do
+        attach_cmds="$attach_cmds (mml-attach-file \"$1\")"
+        shift
+    done
+    emacsclient -a '' -c -e "(progn (compose-mail) $attach_cmds)"
+
+
 -----
 
 <h2 id="advanced_tips">Advanced tips and tweaks</h2>