Re: [PATCH] Update: Edit the filename in the Content-Disposition header
* On Wed, Apr 05, 2006 at 10:12:40PM +0100, Simon Williams wrote:
> I was looking for a way to edit the suggested filename for an
> attachment sent in the Content-Disposition header (without first
> renaming the file).
>
> I've attached a patch to 1.5.11 to allow users to do that. The default
> key binding is 'ESC F' in the compose menu.
Spot the deliberate mistake. On taking another look at Mutt's
behaviour, it seems that a screen redraw wouldn't be of much help (at
least on my setup). An updated patch is attached.
Regards,
--
Simon Williams <simon@xxxxxxxxxxxxxxxxx> **** GPG: F4A23C69
"We demand rigidly defined areas of doubt and uncertainty."
- Douglas Adams
diff -ru mutt-1.5.11.orig/OPS mutt-1.5.11/OPS
--- mutt-1.5.11.orig/OPS 2005-07-24 17:56:42.000000000 +0100
+++ mutt-1.5.11/OPS 2006-04-05 21:58:17.000000000 +0100
@@ -22,6 +22,7 @@
OP_COMPOSE_EDIT_ENCODING "edit attachment transfer-encoding"
OP_COMPOSE_EDIT_FCC "enter a file to save a copy of this message in"
OP_COMPOSE_EDIT_FILE "edit the file to be attached"
+OP_COMPOSE_EDIT_FILENAME "edit the attachment filename"
OP_COMPOSE_EDIT_FROM "edit the from field"
OP_COMPOSE_EDIT_HEADERS "edit the message with headers"
OP_COMPOSE_EDIT_MESSAGE "edit the message"
diff -ru mutt-1.5.11.orig/PATCHES mutt-1.5.11/PATCHES
--- mutt-1.5.11.orig/PATCHES 2005-08-15 09:16:00.000000000 +0100
+++ mutt-1.5.11/PATCHES 2006-04-05 22:05:39.000000000 +0100
@@ -0,0 +1 @@
+patch-1.5.11.sw.edit_filename.1
diff -ru mutt-1.5.11.orig/compose.c mutt-1.5.11/compose.c
--- mutt-1.5.11.orig/compose.c 2005-08-11 20:37:23.000000000 +0100
+++ mutt-1.5.11/compose.c 2006-04-05 21:58:17.000000000 +0100
@@ -856,6 +856,21 @@
}
#undef CURRENT
+ /* Edit the filename as it appears in the Content-Disposition header */
+ case OP_COMPOSE_EDIT_FILENAME:
+ CHECK_COUNT;
+ strfcpy (buf,
+ idx[menu->current]->content->d_filename ?
+ idx[menu->current]->content->d_filename : "",
+ sizeof (buf));
+ if (mutt_get_field ("Filename: ", buf, sizeof (buf), 0) == 0)
+ {
+ mutt_str_replace (&idx[menu->current]->content->d_filename, buf);
+ }
+ mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ break;
+
case OP_COMPOSE_EDIT_DESCRIPTION:
CHECK_COUNT;
strfcpy (buf,
diff -ru mutt-1.5.11.orig/doc/manual.xml.tail mutt-1.5.11/doc/manual.xml.tail
--- mutt-1.5.11.orig/doc/manual.xml.tail 2005-09-04 07:57:04.000000000
+0100
+++ mutt-1.5.11/doc/manual.xml.tail 2006-04-05 21:58:17.000000000 +0100
@@ -314,6 +314,7 @@
edit-fcc f enter a file to save a copy of this message in
edit-from ESC f edit the from: field
edit-file ^X e edit the file to be attached
+edit-filename ESC F edit edit suggested filename on attachment
edit-headers E edit the message with headers
edit e edit the message
edit-mime m edit attachment using mailcap entry
diff -ru mutt-1.5.11.orig/functions.h mutt-1.5.11/functions.h
--- mutt-1.5.11.orig/functions.h 2005-07-24 17:56:42.000000000 +0100
+++ mutt-1.5.11/functions.h 2006-04-05 21:58:17.000000000 +0100
@@ -288,6 +288,7 @@
{ "edit-message", OP_COMPOSE_EDIT_MESSAGE, "e" },
{ "edit-headers", OP_COMPOSE_EDIT_HEADERS, "E" },
{ "edit-file", OP_COMPOSE_EDIT_FILE, "\030e" },
+ { "edit-filename", OP_COMPOSE_EDIT_FILENAME, "\033F" },
{ "edit-encoding", OP_COMPOSE_EDIT_ENCODING, "\005" },
{ "edit-from", OP_COMPOSE_EDIT_FROM, "\033f" },
{ "edit-fcc", OP_COMPOSE_EDIT_FCC, "f" },