unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* image-rotate: Accept angle as an argument
@ 2016-09-05  5:52 Tino Calancha
  2016-09-05  7:52 ` Tino Calancha
  0 siblings, 1 reply; 7+ messages in thread
From: Tino Calancha @ 2016-09-05  5:52 UTC (permalink / raw)
  To: Emacs developers; +Cc: tino.calancha


Hello,
lisp/image.el defines 'image-increase-size' and 'image-decrease-size',
with an argument N.  We might allow for an argument in 'image-rotate'
as well.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
commit 27fb0aeb3b12256853c86d8494ff258c8926073e
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Mon Sep 5 14:44:18 2016 +0900

     image-rotate: Accept angle as an argument

     * lisp/image.el (image-rotate):
     Add argument ANGLE, the angle in degrees for the rotation.
     Add optional argument _ARG; in interactive calls, a non-nil
     value prompt for ANGLE.

diff --git a/lisp/image.el b/lisp/image.el
index e1f52de..cad8332 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1008,12 +1008,21 @@ image--current-scaling
          (display-width (car (image-size image t))))
      (/ (float display-width) image-width)))

-(defun image-rotate ()
-  "Rotate the image under point by 90 degrees clockwise."
-  (interactive)
+(defun image-rotate (angle &optional _arg)
+  "Rotate the image under point by ANGLE degrees clockwise.
+If ANGLE is a negative number, then rotate counterclockwise.
+When called interactively with a prefix argument, prompt for ANGLE."
+  (interactive
+   (let* ((ask current-prefix-arg)
+          (default 90)
+          (prompt "Rotate image by ANGLE degrees: ")
+          (rotation (if ask
+                        (read-number prompt default)
+                      default)))
+     (list rotation ask)))
    (let ((image (image--get-imagemagick-and-warn)))
      (plist-put (cdr image) :rotation
-               (float (mod (+ (or (plist-get (cdr image) :rotation) 0) 
90)
+               (float (mod (+ (or (plist-get (cdr image) :rotation) 0) 
angle)
                             ;; We don't want to exceed 360 degrees
                             ;; rotation, because it's not seen as valid
                             ;; in exif data.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.9)
  of 2016-09-05 built on calancha-pc
Repository revision: 62e4dc4660cb3b29cfffcad0639e51c7f382ced8





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-05 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-05  5:52 image-rotate: Accept angle as an argument Tino Calancha
2016-09-05  7:52 ` Tino Calancha
2016-09-05 12:36   ` Lars Ingebrigtsen
2016-09-05 14:59     ` Stefan Monnier
2016-09-05 16:30     ` Tino Calancha
2016-09-05 16:52       ` Lars Ingebrigtsen
2016-09-05 17:28         ` Tino Calancha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).