all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-devel@gnu.org
Subject: DJVU files and ImageMagick
Date: Sat, 02 Feb 2019 23:12:12 +0100	[thread overview]
Message-ID: <87zhrdn8lf.fsf@gmx.net> (raw)

Should the following change be made?

diff --git a/lisp/image.el b/lisp/image.el
index 3aa3b0aa24..ba75bdf034 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -902,7 +902,7 @@ imagemagick-register-types
       (setq imagemagick--file-regexp re))))
 
 (defcustom imagemagick-types-inhibit
-  '(C HTML HTM INFO M TXT PDF)
+  '(C HTML HTM INFO M TXT PDF DJVU)
   "List of ImageMagick types that should never be treated as images.
 This should be a list of symbols, each of which should be one of
 the ImageMagick types listed by `imagemagick-types'.  The listed

Here's my reason for asking:

If Emacs is built without ImageMagick support and the ddjvu program
(from DjVuLibre) is found, DJVU files are automatically (via
auto-mode-alist) displayed in doc-view-mode.  If Emacs is built with
ImageMagick support (version 6 or 7), image-mode is used to display DJVU
files, because DJVU is one of the images type imagemagick-register-types
assigns to image-mode and adds the corresponding entry to
auto-mode-alist before the entry using doc-view-mode-maybe.

I build Emacs from master with ImageMagick support, but if I try to
visit a DJVU file (e.g. a ca. 200 page book of about 1.5 MB),
immediately almost all my system's RAM is consumed, bringing Emacs to a
halt, so it doesn't display the file, and I can recover the memory only
by killing Emacs.  In contrast, when I open the same DJVU file from the
shell using the ImageMagick 'display' command, it also uses most of the
system memory for a number of seconds but then does display the file and
I can exit the program normally and recover the memory.  (This is with
ImageMagick 7; I also tried it on another system using ImageMagick 6 and
there, but using 'display' from the shell was the same as the Emacs
behavior: almost all memory was consumed and the process had to be
killed.)  Can anyone here visit a comparably sized DJVU file in Emacs
built with ImageMagick and have it displayed?  If so, maybe my system
just lacks sufficient memory (it has 4GB RAM + 1 GB swap) -- though that
doesn't explain the difference between 'display' and Emacs+ImageMagick
with ImageMagick 7.

I can prevent Emacs from using ImageMagick with DJVU by customizing
either imagemagick-types-inhibit or imagemagick-enabled-types, but if
this is a general issue, maybe the default value of one of these should
be changed to prevent using ImageMagick with DJVU files.  I see that by
default, PDF is in both lists, whereas DJVU is only in the latter (which
comes from imagemagick-types according to what ImageMagick itself claims
to support).  And indeed, when I try to open a PDF file from the shell
with 'display', the process aborts, so I infer that's why PDF was added
to imagemagick-types-inhibit, and hence, if the problem with DJVU I see
is general, the same thing should be done for this file type (i.e., the
above patch).  (I normally view DJVU files in Emacs using the
djvu package from ELPA, which like doc-view uses DjVuLibre programs, not
ImageMagick, so it doesn't have this issue; but if I use C-x C-f or
Dired to visit a DJVU file, I get the problem.)

If this is just a problem of too little memory, an alternative to
changing the default value of imagemagick-types-inhibit is to add a note
to etc/PROBLEMS suggesting to customize this user option.

Steve Berman



             reply	other threads:[~2019-02-02 22:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02 22:12 Stephen Berman [this message]
2019-02-03 17:12 ` DJVU files and ImageMagick Eli Zaretskii
2019-02-03 21:48   ` joakim
2019-02-04  2:30 ` Roland Winkler
2019-02-04  7:18   ` Colin Baxter
2019-02-04 17:34   ` Stephen Berman
2019-02-06  3:53     ` Roland Winkler
2019-02-06  5:30       ` Drew Adams
2019-02-06 16:35         ` Roland Winkler
2019-02-06  8:45       ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhrdn8lf.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.