all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18683: Patch for wish-list item: 560
@ 2014-10-10 22:58 Matthew Leach
  2014-10-10 23:47 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Leach @ 2014-10-10 22:58 UTC (permalink / raw)
  To: 18683

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

Hello,

Attached is a simple patch that adds {+-}90 degree rotation to image
mode as requested in [1].

Any comments welcome.

[1]: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=560

2014-10-10  Matthew Leach  <matthew@mattleach.net>

	* image-mode.el (image-mode-map): map 'r' and 'l' to rotation
	functions.
	(image-rotate-90-right): New method.
	(image-rotate-90-left):


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: img-90-rotation.patch --]
[-- Type: text/x-diff, Size: 1222 bytes --]

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index b94162d..de75f4a 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -375,6 +375,8 @@ call."
     (define-key map "f" 'image-next-frame)
     (define-key map "b" 'image-previous-frame)
     (define-key map "n" 'image-next-file)
+    (define-key map "r" 'image-rotate-90-right)
+    (define-key map "l" 'image-rotate-90-left)
     (define-key map "p" 'image-previous-file)
     (define-key map "a+" 'image-increase-speed)
     (define-key map "a-" 'image-decrease-speed)
@@ -1106,6 +1108,16 @@ Emacs is compiled with ImageMagick support."
   (setq image-transform-rotation (float (mod rotation 360)))
   (image-toggle-display-image))
 
+(defun image-rotate-90-right ()
+  "Increase the rotation of the current image by 90 degrees."
+  (interactive)
+  (image-transform-set-rotation (+ image-transform-rotation 90)))
+
+(defun image-rotate-90-left ()
+  "Decrease the rotation of the current image by 90 degrees."
+  (interactive)
+  (image-transform-set-rotation (- image-transform-rotation 90)))
+
 (defun image-transform-reset ()
   "Display the current image with the default size and rotation.
 This command has no effect unless Emacs is compiled with

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


-- 
Matt

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

* bug#18683: Patch for wish-list item: 560
  2014-10-10 22:58 bug#18683: Patch for wish-list item: 560 Matthew Leach
@ 2014-10-10 23:47 ` Glenn Morris
  2014-10-11  9:52   ` Matthew Leach
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2014-10-10 23:47 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 18683, Vitalie Spinu

Matthew Leach wrote:

> Attached is a simple patch that adds {+-}90 degree rotation to image
> mode as requested in [1].

Thanks. It would have better to send this to the existing report, rather
than creating a new one, but no worries.

Anyway, see also unfinished (as far as I know?) patch to do this and
more at:

http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00610.html
http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00264.html





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

* bug#18683: Patch for wish-list item: 560
  2014-10-10 23:47 ` Glenn Morris
@ 2014-10-11  9:52   ` Matthew Leach
  2014-10-11 11:54     ` Vitalie Spinu
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Leach @ 2014-10-11  9:52 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 18683, Vitalie Spinu

Glenn Morris <rgm@gnu.org> writes:

> Matthew Leach wrote:
>
>> Attached is a simple patch that adds {+-}90 degree rotation to image
>> mode as requested in [1].
>
> Thanks. It would have better to send this to the existing report, rather
> than creating a new one, but no worries.

Oops, sorry.

>
>
> Anyway, see also unfinished (as far as I know?) patch to do this and
> more at:
>
> http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00610.html
> http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00264.html

Ah, I didn't know there were already candidate patches written,
apologies for that.

-- 
Matt





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

* bug#18683: Patch for wish-list item: 560
  2014-10-11  9:52   ` Matthew Leach
@ 2014-10-11 11:54     ` Vitalie Spinu
  0 siblings, 0 replies; 4+ messages in thread
From: Vitalie Spinu @ 2014-10-11 11:54 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 18683


The work is here https://github.com/vitoshka/image-transform/

It's an uniform and extensible interface to internal imagemagic and
convert backends. Virtually any type of transformation could be done
from inside of emacs and multiple transformation can be stacked.

The reason I got stuck back then is that I wanted to implement
interactive cropping with the mouse. I have looked into that but
couldn't figure a good way to do so. In hindsight, I should have
finished that I had and pushed to emacs and only then think about the
rest.

Within a week or two I will have loads of free time again so I will be
finishing it for sure this time.


  Vitalie


 >>> Matthew Leach on Sat, 11 Oct 2014 10:52:08 +0100 wrote:

 > Glenn Morris <rgm@gnu.org> writes:
 >> Matthew Leach wrote:
 >> 
 >>> Attached is a simple patch that adds {+-}90 degree rotation to image
 >>> mode as requested in [1].
 >> 
 >> Thanks. It would have better to send this to the existing report, rather
 >> than creating a new one, but no worries.

 > Oops, sorry.

 >> 
 >> 
 >> Anyway, see also unfinished (as far as I know?) patch to do this and
 >> more at:
 >> 
 >> http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00610.html> http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00264.html

 > Ah, I didn't know there were already candidate patches written,
 > apologies for that.





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

end of thread, other threads:[~2014-10-11 11:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10 22:58 bug#18683: Patch for wish-list item: 560 Matthew Leach
2014-10-10 23:47 ` Glenn Morris
2014-10-11  9:52   ` Matthew Leach
2014-10-11 11:54     ` Vitalie Spinu

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.