unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Corwin Brust <corwin@bru.st>
Cc: 54084@debbugs.gnu.org
Subject: bug#54084: 28.0.91; Regression: can't create empty image buffer
Date: Mon, 21 Feb 2022 16:00:12 +0200	[thread overview]
Message-ID: <83mtikuxoz.fsf@gnu.org> (raw)
In-Reply-To: <CAJf-WoSU0e4dEmVTH=wxX5=UywqP0Vy7emhXqv4vXaKtVmPMFg@mail.gmail.com> (message from Corwin Brust on Mon, 21 Feb 2022 07:41:36 -0600)

[Please use Reply All, so that the bug tracker remains on the CC.]

> From: Corwin Brust <corwin@bru.st>
> Date: Mon, 21 Feb 2022 07:41:36 -0600
> 
> On Mon, Feb 21, 2022 at 6:57 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > It's a feature, see bug#16062.  (It misfired when the empty buffer
> > wasn't visiting a file, but I've now fixed that on the release
> > branch.)
> 
> Is there a way to disable this feature?

Why is that needed?  Turning on image-mode in an empty buffer is a
pretty strange thing to do, or at least a rare thing.

> In my case the image type won't change, I'd be fine hard-coding
> that.
> 
> >
> > You are supposed to insert the data, and then turn on image-mode.  We
> > don't support image-mode in empty buffers, because that makes it
> > impossible to detect the image type, and thus leads to complications
> > down the road.
> >
> > Thanks.
> 
> I'm not sure how to avoid this error when I create a new buffer in a
> mode derived from image mode.

Can't you use ignore-errors?

> Is there an alternative you can recommend to creating my own
> "one-off" version of image mode and deriving from that?  In my case,
> I have created an SVG sketching mode and have been reusing,
> e.g. "canvas" resizing logic from image-mode for a couple of years
> without issue.
> 
> TIA for any hints.

How about delaying the mode switch until the user inserted something?





  parent reply	other threads:[~2022-02-21 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  8:21 bug#54084: 28.0.91; Regression: can't create empty image buffer Corwin Brust
2022-02-21 12:57 ` Eli Zaretskii
2022-02-21 13:58   ` Corwin Brust
2022-02-21 14:03     ` Eli Zaretskii
     [not found]   ` <CAJf-WoSU0e4dEmVTH=wxX5=UywqP0Vy7emhXqv4vXaKtVmPMFg@mail.gmail.com>
2022-02-21 14:00     ` Eli Zaretskii [this message]
2022-02-21 14:16       ` Corwin Brust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mtikuxoz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=54084@debbugs.gnu.org \
    --cc=corwin@bru.st \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).