From: Joakim Verona Date: Sun, 27 Jun 2010 00:18:55 +0000 (+0200) Subject: support for fit-width X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~511^2~39 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3a50be5108590c360a5cf90f7010c36d870f9cd1;p=emacs.git support for fit-width --- diff --git a/lisp/image-mode.el b/lisp/image-mode.el index a278c47a555..78ec4772d16 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -579,12 +579,16 @@ the image file and `image-mode' showing the image as an image." ((numberp image-transform-resize) (* image-transform-resize (cdr size))) ((eq image-transform-resize 'fit-height) - (nth 3 (window-inside-pixel-edges))) - ))) - `(,@(if height (list :height height)) - ,@(if (not (equal 0.0 image-transform-rotation)) - (list :rotation image-transform-rotation)) - ))) + (- (nth 3 (window-inside-pixel-edges)) (nth 1 (window-inside-pixel-edges)))) + (t nil))) + (width (if (eq image-transform-resize 'fit-width) + (- (nth 2 (window-inside-pixel-edges)) (nth 0 (window-inside-pixel-edges)))))) + + `(,@(if height (list :height height)) + ,@(if width (list :width width)) + ,@(if (not (equal 0.0 image-transform-rotation)) + (list :rotation image-transform-rotation)) + ))) (defun image-transform-set-scale (scale) (interactive "nscale:") @@ -594,9 +598,13 @@ the image file and `image-mode' showing the image as an image." (interactive) (image-transform-set-resize 'fit-height)) +(defun image-transform-fit-to-width () + (interactive) + (image-transform-set-resize 'fit-width)) + (defun image-transform-set-resize (resize) (setq image-transform-resize resize) - (image-toggle-display-image)) + (if (eq 'image-mode major-mode) (image-toggle-display-image))) (defun image-transform-set-rotation (rotation) (interactive "nrotation:")