emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c768fe1 1/2: Make image-mode respect `imagemagick-t


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master c768fe1 1/2: Make image-mode respect `imagemagick-types-inhibit'
Date: Sat, 14 Apr 2018 09:52:31 -0400 (EDT)

branch: master
commit c768fe1be0d68c182d037891e0946983e5fbe644
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make image-mode respect `imagemagick-types-inhibit'
    
    * lisp/image-mode.el (image--imagemagick-wanted-p): New function
    (bug#29584).
    (image-toggle-display-image): Use it to see whether we want to use
    imagemagick.
---
 etc/NEWS           | 7 +++++++
 lisp/image-mode.el | 8 +++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index d29a513..980a5b4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -551,6 +551,13 @@ such decisions (if they are to be made at all) are left to
 higher-level functions.
 
 
+** image-mode
+
+*** image-mode started using ImageMagick by default for all images
+some years back.  It now respects `imagemagick-types-inhibit' as a way
+to disable that.
+
+
 +++
 ** The new function 'read-answer' accepts either long or short answers
 depending on the new customizable variable 'read-answer-short'.
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 70d2ca8..320f21a 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -758,7 +758,7 @@ was inserted."
         (edges (and (null image-transform-resize)
                     (window-inside-pixel-edges
                      (get-buffer-window (current-buffer)))))
-        (type (if (fboundp 'imagemagick-types)
+        (type (if (image--imagemagick-wanted-p filename)
                   'imagemagick
                 (image-type file-or-data nil data-p)))
         (image (if (not edges)
@@ -803,6 +803,12 @@ was inserted."
     (if (called-interactively-p 'any)
        (message "Repeat this command to go back to displaying the file as 
text"))))
 
+(defun image--imagemagick-wanted-p (filename)
+  (and (fboundp 'imagemagick-types)
+       (not (eq imagemagick-types-inhibit t))
+       (not (memq (intern (upcase (file-name-extension filename)) obarray)
+                  imagemagick-types-inhibit))))
+
 (defun image-toggle-hex-display ()
   "Toggle between image and hex display."
   (interactive)



reply via email to

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