emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Julien Danjou <julien@danjou.info>
Cc: emacs-orgmode@gnu.org
Subject: Re: Getting a Google Maps' map for an entry
Date: Tue, 29 Jun 2010 15:29:51 +0200	[thread overview]
Message-ID: <87tyom6k6o.fsf@gmx.de> (raw)
In-Reply-To: <87y6dy6l09.fsf@gmx.de> (Sebastian Rose's message of "Tue, 29 Jun 2010 15:12:06 +0200")

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

Sebastian Rose <sebastian_rose@gmx.de> writes:
> Julien Danjou <julien@danjou.info> 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:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: static.default-zoom-not-set-2.patch --]
[-- Type: text/x-diff, Size: 1411 bytes --]

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."

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



Sebastian


[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-06-29 13:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
2010-06-29  9:09 ` Thierry Volpiatto
2010-06-29  9:14 ` Giovanni Ridolfi
2010-06-29 12:25 ` Memnon Anon
2010-06-29 15:45   ` Julien Danjou
2010-06-29 16:13     ` Thierry Volpiatto
2010-06-30  5:34       ` Julien Danjou
2010-06-30  5:28     ` Thierry Volpiatto
2010-06-29 13:12 ` Sebastian Rose
2010-06-29 13:29   ` Sebastian Rose [this message]
2010-07-01  9:00 ` d.tchin
2010-07-02 11:56   ` d.tchin

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.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tyom6k6o.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=julien@danjou.info \
    /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/org-mode.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).