aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKjartan Oli Agustsson2022-03-07 17:29:38 +0100
committerLars Ingebrigtsen2022-03-07 17:29:38 +0100
commit494daefda1c7e6fc5881997de7c837172a4111c3 (patch)
tree0e589a2de92592409a747c3d8b06c44775b66b82
parentd67ca6739c3ed0c4ac36d3ee5a4eb158d791f668 (diff)
downloademacs-494daefda1c7e6fc5881997de7c837172a4111c3.tar.gz
emacs-494daefda1c7e6fc5881997de7c837172a4111c3.zip
Add user stylesheet option for doc-view EPUB support
* lisp/doc-view.el (doc-view-start-process): Add user stylesheet to process arguments when appropriate. * lisp/doc-view.el (doc-view-mutool-user-stylesheet): New user option. Copyright-paperwork-exempt: yes
-rw-r--r--lisp/doc-view.el18
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 193cf42ea42..5b07d75f6d8 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -226,6 +226,12 @@ are available (see Info node `(emacs)Document View')"
226Higher values result in larger images." 226Higher values result in larger images."
227 :type 'number) 227 :type 'number)
228 228
229(defcustom doc-view-mutool-user-stylesheet nil
230 "User stylesheet to use when converting EPUB documents to PDF."
231 :type '(choice (const nil)
232 (file :must-match t))
233 :version "29.1")
234
229(defvar doc-view-doc-type nil 235(defvar doc-view-doc-type nil
230 "The type of document in the current buffer. 236 "The type of document in the current buffer.
231Can be `dvi', `pdf', `ps', `djvu', `odf', 'epub', `cbz', `fb2', 237Can be `dvi', `pdf', `ps', `djvu', `odf', 'epub', `cbz', `fb2',
@@ -1169,8 +1175,16 @@ The test is performed using `doc-view-pdfdraw-program'."
1169 (options `(,(concat "-o" png) 1175 (options `(,(concat "-o" png)
1170 ,(format "-r%d" (round doc-view-resolution)) 1176 ,(format "-r%d" (round doc-view-resolution))
1171 ,@(if pdf-passwd `("-p" ,pdf-passwd))))) 1177 ,@(if pdf-passwd `("-p" ,pdf-passwd)))))
1172 (when (and (eq doc-view-doc-type 'epub) doc-view-epub-font-size) 1178 (when (eq doc-view-doc-type 'epub)
1173 (setq options (append options (list (format "-S%s" doc-view-epub-font-size))))) 1179 (when doc-view-epub-font-size
1180 (setq options (append options
1181 (list (format "-S%s" doc-view-epub-font-size)))))
1182 (when doc-view-mutool-user-stylesheet
1183 (setq options
1184 (append options
1185 (list (format "-U%s"
1186 (expand-file-name
1187 doc-view-mutool-user-stylesheet)))))))
1174 (doc-view-start-process 1188 (doc-view-start-process
1175 "pdf->png" doc-view-pdfdraw-program 1189 "pdf->png" doc-view-pdfdraw-program
1176 `(,@(doc-view-pdfdraw-program-subcommand) 1190 `(,@(doc-view-pdfdraw-program-subcommand)