From: Lars Magne Ingebrigtsen Date: Tue, 12 Aug 2014 14:16:45 +0000 (+0200) Subject: Allow resetting image transform options X-Git-Tag: emacs-25.0.90~2635^2~679^2~476 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9e6adaec872fb8274619ae117213431c4ff300f2;p=emacs.git Allow resetting image transform options * image-mode.el (image-transform-reset): New command and menu item. (image-mode-map): Rearrange the menu items to put presumably more obscure items at the end. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f91f3a0351e..10b17d63119 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-08-12 Lars Magne Ingebrigtsen + + * image-mode.el (image-transform-reset): New command and menu item. + (image-mode-map): Rearrange the menu items to put presumably more + obscure items at the end. + 2014-08-12 Juri Linkov * vc/vc-annotate.el (vc-annotate-background-mode): diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 76a64220413..492ac10d706 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -379,8 +379,6 @@ call." ["Show as Text" image-toggle-display :active t :help "Show image as text"] "--" - ["Fit Frame to Image" image-mode-fit-frame :active t - :help "Resize frame to match image"] ["Fit to Window Height" image-transform-fit-to-height :visible (eq image-type 'imagemagick) :help "Resize image to match the window height"] @@ -390,6 +388,9 @@ call." ["Rotate Image..." image-transform-set-rotation :visible (eq image-type 'imagemagick) :help "Rotate the image"] + ["Reset Transformations" image-transform-reset + :visible (eq image-type 'imagemagick) + :help "Reset all image transformations"] "--" ["Show Thumbnails" (lambda () @@ -402,6 +403,9 @@ call." ["Previous Image" image-previous-file :active buffer-file-name :help "Move to previous image in this directory"] "--" + ["Fit Frame to Image" image-mode-fit-frame :active t + :help "Resize frame to match image"] + "--" ["Animate Image" image-toggle-animation :style toggle :selected (let ((image (image-get-display-property))) (and image (image-animate-timer image))) @@ -1097,6 +1101,16 @@ Emacs is compiled with ImageMagick support." (setq image-transform-rotation (float (mod rotation 360))) (image-toggle-display-image)) +(defun image-transform-reset () + "Display the current image with the default size and rotation. +This command has no effect unless Emacs is compiled with +ImageMagick support." + (interactive) + (setq image-transform-resize nil + image-transform-rotation 0.0 + image-transform-scale 1) + (image-toggle-display-image)) + (provide 'image-mode) ;;; image-mode.el ends here