From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#43775: 28.0.50; Feature request: to include EPUB reading into doc-view Date: Sat, 03 Oct 2020 13:30:30 +0200 Message-ID: <87eemfpmw9.fsf@posteo.net> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11684"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: 43775@debbugs.gnu.org To: Jean Louis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 03 13:31:26 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kOfl8-0002vf-GB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Oct 2020 13:31:26 +0200 Original-Received: from localhost ([::1]:54120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOfl7-0002KF-Bz for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Oct 2020 07:31:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOfkl-0002Jw-UL for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 07:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOfkj-0004FS-S5 for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 07:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kOfkj-0006jD-MP for bug-gnu-emacs@gnu.org; Sat, 03 Oct 2020 07:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Oct 2020 11:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43775 X-GNU-PR-Package: emacs Original-Received: via spool by 43775-submit@debbugs.gnu.org id=B43775.160172464825144 (code B ref 43775); Sat, 03 Oct 2020 11:31:01 +0000 Original-Received: (at 43775) by debbugs.gnu.org; 3 Oct 2020 11:30:48 +0000 Original-Received: from localhost ([127.0.0.1]:43076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOfkV-0006Wj-LG for submit@debbugs.gnu.org; Sat, 03 Oct 2020 07:30:48 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:36687) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kOfkS-0006No-TZ for 43775@debbugs.gnu.org; Sat, 03 Oct 2020 07:30:46 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 26C33160061 for <43775@debbugs.gnu.org>; Sat, 3 Oct 2020 13:30:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1601724638; bh=3iPk4+JMoPEg6Z1DM2U40SdG5x52y16070o4mm9PzCA=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=hqB75ckgOp67TP3wi1TjNX5wJLhWg3SVb7VsWAplOkyly3Ay6Wry+hDMW64K5773Q hGzHmbIJTJpXcvTWCRsAwhChU1dtSJ40tWFQibsjTHtgPXyD1RWkgqgt35cLrd3/g0 adfrea3BfIVJ3DYZRqW2HCf7YXgBabqDWGpaqUeFs4FUVkQoROzw1IBcI+NBLPkwAA cc4Vv3/J3fuMmhIgJ4wnYHYNtogJsqx4Lh1KZ4Zky42UFupxJj6zXIRjAMDo2j/4oI Kn9OUFWPMVBcPJCibYffGW4W8XZ9iY31cmLz3QSePcrInRIbYM/rJISAwWZ8yhA/AB rN+yAJttuNOGw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4C3Pml31WFz6tmg; Sat, 3 Oct 2020 13:30:31 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; keydata= mDMEX3hAuhYJKwYBBAHaRw8BAQdAFAm2xCB82dkbDzzXb3owKQrQa+3cOCJFirsJ0GeCoXC0OlBo aWxpcCBLLiAoZ2VuZXJhdGVkIGJ5IGF1dG9jcnlwdC5lbCkgPHBoaWxpcGtAcG9zdGVvLm5ldD6I lgQTFggAPhYhBL25GCaJ81Yt15g9j5xJtnmp46ehBQJfeEC6AhsDBQkB4TOABQsJCAcCBhUKCQgL AgQWAgMBAh4BAheAAAoJEJxJtnmp46ehbNwA/0NWK8pkKN+fRHNYpmSM0Uu9m3IEQDRVxcEuYjBl vWlnAQDrJ1d94ueMHFiDuiEZGIzuXxMcaSiCyh+OZ2Yuuaf2Bbg4BF94QLoSCisGAQQBl1UBBQEB B0BIeofrhv+0MuWbs3YYomIJLn6QLmd0e4SHPFkJpKAYJwMBCAeIfgQYFggAJhYhBL25GCaJ81Yt 15g9j5xJtnmp46ehBQJfeEC6AhsMBQkB4TOAAAoJEJxJtnmp46ehjGUA/1P7RU4AxUgE9rc7044A 14pQcxegwe5erf5Xfx2epxkSAP0bmvK3zgkor2NLmE658/ExN3+SVjDuoxlu/QK0on0pAA== In-Reply-To: (Jean Louis's message of "Sat, 03 Oct 2020 11:03:48 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:189692 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jean Louis writes: > Situation is that doc-view can read PDF files, and Libreoffice or Open > Document files, and others, but EPUB files are not included. Many > digital books are made in EPUB format. > > Vasilij Schneidermann have written the nov= -mode > which when aded to auto-mode-list, opens EPUB files > > (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) > > I have asked him, he would be somehow willing to cooperate if this is > also confirmed by more users, there are few problems with it, as it > depends on dash.el and other packages. I sent him a patch a few weeks ago to remove dash (attached below), so that shouldn't be an issue if he's interested. It's not a radical change, but at the time he wasn't interested. The second dependency, esxml is practically part of nov-mode, and wouldn't make sense to factor it out. --=20 Philip K. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Drop-dash-dependency.patch >From a50b42281c8dfa4bb727f43f006cbaefa0d88640 Mon Sep 17 00:00:00 2001 From: Philip K Date: Fri, 28 Aug 2020 23:34:05 +0200 Subject: [PATCH] Drop dash dependency --- nov.el | 96 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/nov.el b/nov.el index 0072ea1..43749de 100644 --- a/nov.el +++ b/nov.el @@ -5,7 +5,7 @@ ;; Author: Vasilij Schneidermann ;; URL: https://depp.brause.cc/nov.el ;; Version: 0.3.0 -;; Package-Requires: ((dash "2.12.0") (esxml "0.3.3") (emacs "24.4")) +;; Package-Requires: ((esxml "0.3.3") (emacs "24.4")) ;; Keywords: hypermedia, multimedia, epub ;; This file is NOT part of GNU Emacs. @@ -44,7 +44,7 @@ ;;; Code: (require 'cl-lib) -(require 'dash) +(require 'pcase) (require 'esxml-query) (require 'shr) (require 'url-parse) @@ -148,8 +148,9 @@ Each element of the stack is a list (NODEINDEX BUFFERPOS).") (defun nov-directory-files (directory) "Returns a list of files in DIRECTORY except for . and .." - (--remove (string-match-p "/\\.\\(?:\\.\\)?\\'" it) - (directory-files directory t))) + (cl-loop for file in (directory-files directory t) + unless (string-match-p "/\\.\\(?:\\.\\)?\\'" file) + collect file)) (defun nov-contains-nested-directory-p (directory) "Non-nil if DIRECTORY contains exactly one directory." @@ -167,9 +168,9 @@ Each element of the stack is a list (NODEINDEX BUFFERPOS).") (delete-directory child)) (defun nov--fix-permissions (file-or-directory mode) - (->> (file-modes file-or-directory) - (file-modes-symbolic-to-number mode) - (set-file-modes file-or-directory))) + (let* ((modes (file-modes file-or-directory)) + (symbolic (file-modes-symbolic-to-number mode modes))) + (set-file-modes file-or-directory symbolic))) (defun nov-fix-permissions (directory) "Iterate recursively through DIRECTORY to fix its files." @@ -306,7 +307,9 @@ Required keys are 'identifier and everything in "Extract an alist of manifest files for CONTENT in DIRECTORY. Each alist item consists of the identifier and full path." (mapcar (lambda (node) - (-let [(&alist 'id id 'href href) (esxml-node-attributes node)] + (let* ((attr (esxml-node-attributes node)) + (id (cdr (assq 'id attr))) + (href (cdr (assq 'href attr)))) (cons (intern id) (nov-make-path directory (nov-urldecode href))))) (esxml-query-all "package>manifest>item" content))) @@ -336,7 +339,7 @@ Each alist item consists of the identifier and full path." (let ((toc-file (assq nov-toc-id manifest))) (when (not toc-file) (error "EPUB 3