From: Steve Youngs Date: Sat, 18 Apr 2020 10:40:41 +0000 (+1000) Subject: Turn off PDF support in ffi-wand. X-Git-Tag: v22.1.17~5 X-Git-Url: http://cgit.sxemacs.org/?p=sxemacs;a=commitdiff_plain;h=080c0d4f34f91889ca786505fc38100b3c172922 Turn off PDF support in ffi-wand. Some versions of libWand struggled with PDF so easier just to turn it off here. * lisp/ffi/ffi-wand.el (Wand-file-supported-for-read-p): Don't do PDF. Signed-off-by: Steve Youngs --- diff --git a/lisp/ffi/ffi-wand.el b/lisp/ffi/ffi-wand.el index c309eb4..b8b304b 100644 --- a/lisp/ffi/ffi-wand.el +++ b/lisp/ffi/ffi-wand.el @@ -2979,11 +2979,13 @@ Bindings are: (defun Wand-file-supported-for-read-p (file) "Return non-nil if Wand can decode FILE." ;; Use `magic:file-image-p' first, fallback to file extension check - ;; if that fails. - (let ((itype (magic:file-image-p file)) - (ext (file-name-extension file))) - (or (and itype (Wand-format-supported-for-read-p itype)) - (and ext (Wand-format-supported-for-read-p ext))))) + ;; if that fails. But lets not do PDFs as some versions of libWand + ;; are a bit finicky in that regard. --SY. + (unless (equal (magic:file file :mime-type) "application/pdf") + (let ((itype (magic:file-image-p file)) + (ext (file-name-extension file))) + (or (and itype (Wand-format-supported-for-read-p itype)) + (and ext (Wand-format-supported-for-read-p ext)))))) (defun Wand-formats-list (fmt-regexp &optional mode) "Return names of supported formats that matches FMT-REGEXP.