From: Brian Sniffen <bts@evenmere.org>
To: Bart Bunting <bart.bunting@ursys.com.au>, notmuch@notmuchmail.org
Subject: Re: converting attachments to text
Date: Tue, 03 Jan 2017 12:23:34 -0500 [thread overview]
Message-ID: <874m1gukfd.fsf@istari.evenmere.org> (raw)
In-Reply-To: <m260lwmwmc.fsf@fiz.local>
[-- Attachment #1: Type: text/plain, Size: 771 bytes --]
Sure! Here's what I use for docx, and I think it could be adapted to
pdf with pdftotext or whatever you're already using there. You need a
small shell script that reads from STDIN, writes to a file, and calls
pandoc or pdftotext or whatever, like ~/bin/antiwordx:
#!/bin/sh
tmpfile=$(mktemp /tmp/antiwordx.XXXXXX.docx)
trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT
cat > "$tmpfile"
pandoc --normalize -r docx -w markdown "$tmpfile"
You need a small handler function to call it from Elisp---see attached
file `inline-docx.el`, which assumed you have both the old `antiword`
for old-style .doc files and pandoc for new-style `docx`.
I apologize for the roughness of the code; it should probably use
customizable paths for pandoc and such.
-Brian
[-- Attachment #2: inline-docx.el --]
[-- Type: application/emacs-lisp, Size: 3445 bytes --]
[-- Attachment #3: Type: text/plain, Size: 993 bytes --]
Bart Bunting <bart.bunting@ursys.com.au> writes:
> Hi,
>
> Just looking for some pointers.
>
> I have to deal with quite a few emails with attachments in either pdf or
> word format.
>
> I'm on a mac so can use applescript or something pdftotext or similar to
> convert them to text.
>
> I'm blind so use emacspeak as my primary interface. Having an easy way
> to convert the notmuch attachments to text other than saving to a file
> and processing them would greatly speed up my workflow.
>
> Is there something in existance already to do this sort of thing?
>
> I have a little rudimentary lisp skill so can hack something up if
> someone can give me some pointers on a direction to head in.
>
> Any advice appreciated.
>
> Kind regards
>
> Bart
>
> Kind regards
> Bart
> --
>
> Bart Bunting - URSYS
> PH: 02 87452811
> Mbl: 0409560005
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
next prev parent reply other threads:[~2017-01-03 17:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-03 7:27 converting attachments to text Bart Bunting
2017-01-03 7:49 ` Daniel Kahn Gillmor
2017-01-03 17:23 ` Brian Sniffen [this message]
2017-01-10 0:57 ` Bart Bunting
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874m1gukfd.fsf@istari.evenmere.org \
--to=bts@evenmere.org \
--cc=bart.bunting@ursys.com.au \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.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).