From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: adam plaice Newsgroups: gmane.emacs.bugs Subject: bug#29584: imagemagick-types-inhibit does not result in correct image backend (minor) Date: Tue, 5 Dec 2017 21:12:07 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1512508391 8450 195.159.176.226 (5 Dec 2017 21:13:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 5 Dec 2017 21:13:11 +0000 (UTC) To: 29584@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 05 22:13:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMKWW-0001tA-1x for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Dec 2017 22:13:04 +0100 Original-Received: from localhost ([::1]:52094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMKWc-0003p4-V3 for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Dec 2017 16:13:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMKWV-0003hI-IE for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:13:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMKWU-0007Hy-5I for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:13:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39474) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eMKWU-0007Hu-0e for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eMKWT-0003tH-OW for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: adam plaice Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Dec 2017 21:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29584 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151250834214902 (code B ref -1); Tue, 05 Dec 2017 21:13:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Dec 2017 21:12:22 +0000 Original-Received: from localhost ([127.0.0.1]:48155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMKVo-0003sG-Nz for submit@debbugs.gnu.org; Tue, 05 Dec 2017 16:12:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eMKVm-0003s4-Rr for submit@debbugs.gnu.org; Tue, 05 Dec 2017 16:12:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMKVg-00073K-C9 for submit@debbugs.gnu.org; Tue, 05 Dec 2017 16:12:13 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:34813) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eMKVg-00073G-7o for submit@debbugs.gnu.org; Tue, 05 Dec 2017 16:12:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eMKVe-0003F5-KT for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:12:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eMKVd-00072Y-52 for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:12:10 -0500 Original-Received: from mail-yw0-x235.google.com ([2607:f8b0:4002:c05::235]:45202) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eMKVc-00072P-VX for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2017 16:12:09 -0500 Original-Received: by mail-yw0-x235.google.com with SMTP id y187so720584ywd.12 for ; Tue, 05 Dec 2017 13:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=mNK2408Gj1Wjuu66vWhgY6QCeBO6oeC+uiNZ7xEM8g0=; b=bAU9Uyzf2EAg4c1US+SoxJR1dm9Q2EZ8BZlY+rF+/Ea47BCpCVIEs7TmogxBLIDf6E y8uQ37xJFKVbzK9jpVLGVyFPHreIXF9XBU4bHDyRhljctX/TisPbnDp8LRLF2O+Me7HI zg7QZq6dmLSdtEHklLfFfK/uwsoQdpf3/4Op4+wsmnQlDg3Xief8DMGqVm0Vw/4wT4RB fwR3XblLWZJajfL/hcuzzRjQ9Me08XQZ9FakWcac8/UPKuNApzDXp9qMDxhmsBoXGqD/ E1SvrkiAGbUAnFgjFzzriJbtJ65yFjpvJV2M+FadhQ48gHCKRMKxo9A4w/7dqn6FHdtk 3pXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=mNK2408Gj1Wjuu66vWhgY6QCeBO6oeC+uiNZ7xEM8g0=; b=aZgE10Cg881VsTWsghy1jt9Whs7Wz61H0YgI16sdhSrvLexP7Mm5y1jI7g0FeZohFp 7RzLsxFOdaja1CiBVGDCt0YqIBHqW/xZ5woowLXuZTUrouZdOQemZHVeOJQeJdwXGOgA vOxZFsKHWtCzJ3xhcNo83CyGLvwQ9sQgItWEltDj+ksVckpdH0Q+RZLrLMeqYdb9sflh aS6BttDCWFCssPgDCw4+KLx5Z5Jebn/ive9ibMWIJDnOYFuTIFee6R8SUiyHY0yMLLO+ p2vBsSkz8D7PwOkYxYrLA3dPAZE9iTd/JL4SiSEafikoF732SXrq1jXZkcoD1q4Zsz3e AyfA== X-Gm-Message-State: AJaThX57n42q3+hE0SfcpiBguCZ+jsl5ljAvWVRHe6Ul1BEj7/feIqn4 uYODStT2/rw2jzQqmeaZ8BE09KOxVgZhIUhglD8= X-Google-Smtp-Source: AGs4zMZZKUtzKx2W/CM2xfrjDd5QSiH3URdllcJ8rrXBbWZoMFTI1Jq4ax/hQ8Kx0Uct8mVSPuyMb3O/6a4eeS1gJMg= X-Received: by 10.129.79.67 with SMTP id d64mr13760895ywb.463.1512508327847; Tue, 05 Dec 2017 13:12:07 -0800 (PST) Original-Received: by 10.37.129.201 with HTTP; Tue, 5 Dec 2017 13:12:07 -0800 (PST) X-Google-Sender-Auth: euVNKD0J5MeOL_U7cO_Qtr3aY1M X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140734 Archived-At: 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))