1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
script- mutt to plain text note
tags: nvalt gtd
date: January 24, 2013 19:03:28 PM
---
Subject: Re: Your Mutt Scripts...
Hi Scott,
Thanks for your nice message, and glad you found the posts useful.
Here's the script I use, which is somewhat geared towards my
idiosyncratic "2q" system:
#!/bin/sh
# $HOME/Scripts/m2q
BODY=$(sed -n '/^Date/,$ p' | grep -E -i '^[^X]+' | sed -En '/^Date/,/application\// p')
TITLE="2q $1"
echo "${BODY}" | sed -En '/^Date/,/text\/html/ p' > /Users/wcm1/Dropbox/notes/"$TITLE".txt
echo "${BODY}" | sed -En '/text\/html/,$ p' | pandoc --strict -f html -t markdown >> $HOME/Dropbox/notes/"$TITLE".txt
It's actually a very imperfect filter. The sed command in the BODY
variable is clumsy and designed mainly to clear out gobbledy-gook from
attachments. I use the other echo commands to print both the
plain-text version of the message and the HTML version (if there is
one) parsed by pandoc to my note.
Within put, I use the | key to call the pipe message command, and then
I enter:
m2q "Title of my note"
and hit enter (the Script is called m2q and resides in my $PATH).
You should be able to see how to make an even simpler script, though.
If all you wanted to do was be able to give your note a title within
Mutt, your script could look like this:
```
MESSAGE=$(cat)
TITLE="$1"
echo "${MESSAGE}" > path/to/notes/"$1".txt
```
Hope this helps,
Caleb
W. Caleb McDaniel
Assistant Professor of History
Rice University
http://wcm1.web.rice.edu
On Wed, Jan 23, 2013 at 04:54:49PM -0500, Scott Gilbertson wrote:
> Caleb-
>
> I stumbled across your site trying to perfect my GTD-in-plain-text
> system. I like what you wrote about regarding notational velocity, it's
> very similar to what I do.
>
> What I was writing about though is your mutt post. This bit about saving
> messages as plain text files caught my eye: "I wrote up a simple script
> that takes the message, cleans it up, and puts it in a plain text file
> whose title I specify within Mutt."
>
> I was wondering if you'd be willing to share that script?
>
> What I'm doing right now is just putting <pipe-message> in my muttrc and
> passing it to cat to saving the file in my notes folder. But I like the
> idea of giving it a title and everything right in mutt. I just can't
> seem to get that to work for me.
>
> Anyway, thanks for your time.
>
> cheers
> Scott Gilbertson
> sng@luxagraf.net
>
|