Subject: bug#10758: thumbs and image-dired to use built-in ImageMagick

From: Mathias Dahl <[email-masked]>
Date: Mon, 25 Oct 2021 21:02:42 +0200

On Sun, Oct 24, 2021 at 11:45 AM Stefan Kangas <[email-masked]> wrote:

> Stefan Kangas <[email-masked]> writes:
>
> > Stefan Kangas <[email-masked]> writes:
> >
> >> So perhaps this feature request is relevant anymore.  WDYT?
> >
> > I now see that Glenn mentioned resizing as well, where using the
> > built-in image scaling seems very relevant.  We currently jump through
> > some unnecessary hoops in `image-dired-display-image' when we could just
> > resize the image in memory.
> >
> > Is there any reason why `image-dired-display-image-mode' doesn't just
> > inherit `image-mode'?  That would avoid code duplication and also allow
> > us to immediately benefit from any improvements to `image-mode'.

Hi, sorry for coming late to the party.

I cannot remember any good reason for not inheriting from `image-mode', but
I opened image-dired.el now and found this:

(defvar image-dired-display-image-mode-map
  (let ((map (make-sparse-keymap)))
    ;; `image-mode-map' has bindings that do not make sense in image-dired
    ;; (set-keymap-parent map image-mode-map)
    (define-key map "f" 'image-dired-display-current-image-full)
    (define-key map "s" 'image-dired-display-current-image-sized)
    (define-key map "g" nil)

    ;; Useful bindings from `image-mode-map'
    (define-key map [remap forward-char] 'image-forward-hscroll)
    (define-key map [remap backward-char] 'image-backward-hscroll)
...

It seems I knew about `image-mode' but perhaps it never crossed my mind
to inherit from it. 16 years later, my memory fails me...

At any rate I have nothing against it, if someone wants to give it a try.

/Mathias