emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [OT] Importing plain text attachments into Org
@ 2011-01-24  0:22 Richard Lawrence
  2011-01-24 10:15 ` Jeff Horn
  2011-01-24 18:37 ` Eric S Fraga
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Lawrence @ 2011-01-24  0:22 UTC (permalink / raw)
  To: emacs-orgmode

Dear Orgsters,

I'm hoping I can solicit a little advice about pulling email attachments
into Org (via Gnus), since some of the folks on this list seem to have
experience interacting with Gnus from Org.  I realize that the meat of
my question may be better asked on the Gnus list, but if anyone here has
knowledge and/or a similar setup that you'd be willing to share, I would
very much appreciate hearing about it.

The background: I am about to begin teaching a writing-intensive course.
Students will email me their papers every week.  I have no desire to
download, print, and read a bunch of .doc files by hand every week.
(This is a pain, and requires proprietary software I don't have; and I
find 12pt double-spaced Times New Roman much more difficult to read than
a LaTeX article anyway.)  So I am considering asking my students to
email their papers in plain text.  I would like to then apply some
automated processing on my end that would:

1) Download each student's paper into a file in my "teaching" directory.

2) Apply some *very* simple transformations, like adding #+TITLE before
their title, replacing Windows `smart quote' characters with ASCII ` and
', and generally making the files play nice with Org on a GNU box.  I
might also like to do things like run a word count at this stage to make
sure they are within the guidelines for the course.

3) Use Org's export abilities to compile each paper into a PDF (or
perhaps a single PDF for the whole week's submissions).

4) [Not necessary, but would be cool:] Automatically insert TODO items
into my agenda for each paper I have to read; automatically grade
students who don't turn in papers on time; etc.

Does anyone have any ideas about how I might go about this, and whether
it's worth the effort to automate it?  (I will have about 100 papers to
read this semester.)  

Thanks so much!

Best,
Richard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OT] Importing plain text attachments into Org
@ 2011-01-24  8:59 Rustom Mody
  0 siblings, 0 replies; 4+ messages in thread
From: Rustom Mody @ 2011-01-24  8:59 UTC (permalink / raw)
  To: emacs-orgmode

> replacing Windows `smart quote' characters with ASCII ` and ',

Ive seen more problem-causing characters like dashes of different
lengths and maybe some others

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OT] Importing plain text attachments into Org
  2011-01-24  0:22 [OT] Importing plain text attachments into Org Richard Lawrence
@ 2011-01-24 10:15 ` Jeff Horn
  2011-01-24 18:37 ` Eric S Fraga
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Horn @ 2011-01-24 10:15 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode

> Students will email me their papers every week.  I have no desire to
> download, print, and read a bunch of .doc files by hand every week.

I don't have direct answers to your other questions, but have a look
at catdoc and antiword (I prefer the latter) for reading docs on the
command line. I spotted an interesting article on how to use emacs to
open doc files using antiword, but haven't tried it yet.

    http://www.emacswiki.org/emacs/AntiWord

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OT] Importing plain text attachments into Org
  2011-01-24  0:22 [OT] Importing plain text attachments into Org Richard Lawrence
  2011-01-24 10:15 ` Jeff Horn
@ 2011-01-24 18:37 ` Eric S Fraga
  1 sibling, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2011-01-24 18:37 UTC (permalink / raw)
  To: Richard Lawrence; +Cc: emacs-orgmode

Richard Lawrence <richard.lawrence@berkeley.edu> writes:

> Dear Orgsters,
>
> I'm hoping I can solicit a little advice about pulling email attachments
> into Org (via Gnus), since some of the folks on this list seem to have
> experience interacting with Gnus from Org.  I realize that the meat of
> my question may be better asked on the Gnus list, but if anyone here has
> knowledge and/or a similar setup that you'd be willing to share, I would
> very much appreciate hearing about it.
>
> The background: I am about to begin teaching a writing-intensive course.
> Students will email me their papers every week.  I have no desire to
> download, print, and read a bunch of .doc files by hand every week.
> (This is a pain, and requires proprietary software I don't have; and I
> find 12pt double-spaced Times New Roman much more difficult to read than
> a LaTeX article anyway.)  So I am considering asking my students to
> email their papers in plain text.  I would like to then apply some
> automated processing on my end that would:

A lot depends on what you use to read your emails.  Since you are using
gnus, I think some aspects of what you want to do are possible.  You may
need to upgrade to no-gnus (the development version of gnus which goes
under various names...).

> 1) Download each student's paper into a file in my "teaching"
> directory.

I would avoid downloading the papers.  Simply use org-capture to create
a task for each paper you need to read that links automatically to the
gnus email.  Store a link first (org-store-link) when in the email and
then capture a task (org-capture) in which you insert the link
(org-insert-link).  You may wish to create a custom template and it may
be possible to extract the From and Subject fields from the link
information automatically (see messages in this list from a few weeks
ago, I believe -- I'm offline at the moment unfortunately).

> 2) Apply some *very* simple transformations, like adding #+TITLE before
> their title, replacing Windows `smart quote' characters with ASCII ` and
> ', and generally making the files play nice with Org on a GNU box.  I
> might also like to do things like run a word count at this stage to make
> sure they are within the guidelines for the course.

Assuming you follow my suggestion for 1) above, you can read the
document in the email with appropriate transformations (by "washing" the
email in gnus parlance; e.g. function gnus-article-fill-long-lines and
variable gnus-treat-strip-cr, amongst others).  You can display MS Word
documents inline in the message using mm-decode functions.  I have the
following set:

#+begin_src emacs-lisp
;; --- for MS Word files
(add-to-list 'mm-attachment-override-types "application/msword")
(add-to-list 'mm-attachment-override-types "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
(add-to-list 'mm-automatic-display "application/msword")
(add-to-list 'mm-inline-media-tests '("application/msword" mm-inline-text identity))
(add-to-list 'mm-automatic-display "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
(add-to-list 'mm-inline-media-tests '("application/vnd.openxmlformats-officedocument.wordprocessingml.document" mm-inline-text identity))
#+end_src

I don't pretend to understand some of this incantation, mind you...  in
any case, some of this will depend on your ~/.mailcap (or /etc/mailcap)
entries.  I have:

--8<---------------cut here---------------start------------->8---
application/msword; antiword -w 0 %s; copiousoutput
application/vnd.openxmlformats-officedocument.wordprocessingml.document; /home/ucecesf/s/bin/docx2txt.pl %s -; copiousoutput
--8<---------------cut here---------------end--------------->8---

where docx2txt.pl is a perl script I found on the web somewhere (I can
send it to you if you wish) that handles the latest MS Word format.

> 3) Use Org's export abilities to compile each paper into a PDF (or
> perhaps a single PDF for the whole week's submissions).
>
> 4) [Not necessary, but would be cool:] Automatically insert TODO items
> into my agenda for each paper I have to read; automatically grade
> students who don't turn in papers on time; etc.

You can tag your capture tasks created above appropriately and then use,
for instance, properties to enter marks which you can subsequently
collate (I believe -- I don't know how to do this but I believe it is
possible).

> Does anyone have any ideas about how I might go about this, and whether
> it's worth the effort to automate it?  (I will have about 100 papers to
> read this semester.)  

Enjoy!  ;-)
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.4 (release_7.4.232.g8d003)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-24 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24  0:22 [OT] Importing plain text attachments into Org Richard Lawrence
2011-01-24 10:15 ` Jeff Horn
2011-01-24 18:37 ` Eric S Fraga
  -- strict thread matches above, loose matches on Subject: below --
2011-01-24  8:59 Rustom Mody

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).