GNU bug report logs - #24586
24.5; `find-file' for non-existent file a.jpg should not complain

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Drew Adams <drew.adams@HIDDEN>; dated Sun, 2 Oct 2016 16:28:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'minor' from 'normal' Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 24586 <at> debbugs.gnu.org:


Received: (at 24586) by debbugs.gnu.org; 5 Oct 2016 00:03:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 04 20:03:58 2016
Received: from localhost ([127.0.0.1]:45017 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1brZgj-0005u2-PT
	for submit <at> debbugs.gnu.org; Tue, 04 Oct 2016 20:03:57 -0400
Received: from mail-io0-f169.google.com ([209.85.223.169]:33558)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>)
 id 1brZgi-0005tj-AL; Tue, 04 Oct 2016 20:03:56 -0400
Received: by mail-io0-f169.google.com with SMTP id q192so5009832iod.0;
 Tue, 04 Oct 2016 17:03:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=LGTMK/++MV80cOFeoRRLxSJXNSUNqwKDz1DZe6OW6dQ=;
 b=pncTTguIddmCaKqccRz3unWn8tJmNOwL74RDI640rY8+PZRctRkqOhvmwGpmb9sTjN
 P84AYF4Crcl1B9UitrmCD+V+ZuqZOBX94WqVurOU6RC93cfF6pjl3YGZEHRHdfZHPSaS
 D3nZQHiRKZ6tukDblhpsioreEGxfVNahh25dTWyrSacGmPv7+2KSUAd1MW0l8bbvieYx
 E37ZHvb+1Rm78NFOKmw8di6ApZ0IcFJTpbuLD5aJCWgfZbkKUXNGDDiPPh7ZJCrVhS2e
 +LXksuv/CngOBUNl6GfePher8urQrK67jVQrk1SQagz9xdlc576RKQ+bC841OJdfDE7D
 qMJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=LGTMK/++MV80cOFeoRRLxSJXNSUNqwKDz1DZe6OW6dQ=;
 b=XNFpkwTSzhdM4is7g/qxF36mhC908forfp8aCllpvATVXineQ01altru5V79tBSvO3
 n2muUsVPfGCmuXkjLTK3sFOnZaWR0NBvB6lfqhDC7Pwh04lHmYyMjyQ3NIJH7AU0CKJM
 C80wqZrzCCOXwyxDOBnU1u0ZJ5nCfdA1HXUOjoUV188AHBZvfWfi+wE0LUbx28hfyLlS
 EpozZUrEM4mFgHHtJC72BH4fNYkUaLPFL7ycbXJhR3pRHVPPy8vvyXao9hGb9nmXfZcz
 VOGy2rCowrB49NGmDxmo4CPiiPzXnGWhBZ6jv4DeZvCczzywpoEwXqjLWvE9aY2Gbtbx
 t41A==
X-Gm-Message-State: AA6/9RmsNlWpVwxw4uneMld1G8GYnOKkTzpziwrPIhoGscYLkW+TrUWAjF9yiPNtf3AWSg==
X-Received: by 10.107.134.142 with SMTP id q14mr6949660ioi.220.1475625830302; 
 Tue, 04 Oct 2016 17:03:50 -0700 (PDT)
Received: from zony ([45.2.7.130])
 by smtp.googlemail.com with ESMTPSA id t14sm2582176itb.22.2016.10.04.17.03.49
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 04 Oct 2016 17:03:49 -0700 (PDT)
From: npostavs@HIDDEN
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#24586: 24.5;
 `find-file' for non-existent file a.jpg should not complain
References: <7551034a-2464-4925-9020-20e853e2db3d@default>
Date: Tue, 04 Oct 2016 20:04:22 -0400
In-Reply-To: <7551034a-2464-4925-9020-20e853e2db3d@default> (Drew Adams's
 message of "Sun, 2 Oct 2016 09:27:31 -0700 (PDT)")
Message-ID: <87int7y83d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.2 (/)
X-Debbugs-Envelope-To: 24586
Cc: 24586 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.2 (/)

severity 24586 minor
quit

Drew Adams <drew.adams@HIDDEN> writes:

