]> git.cworth.org Git - notmuch-wiki/commitdiff
Fix script for adding attachments from command line
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 28 Dec 2010 13:38:20 +0000 (14:38 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 28 Dec 2010 13:38:20 +0000 (14:38 +0100)
It is better to specify the attachment via its full path, because if
the attachment markup is copied to another buffer, the relative path
may not be valid there.

emacstips.mdwn

index fb9742a0c96f1c561b9b761aa65a866c1af7efd5..7a23293783bd467d99b8128b917b3d9c63bd4d8a 100644 (file)
@@ -78,7 +78,8 @@ mentioned as script arguments. (Note: The script expects that you have
     #!/bin/sh
     attach_cmds=""
     while [ "$1" ]; do
-        attach_cmds="$attach_cmds (mml-attach-file \"$1\")"
+        fullpath=$(readlink --canonicalize $1)
+        attach_cmds="$attach_cmds (mml-attach-file \"$fullpath\")"
         shift
     done
     emacsclient -a '' -c -e "(progn (compose-mail) $attach_cmds)"