[elpa] 01/02: Add metar.el.

2014-05-26 Thread Mario Lang
mlang pushed a commit to branch master
in repository elpa.

commit 8aadf0c0d68e6cbff0fca08dc78d86eea642bbb8
Author: Mario Lang ml...@delysid.org
Date:   Sun May 25 00:02:45 2014 +0200

Add metar.el.
---
 packages/metar/metar.el |  508 +++
 1 files changed, 508 insertions(+), 0 deletions(-)

diff --git a/packages/metar/metar.el b/packages/metar/metar.el
new file mode 100644
index 000..3a04b47
--- /dev/null
+++ b/packages/metar/metar.el
@@ -0,0 +1,508 @@
+;;; metar.el --- Retrieve and decode METAR weather information
+
+;; Copyright (C) 2007, 2014  Free Software Foundation, Inc.
+
+;; Author: Mario Lang ml...@delysid.org
+;; Version: 0
+;; Package-Requires: ((cl-lib 0.5))
+;; Keywords: comm
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see http://www.gnu.org/licenses/.
+
+;;; Commentary:
+
+;; Run `M-x metar RET' to get a simple weather report from weather.noaa.gov.
+;; The value of `calendar-latitude' and `calendar-longitude' will be used to
+;; automatically determine a nearby station.  If these variables are not set,
+;; you will be prompted to enter the location manually.
+;;
+;; With `C-u M-x metar RET', country and station name need to be entered.
+;; `C-u C-u M-x metar RET' will prompt for the METAR station code (4 letters).
+;;
+;; For programmatic access to decoded weather reports, use:
+;;
+;;   (metar-decode (metar-get-record CODE))
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'rx)
+(require 'solar)
+(require 'url)
+
+(defvar metar-stations-info-url http://weather.noaa.gov/data/nsd_bbsss.txt;
+  URL to use for retrieving station meta information.)
+
+(defvar metar-stations nil
+  Variable containing (cached) METAR station information.
+Use the function `metar-stations' to get the actual station list.)
+
+(defun metar-stations ()
+  Retrieve a list of METAR stations.
+Results are cached in variable `metar-stations'.
+If this variable is nil, the information is retrieved from the Internet.
+  (or metar-stations
+  (let ((data (with-temp-buffer
+   (url-insert-file-contents metar-stations-info-url)
+   (mapcar (lambda (entry)
+ (split-string entry ;))
+   (split-string (buffer-string) \n)
+   (setq metar-stations nil)
+   (while data
+ (when (and (nth 7 (car data)) (nth 8 (car data))
+(not (string= (nth 2 (car data)) )))
+   (setq metar-stations
+ (append
+  (let ((item (car data)))
+(list
+ (list (cons 'code (nth 2 item))
+   (cons 'name (nth 3 item))
+   (cons 'country (nth 5 item))
+   (cons 'latitude
+ (when (string-match 
^\\([0-9]+\\)-\\([0-9]+\\)\\(-[0-9]+\\)?\\([NS]\\) (nth 7 item))
+ (funcall (if (string= (match-string 4 
(nth 7 item)) N) #'+ #'-)
+  (+ (string-to-number 
(match-string 1 (nth 7 item)))
+ (/ (string-to-number 
(match-string 2 (nth 7 item)))
+60.0)
+   (cons 'longitude
+ (when (string-match 
^\\([0-9]+\\)-\\([0-9]+\\)\\(-[0-9]+\\)?\\([WE]\\) (nth 8 item))
+   (funcall (if (string= (match-string 4 (nth 
8 item)) E) #'+ #'-)
+(+ (string-to-number (match-string 
1 (nth 8 item)))
+   (/ (string-to-number 
(match-string 2 (nth 8 item)))
+  60.0)
+   (cons 'altitude (string-to-number (nth 12 item))
+  metar-stations)))
+ (setq data (cdr data)))
+   ;; (unless metar-timer
+   ;;   (setq metar-timer
+   ;;  (run-with-timer 600 nil (lambda () (setq metar-stations nil)
+   metar-stations)))
+
+(defun metar-stations-get (station-code key)
+  Get meta information for station with STATION-CODE and KEY.
+KEY can be one of the symbols `code', `name', `country', `latitude',
+`longitude' or `altitude'.
+  (let ((stations (metar-stations)) result)
+(while stations
+  (when (string= 

[elpa] branch master updated (4aee70d - fab13fe)

2014-05-26 Thread Mario Lang
mlang pushed a change to branch master
in repository elpa.

  from  4aee70d   [aa2u maint] Mention TAB infelicity in HACKING; nfc.
   new  8aadf0c   Add metar.el.
   new  fab13fe   Fix phenomena decoding

The 2 revisions listed above as new are entirely new to this
repository and will be described in separate emails.  The revisions
listed as adds were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/metar/metar.el |  509 +++
 1 files changed, 509 insertions(+), 0 deletions(-)
 create mode 100644 packages/metar/metar.el



[elpa] 02/02: Fix phenomena decoding

2014-05-26 Thread Mario Lang
mlang pushed a commit to branch master
in repository elpa.

commit fab13fef39e68b3511d5c5d73673022fe73bc9b0
Author: Mario Lang ml...@delysid.org
Date:   Mon May 26 14:55:58 2014 +0200

Fix phenomena decoding
---
 packages/metar/metar.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/packages/metar/metar.el b/packages/metar/metar.el
index 3a04b47..cbba5f8 100644
--- a/packages/metar/metar.el
+++ b/packages/metar/metar.el
@@ -388,7 +388,7 @@ If no record was found for STATION, nil is returned.
 (cons 'humidity humidity)
 (cons 'pressure pressure))
(when (metar-phenomena codes)
-(list 'phenomena (metar-phenomena codes)))
+(list (cons 'phenomena (metar-phenomena codes
 
 (defun metar-magnus-formula-humidity-from-dewpoint (temperature dewpoint)
   Calculate relative humidity (in %) from TEMPERATURE and DEWPOINT (in
@@ -450,7 +450,8 @@ Otherwise, determine the best station via 
latitude/longitude.
   (cadr (assoc 'temperature info))
   (cadr (assoc 'humidity info))
   (if (assoc 'phenomena info)
-  (concat ,  (cdr (assoc 'phenomena info)))
+  (concat \n Phenomena: 
+  (cdr (assoc 'phenomena info)))
 ))
(message No weather information found, sorry.)
   



[elpa] branch master updated (fab13fe - 790d134)

2014-05-26 Thread Stephen Leake
stephen_leake pushed a change to branch master
in repository elpa.

  from  fab13fe   Fix phenomena decoding
   new  790d134   release ada-mode 5.1.4

The 1 revisions listed above as new are entirely new to this
repository and will be described in separate emails.  The revisions
listed as adds were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/ada-mode/NEWS  |   19 +
 packages/ada-mode/README|4 +-
 packages/ada-mode/ada-gnat-xref.el  |4 +-
 packages/ada-mode/ada-grammar-wy.el | 2671 ++-
 packages/ada-mode/ada-mode.el   |   89 ++-
 packages/ada-mode/ada-mode.info |   81 +-
 packages/ada-mode/ada-wisi.el   |9 +-
 packages/ada-mode/gnat-core.el  |   12 +-
 packages/ada-mode/gnat-inspect.el   |   12 +-
 packages/ada-mode/gpr-mode.el   |   11 -
 packages/ada-mode/gpr-query.el  |   25 +-
 11 files changed, 1544 insertions(+), 1393 deletions(-)



[elpa] branch master updated (790d134 - b531af5)

2014-05-26 Thread Stefan Monnier
monnier pushed a change to branch master
in repository elpa.

  from  790d134   release ada-mode 5.1.4
   new  b531af5   * packages/nlinum/nlinum.el (nlinum-mode): Don't leave 
overlays around when switching major mode.

The 1 revisions listed above as new are entirely new to this
repository and will be described in separate emails.  The revisions
listed as adds were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/nlinum/nlinum.el |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)



[elpa] 01/01: * packages/nlinum/nlinum.el (nlinum-mode): Don't leave overlays around when switching major mode.

2014-05-26 Thread Stefan Monnier
monnier pushed a commit to branch master
in repository elpa.

commit b531af546e116b5367586bb65c5d26d11c6e377e
Author: Stefan Monnier monn...@iro.umontreal.ca
Date:   Mon May 26 19:18:05 2014 -0400

* packages/nlinum/nlinum.el (nlinum-mode): Don't leave overlays around when
switching major mode.
---
 packages/nlinum/nlinum.el |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el
index 750ebc0..41b79b6 100644
--- a/packages/nlinum/nlinum.el
+++ b/packages/nlinum/nlinum.el
@@ -54,12 +54,15 @@ Linum mode is a buffer-local minor mode.
   :lighter nil ;; ( NLinum nlinum--desc)
   (jit-lock-unregister #'nlinum--region)
   (remove-hook 'window-configuration-change-hook #'nlinum--setup-window t)
-  (remove-hook 'after-change-functions #'nlinum--after-change)
+  (remove-hook 'after-change-functions #'nlinum--after-change t)
   (kill-local-variable 'nlinum--line-number-cache)
   (remove-overlays (point-min) (point-max) 'nlinum t)
   ;; (kill-local-variable 'nlinum--ol-counter)
   (kill-local-variable 'nlinum--width)
   (when nlinum-mode
+;; FIXME: Another approach would be to make the mode permanent-local,
+;; which might indeed be preferable.
+(add-hook 'change-major-mode-hook (lambda () (nlinum-mode -1)))
 (add-hook 'window-configuration-change-hook #'nlinum--setup-window nil t)
 (add-hook 'after-change-functions #'nlinum--after-change nil t)
 (jit-lock-register #'nlinum--region t))
@@ -136,6 +139,14 @@ Linum mode is a buffer-local minor mode.
 (defvar nlinum--line-number-cache nil)
 (make-variable-buffer-local 'nlinum--line-number-cache)
 
+;; We could try and avoid flushing the cache at every change, e.g. with:
+;;   (defun nlinum--before-change (start _end)
+;; (if (and nlinum--line-number-cache
+;;  ( start (car nlinum--line-number-cache)))
+;; (save-excursion (goto-char start) (nlinum--line-number-at-pos
+;; But it's far from clear that it's worth the trouble.  The current simplistic
+;; approach seems to be good enough in practice.
+
 (defun nlinum--after-change (rest _args)
   (setq nlinum--line-number-cache nil))
 



[elpa] branch master updated (b531af5 - 2ba7e77)

2014-05-26 Thread Stefan Monnier
monnier pushed a change to branch master
in repository elpa.

  from  b531af5   * packages/nlinum/nlinum.el (nlinum-mode): Don't leave 
overlays around when switching major mode.
   new  6073044   * packages/metar/metar.el 
(metar-latitude-longitude-distance-haversine): `macrolet' is called 
`cl-macrolet' in cl-lib. (metar-station-countries): Avoid `add-to-list'.  Use 
dolist.
   new  2ba7e77   * packages/gnugo: Add `cl-lib' as dependency; require it 
and use its names. Don't bother with lexical-let since we use lexical-binding. 
* packages/gnugo/gnugo.el (gnugo-board-mode-map): * 
packages/gnugo/gnugo-frolic.el (gnugo-frolic-mode-map): Move initialization 
into declaration.

The 2 revisions listed above as new are entirely new to this
repository and will be described in separate emails.  The revisions
listed as adds were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/gnugo/gnugo-frolic.el |  114 ++---
 packages/gnugo/gnugo-imgen.el  |   14 ++--
 packages/gnugo/gnugo.el|  213 
 packages/metar/metar.el|   13 +--
 4 files changed, 173 insertions(+), 181 deletions(-)



[elpa] 01/02: * packages/metar/metar.el (metar-latitude-longitude-distance-haversine): `macrolet' is called `cl-macrolet' in cl-lib. (metar-station-countries): Avoid `add-to-list'. Use dolist.

2014-05-26 Thread Stefan Monnier
monnier pushed a commit to branch master
in repository elpa.

commit 607304435b649bdd1185719f919c53b0e1d0d9a0
Author: Stefan Monnier monn...@iro.umontreal.ca
Date:   Mon May 26 23:47:26 2014 -0400

* packages/metar/metar.el (metar-latitude-longitude-distance-haversine):
`macrolet' is called `cl-macrolet' in cl-lib.
(metar-station-countries): Avoid `add-to-list'.  Use dolist.
---
 packages/metar/metar.el |   13 ++---
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/packages/metar/metar.el b/packages/metar/metar.el
index cbba5f8..43a72db 100644
--- a/packages/metar/metar.el
+++ b/packages/metar/metar.el
@@ -120,8 +120,8 @@ LATITUDE2/LONGITUDE2.
  latitude2 longitude2)
   Caluclate the distance (in kilometers) between two points on the
 surface of the earth given as LATITUDE1, LONGITUDE1, LATITUDE2 and LONGITUDE2.
-  (macrolet ((distance (d1 d2)
-  `(expt (sin (/ (degrees-to-radians (- ,d2 ,d1)) 2)) 2)))
+  (cl-macrolet ((distance (d1 d2)
+ `(expt (sin (/ (degrees-to-radians (- ,d2 ,d1)) 2)) 2)))
 (let ((a (+ (distance latitude1 latitude2)
(* (cos (degrees-to-radians latitude1)) (cos 
(degrees-to-radians latitude2))
   (distance longitude1 longitude2)
@@ -456,11 +456,10 @@ Otherwise, determine the best station via 
latitude/longitude.
(message No weather information found, sorry.)
   
 (defun metar-station-countries ()
-  (let (countries (stations (metar-stations)))
-(while stations
-  (let ((country (cdr (assq 'country (car stations)
-   (add-to-list 'countries country))
-  (setq stations (cdr stations)))
+  (let (countries)
+(dolist (station (metar-stations))
+  (let ((country (cdr (assq 'country station
+   (cl-pushnew country countries :test #'equal)))
 countries))
 
 (defun metar-stations-in-country (country)



[elpa] 02/02: * packages/gnugo: Add `cl-lib' as dependency; require it and use its names. Don't bother with lexical-let since we use lexical-binding. * packages/gnugo/gnugo.el (gnugo-board-mode-map):

2014-05-26 Thread Stefan Monnier
monnier pushed a commit to branch master
in repository elpa.

commit 2ba7e772cc6ed17a7bf1d2b96aea18b528f922e4
Author: Stefan Monnier monn...@iro.umontreal.ca
Date:   Mon May 26 23:58:35 2014 -0400

* packages/gnugo: Add `cl-lib' as dependency; require it and use its names.
Don't bother with lexical-let since we use lexical-binding.
* packages/gnugo/gnugo.el (gnugo-board-mode-map):
* packages/gnugo/gnugo-frolic.el (gnugo-frolic-mode-map): Move 
initialization
into declaration.
---
 packages/gnugo/gnugo-frolic.el |  114 ++---
 packages/gnugo/gnugo-imgen.el  |   14 ++--
 packages/gnugo/gnugo.el|  213 
 3 files changed, 167 insertions(+), 174 deletions(-)

diff --git a/packages/gnugo/gnugo-frolic.el b/packages/gnugo/gnugo-frolic.el
index be6b2ac..69373e8 100644
--- a/packages/gnugo/gnugo-frolic.el
+++ b/packages/gnugo/gnugo-frolic.el
@@ -20,19 +20,39 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (require 'gnugo)
 (require 'ascii-art-to-unicode) ; for `aa2u'
 
-(defvar gnugo-frolic-mode-map nil
+(defvar gnugo-frolic-mode-map
+  (let ((map (make-sparse-keymap)))
+(suppress-keymap map)
+(mapc (lambda (pair)
+(define-key map (car pair) (cdr pair)))
+  '((q  . gnugo-frolic-quit)
+(Q  . gnugo-frolic-quit)
+(\C-q   . gnugo-frolic-quit)
+(C  . gnugo-frolic-quit) ; like ‘View-kill-and-leave’
+(\C-b   . gnugo-frolic-backward-branch)
+(\C-f   . gnugo-frolic-forward-branch)
+(\C-p   . gnugo-frolic-previous-move)
+(\C-n   . gnugo-frolic-next-move)
+(t  . gnugo-frolic-tip-move)
+(j  . gnugo-frolic-exchange-left)
+(J  . gnugo-frolic-rotate-left)
+(k  . gnugo-frolic-exchange-right)
+(K  . gnugo-frolic-rotate-right)
+(\C-m   . gnugo-frolic-set-as-main-line)
+(\C-\M-p. gnugo-frolic-prune-branch)
+(o  . gnugo-frolic-return-to-origin)))
+map)
   Keymap for GNUGO Frolic mode.)
 
 (defvar gnugo-frolic-parent-buffer nil)
 (defvar gnugo-frolic-origin nil)
 
 (define-derived-mode gnugo-frolic-mode special-mode GNUGO Frolic
-  A special mode for manipulating a GNUGO gametree.
-
-\\{gnugo-frolic-mode-map}
+  A special mode for manipulating a GNUGO gametree.
   (setq truncate-lines t)
   (buffer-disable-undo))
 
@@ -103,7 +123,7 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details.
  (as-pos (gnugo--as-pos-func))
  (at (car (aref monkey 0)))
  (bidx (aref monkey 1))
- (valid (map 'vector (lambda (end)
+ (valid (cl-map 'vector (lambda (end)
(gethash (car end) mnum))
  ends))
  (max-move-num (apply 'max (append valid nil)))
@@ -119,9 +139,9 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details.
  (apply 'format fmt args)
  properties
   ;; breathe in
-  (loop
+  (cl-loop
for bx below width
-   do (loop
+   do (cl-loop
with fork
for node in (aref ends bx)
do (if (setq fork (on node))
@@ -130,7 +150,7 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details.
   ;; todo: ignore non-move nodes
   (eq node (car (aref ends bix
(link (other)
- (pushnew other (gethash node soil
+ (cl-pushnew other (gethash node soil
 (unless (tip-p bx)
   (unless (tip-p fork)
 (link fork))
@@ -142,12 +162,12 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details.
   (gnugo-frolic-mode)
   (erase-buffer)
   (setq header-line-format
-(lexical-let ((full (concat
- (make-string 11 ?\s)
- (mapconcat (lambda (n)
-  (format %-5s n))
-lanes
- 
+(let ((full (concat
+ (make-string 11 ?\s)
+ (mapconcat (lambda (n)
+  (format %-5s n))
+lanes
+ 
   `((:eval
  (funcall
   ,(lambda ()
@@ -173,13 +193,13 @@ are dimmed.  Type \\[describe-mode] in that buffer for 
details.
   (set (make-local-variable 'gnugo-frolic-parent-buffer) from)
   (set (make-local-variable 'gnugo-state)
(buffer-local-value 'gnugo-state from))
-  (loop
+  (cl-loop
with props
  

[elpa] branch master updated (2ba7e77 - bd29e9b)

2014-05-26 Thread Stefan Monnier
monnier pushed a change to branch master
in repository elpa.

  from  2ba7e77   * packages/gnugo: Add `cl-lib' as dependency; require it 
and use its names. Don't bother with lexical-let since we use lexical-binding. 
* packages/gnugo/gnugo.el (gnugo-board-mode-map): * 
packages/gnugo/gnugo-frolic.el (gnugo-frolic-mode-map): Move initialization 
into declaration.
   new  bd29e9b   * packages/osc/osc.el (osc-filter): Fix up old `cl' name. 
(osc--test-transport-equality): Mark `path' as unused.

The 1 revisions listed above as new are entirely new to this
repository and will be described in separate emails.  The revisions
listed as adds were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/osc/osc.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)