emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Auto-resizing of images in image-mode


From: Juri Linkov
Subject: Re: Auto-resizing of images in image-mode
Date: Mon, 20 Apr 2020 02:19:51 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Also there are no keys for image-transform-fit-to-width,
>> image-transform-fit-to-height and image-transform-reset.
>> I thought about using a prefix key 'f', so using 'f w' to fit width,
>> but 'f' is already taken too.
>> 
>> But anyway their docstrings say:
>> 
>>   This command has no effect unless Emacs is compiled with
>>   ImageMagick support.
>> 
>> So these commands should be fixed to work without ImageMagick.
>
> Right.  But that's for master, I think.

After testing these commands it became clear that they all already work
without ImageMagick, so I just removed mentions of ImageMagick
from docstrings and these conditionals from menus:

         :visible (eq image-type 'imagemagick)

So what remains to do in emacs-27 is to add defcustoms.

As for master, there is much work remains to do to fix the mess
what is image-mode currently is:

1. Figure out why there are two rotating commands:
   image-rotate bound to 'r' in image-map, and
   image-transform-set-rotation in image-mode.

2. Try to make sense out of commented code:

    ;; Not yet implemented.
    ;; (defvar image-transform-minor-mode-map
    ;;   (let ((map (make-sparse-keymap)))
    ;;     ;; (define-key map  [(control ?+)] 'image-scale-in)
    ;;     ;; (define-key map  [(control ?-)] 'image-scale-out)
    ;;     ;; (define-key map  [(control ?=)] 'image-scale-none)
    ;;     ;; (define-key map "c f h" 'image-scale-fit-height)
    ;;     ;; (define-key map "c ]" 'image-rotate-right)
    ;;     map)
    ;;   "Minor mode keymap `image-transform-mode'.")
    ;;
    ;; (define-minor-mode image-transform-mode
    ;;   "Minor mode for scaling and rotating images.
    ;; With a prefix argument ARG, enable the mode if ARG is positive,
    ;; and disable it otherwise.  If called from Lisp, enable the mode
    ;; if ARG is omitted or nil.  This minor mode requires Emacs to have
    ;; been compiled with ImageMagick support."
    ;;   nil "image-transform" image-transform-minor-mode-map)

>> (defcustom image-window-resize t
>>   "Non-nil to resize the image whenever the window's dimensions change."
>>   :type 'boolean
>>   :version "27.1"
>>   :group 'image)
>> 
>> (defcustom image-window-resize-delay 1
>>   "Number of seconds to wait before resizing according to 
>> `image-window-resize'."
>>   :type 'integer
>>   :version "27.1"
>>   :group 'image)
>> 
>> If this looks good, I could send a complete patch.
>
> Please do, and thanks.

It seems image-window-resize and image-window-resize-delay could be
combined into one defcustom that will be either nil or number, will post
the patch ASAP.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]