]> code.delx.au - gnu-emacs/commitdiff
Allow resetting image transform options
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 12 Aug 2014 14:16:45 +0000 (16:16 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 12 Aug 2014 14:16:45 +0000 (16:16 +0200)
* 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.

lisp/ChangeLog
lisp/image-mode.el

index f91f3a0351ef79124fe065994101126cd8c8899c..10b17d63119a120dc3cdc8b8252132fa10a60aeb 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * 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  <juri@jurta.org>
 
        * vc/vc-annotate.el (vc-annotate-background-mode):
index 76a64220413692abf43cbddb9c799a68e9d8f28f..492ac10d706c2f3dd529fb3eb2b2a444ee3af212 100644 (file)
@@ -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