diff --git a/CHANGELOG b/CHANGELOG index f75934f868f072c31eb3659384ed2aa77490de01..1ff41024f55626b3103456c1ceb41f565b410da7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ 2020-07-22 David Byers <david.byers@liu.se> + Rename some functions: + * olc.el (olc-shorten-compound): Renamed from olc-shorten-geo to + better match Google's terminology in their plus codes api. + (olc-recover-compound): Same. + Implement olc-shorten-geo and clean up: * olc.el (olc-shorten-geo): New function. (olc-encode): Use cl-defun and keyword args. diff --git a/README.md b/README.md index 9868235787465b5969f5c5a33c7fd4bff0c9ca1c..0ad5e51584934f04b13332ea737f9d45e1e62cfe 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,6 @@ Recovery using a geographical reference (requires `requests` and uses the OpenStreetMap API): ```` -(olc-recover-string "M24Q+89 Mutitjulu") +(olc-recover-compound "M24Q+89 Mutitjulu") "5Q6HM24Q+89" ```` diff --git a/olc.el b/olc.el index 47c578e37680c6435b1fbb84997ddaa1ca13ae8d..694e43e7db862e2379d088c1f6a74892250b2a01 100644 --- a/olc.el +++ b/olc.el @@ -1,4 +1,6 @@ -;;; olc.el --- Open location code library -*-coding: utf-8;-*- +;; -*-coding: utf-8;-*- + +;;; olc.el --- Open location code library ;; Copyright (C) 2020 David Byers ;; @@ -434,7 +436,7 @@ shortened code, of if LIMIT is not positive and even." code)))) -(cl-defun olc-shorten-geo (code &key (limit 4) (zoom '(1 18))) +(cl-defun olc-shorten-compound (code &key (limit 4) (zoom '(1 18))) "Attempt to shorten CODE with a geographic reference. Shorten CODE, which must be a full open location code, finding a @@ -545,7 +547,7 @@ full open location code." (olc-encode lat lon :len (olc-parse-precision parse))))))) -(cl-defun olc-recover-geo (arg1 &optional arg2 &key (format 'area)) +(cl-defun olc-recover-compound (arg1 &optional arg2 &key (format 'area)) "Recover a location from a short code and reference. When called with one argument, ARG1, it must be a string diff --git a/olc.texi b/olc.texi index 5bf2edd2132e4fb7fd36fb0fb250cf37d625e5ea..c86716f99fa35c8a39f2e319bf9e8731c9020cb0 100644 --- a/olc.texi +++ b/olc.texi @@ -177,7 +177,7 @@ or shortened code, of if @var{limit} is not even. @end example @end defun -@defun olc-shorten-geo code &key limit +@defun olc-shorten-compound code &key limit Shorten @var{code}, which must be a full open location code, finding a reference near the encoded location. If @var{limit} is non-nil, then the code will be shortened by at most that many digits. If the code @@ -194,13 +194,13 @@ shortened code, of if @var{limit} is not even. @example @group -(olc-shorten-geo "5Q6HM24Q+89") +(olc-shorten-compound "5Q6HM24Q+89") @result{} "M24Q+89 Mutitjulu, Northern Territory, Australia" -(olc-shorten-geo "5Q6HM24Q+89" :limit 2) +(olc-shorten-compound "5Q6HM24Q+89" :limit 2) @result{} "6HM24Q+89 Northern Territory, Australia" -(olc-shorten-geo "5Q6HM24Q+89" :zoom 14) +(olc-shorten-compound "5Q6HM24Q+89" :zoom 14) @result{} "M24Q+89 Mutitjulu, Northern Territory, Australia" -(olc-shorten-geo "5Q6HM24Q+89" :zoom 1) +(olc-shorten-compound "5Q6HM24Q+89" :zoom 1) "6HM24Q+89 Australia" @end group @end example @@ -223,7 +223,7 @@ value), the returned value is an full open location code. @end example @end defun -@defun olc-recover-geo arg1 &optional arg2 &key format +@defun olc-recover-compound arg1 &optional arg2 &key format Recover a shortened code @i{without} the reference latitude and longitude. @@ -240,11 +240,11 @@ details). @example @group -(olc-recover-geo "M24Q+89 Mutitjulu") +(olc-recover-compound "M24Q+89 Mutitjulu") @result{} "5Q6HM24Q+89" -(olc-recover-geo "M24Q+89" "Mutitjulu") +(olc-recover-compound "M24Q+89" "Mutitjulu") @result{} "5Q6HM24Q+89" -(olc-recover-geo "M24Q+89" "Mutitjulu" :format 'latlon) +(olc-recover-compound "M24Q+89" "Mutitjulu" :format 'latlon) @result{} (-25.344187500000004 . 131.0384375) @end group @end example