From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: image-rotate: Accept angle as an argument Date: Mon, 5 Sep 2016 14:52:42 +0900 (JST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1473054785 19841 195.159.176.226 (5 Sep 2016 05:53:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2016 05:53:05 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: tino.calancha@gmail.com To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 05 07:53:01 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgmq4-0004au-PL for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2016 07:53:00 +0200 Original-Received: from localhost ([::1]:52363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmq2-0000Dv-AY for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2016 01:52:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmpt-0000Dn-Ol for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:52:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgmpq-0000ZA-Kf for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:52:49 -0400 Original-Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:36625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgmpq-0000Z4-Di for emacs-devel@gnu.org; Mon, 05 Sep 2016 01:52:46 -0400 Original-Received: by mail-pf0-x242.google.com with SMTP id a143so5883113pfa.3 for ; Sun, 04 Sep 2016 22:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:user-agent:mime-version; bh=s1HaIT7tkc7vsk8YmtutP7neghuFqN7CMKj+Bq0WUaE=; b=fLrkNcDx29amlaIN5JarQP0ZAfBKLvEDm7Mlr3iaLgnuh2QWHOK+lUwKiiTwQlvDc4 CWRD88stq2quHtPqdISnf1AOgsI5Lsd51cGhbcsVo46vh7xqOgEx5rzuGPBx5XRKptmW JTFlrbxlL6+hPNDz+DIeeyr0FYJNWMIvTp/VHzAacKkwOOQmq4hMnCKvU6WeEo17jy23 U/ZZ+ah4heW5w/zC46jEMSPj88oSATCyxw98lH2SX7r5zRZYfqWILUvYpI5Jhrjkj8R6 OTMZLtQcD+EUZjqm2qg5SNw5kbtGVqEEwqoThINbKD3XoBmZjeBDSOrGRZINn9TKX3hz Cvzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:user-agent :mime-version; bh=s1HaIT7tkc7vsk8YmtutP7neghuFqN7CMKj+Bq0WUaE=; b=IJpe9/3ylVpbL1/VJkuv47sJDFmwVxo9pOaT4Qcq2nEhqRLjVBgMwi9j4KI1EYaFiv XiJCbLy9BHVQNqE5BMY15Dep3rwDCDwkD0NcvQCa88jiODknJ0OBeTjmTH3OJrQVc9Cf pc4M1zB/1ILJd+5aCbStcrPAQYLiYpPSUOo/OIYRnKN1UDc/G7ICY+EQHJ+lb+dMPJAj cKnBhxphdeZFRpNgxI95vQU0SrTVipPVGe17FnN6ZlC9QjdM9MIfo9o7eTo+4RMuTmmY f15fS31LRlulBmIm+qPKlW7P6BB9EsoUOEuvzwUOrMPg0ztBpOEiHVvuKGlfbHxOX6mW /g0A== X-Gm-Message-State: AE9vXwOcyxJDn1A0YGpaX0cOfgMic44VrpDwxaRcA1RJmOrBoNzQa2sAYVVVem11pXsfkw== X-Received: by 10.98.159.73 with SMTP id g70mr60593746pfe.121.1473054765431; Sun, 04 Sep 2016 22:52:45 -0700 (PDT) Original-Received: from calancha-pc (69.191.218.133.dy.bbexcite.jp. [133.218.191.69]) by smtp.gmail.com with ESMTPSA id tr1sm30717648pab.19.2016.09.04.22.52.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 22:52:44 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207189 Archived-At: 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 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