Subject: Re: bug#46552: 27.1; image-mode should not move current point

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 16 Feb 2021 13:36:18 +0100

[email-masked] writes:

> Example:
> C-x C-f /emacs-27.1-x86_64/x86_64/share/emacs/27.1/etc/images/splash.png RET
> M-: (point) RET
>   => 3 ;; check current point
> C-c C-c ;; change to text display
> M-: (point) RET
>   => 1 :: check current point
> C-c C-c ;; change to image display
> M-: (point) RET
>   => 25161 ;; check current point, value is EOB

This is most puzzling.  I can reproduce this problem in Emacs 28 without
a problem.  But:

C-c C-c runs the command image-toggle-display (found in
image-minor-mode-map), which is an interactive Lisp closure in
‘image-mode.el’.

If I instead say `M-: (image-toggle-display) RET' or even
`M-: (call-interactively 'image-toggle-display) RET', I can't.

And `C-c C-c' should be totally equivalent to the latter, right?

So what's moving point?  It must be some...  hook function or something
that reacts differently to the two things...  but looking through the
image-mode.el code, it's not obvious what that could be.

Anybody got any ideas here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no