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)
(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:
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)
(image-type file-or-data nil data-p)))
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,
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
For information about GNU Emacs and the GNU system, type C-h C-a.
'configure --with-modules --without-pop'
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
value of $LANG: en_GB.UTF-8
Major mode: Lisp Interaction
Minor modes in effect:
(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)
((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))
adam plaice wrote:
> 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)
> (image-type file-or-data nil data-p)))
This may be a kinda controversial change, since it now defaults to
using imagemagick for images, if you have support for imagemagick.
But this makes it possible to browse a typical
directory-of-images-from-your-camera just by hitting `n' a lot, without
a lot of futzing around, so I think it's a net win.
Perhaps there should be an option to disable it if it annoys people.
Thanks for the clarification.
As it's a deliberate change and to avoid over-complication that nobody
usually needs (if one generally dislikes the imagemagick backend then
one should use a version of emacs compiled without it, and in the very
rare case when one does need to change the backend on the fly, one can
just override image-toggle-display-image), leaving the code alone is
probably the best option.
However, I'd argue that the documentation should be updated — the
docstring of imagemagick-types-inhibit already contains extensive
If you change this without using customize, you must call
If Emacs is compiled without ImageMagick support, this variable
has no effect.
so another sentence to the effect of "If emacs is compiled with
alternative image backends, in addition to ImageMagick support, this
variable also has no effect." wouldn't be out place (and since there
are already extensive warnings, creating an impression of
completeness, the absence of an important warning — having multiple sets
of backends is probably the most frequent situation on GNU/Linux —
would be confusing).
Adam Plaice <[hidden email]> writes:
> As it's a deliberate change and to avoid over-complication that nobody
> usually needs (if one generally dislikes the imagemagick backend then
> one should use a version of emacs compiled without it, and in the very
> rare case when one does need to change the backend on the fly, one can
> just override image-toggle-display-image), leaving the code alone is
> probably the best option.
I think it probably wouldn't be very difficult to make image-mode
respect that variable, and that would probably be the nicest fix here...
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
|Free forum by Nabble||Edit this page|