Skip to content

Instantly share code, notes, and snippets.

@anarazel
Created December 5, 2012 15:29
Show Gist options
  • Save anarazel/4216557 to your computer and use it in GitHub Desktop.
Save anarazel/4216557 to your computer and use it in GitHub Desktop.
diff --git a/handler.c b/handler.c
index 13c89ec..3f21e79 100644
--- a/handler.c
+++ b/handler.c
@@ -1236,7 +1236,7 @@ static int autoview_handler (BODY *a, STATE *s)
int rc = 0;
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
- rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW);
+ rfc1524_mailcap_lookup (a, type, entry, s->flags & M_REPLYING ? M_COMPOSE : M_AUTOVIEW);
fname = safe_strdup (a->filename);
mutt_sanitize_filename (fname, 1);
@@ -1245,7 +1245,10 @@ static int autoview_handler (BODY *a, STATE *s)
if (entry->command)
{
- strfcpy (command, entry->command, sizeof (command));
+ if (s->flags & M_REPLYING && entry->composecommand)
+ strfcpy (command, entry->composecommand, sizeof (command));
+ else
+ strfcpy (command, entry->command, sizeof (command));
/* rfc1524_expand_command returns 0 if the file is required */
piped = rfc1524_expand_command (a, tempfile, type, command, sizeof (command));
@@ -1534,7 +1537,7 @@ int mutt_body_handler (BODY *b, STATE *s)
{
rfc1524_entry *entry = rfc1524_new_entry ();
- if (rfc1524_mailcap_lookup (b, type, entry, M_AUTOVIEW))
+ if (rfc1524_mailcap_lookup (b, type, entry, s->flags & M_REPLYING ? M_COMPOSE : M_AUTOVIEW))
{
handler = autoview_handler;
s->flags &= ~M_CHARCONV;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment