I've started using tm_wait as my mutt editor, and have been working on an email bundle to make editing mail easier in TextMate. I've finally got automatic hard-wrapping working (I have a macro bound to <return> that hands off the current paragraph to the 'par' wrapping utility; this handles wrapping better than TM's "Reformat Paragraph" command). The last thing I'd like to do to polish off the text-wrap is to set "Soft wrap" on and adjust the wrap column whenever an email is opened.
Is there any way to do this? The soft wrap setting at least appears to be stored on a per-window basis. I was thinking they would be stashed in the file's metadata, but using the xattr tool (mentioned at http://arstechnica.com/reviews/os/macosx-10.4.ars/7) shows that only the caret location is saved. (Hmmm... I could use this to place the cursor below the mail headers... but I digress.) I haven't seen mention of "hooks" in TextMate for calling commands/macros, but maybe I just haven't looked hard enough.
Suggestions are appreciated.
On 20/09/2005, at 10.57, Eric Peden wrote:
[...] (I have a macro bound to <return> that hands off the current paragraph to the 'par' wrapping utility; this handles wrapping better than TM's "Reformat Paragraph" command).
I didn't know this utility, but have now installed it. Though I see (from the man):
For the "power user", a full understanding of par will require multiple readings of the TERMINOLOGY, OPTIONS, DETAILS, and EXAMPLES sections.
So may be a while before grasp it all ;)
The last thing I'd like to do to polish off the text-wrap is to set "Soft wrap" on and adjust the wrap column whenever an email is opened.
Is there any way to do this? The soft wrap setting at least appears to be stored on a per-window basis.
It is not, it is saved on (sort of) a per-file type basis.
So what I'd suggest is to create a new language (you'd probably do that anyway to get proper styling of quoted text etc.) and use that language for your emails (so give it a unique extensions, so they'll be recognized).
If you toggle the soft wrap setting, while the language is set to your new email language, it should stick for that file type.
On Wed, Sep 21, 2005 at 04:23:17PM +0200, Allan Odgaard wrote:
On 20/09/2005, at 10.57, Eric Peden wrote:
[...] (I have a macro bound to <return> that hands off the current paragraph to the 'par' wrapping utility; this handles wrapping better than TM's "Reformat Paragraph" command).
I didn't know this utility, but have now installed it. Though I see (from the man):
For the "power user", a full understanding of par will require
multiple readings of the TERMINOLOGY, OPTIONS, DETAILS, and EXAMPLES sections.
So may be a while before grasp it all ;)
I just grabbed my par options from someone else's example. ;) In case it's of use to anyone else, here's the command I use to re-wrap the currently selected text. Input = selected text, output = replace selected text:
PARINIT="rTbgqR B=.,?!_A_a Q=_s>|+" /opt/local/bin/par
Of course, adjust the path to 'par' as appropriate for your system.
What do those PARINIT settings do? In a shocking display of ignorance... I have no idea. But they "just work" for email re-wrapping. As an exercise for the reader, instructing 'par' to add spaces to the end of each line, or piping the output of par through sed to accomplish the same thing, should make text suitable for use in format=flowed messages.
The last thing I'd like to do to polish off the text-wrap is to set "Soft wrap" on and adjust the wrap column whenever an email is opened.
Is there any way to do this? The soft wrap setting at least appears to be stored on a per-window basis.
[...]If you toggle the soft wrap setting, while the language is set to your new email language, it should stick for that file type.
I had already created a new language. I just hadn't noticed the soft wrap command sticking... it does in fact seem to be doing this. An excellent example of a smart program anticipating my needs ahead of time, without getting in the way of what I'm actually trying to do. I hope Clippy the Paperclip is paying attention...
On 20/09/2005, at 10.57, Eric Peden wrote:
I've started using tm_wait as my mutt editor, and have been working on an email bundle to make editing mail easier in TextMate. I've finally got automatic hard-wrapping working
Curious.. why would you want this (hard wrap)? Doesn't mutt wrap outgoing mails itself? Surely it must do so if it adheres to the SMTP and MIME standards? Automated is also a half solution anyway, as it will mess up if you go back and correct.
-- Sune.
On 21/09/2005, at 21.56, Sune Foldager wrote:
[...] I've finally got automatic hard-wrapping working
[...] Automated is also a half solution anyway, as it will mess up if you go back and correct.
And when people quote you, unless they reflow your text, which e.g. I didn't do for this and my previous reply in this thread.
Mail seems to handle this (soft wrap over email) pretty good with the format=flowed [1].
On Wed, Sep 21, 2005 at 09:56:01PM +0200, Sune Foldager wrote:
On 20/09/2005, at 10.57, Eric Peden wrote:
I've started using tm_wait as my mutt editor, and have been working on an email bundle to make editing mail easier in TextMate. I've finally got automatic hard-wrapping working
Curious.. why would you want this (hard wrap)? Doesn't mutt wrap outgoing mails itself? Surely it must do so if it adheres to the SMTP and MIME standards? Automated is also a half solution anyway, as it will mess up if you go back and correct.
Mutt (rightly so, in my opinion) considers text-wrapping to be the domain of the text editor. For example, if I'm posting, say, a log file, or a Makefile output, or source code, I need to be in control of the wrapping. There are times when it's important to include an extra-long line, especially when you're trying to include verbatim text that wasn't necessarily intended for inclusion in an e-mail. If mutt auto-wrapped, it would mangle the text and I'd never even know it was happening. By respecting the text given to it by the editor, mutt avoids this switcheroo on the user.
You're correct in pointing out that hard wrapped text can cause problems during editing... but that's what I use TM's "Reformat paragraph" command for. ;) The problem with auto-wrapping the text after it's written is that, sometimes, you don't want the text auto-wrapped (see my explanation above, and consider short bulleted lists as another example). By re-wrapping paragraphs on hitting return, I get automatic wrapping when I need it, i.e., most of the time. When I *don't* want a paragraph wrapped in TextMate, I just press option-return: this bypasses my wrap command and gives me a hard line break. Best of both worlds.
On 23/09/2005, at 2.24, Eric Peden wrote:
Curious.. why would you want this (hard wrap)? [...]
[...] The problem with auto-wrapping the text after it's written is that, sometimes, you don't want the text auto-wrapped (see my explanation above, and consider short bulleted lists as another example).
But format=flowed solves that, as long as the receiver also supports f=f. And in addition, it doesn't require a heuristic to figure out which text is quoted at what level.
Of course f=f can't distinguish between a line which is long because it's a paragraph, or long because it was something quoted verbatim from a log file or similar, so the receiving client will apply soft wrap to both lines (but using the width of the receivers display).
That said, you're naturally free to wrap and reflow as you like :)