emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Capture from GNU screen to Org-mode (was: Email -> Org-mode: charset


From: Karl Voit
Subject: [O] Capture from GNU screen to Org-mode (was: Email -> Org-mode: charset problem)
Date: Tue, 28 Jun 2011 19:13:33 +0200
User-agent: slrn/0.9.9 (Linux)

* David Maus <address@hidden> wrote:
>
> As far as I know a lot, if not most, email messages are transfered in
> 7bit for backward compatibility reasons and getting things other than
> text/plain; charset=3Dus-ascii across the net via email requires a lot
> of things to consider (RFC2045-49 in all their glory). 

Yes. The header is always 7-bit ASCII. The body has to be
interpreted by very advanced algorithms in order to show the various
types of content properly.

> So dumping the raw message won't help, you need functions for
> processing the raw message informaton.

I came to the very same conclusion. :-( I thought «formail» would be
able to handle charset for me.

> Here's an idea (or two).

Thanks for your ideas!

Those are perfectly good tips for someone who is using a MUA and
Org-mode on the same computer.

But my system is different since I am using «mutt»[1] as MUA
(running in a GNU screen[2] session) on a remote server (accessed by
ssh). 

Org-mode is (only) running on my local machine since the (very slow)
root server is an old Debian stable one (with emacs21 only).

My personal solution for the moment is following system:

Since I am using GNU screen which has the ability to dump its screen
content (non graphical!) into a file, I wrote a shell script that
generates an Org-mode entry and appends it to the input.org which
will be synchronized over all my systems anyway (by cron and
unison[3] although dvcs-autosync[4] seems to be very handy too for
building your own Dropbox[5] alternative, respectively).

,----[ *one* line from my .screenrc ]
| bind O eval "hardcopy_append off" "hardcopy
|   $HOME/screen-capture.tmp" "screen sh
|   $HOME/bin/add-screensnapshot-to-org.sh"
`----

... this one creates a screenshot when I press «Ctrl-a O» in GNU
screen. Then «$HOME/screen-capture.tmp» gets filled with the screen
content (which is the start of an email or a usenet posting[6] or
similar - whichever is shown currently in GNU screen).

Then following script generates the (simple) Org-mode entry:

,----[ $HOME/bin/add-screensnapshot-to-org.sh ]
| #!/bin/sh
| ## generates an org-file-entry from a screen capture file from GNU screen
|
| SCREENCONTENTFILE="$HOME/screen-capture.tmp"
| ORGFILE="$HOME/org-mode/inbox.org"
|
| ## not very elegant, I know:
| echo "* TODO screen "`date '+%Y-%m-%dT%H:%M'` >> ${ORGFILE}
| echo ":PROPERTIES:" >> ${ORGFILE}
| echo ":CREATED: <"`date '+%Y-%m-%d %a %H:%M'`">" >> ${ORGFILE}
| echo ":END:" >> ${ORGFILE}
| echo >> ${ORGFILE}
| echo "#+BEGIN_VERB" >> ${ORGFILE}
| cat "${SCREENCONTENTFILE}" >> ${ORGFILE}
| echo "#+END_VERB" >> ${ORGFILE}
| echo  >> ${ORGFILE}
|
| #end
`----

Probably this method could be handy for other users of GNU screen
and Org-mode too.

  1. http://www.mutt.org/
  2. https://secure.wikimedia.org/wikipedia/en/wiki/GNU_Screen
  3. http://www.cis.upenn.edu/~bcpierce/unison/
  4. http://www.mayrhofer.eu.org/dvcs-autosync
  5. https://www.dropbox.com/
  6. http://www.slrn.org/
-- 
Karl Voit




reply via email to

[Prev in Thread] Current Thread [Next in Thread]