[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
read-epub.el
From: |
Bob Newell |
Subject: |
read-epub.el |
Date: |
Sun, 8 Jun 2014 17:54:44 -0700 (PDT) |
User-agent: |
G2/1.0 |
I know there's epub-mode.el, but I ran into some problems and decided to
leverage ebook-convert in the Calibre package. The result is very simple though
definitely quick and dirty.
The file "bigbook.epub" is converted to "bigbook.epub.txt" and paragraphs are
wrapped. This will hose up stuff like text-based tables but I was mostly
interested in novels. Take out the wrapping if it gets in your way.
There are problems with embedded spaces in filenames so rename the epub if you
have them.
I told you it's not elegant!
;;;;;;;;;;;;;;;;; begin read-epub
;; read-epub
;; Read an epub in Emacs.
;; Requires Calibre package, to provide ebook-convert.
;; M-x read-epub
;; and give the path to the epub you want to read.
;; Inspired by epub-mode, but much simpler because it
;; depends on the Calibre package to do the work.
;; No error checking :) See the *Messages* buffer if
;; it doesn't work.
;; 2014-06-08 Bob Newell (address@hidden),
;; Honolulu, Hawai`i
;; Released into the public domain.
(defun read-epub (epub-file)
"Read epub files in emacs"
(interactive "fname of epub: ")
(message "Converting %s, this may take some time" epub-file)
(shell-command (concat "ebook-convert " epub-file " " epub-file".txt" ))
(find-file (concat epub-file ".txt"))
(mark-whole-buffer)
(fill-paragraph nil 1)
(save-buffer)
(delete-other-windows)
(goto-char (point-min))
)
;;;;;;;;;;;;;;; end read-epub
- read-epub.el,
Bob Newell <=