Mercurial > emacs
changeset 109867:7b3550d93e3a
support for fit-width
author | Joakim <joakim@localhost.localdomain> |
---|---|
date | Sun, 27 Jun 2010 02:18:55 +0200 |
parents | 73512e4aa257 |
children | c1ae0a9b14a1 |
files | lisp/image-mode.el |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/image-mode.el Sat Jun 26 23:17:02 2010 +0200 +++ b/lisp/image-mode.el Sun Jun 27 02:18:55 2010 +0200 @@ -579,12 +579,16 @@ ((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 @@ (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:")