From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain Date: Tue, 04 Oct 2016 20:04:22 -0400 Message-ID: <87int7y83d.fsf@users.sourceforge.net> References: <7551034a-2464-4925-9020-20e853e2db3d@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1475625888 14520 195.159.176.226 (5 Oct 2016 00:04:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2016 00:04:48 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 24586@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 05 02:04:44 2016 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 1brZh8-0000Rx-D8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Oct 2016 02:04:22 +0200 Original-Received: from localhost ([::1]:45815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brZh7-0006zf-0i for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Oct 2016 20:04:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brZgs-0006uY-VN for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 20:04:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brZgo-0006yt-Ok for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 20:04:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brZgo-0006yl-Iu for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 20:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1brZgo-0005uP-BT for bug-gnu-emacs@gnu.org; Tue, 04 Oct 2016 20:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2016 00:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24586 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24586-submit@debbugs.gnu.org id=B24586.147562583822703 (code B ref 24586); Wed, 05 Oct 2016 00:04:02 +0000 Original-Received: (at 24586) by debbugs.gnu.org; 5 Oct 2016 00:03:58 +0000 Original-Received: from localhost ([127.0.0.1]:45017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brZgj-0005u2-PT for submit@debbugs.gnu.org; Tue, 04 Oct 2016 20:03:57 -0400 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:33558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brZgi-0005tj-AL; Tue, 04 Oct 2016 20:03:56 -0400 Original-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) Original-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) In-Reply-To: <7551034a-2464-4925-9020-20e853e2db3d@default> (Drew Adams's message of "Sun, 2 Oct 2016 09:27:31 -0700 (PDT)") 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:124078 Archived-At: severity 24586 minor quit Drew Adams 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.