emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Getting a Google Maps' map for an entry


From: Sebastian Rose
Subject: Re: [Orgmode] Getting a Google Maps' map for an entry
Date: Tue, 29 Jun 2010 15:29:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Sebastian Rose <address@hidden> writes:
> Julien Danjou <address@hidden> writes:
>> Hi there,
>>
>> I've recently wrote a Google Maps extension for Emacs[1].
>>
>> Therefore, I've extended org-mode to display a Google Maps' map for an
>> event location. The extension, which is very simple, is available
>> here[2] and I wanted you to know about it.
>>
>> I'd be glad to have feedback. patches or ideas. ;)
>>
>> Happy hacking.
>>
>> [1]  http://julien.danjou.info/google-maps-el.html
>>
>> [2]  
>> http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-maps.el;hb=HEAD
>
> Wow - works pefect on emacs 24!
>
>
> 'Current zoom level is unknown'
>
> I guess `google-maps-static-default-zoom' is not set (possible patch
> appended).
>
>
> Thanks for sharing :)
>
> We where talking about GEO locations and org-mode recently:
>
>
>
>
>    Sebastian
>
>
>
> diff --git a/google-maps-static.el b/google-maps-static.el
> index 644408d..98d9ac8 100644
> --- a/google-maps-static.el
> +++ b/google-maps-static.el
> @@ -332,7 +332,7 @@ PLIST can contains this properties:
>    "Zoom a Google map in."
>    (interactive)
>    (unless (plist-member google-maps-static-params :zoom)
> -    (error "Current zoom level is unknown, cannot zoom in."))
> +    (plist-set google-maps-static-params :zoom 
> google-maps-static-default-zoom))
>    (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom))))
>  
>  (defun google-maps-static-zoom-out ()



Sorry, did not save before doing the `git diff'.
I like this patch better anyway:


diff --git a/google-maps-static.el b/google-maps-static.el
index 644408d..89c877a 100644
--- a/google-maps-static.el
+++ b/google-maps-static.el
@@ -328,12 +328,20 @@ PLIST can contains this properties:
                (max (min level google-maps-static-maximum-zoom) 
google-maps-static-minimum-zoom))
     (apply 'google-maps-static-show plist)))
 
-(defun google-maps-static-zoom-in ()
-  "Zoom a Google map in."
-  (interactive)
-  (unless (plist-member google-maps-static-params :zoom)
-    (error "Current zoom level is unknown, cannot zoom in."))
-  (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom))))
+(defun google-maps-static-zoom-in (&optional arg)
+  "Zoom a Google map in.
+If the numeric prefix argument ARG is set, zoom in this much levels."
+  (interactive "p")
+  (let* ((arg (if (> 1 arg) 1 arg))
+         (current (or (plist-get google-maps-static-params :zoom)
+                      google-maps-static-default-zoom))
+         (next (if (and (<= (+ arg current) google-maps-static-maximum-zoom)
+                        (>= (+ arg current) google-maps-static-minimum-zoom))
+                   (+ arg current)
+                 google-maps-static-maximum-zoom)))
+    (setq google-maps-static-params
+          (plist-put google-maps-static-params :zoom next))
+  (google-maps-static-zoom next)))
 
 (defun google-maps-static-zoom-out ()
   "Zoom a Google map out."

Sebastian


reply via email to

[Prev in Thread] Current Thread [Next in Thread]