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 ([email protected]),
;;            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

  
_______________________________________________
gnu-emacs-sources mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnu-emacs-sources

Reply via email to