> emacs -Q
>
> C-x C-f a.jpg     ; Where file `a.jpg' does not exist
>
> This presents these error/warning messages, but it does not raise an
> error:
>
>   Type C-c C-c to view the image as an image.
>   Cannot display image: (Cannot determine image type)
>
> This seems wrong, because the file does not exist.  If you are trying to
> create an ordinary text file that happens to match an image-file name
> pattern, you should be able to do so, without getting such messages.  It
> could be helpful to instead get a message confirming that this is in
> fact what you are doing.
>
> Or if it is considered wrong to do that then Emacs should raise an
> error.
>
> IOW, either raise an error, if you are not allowed to create a new file
> whose name matches an image file, or else show a different message,
> saying, e.g., that no such image file exists and the buffer is therefore
> not in image mode (and it should in that case not be put in image mode).
>
> It seems wrong to both put the new buffer for the non-existent file in
> image mode and to complain that Emacs cannot display the image.  And
> the first message, about typing C-c C-c seems doubly inappropriate.

But then what would a user who wants to type the raw jpeg bytes into a
buffer and use C-c C-c to check the result do? ;)

Possible solutions:

1. Use the content-based magic-mode-alist to recognize images instead of
the filename-based auto-mode-alist.

2. Add a check to `image-mode' for an empty buffer and stay in
fundamental-mode in that case.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24586; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Oct 2016 16:27:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 02 12:27:53 2016
Received: from localhost ([127.0.0.1]:42120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bqjcG-000312-Uw
	for submit <at> debbugs.gnu.org; Sun, 02 Oct 2016 12:27:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42507)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjcE-00030m-TS
 for submit <at> debbugs.gnu.org; Sun, 02 Oct 2016 12:27:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjc8-0003oo-QZ
 for submit <at> debbugs.gnu.org; Sun, 02 Oct 2016 12:27:45 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51651)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjc8-0003oA-Nx
 for submit <at> debbugs.gnu.org; Sun, 02 Oct 2016 12:27:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33478)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjc6-00070Q-C3
 for bug-gnu-emacs@HIDDEN; Sun, 02 Oct 2016 12:27:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjc1-0003kU-8w
 for bug-gnu-emacs@HIDDEN; Sun, 02 Oct 2016 12:27:41 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:25736)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1bqjc0-0003jK-WF
 for bug-gnu-emacs@HIDDEN; Sun, 02 Oct 2016 12:27:37 -0400
Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74])
 by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id
 u92GRYHR022957
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Sun, 2 Oct 2016 16:27:34 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u92GRYqk028536
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Sun, 2 Oct 2016 16:27:34 GMT
Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8])
 by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u92GRWIO023973
 for <bug-gnu-emacs@HIDDEN>; Sun, 2 Oct 2016 16:27:33 GMT
MIME-Version: 1.0
Message-ID: <7551034a-2464-4925-9020-20e853e2db3d@default>
Date: Sun, 2 Oct 2016 09:27:31 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.5; `find-file' for non-existent file a.jpg should not complain
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9  (901082) [OL
 12.0.6753.5000 (x86)]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Source-IP: userv0022.oracle.com [156.151.31.74]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

emacs -Q

C-x C-f a.jpg     ; Where file `a.jpg' does not exist

This presents these error/warning messages, but it does not raise an
error:

  Type C-c C-c to view the image as an image.
  Cannot display image: (Cannot determine image type)

This seems wrong, because the file does not exist.  If you are trying to
create an ordinary text file that happens to match an image-file name
pattern, you should be able to do so, without getting such messages.  It
could be helpful to instead get a message confirming that this is in
fact what you are doing.

Or if it is considered wrong to do that then Emacs should raise an
error.

IOW, either raise an error, if you are not allowed to create a new file
whose name matches an image file, or else show a different message,
saying, e.g., that no such image file exists and the buffer is therefore
not in image mode (and it should in that case not be put in image mode).

It seems wrong to both put the new buffer for the non-existent file in
image mode and to complain that Emacs cannot display the image.  And
the first message, about typing C-c C-c seems doubly inappropriate.


In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=3D/c/usr --host=3Di686-pc-mingw32'




Acknowledgement sent to Drew Adams <drew.adams@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#24586; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 5 Oct 2016 00:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.