emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 52b9770: Resurrect image loading under auto-image-f


From: Eli Zaretskii
Subject: [Emacs-diffs] master 52b9770: Resurrect image loading under auto-image-file-mode
Date: Mon, 19 Oct 2015 13:16:45 +0000

branch: master
commit 52b977006031a32891f4d3eb96971d72c625f780
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Resurrect image loading under auto-image-file-mode
    
    * src/image.c (x_find_image_fd): Handle the case of -2 returned by
    'openp' specially.  This special case was lost in the changes on
    2015-08-18.  (Bug#21685)
---
 src/image.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/image.c b/src/image.c
index c702782..9970e58 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2292,7 +2292,19 @@ x_find_image_fd (Lisp_Object file, int *pfd)
   /* Try to find FILE in data-directory/images, then x-bitmap-file-path.  */
   fd = openp (search_path, file, Qnil, &file_found,
              pfd ? Qt : make_number (R_OK), false);
-  if (fd < 0)
+  if (fd >= 0 || fd == -2)
+    {
+      file_found = ENCODE_FILE (file_found);
+      if (fd == -2)
+       {
+         /* The file exists locally, but has a file handler.  (This
+            happens, e.g., under Auto Image File Mode.)  'openp'
+            didn't open the file, so we should, because the caller
+            expects that.  */
+         fd = emacs_open (SSDATA (file_found), O_RDONLY | O_BINARY, 0);
+       }
+    }
+  else /* fd < 0, but not -2 */
     return Qnil;
   if (pfd)
     *pfd = fd;



reply via email to

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