aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorBasil L. Contovounesios2019-07-16 22:51:27 +0100
committerBasil L. Contovounesios2019-07-20 16:00:31 +0100
commitb728620a756db78b8cb0a41afa72db6209102cdf (patch)
tree30b5a0597791fe9a47cae18dda203d737b453bfa /lisp
parent6b882ea3532fffe31e2f27bfec265129a5e80348 (diff)
downloademacs-b728620a756db78b8cb0a41afa72db6209102cdf.tar.gz
emacs-b728620a756db78b8cb0a41afa72db6209102cdf.zip
Allow counter-clockwise rotations in image-rotate
* lisp/image.el (image-rotate): Extend with an optional argument specifying the rotation in degrees (bug#35421). * doc/lispref/display.texi (Showing Images): * etc/NEWS: Document the change. * test/lisp/image-tests.el (image-rotate): New test.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/image.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/image.el b/lisp/image.el
index b58b1dc9542..c3e28655c38 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1028,16 +1028,20 @@ default is 20%."
1028 (display-width (car (image-size image t)))) 1028 (display-width (car (image-size image t))))
1029 (/ (float display-width) image-width))) 1029 (/ (float display-width) image-width)))
1030 1030
1031(defun image-rotate () 1031(defun image-rotate (&optional angle)
1032 "Rotate the image under point by 90 degrees clockwise." 1032 "Rotate the image under point by ANGLE degrees clockwise.
1033 (interactive) 1033If nil, ANGLE defaults to 90. Interactively, rotate the image 90
1034degrees clockwise with no prefix argument, and counter-clockwise
1035with a prefix argument. Note that most image types support
1036rotations by only multiples of 90 degrees."
1037 (interactive (and current-prefix-arg '(-90)))
1034 (let ((image (image--get-imagemagick-and-warn))) 1038 (let ((image (image--get-imagemagick-and-warn)))
1035 (plist-put (cdr image) :rotation 1039 (setf (image-property image :rotation)
1036 (float (mod (+ (or (plist-get (cdr image) :rotation) 0) 90) 1040 (float (mod (+ (or (image-property image :rotation) 0)
1037 ;; We don't want to exceed 360 degrees 1041 (or angle 90))
1038 ;; rotation, because it's not seen as valid 1042 ;; We don't want to exceed 360 degrees rotation,
1039 ;; in exif data. 1043 ;; because it's not seen as valid in Exif data.
1040 360))))) 1044 360)))))
1041 1045
1042(defun image-save () 1046(defun image-save ()
1043 "Save the image under point." 1047 "Save the image under point."