From: Eli Zaretskii Date: Mon, 19 Oct 2015 13:15:30 +0000 (+0300) Subject: Resurrect image loading under auto-image-file-mode X-Git-Tag: emacs-25.0.90~1088 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52b977006031a32891f4d3eb96971d72c625f780;p=emacs.git 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) --- diff --git a/src/image.c b/src/image.c index c702782b64b..9970e5881e0 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;