[Top][All Lists]

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

address@hidden: Re: Tumme fails with default custom settings]

From: Richard Stallman
Subject: address@hidden: Re: Tumme fails with default custom settings]
Date: Tue, 24 Apr 2007 22:05:29 -0400

Would someone please install this, then ack to him and me?

------- Start of forwarded message -------
X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS,
        UNPARSEABLE_RELAY autolearn=failed version=3.1.0
To: address@hidden
From: Mathias Dahl <address@hidden>
Date: Tue, 24 Apr 2007 20:18:10 +0200
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: Re: Tumme fails with default custom settings

Richard Stallman <address@hidden> writes:

>     I was able to recreate this, but only for "small" images. Not sure yet
>     if there is a certain limit or if it is variable. The same problem can
>     be seen if you do C-u RET instead of RET in the thumbnail buffer.
>     I cannot say if this ever worked because I think that each time I have
>     tested this command I have done it with an image which is larger than
>     the Emacs window.
> Can you fix it?

Yes. The cause of the problem was that when displaying the image in
its original size, no conversion was needed, and therefore the image
format was not always JPEG (JPEG this was hardcoded in the previous
version of the defun below, now it is replaced by a variable). 

The new version below takes care of this case and uses
`image-type-from-file-name' to determine the image type. This solves
the problem for PNG and XPM files (the ones I could test that wasn't
JPEG) but GIF does not seem to be possible to insert. Is this on

Anyway, this fixes the parent poster's problem but not the problem the
original poster had (that I was not able to reproduce, yet).

Replace `image-dired-display-image' in image-dired.el with the fixed
version below:

;;; code begins here

(defun image-dired-display-image (file &optional original-size)
  "Display image FILE in image buffer.
Use this when you want to display the image, semi sized, in a new
window.  The image is sized to fit the display window (using a
temporary file, don't worry).  Because of this, it will not be as
quick as opening it directly, but on most modern systems it
should feel snappy enough.

If optional argument ORIGINAL-SIZE is non-nil, display image in its
original size."
  (let ((new-file (expand-file-name image-dired-temp-image-file))
        width height command ret
        (image-type 'jpeg))
    (setq file (expand-file-name file))
    (if (not original-size)
          (setq width (image-dired-display-window-width))
          (setq height (image-dired-display-window-height))
          (setq command
                  (cons ?p image-dired-cmd-create-temp-image-program)
                  (cons ?w width)
                  (cons ?h height)
                  (cons ?f file)
                  (cons ?t new-file))))
          (setq ret (call-process shell-file-name nil nil nil
                                  shell-command-switch command))
          (if (not (= 0 ret))
              (error "Could not resize image")))
      (setq image-type (image-type-from-file-name file))
      (copy-file file new-file t))
    (with-current-buffer (image-dired-create-display-image-buffer)
      (let ((inhibit-read-only t))
        (image-dired-insert-image image-dired-temp-image-file image-type 0 0)
        (goto-char (point-min))
        (image-dired-update-property 'original-file-name file)))))

;;; code ends here


emacs-pretest-bug mailing list
------- End of forwarded message -------

reply via email to

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