#3706: [PATCH] Renaming attachments when composing message
----------------------------+----------------------
 Reporter:  gauthma         |      Owner:  mutt-dev
     Type:  enhancement     |     Status:  new
 Priority:  minor           |  Milestone:
Component:  user interface  |    Version:
 Keywords:                  |
----------------------------+----------------------
 So mutt allows the user to rename an attachment, but what this does
 is to rename the underlying file. To me at least, this is 1) not
 very useful, and 2) a violation of the principle of least
 astonishment
 (http://en.wikipedia.org/wiki/Principle_of_least_astonishment). So I
 decided to have a look at the source code, to
 see if would be too hard to change.

 It wasn't, and indeed I was able to modify the source so it does
 what I want it to: renaming an attachment just changed the
 "filename" parameter that gets sent with the "Content-Disposition"
 header. But I ended up doing two additional changes, as described
 hereinafter.

 First, pressing R in the compose menu, brings up the "Rename to: "
 diaglog, pre-filled with the *unprettyfied* original attachment name (with
 path)(*). The idea is to allow the user to undo the rename: just press
 R<Enter> and the attachment gets its original name -- and accompanying
 path, just like if the user had just manually selected the relevant file
 again. We need the unprettyfied version in order to be able to compare it
 with the original name. Also, the new file name (inserted through the
 "Rename to: " dialog) must not contain forward slashes ('/'), except if
 it's the original filename (otherwise we could not revert to the original
 filename).

 Second, pressing (again on the compose menu) `^o` brings up a message
 displaying the original file path. The idea is to allow the user to check
 to what file corresponds a given (new) name. It may seem a strange
 feature, but I've found it useful in practice.

 The patch can be applied by cd'ing to mutt source dir, and doing `patch <
 /path/to/file.patch`. Feedback is welcome.

 Caveat lector: due to mutt's sui generis existing indentation style, I
 arranged the patch to divert from it as little as possible. To what degree
 I have succeeded is left to the reader to determine.

 (*) - Perhaps we should add a small appendix to the "Rename to: " string
 saying the user can press ^U to clear the pre-filled name (which, being a
 full path, can become quite long)?

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/3706>
Mutt <http://www.mutt.org/>
The Mutt mail user agent

Reply via email to