unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [mathias.dahl@gmail.com: Re: Tumme fails with default custom settings]
@ 2007-04-25  2:05 Richard Stallman
  2007-04-25  4:57 ` Glenn Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Richard Stallman @ 2007-04-25  2:05 UTC (permalink / raw)
  To: emacs-devel

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: emacs-pretest-bug@gnu.org
From: Mathias Dahl <mathias.dahl@gmail.com>
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 <rms@gnu.org> 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
purpose?

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)
        (progn
          (setq width (image-dired-display-window-width))
          (setq height (image-dired-display-window-height))
          (setq command
                (format-spec
                 image-dired-cmd-create-temp-image-options
                 (list
                  (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))
        (erase-buffer)
        (clear-image-cache)
        (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

/Mathias



_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-04-28 12:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-25  2:05 [mathias.dahl@gmail.com: Re: Tumme fails with default custom settings] Richard Stallman
2007-04-25  4:57 ` Glenn Morris
2007-04-25  7:47 ` Mathias Dahl
2007-04-25  7:51   ` David Kastrup
2007-04-25 14:03     ` Mathias Dahl
2007-04-25 10:10   ` Tassilo Horn
2007-04-26  4:23   ` Richard Stallman
2007-04-26  2:56 ` Glenn Morris
2007-04-26 11:31   ` Mathias Dahl
2007-04-26 15:24     ` Glenn Morris
2007-04-26 20:11       ` Mathias Dahl
2007-04-26 21:00       ` Stephen Berman
2007-04-27  0:58         ` Glenn Morris
2007-04-27 20:39           ` Richard Stallman
2007-04-28  4:11             ` Glenn Morris
2007-04-28 12:46               ` Mathias Dahl

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).