bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29584: imagemagick-types-inhibit does not result in correct image ba


From: adam plaice
Subject: bug#29584: imagemagick-types-inhibit does not result in correct image backend (minor)
Date: Tue, 5 Dec 2017 21:12:07 +0000

If emacs was compiled with both imagemagick and specific image type
backend support (e.g. librsvg, libpng), then imagemagick-types-inhibit
has no effect on the backend used for the given image types (e.g. svg, png).

* To reproduce

1. With emacs -Q, evaluate:

(setq imagemagick-types-inhibit t)
(imagemagick-register-types)

(Alternatively and equivalently, customize imagemagick-types-inhibit
to t, or place the above two lines in init.el.)

2. Open a png file in emacs. For instance:

wget https://upload.wikimedia.org/wikipedia/commons/d/d9/Test.png

C-x C-f Test.png RET

* Expected result

The image is opened in image-mode, using the libpng backend (and
(Image[png]) is displayed in the mode-line).

* Actual result

The image is opened in image-mode, using the imagemagick backend (and
(Image[imagemagick]) is displayed in the mode-line), despite
imagemagick-types-inhibit having been set to `t'.

According to both the docstring of imagemagick-types-inhibit and the Texinfo
manual ((elisp) ImageMagick Images), imagemagick-types-inhibit should prevent
imagemagick from being used for the given image type (or overall for t).


* Discussion and speculation

This is obviously a very minor bug, since it's only a matter of the
choice of backend and it only came up when investigating #29581, where
it was interesting to determine the effect of different backends.


I think that the issue is caused by these lines (in the definition of
image-toggle-display-image in image-mode.el):

     (type (if (fboundp 'imagemagick-types)
           'imagemagick
         (image-type file-or-data nil data-p)))

https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/image-mode.el?h=emacs-26#n761

It seems that if imagemagick is available, then irrespective of the
value of imagemagick-types-inhibit, the imagemagick backend will
always be used.

If alternative backends (libpng etc.) were not compiled in,
imagemagick-types-inhibit set to `t' would have caused image-mode not
to be present in the auto-mode-alist, meaning that image-mode would
not be activated by default and imagemagick-types-inhibit would act as
expected.  However, when these other backends are compiled in, then
they modify the auto-mode-alist, causing image-mode to be used for
.png or .svg files, despite the fact that once image-mode is launched,
the imagemagick backend will be used.


I'm not sure what is the right solution in this case. The easiest
would be to update the documentation to the current state of
affairs.  OTOH being able to easily set the image backend is
occasionally nice to have.

Thank you and best regards,
Adam


In GNU Emacs 26.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-12-05 built on adam
Repository revision: 46d62b9f36f1ef771a077df4227ae6559fb32e84
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:    Ubuntu 16.04.3 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --with-modules --without-pop'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 94561 8308)
 (symbols 48 20332 1)
 (miscs 40 42 118)
 (strings 32 28247 1513)
 (string-bytes 1 744109)
 (vectors 16 13967)
 (vector-slots 8 491974 7546)
 (floats 8 50 67)
 (intervals 56 219 0)
 (buffers 992 12)
 (heap 1024 35241 1000))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]