From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karl Voit Subject: Capture from GNU screen to Org-mode (was: Email -> Org-mode: charset problem) Date: Tue, 28 Jun 2011 19:13:33 +0200 Message-ID: <2011-06-28T18-54-01@devnull.Karl-Voit.at> References: <2011-06-27T10-18-00@devnull.Karl-Voit.at> <87fwmvghxa.wl%dmaus@ictsoc.de> Reply-To: news1142@Karl-Voit.at Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:38946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbbrE-000098-03 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 13:13:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbbrA-00074y-06 for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 13:13:51 -0400 Received: from lo.gmane.org ([80.91.229.12]:56240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qbbr9-00074q-Ic for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 13:13:47 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qbbr9-0006ty-2X for emacs-orgmode@gnu.org; Tue, 28 Jun 2011 19:13:47 +0200 Received: from mail.michael-prokop.at ([88.198.6.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Jun 2011 19:13:47 +0200 Received: from news1142 by mail.michael-prokop.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Jun 2011 19:13:47 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * David Maus 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