The option x-neomutt-keep instructs neomutt not to remove the attachment
after the view-command has quit. This is helpful with mime types handled
by commands such as firefox, which fork before opening the attachment in
the main instance. Example:
application/pdf; evince; x-neomutt-keep;
return_error:
- if (entry)
- rfc1524_free_entry(&entry);
- if (fp && tempfile[0])
+ if (!entry || !entry->xneomuttkeep)
{
- /* add temporary file to TempAttachmentsList to be deleted on exit */
- mutt_add_temp_attachment(tempfile);
+ if (fp && tempfile[0])
+ {
+ /* add temporary file to TempAttachmentsList to be deleted on exit */
+ mutt_add_temp_attachment(tempfile);
+ }
+ else if (unlink_tempfile)
+ {
+ unlink(tempfile);
+ }
}
- else if (unlink_tempfile)
- unlink(tempfile);
+
+ if (entry)
+ rfc1524_free_entry(&entry);
if (pagerfile[0])
mutt_file_unlink(pagerfile);
FREE(&test_command);
}
}
+ else if (mutt_str_strncasecmp(field, "x-neomutt-keep", 14) == 0)
+ {
+ if (entry)
+ entry->xneomuttkeep = true;
+ }
} /* while (ch) */
if (opt == MUTT_AUTOVIEW)
FREE(&entry->convert);
entry->needsterminal = false;
entry->copiousoutput = false;
+ entry->xneomuttkeep = false;
}
}
} /* while (!found && (buf = mutt_file_read_line ())) */
char *convert;
bool needsterminal : 1; /**< endwin() and system */
bool copiousoutput : 1; /**< needs pager, basically */
+ bool xneomuttkeep : 1; /**< do not remove the file on command exit */
};
struct Rfc1524MailcapEntry *rfc1524_new_entry(void);