From: Tino Calancha <tino.calancha@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Cc: tino.calancha@gmail.com
Subject: image-rotate: Accept angle as an argument
Date: Mon, 5 Sep 2016 14:52:42 +0900 (JST) [thread overview]
Message-ID: <alpine.DEB.2.20.1609051451100.32022@calancha-pc> (raw)
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
next reply other threads:[~2016-09-05 5:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 5:52 Tino Calancha [this message]
2016-09-05 7:52 ` image-rotate: Accept angle as an argument 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1609051451100.32022@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).