[elpa] externals/osc 6b6dbb4: Release 0.4

2021-04-07 Thread Mario Lang
branch: externals/osc
commit 6b6dbb4176f45f9ff3a783c816c4556ca2931a22
Author: Mario Lang 
Commit: Mario Lang 

Release 0.4
---
 osc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osc.el b/osc.el
index 3c4ef6e..102afae 100644
--- a/osc.el
+++ b/osc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2021  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
-;; Version: 0.3
+;; Version: 0.4
 ;; Keywords: comm, processes, multimedia
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] externals/osc 257e602: Fix blob encoding

2021-04-03 Thread Mario Lang
branch: externals/osc
commit 257e602e2d7f0c90662822f5eada2e99285de00d
Author: Mario Lang 
Commit: Mario Lang 

Fix blob encoding
---
 osc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osc.el b/osc.el
index e54b99a..3c4ef6e 100644
--- a/osc.el
+++ b/osc.el
@@ -54,7 +54,7 @@
 (defun osc-blob (vector)
   (let ((length (length vector)))
 (concat (osc-int32 length)
-   vector
+   (apply #'unibyte-string (append vector nil))
(make-string (% (- 4 (% length 4)) 4) 0
 
 (defun osc-float32 (value)



[elpa] externals/osc dbc5a37: Send signed integers by default

2021-04-02 Thread Mario Lang
branch: externals/osc
commit dbc5a37c3eef0741dde2049927aa8b0f79316923
Author: Mario Lang 
Commit: Mario Lang 

Send signed integers by default
---
 osc.el | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/osc.el b/osc.el
index 062f960..e54b99a 100644
--- a/osc.el
+++ b/osc.el
@@ -81,15 +81,32 @@
(lsh (logand f #XFF00) -8)
(logand f #XFF
 
-(defun osc-int32 (value)
-  (let (bytes)
-(dotimes (_ 4)
-  (push (% value 256) bytes)
-  (setq value (/ value 256)))
-(apply 'unibyte-string bytes)))
+(defconst osc-int32-zero (unibyte-string 0 0 0 0))
+(defconst osc-most-negative-signed-int32 (- (ash 1 (1- 32
+(defconst osc-most-positive-signed-int32 (1- (ash 1 (1- 32
+(defconst osc-most-positive-unsigned-int32 (1- (ash 1 32)))
+
+(defun osc-int32 (integer &optional unsigned)
+  (cl-check-type integer integer)
+  (if (zerop integer)
+  osc-int32-zero
+(if unsigned
+   (unless (and (natnump integer)
+(<= integer osc-most-positive-unsigned-int32))
+ (signal 'overflow-error (list integer)))
+  (unless (and (>= integer osc-most-negative-signed-int32)
+  (<= integer osc-most-positive-signed-int32))
+   (signal 'overflow-error (list integer)))
+  (unless (natnump integer)
+   (setq integer (+ integer (ash 1 32)
+(let (bytes)
+  (dotimes (_ 4)
+   (push (logand integer #xFF) bytes)
+   (setq integer (ash integer -8)))
+  (apply #'unibyte-string bytes
 
 (defconst osc-timetag-now
-  (concat (osc-int32 0) (osc-int32 1)))
+  (concat (osc-int32 0 t) (osc-int32 1 t)))
 
 (defconst osc-ntp-offset
   (round
@@ -101,9 +118,11 @@
   osc-timetag-now
 (pcase (time-convert time 'list)
   (`(,high ,low ,usec ,psec)
-   (concat (osc-int32 (+ (ash high 16) low osc-ntp-offset))
+   (concat (osc-int32 (+ (ash high 16) low osc-ntp-offset)
+ t)
   (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
-   (1- (ash 1 32))
+   (1- (ash 1 32
+ t))
 
 ;;;###autoload
 (defun osc-make-client (host port)



[elpa] externals/osc 9b288d5: Handle timetags in bundles

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 9b288d571bc5f461263ca8ce48b462a8aac9118d
Author: Mario Lang 
Commit: Mario Lang 

Handle timetags in bundles
---
 osc.el | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/osc.el b/osc.el
index 3c8a38f..062f960 100644
--- a/osc.el
+++ b/osc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2021  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
-;; Version: 0.2
+;; Version: 0.3
 ;; Keywords: comm, processes, multimedia
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -228,8 +228,11 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (time-add (time-convert (- (osc-read-int32) osc-ntp-offset))
-   (time-convert (cons (osc-read-int32) (ash 1 32)
+  (let ((secs (osc-read-int32)) (frac (osc-read-int32)))
+(if (and (zerop secs) (= frac 1))
+   nil ; now
+  (time-add (time-convert (- secs osc-ntp-offset))
+   (time-convert (cons frac (ash 1 32)))
 
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.
@@ -268,12 +271,12 @@ the generic handler for SERVER."
(?i (osc-read-int32))
(?s (osc-read-string
(string-to-list (substring (osc-read-string) 1))
- (forward-char 8) ;skip 64-bit timetag
- (while (not (eobp))
-   (let ((size (osc-read-int32)))
- (osc-filter proc
- (buffer-substring
-  (point) (progn (forward-char size) (point)))
+ (let ((time (osc-read-timetag)))
+   (while (not (eobp))
+ (let* ((size (osc-read-int32))
+(data (buffer-substring
+   (point) (progn (forward-char size) (point)
+   (run-at-time time nil #'osc-filter proc data)
 
 ;;;###autoload
 (defun osc-make-server (host port default-handler)



[elpa] externals/osc 07783f6: Fix osc-send-bundle

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 07783f6677ec5f0623c99580cbfdd21e1d44f099
Author: Mario Lang 
Commit: Mario Lang 

Fix osc-send-bundle
---
 osc.el | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/osc.el b/osc.el
index f676554..3c8a38f 100644
--- a/osc.el
+++ b/osc.el
@@ -33,10 +33,6 @@
 ;; * `osc-server-set-handler' can be used to change handlers for particular
 ;;   OSC paths on a server process object on the fly.
 
-;; BUGS/TODO:
-;;
-;; * Timetags are not supported yet.
-
 ;; Usage:
 ;;
 ;; Client: (setq my-client (osc-make-client "127.0.0.1" 7770))
@@ -92,11 +88,22 @@
   (setq value (/ value 256)))
 (apply 'unibyte-string bytes)))
 
-(defun osc-timetag (time)
-  (cl-multiple-value-bind (high low usec psec) (time-convert time 'list)
-(concat (osc-int32 (+ 2208988800 (ash high 16) low))
-   (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
-(1- (ash 1 32
+(defconst osc-timetag-now
+  (concat (osc-int32 0) (osc-int32 1)))
+
+(defconst osc-ntp-offset
+  (round
+   (float-time (time-subtract (time-convert 0)
+ (encode-time '(0 0 0 1 1 1900 nil nil t))
+
+(defun osc-timetag (&optional time)
+  (if (not time)
+  osc-timetag-now
+(pcase (time-convert time 'list)
+  (`(,high ,low ,usec ,psec)
+   (concat (osc-int32 (+ (ash high 16) low osc-ntp-offset))
+  (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
+   (1- (ash 1 32))
 
 ;;;###autoload
 (defun osc-make-client (host port)
@@ -141,11 +148,10 @@ string to a vector if embedding in another OSC message is 
what you want."
   (process-send-string process (apply #'osc-make-message path args)))
 
 (defconst osc-bundle-tag (osc-string "#bundle"))
-(defconst osc-timetag-now (concat (osc-int32 0) (osc-int32 1)))
 
 (defun osc-make-bundle (time &rest messages)
   "Make a bundle with timetag TIME and MESSAGES as payload."
-  (apply #'concat osc-bundle-tag (if time (osc-timetag time) osc-timetag-now)
+  (apply #'concat osc-bundle-tag (osc-timetag time)
 (mapcar (lambda (message)
   (concat (osc-int32 (length message)) message))
 messages)))
@@ -153,7 +159,7 @@ string to a vector if embedding in another OSC message is 
what you want."
 ;;;###autoload
 (defun osc-send-bundle (process time &rest messages)
   "Send a bundle to PROCESS with timetag TIME and MESSAGES as payload."
-  (process-send-string process (apply #'osc-make-bundle path args)))
+  (process-send-string process (apply #'osc-make-bundle time messages)))
 
 (defun osc-read-string ()
   (let ((pos (point)) string)
@@ -222,7 +228,7 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (time-add (time-convert (- (osc-read-int32) 2208988800))
+  (time-add (time-convert (- (osc-read-int32) osc-ntp-offset))
(time-convert (cons (osc-read-int32) (ash 1 32)
 
 (defun osc-server-set-handler (server path handler)



[elpa] externals/osc 48d043e: Fix precision of osc-read-timetag

2021-03-31 Thread Mario Lang
branch: externals/osc
commit 48d043e96006e3c0d84848ab506e5590ef8e42a3
Author: Mario Lang 
Commit: Mario Lang 

Fix precision of osc-read-timetag
---
 osc.el | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/osc.el b/osc.el
index daa0421..f676554 100644
--- a/osc.el
+++ b/osc.el
@@ -95,8 +95,7 @@
 (defun osc-timetag (time)
   (cl-multiple-value-bind (high low usec psec) (time-convert time 'list)
 (concat (osc-int32 (+ 2208988800 (ash high 16) low))
-   (osc-int32 (round (* (+ (* usec (expt 10.0 -6))
-   (* psec (expt 10.0 -12)))
+   (osc-int32 (round (* (+ (* usec 1e-06) (* psec 1e-12))
 (1- (ash 1 32
 
 ;;;###autoload
@@ -141,6 +140,21 @@ string to a vector if embedding in another OSC message is 
what you want."
   "Send an OSC message from PROCESS to the specified PATH with ARGS."
   (process-send-string process (apply #'osc-make-message path args)))
 
+(defconst osc-bundle-tag (osc-string "#bundle"))
+(defconst osc-timetag-now (concat (osc-int32 0) (osc-int32 1)))
+
+(defun osc-make-bundle (time &rest messages)
+  "Make a bundle with timetag TIME and MESSAGES as payload."
+  (apply #'concat osc-bundle-tag (if time (osc-timetag time) osc-timetag-now)
+(mapcar (lambda (message)
+  (concat (osc-int32 (length message)) message))
+messages)))
+
+;;;###autoload
+(defun osc-send-bundle (process time &rest messages)
+  "Send a bundle to PROCESS with timetag TIME and MESSAGES as payload."
+  (process-send-string process (apply #'osc-make-bundle path args)))
+
 (defun osc-read-string ()
   (let ((pos (point)) string)
 (while (not (= (following-char) 0)) (forward-char 1))
@@ -208,10 +222,8 @@ string to a vector if embedding in another OSC message is 
what you want."
 (1+ (/ f (expt 2.0 52
 
 (defun osc-read-timetag ()
-  (let ((secs (osc-read-int32))
-   (frac (osc-read-int32)))
-(time-convert (+ (- secs 2208988800)
-(/ (float frac) (1- (ash 1 32)))
+  (time-add (time-convert (- (osc-read-int32) 2208988800))
+   (time-convert (cons (osc-read-int32) (ash 1 32)
 
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.



[elpa] externals/osc c916424: New function `osc-make-message'

2021-03-30 Thread Mario Lang
branch: externals/osc
commit c91642422eaea3cf4e7447e89a98dbe84f47e9a5
Author: Mario Lang 
Commit: Mario Lang 

New function `osc-make-message'
---
 osc.el | 33 +
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/osc.el b/osc.el
index 5a6a33d..daa0421 100644
--- a/osc.el
+++ b/osc.el
@@ -92,6 +92,13 @@
   (setq value (/ value 256)))
 (apply 'unibyte-string bytes)))
 
+(defun osc-timetag (time)
+  (cl-multiple-value-bind (high low usec psec) (time-convert time 'list)
+(concat (osc-int32 (+ 2208988800 (ash high 16) low))
+   (osc-int32 (round (* (+ (* usec (expt 10.0 -6))
+   (* psec (expt 10.0 -12)))
+(1- (ash 1 32
+
 ;;;###autoload
 (defun osc-make-client (host port)
   "Create an OSC client process which talks to HOST and PORT."
@@ -102,13 +109,12 @@
:service port
:type 'datagram))
 
-;;;###autoload
-(defun osc-send-message (client path &rest args)
-  "Send an OSC message from CLIENT to the specified PATH with ARGS."
-  (process-send-string
-   client
-   (apply
-'concat
+(defun osc-make-message (path &rest args)
+  "Make a OSC message with specified PATh and ARGS.
+A unibyte string is returned.  Use `vconcat' to convert that unibyte
+string to a vector if embedding in another OSC message is what you want."
+  (apply
+   'concat
 (osc-string path)
 (osc-string
  (apply
@@ -128,7 +134,12 @@
((integerp arg) (osc-int32 arg))
((stringp arg) (osc-string arg))
((vectorp arg) (osc-blob arg
- args
+ args)))
+
+;;;###autoload
+(defun osc-send-message (process path &rest args)
+  "Send an OSC message from PROCESS to the specified PATH with ARGS."
+  (process-send-string process (apply #'osc-make-message path args)))
 
 (defun osc-read-string ()
   (let ((pos (point)) string)
@@ -196,6 +207,12 @@
 (expt 2.0 (- e 1023))
 (1+ (/ f (expt 2.0 52
 
+(defun osc-read-timetag ()
+  (let ((secs (osc-read-int32))
+   (frac (osc-read-int32)))
+(time-convert (+ (- secs 2208988800)
+(/ (float frac) (1- (ash 1 32)))
+
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.
 IF HANDLER is nil, remove previously defined handler and fallback to



[elpa] externals/osc ef72809: Set binary coding for servers

2021-03-30 Thread Mario Lang
branch: externals/osc
commit ef72809f3d425e502a379790863bdb4a46ab4797
Author: Mario Lang 
Commit: Mario Lang 

Set binary coding for servers
---
 osc.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/osc.el b/osc.el
index 8be30ef..5a6a33d 100644
--- a/osc.el
+++ b/osc.el
@@ -249,6 +249,7 @@ fine grained control.
 A process object is returned which can be dicarded with `delete-process'."
   (make-network-process
:name "OSCserver"
+   :coding 'binary
:filter #'osc-filter
:host host
:service port



[elpa] externals/osc 41c6577: Support for receiving double precision (float64) values

2021-03-30 Thread Mario Lang
branch: externals/osc
commit 41c65773a75014cd32da5cf2072e6b563002bbff
Author: Mario Lang 
Commit: Mario Lang 

Support for receiving double precision (float64) values
---
 osc.el | 26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/osc.el b/osc.el
index 28a1a5c..8be30ef 100644
--- a/osc.el
+++ b/osc.el
@@ -1,6 +1,6 @@
 ;;; osc.el --- Open Sound Control protocol library  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2014-2020  Free Software Foundation, Inc.
+;; Copyright (C) 2014-2021  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
 ;; Version: 0.2
@@ -173,6 +173,29 @@
 (expt 2.0 (- e 127))
 (1+ (/ f (expt 2.0 23
 
+(defun osc-read-float64 ()
+  (let ((s (lsh (logand (following-char) #X80) -7))
+   (e (+ (lsh (logand (following-char) #X7F) 4)
+ (lsh (logand (progn (forward-char) (following-char)) #XF0) -4)))
+   (f (+ (lsh (logand (following-char) #X0F) 48)
+ (lsh (progn (forward-char) (following-char)) 40)
+ (lsh (progn (forward-char) (following-char)) 32)
+ (lsh (progn (forward-char) (following-char)) 24)
+ (lsh (progn (forward-char) (following-char)) 16)
+ (lsh (progn (forward-char) (following-char)) 8)
+ (prog1 (progn (forward-char) (following-char)) (forward-char)
+(cond
+ ((and (= e 0) (= f 0))
+  (* 0.0 (expt -1 s)))
+ ((and (= e 2047) (or (= f (1- (expt 2 52))) (= f 0)))
+  (* 1.0e+INF (expt -1 s)))
+ ((and (= e 2047) (not (or (= f 0) (= f (1- (expt 2 52))
+  0.0e+NaN)
+ (t
+  (* (expt -1 s)
+(expt 2.0 (- e 1023))
+(1+ (/ f (expt 2.0 52
+
 (defun osc-server-set-handler (server path handler)
   "Set HANDLER for PATH on SERVER.
 IF HANDLER is nil, remove previously defined handler and fallback to
@@ -205,6 +228,7 @@ the generic handler for SERVER."
(lambda (type)
  (cl-case type
(?b (osc-read-blob))
+   (?d (osc-read-float64))
(?f (osc-read-float32))
(?i (osc-read-int32))
(?s (osc-read-string



[elpa] externals/chess 2d797ff 1/2: * chess-game.el (chess-game-ply): Fix docstring.

2020-09-19 Thread Mario Lang
branch: externals/chess
commit 2d797ff3a3e9d8e0019feec7fa99a34b5d15ad42
Author: Mario Lang 
Commit: Mario Lang 

* chess-game.el (chess-game-ply): Fix docstring.
---
 chess-game.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chess-game.el b/chess-game.el
index d86f159..06b99fb 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -222,7 +222,7 @@ if INDEX is nil)."
 
 (defun chess-game-ply (game &optional index)
   "Return a ply of GAME.
-If INDEX is non-nil, the last played ply is returned."
+If INDEX is nil, the last played ply is returned."
   (cl-assert game)
   (if index
   (nth index (chess-game-plies game))



[elpa] externals/chess updated (31a581b -> 7193c24)

2020-09-19 Thread Mario Lang
mlang pushed a change to branch externals/chess.

  from  31a581b   * chess-pgn.el (chess-pgn-parse): Fix unescaped character 
literal
   new  2d797ff   * chess-game.el (chess-game-ply): Fix docstring.
   new  7193c24   * chess-network.el (chess-network-handler): Use 
`executable-find'.


Summary of changes:
 chess-game.el| 2 +-
 chess-network.el | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)



[elpa] externals/chess 7193c24 2/2: * chess-network.el (chess-network-handler): Use `executable-find'.

2020-09-19 Thread Mario Lang
branch: externals/chess
commit 7193c24769d463ae8920a2f8143f8cc3d0122eb1
Author: Mario Lang 
Commit: Mario Lang 

* chess-network.el (chess-network-handler): Use `executable-find'.
---
 chess-network.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/chess-network.el b/chess-network.el
index c9a6b3d..16f7aa7 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -144,7 +144,7 @@
  (string-to-number
   (read-string "Port: ")))
(start-process "*chess-network*"
-  (current-buffer) "/usr/bin/nc"
+  (current-buffer) (executable-find "nc")
   "-l" "-p" (read-string "Port: ")))
(open-network-stream "*chess-network*" (current-buffer)
 (read-string "Host: ")



[elpa] master updated (4db95ab -> 2604824)

2019-12-19 Thread Mario Lang
mlang pushed a change to branch master.

  from  4db95ab   Concatenate messages instead of using a temp-buffer and 
buffer-string
   new  dcb301b   Support for binary blobs
   new  2604824   Release version 0.2


Summary of changes:
 packages/osc/osc.el | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)



[elpa] master 2604824 2/2: Release version 0.2

2019-12-19 Thread Mario Lang
branch: master
commit 2604824e5dfbe1ba23210f9d5c966fd8918832c4
Author: Mario Lang 
Commit: Mario Lang 

Release version 0.2
---
 packages/osc/osc.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/packages/osc/osc.el b/packages/osc/osc.el
index 5450751..a63d382 100644
--- a/packages/osc/osc.el
+++ b/packages/osc/osc.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014-2019  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
-;; Version: 0.1
+;; Version: 0.2
 ;; Keywords: comm, processes, multimedia
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -39,11 +39,11 @@
 
 ;; Usage:
 ;;
-;; Client: (setq my-client (osc-make-client "localhost" 7770))
+;; Client: (setq my-client (osc-make-client "127.0.0.1" 7770))
 ;; (osc-send-message my-client "/osc/path" 1.5 1.0 5 "done")
 ;; (delete-process my-client)
 ;;
-;; Server: (setq my-server (osc-make-server "localhost" 7770
+;; Server: (setq my-server (osc-make-server "127.0.0.1" 7770
 ;;  (lambda (path &rest args)
 ;;(message "OSC %s: %S" path args
 



[elpa] master dcb301b 1/2: Support for binary blobs

2019-12-19 Thread Mario Lang
branch: master
commit dcb301bb9894e2862183317622e6207bc0b8e8ed
Author: Mario Lang 
Commit: Mario Lang 

Support for binary blobs

* packages/osc/osc.el: (osc-blob, osc-read-blob): New functions.
* (osc-send-message, osc-filter): Adjust.
---
 packages/osc/osc.el | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/packages/osc/osc.el b/packages/osc/osc.el
index e88f135..5450751 100644
--- a/packages/osc/osc.el
+++ b/packages/osc/osc.el
@@ -35,7 +35,7 @@
 
 ;; BUGS/TODO:
 ;;
-;; * Timetags and binary blobs are not supported yet.
+;; * Timetags are not supported yet.
 
 ;; Usage:
 ;;
@@ -55,6 +55,12 @@
   (setq string (encode-coding-string string 'binary))
   (concat string (make-string (1+ (- 3 (% (length string) 4))) 0)))
 
+(defun osc-blob (vector)
+  (let ((length (length vector)))
+(concat (osc-int32 length)
+   vector
+   (make-string (% (- 4 (% length 4)) 4) 0
+
 (defun osc-float32 (value)
   (let (s (e 0) f)
 (cond
@@ -112,6 +118,7 @@
 ((floatp arg) "f")
 ((integerp arg) "i")
 ((stringp arg) "s")
+((vectorp arg) "b")
 (t (error "Invalid argument: %S" arg
  args)))
 (mapcar
@@ -119,7 +126,8 @@
(cond
((floatp arg) (osc-float32 arg))
((integerp arg) (osc-int32 arg))
-   ((stringp arg) (osc-string arg
+   ((stringp arg) (osc-string arg))
+   ((vectorp arg) (osc-blob arg
  args
 
 (defun osc-read-string ()
@@ -129,6 +137,16 @@
 (forward-char (- 4 (% (length string) 4)))
 string))
 
+(defun osc-read-blob ()
+  (let* ((length (osc-read-int32))
+(pos (point))
+(vector (progn
+  (forward-char length)
+  (string-to-vector (buffer-substring pos (point)
+(padding (% (- 4 (% length 4)) 4)))
+(forward-char padding)
+vector))
+
 (defun osc-read-int32 ()
   (let ((value 0))
 (dotimes (i 4)
@@ -179,13 +197,14 @@ the generic handler for SERVER."
   (goto-char (point-min))
   (let ((path (osc-read-string)))
(if (not (string= path "#bundle"))
-   (when (looking-at ",")
+   (when (= (char-after) ?,)
  (save-excursion
(apply (osc-server-get-handler proc path)
   path
   (mapcar
(lambda (type)
  (cl-case type
+   (?b (osc-read-blob))
(?f (osc-read-float32))
(?i (osc-read-int32))
(?s (osc-read-string



[elpa] master 4db95ab: Concatenate messages instead of using a temp-buffer and buffer-string

2019-12-19 Thread Mario Lang
branch: master
commit 4db95ab266983bf89adcd17d17b91aee1a1b43b4
Author: Mario Lang 
Commit: Mario Lang 

Concatenate messages instead of using a temp-buffer and buffer-string

* packages/osc/osc.el: (osc-float32, osc-int32, osc-string): New functions.
* (osc-insert-float32, osc-insert-int32, osc-insert-string): Remove.
* (osc-send-message): Adjust.
---
 packages/osc/osc.el | 59 +
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/packages/osc/osc.el b/packages/osc/osc.el
index 316b532..e88f135 100644
--- a/packages/osc/osc.el
+++ b/packages/osc/osc.el
@@ -51,10 +51,11 @@
 
 (require 'cl-lib)
 
-(defun osc-insert-string (string)
-  (insert string 0 (make-string (- 3 (% (length string) 4)) 0)))
+(defun osc-string (string)
+  (setq string (encode-coding-string string 'binary))
+  (concat string (make-string (1+ (- 3 (% (length string) 4))) 0)))
 
-(defun osc-insert-float32 (value)
+(defun osc-float32 (value)
   (let (s (e 0) f)
 (cond
  ((= value 0.0)
@@ -73,18 +74,17 @@
   (if (= e 0) (while (< (* f (expt 2.0 e)) 1.0) (setq e (1+ e
   (setq f (round (* (1- (* f (expt 2.0 e))) (expt 2 23)))
e (+ (* -1 e) 127
-(insert (+ (lsh s 7) (lsh (logand e #XFE) -1))
-   (+ (lsh (logand e #X01) 7) (lsh (logand f #X7F) -16))
-   (lsh (logand f #XFF00) -8)
-   (logand f #XFF
+(unibyte-string (+ (lsh s 7) (lsh (logand e #XFE) -1))
+   (+ (lsh (logand e #X01) 7) (lsh (logand f #X7F) -16))
+   (lsh (logand f #XFF00) -8)
+   (logand f #XFF
 
-(defun osc-insert-int32 (value)
+(defun osc-int32 (value)
   (let (bytes)
 (dotimes (i 4)
   (push (% value 256) bytes)
   (setq value (/ value 256)))
-(dolist (byte bytes)
-  (insert byte
+(apply 'unibyte-string bytes)))
 
 ;;;###autoload
 (defun osc-make-client (host port)
@@ -99,23 +99,28 @@
 ;;;###autoload
 (defun osc-send-message (client path &rest args)
   "Send an OSC message from CLIENT to the specified PATH with ARGS."
-  (with-temp-buffer
-(set-buffer-multibyte nil)
-(osc-insert-string path)
-(osc-insert-string
- (apply 'concat "," (mapcar (lambda (arg)
- (cond
-  ((floatp arg) "f")
-  ((integerp arg) "i")
-  ((stringp arg) "s")
-  (t (error "Invalid argument: %S" arg
-   args)))
-(dolist (arg args)
-  (cond
-   ((floatp arg) (osc-insert-float32 arg))
-   ((integerp arg) (osc-insert-int32 arg))
-   ((stringp arg) (osc-insert-string arg
-(process-send-string client (buffer-string
+  (process-send-string
+   client
+   (apply
+'concat
+(osc-string path)
+(osc-string
+ (apply
+  'concat ","
+  (mapcar (lambda (arg)
+   (cond
+((floatp arg) "f")
+((integerp arg) "i")
+((stringp arg) "s")
+(t (error "Invalid argument: %S" arg
+ args)))
+(mapcar
+ (lambda (arg)
+   (cond
+   ((floatp arg) (osc-float32 arg))
+   ((integerp arg) (osc-int32 arg))
+   ((stringp arg) (osc-string arg
+ args
 
 (defun osc-read-string ()
   (let ((pos (point)) string)



[elpa] master d56dd03: Improve single precision floating point serialisation

2019-12-18 Thread Mario Lang
branch: master
commit d56dd0378c5f8a582066c636599be1f297691142
Author: Mario Lang 
Commit: Mario Lang 

Improve single precision floating point serialisation

* packages/osc/osc.el: Update copyright years and author email.
* (osc-insert-float32): Use `copysign' and `isnan'.
---
 packages/osc/osc.el | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/packages/osc/osc.el b/packages/osc/osc.el
index 9f92b17..316b532 100644
--- a/packages/osc/osc.el
+++ b/packages/osc/osc.el
@@ -1,8 +1,8 @@
 ;;; osc.el --- Open Sound Control protocol library
 
-;; Copyright (C) 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019  Free Software Foundation, Inc.
 
-;; Author: Mario Lang 
+;; Author: Mario Lang 
 ;; Version: 0.1
 ;; Keywords: comm, processes, multimedia
 
@@ -57,15 +57,13 @@
 (defun osc-insert-float32 (value)
   (let (s (e 0) f)
 (cond
- ((string= (format "%f" value) (format "%f" -0.0))
-  (setq s 1 f 0))
- ((string= (format "%f" value) (format "%f" 0.0))
-  (setq s 0 f 0))
+ ((= value 0.0)
+  (setq s (if (< (copysign 1.0 value) 0) 1 0) f 0))
  ((= value 1.0e+INF)
   (setq s 0 e 255 f (1- (expt 2 23
  ((= value -1.0e+INF)
   (setq s 1 e 255 f (1- (expt 2 23
- ((string= (format "%f" value) (format "%f" 0.0e+NaN))
+ ((isnan value)
   (setq s 0 e 255 f 1))
  (t
   (setq s (if (>= value 0.0)



[elpa] master 3d0eb58: Adjust for NOAA server changes.

2016-09-27 Thread Mario Lang
branch: master
commit 3d0eb5819af4af256e0160eda84f301275876631
Author: Mark Oteiza 
Commit: Mario Lang 

Adjust for NOAA server changes.
---
 packages/metar/metar.el |   32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/packages/metar/metar.el b/packages/metar/metar.el
index b6989ea..570e6b1 100644
--- a/packages/metar/metar.el
+++ b/packages/metar/metar.el
@@ -83,7 +83,7 @@
 (const :tag "Degree Kelvin" degK)
 (const :tag "Degree Fahrenheit" degF)
 
-(defcustom metar-stations-info-url "http://weather.noaa.gov/data/nsd_bbsss.txt";
+(defcustom metar-stations-info-url 
"http://tgftp.nws.noaa.gov/data/nsd_.txt";
   "URL to use for retrieving station meta information."
   :group 'metar
   :type 'string)
@@ -117,23 +117,21 @@ If this variable is nil, the information is retrieved 
from the Internet."
  (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)) "")))
+   (dolist (entry data)
+ (when (and (nth 7 entry) (nth 8 entry)
+(not (string= (nth 0 entry) "")))
(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
- (metar-station-convert-dms-to-deg (nth 7 
item)))
-   (cons 'longitude
- (metar-station-convert-dms-to-deg (nth 8 
item)))
-   (cons 'altitude (string-to-number (nth 12 item))
-  metar-stations)))
- (setq data (cdr data)))
+  (list
+(list (cons 'code (nth 0 entry))
+  (cons 'name (nth 3 entry))
+  (cons 'country (nth 5 entry))
+  (cons 'latitude
+(metar-station-convert-dms-to-deg (nth 7 
entry)))
+  (cons 'longitude
+(metar-station-convert-dms-to-deg (nth 8 
entry)))
+  (cons 'altitude (string-to-number (nth 11 entry)
+  metar-stations
;; (unless metar-timer
;;   (setq metar-timer
;;  (run-with-timer 600 nil (lambda () (setq metar-stations nil)
@@ -281,7 +279,7 @@ It must have the signature of `math-convert-units', which 
is the default."
  pure
 
 (defcustom metar-url
-  "http://weather.noaa.gov/pub/data/observations/metar/stations/%s.TXT";
+  "http://tgftp.nws.noaa.gov/data/observations/metar/stations/%s.TXT";
   "URL used to fetch station specific information.
 %s is replaced with the 4 letter station code."
   :group 'metar



[elpa] master b24a4b1: [poker] Version 0.2, update copyright years and add todo

2016-08-11 Thread Mario Lang
branch: master
commit b24a4b18b8ca1bf225be7b8db16ff61028e633b1
Author: Mario Lang 
Commit: Mario Lang 

[poker] Version 0.2, update copyright years and add todo
---
 packages/poker/poker.el |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index a630baf..fbfa78c 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -1,10 +1,10 @@
 ;;; poker.el --- Texas hold 'em poker
 
-;; Copyright (C) 2014  Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
 ;; Maintainer: Mario Lang 
-;; Version: 0.1
+;; Version: 0.2
 ;; Keywords: games
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,12 @@
 
 ;; poker.el provides Texas hold 'em poker gameplay for Emacs.
 
+;;; Todo:
+
+;; * Provide a better user interface.  A buffer should be used to keep
+;;   the state and visual representation of a table/game.
+;; * Smarter AIs.
+
 ;;; Requires:
 
 (require 'cl-lib)



[elpa] master daaaadf: Set default number of iterations to 300

2016-08-05 Thread Mario Lang
branch: master
commit ddf5433967b1c1ca8665e209b6de4b32db76
Author: Mario Lang 
Commit: Mario Lang 

Set default number of iterations to 300

Accidentally set too high in previous commit.
---
 packages/poker/poker.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index 9bfe16b..a630baf 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -446,7 +446,7 @@ The optional number of OPPONENTS defaults to 1."
   (nth (or opponents 1)
(assq (poker-starting-hand-name pocket)
  poker-pre-flop-starting-hands)))
-  (let ((wins 0) (iterations 1000))
+  (let ((wins 0) (iterations 300))
(dotimes (i iterations)
  (let ((deck (poker-random-deck))
(players (make-vector (or opponents 1) nil)))



[elpa] master fe4bf34: Add a pre-flop hand strength table and an ert test for poker-hand-value

2016-08-05 Thread Mario Lang
branch: master
commit fe4bf34d509d5fdaa18ba9a9b2a0a48f1cabf7a9
Author: Mario Lang 
Commit: Mario Lang 

Add a pre-flop hand strength table and an ert test for poker-hand-value

Precalculated pre-flop starting hand values with 1^6 iterations.
Adjust `poker-strength' to use them when appropriate.
---
 packages/poker/poker.el |  318 +++
 1 file changed, 265 insertions(+), 53 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index d2896e7..9bfe16b 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -57,6 +57,176 @@
  ((eq rank 'queen) #xD)
  ((eq rank 'king)  #XE)
  (trank
+(defconst poker-pre-flop-starting-hands
+  '((AA 0.8551 0.7375 0.6422 0.5622 0.4946 0.4388 0.3907 0.349 0.3134 0.2828)
+(KK 0.8273 0.692 0.586 0.5022 0.4331 0.3785 0.332 0.2951 0.2638 0.2386)
+(QQ 0.8017 0.6536 0.5387 0.4525 0.3829 0.3298 0.2878 0.2535 0.2265 0.2045)
+(JJ 0.7781 0.6166 0.496 0.4072 0.3406 0.2904 0.2511 0.2214 0.1984 0.181)
+(TT 0.7538 0.5807 0.4568 0.3689 0.3044 0.2577 0.2238 0.1979 0.1771 0.1626)
+(99 0.7251 0.541 0.4159 0.33 0.2709 0.2293 0.1989 0.1767 0.1605 0.1483)
+(88 0.6965 0.5052 0.3808 0.2995 0.2443 0.2084 0.1818 0.1634 0.1499 0.1391)
+(AKs 0.6787 0.5185 0.425 0.3655 0.3216 0.2876 0.2602 0.2362 0.2179 0.2004)
+(AQs 0.6718 0.5059 0.4104 0.3492 0.3056 0.272 0.2451 0.2228 0.2042 0.1884)
+(77 0.6674 0.47 0.3492 0.2728 0.2231 0.1912 0.1685 0.1524 0.141 0.1331)
+(AJs 0.6637 0.495 0.398 0.3365 0.2927 0.2591 0.2337 0.2131 0.1956 0.1813)
+(AK 0.6614 0.4933 0.3965 0.334 0.29 0.2556 0.2257 0.2027 0.183 0.1647)
+(ATs 0.6575 0.4845 0.388 0.3266 0.2827 0.2508 0.2259 0.2057 0.1888 0.1747)
+(AQ 0.6532 0.4804 0.3804 0.3175 0.2726 0.2376 0.2101 0.1858 0.1683 0.1521)
+(AJ 0.6467 0.4673 0.3673 0.3029 0.258 0.2241 0.197 0.1752 0.1569 0.1414)
+(KQs 0.6438 0.4828 0.3937 0.3377 0.2947 0.2639 0.2374 0.2156 0.1977 0.1825)
+(A9s 0.6404 0.4606 0.3617 0.2999 0.2574 0.2263 0.2032 0.184 0.1689 0.1556)
+(66 0.6394 0.4383 0.3205 0.2499 0.2054 0.178 0.1582 0.145 0.1353 0.1278)
+(AT 0.6389 0.4582 0.3555 0.2918 0.2467 0.2134 0.1878 0.1664 0.1492 0.1347)
+(KJs 0.6365 0.4712 0.3824 0.3244 0.2829 0.2513 0.2265 0.2071 0.1893 0.1755)
+(A8s 0.633 0.4531 0.354 0.2915 0.2498 0.219 0.1972 0.1785 0.1638 0.1511)
+(KTs 0.6302 0.4631 0.3713 0.3137 0.2736 0.2418 0.2185 0.1991 0.184 0.1703)
+(A7s 0.6261 0.4434 0.3436 0.2827 0.2425 0.2123 0.1908 0.1732 0.1592 0.1477)
+(KQ 0.6254 0.4559 0.3644 0.3051 0.2626 0.2289 0.2038 0.1814 0.1632 0.1476)
+(A9 0.6208 0.4325 0.3282 0.2635 0.2192 0.1866 0.1631 0.1429 0.127 0.1146)
+(A5s 0.6182 0.4351 0.3396 0.2804 0.2413 0.2142 0.1928 0.1757 0.1621 0.1513)
+(KJ 0.6167 0.4443 0.3509 0.291 0.2484 0.2166 0.1916 0.1702 0.1528 0.1387)
+(A6s 0.6162 0.4318 0.3326 0.2743 0.2351 0.2073 0.1867 0.1697 0.1564 0.1451)
+(QJs 0.6138 0.455 0.3702 0.3156 0.2762 0.2453 0.2211 0.2019 0.1855 0.1721)
+(A8 0.6132 0.4234 0.3185 0.2537 0.2109 0.1794 0.1557 0.1368 0.1216 0.1096)
+(K9s 0.613 0.439 0.3458 0.2865 0.2474 0.2179 0.1955 0.1764 0.1616 0.1501)
+(55 0.6097 0.4074 0.2951 0.2291 0.1908 0.1655 0.1491 0.1365 0.1291 0.1219)
+(KT 0.6095 0.4344 0.3391 0.2795 0.2377 0.2062 0.182 0.1623 0.1463 0.133)
+(A4s 0.6091 0.4264 0.3308 0.2737 0.2366 0.2094 0.1882 0.172 0.1584 0.1474)
+(QTs 0.6076 0.4459 0.3607 0.3052 0.2658 0.237 0.2141 0.1956 0.1803 0.1675)
+(A7 0.6049 0.4124 0.3085 0.2448 0.2018 0.1723 0.1499 0.1312 0.1164 0.1052)
+(A3s 0.6008 0.4184 0.323 0.2675 0.2316 0.204 0.1847 0.1685 0.1555 0.1443)
+(K8s 0.5985 0.4194 0.3251 0.2685 0.2291 0.2015 0.1799 0.1634 0.1499 0.1393)
+(A5 0.5976 0.4047 0.3026 0.2409 0.2012 0.1734 0.1514 0.1336 0.1196 0.1084)
+(A6 0.5945 0.4012 0.2965 0.2347 0.194 0.1654 0.1443 0.1275 0.113 0.1022)
+(QJ 0.5937 0.4274 0.34 0.2836 0.2426 0.2115 0.1873 0.167 0.1503 0.1374)
+(A2s 0.5928 0.4081 0.3147 0.2597 0.2244 0.1985 0.1793 0.1629 0.1503 0.1397)
+(K7s 0.5927 0.4121 0.3174 0.2617 0.224 0.1961 0.1761 0.1594 0.1461 0.1359)
+(K9 0.5922 0.4092 0.3108 0.251 0.21 0.1798 0.1562 0.138 0.123 0.1105)
+(Q9s 0.5909 0.4223 0.3346 0.2789 0.2404 0.2122 0.1898 0.1725 0.1592 0.1476)
+(JTs 0.5894 0.4354 0.3532 0.3017 0.2633 0.2351 0.2124 0.1954 0.1807 0.1688)
+(A4 0.5876 0.3943 0.2932 0.2339 0.1949 0.1673 0.146 0.1295 0.1164 0.105)
+(QT 0.5863 0.4173 0.3283 0.2712 0.2323 0.2017 0.1778 0.1589 0.1448 0.1325)
+(K6s 0.5858 0.4038 0.3101 0.2543 0.2173 0.1918 0.1719 0.1556 0.1434 0.1332)
+(A3 0.5784 0.3846 0.2848 0.2266 0.1894 0.1616 0.1416 0.1249 0.1122 0.1014)
+(K5s 0.5776 0.3947 0.3024 0.2488 0.2136 0.1876 0.1683 0.1531 0.1408 0.1309)
+(44 0.577 0.3741 0.2686 0.2114 0.1776 0.1564 0.1432 0.133 0.1256 0.11

[elpa] master 87f30ef 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa

2016-08-04 Thread Mario Lang
branch: master
commit 87f30ef8a74139e763f4248b7d1bc531b585186e
Merge: 87c8aaa d68f312
Author: Mario Lang 
Commit: Mario Lang 

Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa
---
 packages/realgud/.gitignore |1 +
 packages/realgud/INSTALL|  250 ---
 packages/realgud/INSTALL.md |5 +
 packages/realgud/Makefile.am|2 +-
 packages/realgud/THANKS |2 +-
 packages/realgud/autogen.sh |1 +
 packages/realgud/common.mk  |   10 --
 packages/realgud/common.mk.in   |   25 +++
 packages/realgud/configure.ac   |1 +
 packages/realgud/realgud.el |4 +
 packages/realgud/test/Makefile.am   |1 -
 packages/realgud/test/bt-helper.el  |1 -
 packages/realgud/test/test-buf-cmd.el   |1 +
 packages/realgud/test/test-regexp-gdb.el|1 +
 packages/realgud/test/test-regexp-rdebug.el |4 +
 15 files changed, 45 insertions(+), 264 deletions(-)

diff --git a/packages/realgud/.gitignore b/packages/realgud/.gitignore
index 125299c..843d43b 100644
--- a/packages/realgud/.gitignore
+++ b/packages/realgud/.gitignore
@@ -7,6 +7,7 @@
 /README
 /aclocal.m4
 /autom4te.cache
+/common.mk
 /config.log
 /config.status
 /configure
diff --git a/packages/realgud/INSTALL b/packages/realgud/INSTALL
deleted file mode 100644
index 0ea147f..000
--- a/packages/realgud/INSTALL
+++ /dev/null
@@ -1,250 +0,0 @@
-Installation Instructions
-*
-
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-
-   Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved.  This file is offered as-is,
-without warranty of any kind.
-
-Basic Installation
-==
-
-   Briefly, the shell commands `./configure && make' should configure,
-and build this package.  If that succeeds `make install' will install
-the package. However on some systems you may need root privileges, you 
-may have to use `sudo make install' or perhaps `su root' beforehand.
-
-
-   See http://wiki.github.com/realgud/realgud/how-to-install for more
-detail as to how to install this package.
-
-Generic Information
-===
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It also creates a shell script `config.status' that you can run in
-the future to recreate the current configuration, and a file
-`config.log' containing compiler output (useful mainly for debugging
-`configure').
-
-   The configure script can also use an optional file (typically
-called `config.cache' and enabled with `--cache-file=config.cache' or
-simply `-C') that saves the results of its tests to speed up
-reconfiguring.  Caching is disabled by default to prevent problems
-with accidental use of stale cache files.
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
-may remove or edit it.
-
-   The file `configure.ac' is used to create `configure' by a program
-called `autoconf'.  You need `configure.ac' if you want to change it
-or regenerate `configure' using a newer version of `autoconf'.
-
-   The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
-
- Running `configure' might take a while.  While running, it prints
- some messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
- the package, generally using the just-built uninstalled binaries.
-
-  4. Type `make install' to install the programs and any data files and
- documentation.  When installing into a prefix owned by root, it is
- recommended that the package be configured and built as a regular
- user, and only the `make install' phase executed with root
- privileges.
-
-  5. You can remove the compiled Emacs Lisp files and other derived
- files from the source code directory by typing `make clean'.  To
- also remove the files that `configure' created (so you ca

[elpa] master 87c8aaa 1/2: Improve performance of poker-hand-value by a factor of 4

2016-08-04 Thread Mario Lang
branch: master
commit 87c8aaaf72326f0fd3c9fbb1a9dd6a050890ce3a
Author: Mario Lang 
Commit: Mario Lang 

Improve performance of poker-hand-value by a factor of 4

`cl-count' is unnecessarily expensive, as it at least uses `length' and 
`nthcdr'
which we really don't need in this performance cricital code path.
Rewriting it without `cl-count' turns up another opportunity to speed up,
as we actually don't need to check the whole list to count occurances of
unique elements.  For one, we can start counting from 1 (not 0) if
we encounter the first element, and we only need to check the rest of the
list of cards.  Also, stop using `mapcar' with `poker-card-rank'
to allow it to actually be inlined.  This turns out to make poker-hand-value
*a lot* faster. Mission accomplished.
---
 packages/poker/poker.el |   22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index 61888ae..d2896e7 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -93,15 +93,25 @@ RANK is one of `poker-ranks' and SUIT is one of 
`poker-suits'."
 The result is a 24 bit integer where the leftmost 4 bits (0-8) indicate the 
type
 of hand, and the remaining nibbles are rank values of decisive cards.
 The highest possible value is therefore #x8CBA98 and the lowest is #x053210."
-  (let* ((ranks (mapcar #'poker-card-rank hand))
-(rank-counts (sort (mapcar (lambda (rank) (cons (cl-count rank ranks) 
rank))
-   (cl-remove-duplicates ranks))
+  (let* ((rank-counts (sort (let ((cards hand) result)
+ (while cards
+   (let ((rank (poker-card-rank (car cards
+ (unless (rassq rank result)
+   (push (cons (let ((count 1))
+ (dolist (card (cdr cards) 
count)
+   (when (eq (poker-card-rank 
card)
+ rank)
+ (setq count (1+ count)
+   rank)
+ result)))
+   (setq cards (cdr cards)))
+ result)
(lambda (lhs rhs) (or (> (car lhs) (car rhs))
  (and (= (car lhs) (car rhs))
   (> (cdr lhs) (cdr 
rhs)))
-(ranks-length (length rank-counts)))
-(setq ranks (mapcar #'cdr rank-counts)
- rank-counts (mapcar #'car rank-counts))
+(ranks-length (length rank-counts))
+(ranks (mapcar #'cdr rank-counts)))
+(setq rank-counts (mapcar #'car rank-counts))
 (logior (cond
 ((eq ranks-length 4) #x10)
 ((eq ranks-length 5)



[elpa] master a275e71: Improve poker-hand-value performance by 25%

2016-08-03 Thread Mario Lang
branch: master
commit a275e71c6ef8e3ece445d53582491fc606304d1b
Author: Mario Lang 
Commit: Mario Lang 

Improve poker-hand-value performance by 25%

Avoid unnecessary calls to poker-card-suit in flush check.
---
 packages/poker/poker.el |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index c908bb6..61888ae 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -109,11 +109,16 @@ The highest possible value is therefore #x8CBA98 and the 
lowest is #x053210."
 (eq (nth 1 ranks) 3))
(setq ranks '(3 2 1 0 0)))
  (eq (- (nth 0 ranks) (nth 4 ranks)) 4)))
-   (flush (not (cdr (delete-dups (mapcar #'poker-card-suit 
hand))
+   (flush (let ((suit (poker-card-suit (car hand)))
+(tail (cdr hand)))
+(while (and tail
+(eq suit (poker-card-suit (car tail
+  (setq tail (cdr tail)))
+(not tail
(cond ((and straight flush) #x80)
- (straight #x40)
- (flush #x50)
- (t 0
+ (straight #x40)
+ (flush#x50)
+ (t  0
 ((equal rank-counts '(2 2 1)) #x20)
 ((equal rank-counts '(3 1 1)) #x30)
 ((equal rank-counts '(3 2)) #x60)



[elpa] master ad8d826 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa

2016-08-02 Thread Mario Lang
branch: master
commit ad8d826e80836478286b55247639b1288d35f47f
Merge: a5038a2 1f9393b
Author: Mario Lang 
Commit: Mario Lang 

Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa
---
 packages/loc-changes/el-get-install.el |  104 
 packages/stream/stream.el  |   14 -
 2 files changed, 12 insertions(+), 106 deletions(-)

diff --git a/packages/loc-changes/el-get-install.el 
b/packages/loc-changes/el-get-install.el
deleted file mode 100644
index 86c55ec..000
--- a/packages/loc-changes/el-get-install.el
+++ /dev/null
@@ -1,104 +0,0 @@
-(eval-when-compile
-  (defvar el-get-sources)
-)
-
-(declare-function el-get-post-install 'el-get)
-
-(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
-
-;;; el-get-install.el --- installer for the lazy
-;;
-;; Copyright (C) 2010 Dimitri Fontaine
-;;
-;; Author: Dimitri Fontaine 
-;; URL: http://www.emacswiki.org/emacs/el-get.el
-;; Created: 2010-06-17
-;; Keywords: emacs package elisp install elpa git git-svn bzr cvs apt-get fink 
http http-tar
-;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
-;;
-;; This file is NOT part of GNU Emacs.
-;;
-;; bootstrap your el-get installation, the goal is then to use el-get to
-;; update el-get.
-;;
-;; So the idea is that you copy/paste this code into your *scratch* buffer,
-;; hit C-j, and you have a working el-get.
-
-(let ((el-get-root
-   (file-name-as-directory
-   (or (bound-and-true-p el-get-dir)
-   (concat (file-name-as-directory user-emacs-directory) "el-get")
-
-  (when (file-directory-p el-get-root)
-(add-to-list 'load-path el-get-root))
-
-  ;; try to require el-get, failure means we have to install it
-  (unless (require 'el-get nil t)
-(unless (file-directory-p el-get-root)
-  (make-directory el-get-root t))
-
-(let* ((package   "el-get")
-  (buf   (switch-to-buffer "*el-get bootstrap*"))
-  (pdir  (file-name-as-directory (concat el-get-root package)))
-  (git   (or (executable-find "git")
- (error "Unable to find `git'")))
-  (url   (or (bound-and-true-p el-get-git-install-url)
- "http://github.com/dimitri/el-get.git";))
-  (default-directory el-get-root)
-  (process-connection-type nil)   ; pipe, no pty (--no-progress)
-
-  ;; First clone el-get
-  (status
-   (call-process
-git nil `(,buf t) t "--no-pager" "clone" "-v" url package)))
-
-  (unless (zerop status)
-   (error "Couldn't clone el-get from the Git repository: %s" url))
-
-  ;; switch branch if we have to
-  (let* ((branch (cond
-  ;; Check if a specific branch is requested
-  ((bound-and-true-p el-get-install-branch))
-  ;; Check if master branch is requested
-  ((boundp 'el-get-master-branch) "master")
-  ;; Read the default branch from the el-get recipe
-  ((plist-get (with-temp-buffer
-(insert-file-contents-literally
- (expand-file-name "recipes/el-get.rcp" 
pdir))
-(read (current-buffer)))
-  :branch))
-  ;; As a last resort, use the master branch
-  ("master")))
- (remote-branch (format "origin/%s" branch))
- (default-directory pdir)
- (bstatus
-   (if (string-equal branch "master")
- 0
- (call-process git nil (list buf t) t "checkout" "-t" 
remote-branch
-(unless (zerop bstatus)
-  (error "Couldn't `git checkout -t %s`" branch)))
-
-  (add-to-list 'load-path pdir)
-  (load package)
-  (let ((el-get-default-process-sync t) ; force sync operations for 
installer
-(el-get-verbose t)); let's see it all
-(el-get-post-install "el-get"))
-  (with-current-buffer buf
-   (goto-char (point-max))
-   (insert "\nCongrats, el-get is installed and ready to serve!")
-
-
-(declare-function el-get 'el-get)
-
-;; now either el-get is `require'd already, or have been `load'ed by the
-;; el-get installer.
-(setq
- el-get-sources
- '(el-get  ; el-get is self-hosting
-   loc-changes ; loc marks in buffers
-   load-relative   ; load emacs lisp relative to emacs source
-   test-simple ; simple test framework
-   ))
-
-;; install new packages and init already installed packages
-(el-

[elpa] master a5038a2 1/2: Very slightly improve performance

2016-08-02 Thread Mario Lang
branch: master
commit a5038a2ee05561ba6e586fc5a63e8ba9187fba93
Author: Mario Lang 
Commit: Mario Lang 

Very slightly improve performance

* packages/poker/poker.el (poker-hand-value): Use `delete-dups' instead of
`cl-delete-duplicates' and avoid an unnecessary call to `ash'.
---
 packages/poker/poker.el |   36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index 9de00d3..c908bb6 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -99,25 +99,25 @@ The highest possible value is therefore #x8CBA98 and the 
lowest is #x053210."
(lambda (lhs rhs) (or (> (car lhs) (car rhs))
  (and (= (car lhs) (car rhs))
   (> (cdr lhs) (cdr 
rhs)))
-(ranks-length nil))
+(ranks-length (length rank-counts)))
 (setq ranks (mapcar #'cdr rank-counts)
- rank-counts (mapcar #'car rank-counts)
- ranks-length (length ranks))
-(logior (ash (cond
- ((equal rank-counts '(2 1 1 1)) 1)
- ((eq ranks-length 5)
-  (let ((straight (or (when (and (eq (nth 0 ranks) 12)
-  (eq (nth 1 ranks) 3))
- (setq ranks '(3 2 1 0 0)))
-   (eq (- (nth 0 ranks) (nth 4 ranks)) 4)))
- (flush (eq (length (cl-delete-duplicates
- (mapcar #'poker-card-suit hand))) 
1)))
- (cond ((and straight flush) 8) (flush 5) (straight 4) (t 
0
- ((equal rank-counts '(2 2 1)) 2)
- ((equal rank-counts '(3 1 1)) 3)
- ((equal rank-counts '(3 2)) 6)
- ((equal rank-counts '(4 1)) 7))
-20)
+ rank-counts (mapcar #'car rank-counts))
+(logior (cond
+((eq ranks-length 4) #x10)
+((eq ranks-length 5)
+ (let ((straight (or (when (and (eq (nth 0 ranks) 12)
+(eq (nth 1 ranks) 3))
+   (setq ranks '(3 2 1 0 0)))
+ (eq (- (nth 0 ranks) (nth 4 ranks)) 4)))
+   (flush (not (cdr (delete-dups (mapcar #'poker-card-suit 
hand))
+   (cond ((and straight flush) #x80)
+ (straight #x40)
+ (flush #x50)
+ (t 0
+((equal rank-counts '(2 2 1)) #x20)
+((equal rank-counts '(3 1 1)) #x30)
+((equal rank-counts '(3 2)) #x60)
+((equal rank-counts '(4 1)) #x70))
(ash (nth 0 ranks) 16)
(ash (nth 1 ranks) 12)
(if (> ranks-length 2) (ash (nth 2 ranks) 8) 0)



[elpa] master 1e3a439: Use user-emacs-directory.

2016-08-01 Thread Mario Lang
branch: master
commit 1e3a4396ea61d71b69eb9678417db5b3f4de0bb0
Author: Mario Lang 
Commit: Mario Lang 

Use user-emacs-directory.
---
 packages/async/async-bytecomp.el |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/async/async-bytecomp.el b/packages/async/async-bytecomp.el
index 2c96da0..9ee3071 100644
--- a/packages/async/async-bytecomp.el
+++ b/packages/async/async-bytecomp.el
@@ -51,7 +51,7 @@ the symbol `all', in this case packages are always compiled 
asynchronously."
   :group 'async
   :type '(repeat (choice symbol)))
 
-(defvar async-byte-compile-log-file "~/.emacs.d/async-bytecomp.log")
+(defvar async-byte-compile-log-file (expand-file-name "async-bytecomp.log" 
user-emacs-directory))
 
 ;;;###autoload
 (defun async-byte-recompile-directory (directory &optional quiet)



[elpa] master 5d72b7e: [systemd] Use `process-file' instead of `shell-command'

2016-07-22 Thread Mario Lang
branch: master
commit 5d72b7e0e18753050de2a8a31ba182325abbbaf7
Author: Mario Lang 
Commit: Mario Lang 

[systemd] Use `process-file' instead of `shell-command'
---
 packages/systemd/systemd.el |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/systemd/systemd.el b/packages/systemd/systemd.el
index a7e377c..ac940b1 100644
--- a/packages/systemd/systemd.el
+++ b/packages/systemd/systemd.el
@@ -74,8 +74,8 @@ on the remote host.  When not specified, the remote system 
bus is used."
   "unix:path=/run/dbus/system_bus_socket")
  (`:session
   (with-temp-buffer
-(let ((default-directory (concat "/scpx:" host ":/")))
-  (shell-command "[ -e $XDG_RUNTIME_DIR/bus ] && echo -n 
$XDG_RUNTIME_DIR/bus" t)
+(let ((default-directory (concat "/scpx:" host ":")))
+  (process-file "/bin/sh" nil t nil "-c" "[ -e 
$XDG_RUNTIME_DIR/bus ] && echo -n $XDG_RUNTIME_DIR/bus")
   (when (not (zerop (buffer-size)))
 (buffer-string)
  (_ bus)))



[elpa] master e84d1bf: Support for connecting to remote session bus

2016-07-22 Thread Mario Lang
branch: master
commit e84d1bfa74ef03c967fe4fc96e65fbae9b8941d0
Author: Mario Lang 
Commit: Mario Lang 

Support for connecting to remote session bus
---
 packages/systemd/systemd.el |   25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/packages/systemd/systemd.el b/packages/systemd/systemd.el
index 0c213ca..a7e377c 100644
--- a/packages/systemd/systemd.el
+++ b/packages/systemd/systemd.el
@@ -61,15 +61,32 @@
   (string (string-to-number (match-string 1 string) 16)) t t string)))
   string)
 
-(defun systemd-remote-bus (host &optional address)
-  (unless address
-(setq address "unix:path=/run/dbus/system_bus_socket"))
+(defun systemd-remote-bus (host &optional bus)
+  "Construct a D-Bus bus address suitable for connecting to a remote D-Bus
+instance (via ssh) running on HOST.  Optional argument BUS specifies
+the D-Bus instance to connect to on the remote host.  The keywords
+:system and :session indicate to connect to the remote system or session
+bus, respectively.  If a string is given, that particular D-Bus address is used
+on the remote host.  When not specified, the remote system bus is used."
+  (setq bus
+   (pcase bus
+ ((or `nil `:system)
+  "unix:path=/run/dbus/system_bus_socket")
+ (`:session
+  (with-temp-buffer
+(let ((default-directory (concat "/scpx:" host ":/")))
+  (shell-command "[ -e $XDG_RUNTIME_DIR/bus ] && echo -n 
$XDG_RUNTIME_DIR/bus" t)
+  (when (not (zerop (buffer-size)))
+(buffer-string)
+ (_ bus)))
+  (unless bus
+(error "Unable to determine remote session bus address."))
   (concat "unixexec:"
   "path=ssh"
   ",argv1=-xT"
   ",argv2=" (systemd-escape-dbus-address host)
   ",argv3=systemd-stdio-bridge"
-  ",argv4=" (systemd-escape-dbus-address (concat "--bus-path=" 
address
+  ",argv4=" (systemd-escape-dbus-address (concat "--bus-path=" bus
 
 (defconst systemd-dbus-service "org.freedesktop.systemd1")
 (defconst systemd-dbus-path "/org/freedesktop/systemd1")



[elpa] branch externals/chess updated (a1ec01c -> 298db38)

2014-10-02 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  a1ec01c   Fix FEN insertion.
   new  298db38   [chess-ai] Handle pass.

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:
 ChangeLog   |4 
 chess-ai.el |2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)



[elpa] 01/01: [chess-ai] Handle pass.

2014-10-02 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 298db38184bbf31c1f69eae7b58e43f36ac4e36f
Author: Mario Lang 
Date:   Thu Oct 2 19:41:03 2014 +0200

[chess-ai] Handle pass.
---
 ChangeLog   |4 
 chess-ai.el |2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7a1d31c..e512756 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-10-02  Mario Lang  
+
+   * chess-ai.el (chess-ai-handler): Handle pass.
+
 2014-09-23  Mario Lang  
 
* chess-display.el (chess-display-yank-board): Fix FEN insertion.
diff --git a/chess-ai.el b/chess-ai.el
index 1a19f34..75e5047 100644
--- a/chess-ai.el
+++ b/chess-ai.el
@@ -324,7 +324,7 @@ DEPTH defaults to the value of `chess-ai-depth'."
   (when (chess-game-over-p game)
(chess-game-set-data game 'active nil)))
 
- ((eq event 'post-move)
+ ((memq event '(post-move pass))
   (unless (chess-game-over-p game)
(let ((chess-display-handling-event nil)
  (position (chess-engine-position nil)))



[elpa] 01/01: Fix FEN insertion.

2014-09-23 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit a1ec01c9704a65561f61c4c35c799caa05fe498b
Author: Mario Lang 
Date:   Tue Sep 23 12:23:20 2014 +0200

Fix FEN insertion.
---
 ChangeLog|4 
 chess-display.el |7 ---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 308c3e6..7a1d31c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-09-23  Mario Lang  
+
+   * chess-display.el (chess-display-yank-board): Fix FEN insertion.
+
 2014-07-28  Mario Lang  
 
* chess-display.el (chess-display-draw-square): Add docstring.
diff --git a/chess-display.el b/chess-display.el
index f7238d2..8820383 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -753,14 +753,15 @@ The key bindings available in this mode are:
   (cond
((search-forward "[Event " nil t)
(goto-char (match-beginning 0))
-   (chess-game-copy-game chess-module-game (chess-pgn-to-game)))
+   (chess-game-copy-game display (chess-pgn-to-game)))
((looking-at (concat chess-algebraic-regexp "$"))
(let ((move (buffer-string)))
  (with-current-buffer display
(chess-display-manual-move move
(t
-   (with-current-buffer display
- (chess-display-set-from-fen (buffer-string
+   (let ((fen (buffer-string)))
+ (with-current-buffer display
+   (chess-display-set-from-fen fen
 
 (defvar chess-display-search-map
   (let ((map (copy-keymap minibuffer-local-map)))



[elpa] branch externals/chess updated (e918d19 -> a1ec01c)

2014-09-23 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  e918d19   Release 2.0.4
   new  a1ec01c   Fix FEN insertion.

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:
 ChangeLog|4 
 chess-display.el |7 ---
 2 files changed, 8 insertions(+), 3 deletions(-)



[elpa] tag chess.el/2.0.4 created (now e918d19)

2014-07-28 Thread Mario Lang
mlang pushed a change to tag chess.el/2.0.4
in repository elpa.

at  e918d19   (commit)
No new revisions were added by this update.



[elpa] branch externals/chess updated (00792b5 -> e918d19)

2014-07-28 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  00792b5   Update NEWS.
   new  e918d19   Release 2.0.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:
 chess.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)



[elpa] 01/01: Release 2.0.4

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit e918d19a919f339171850bc9ccf9797e091ba6d5
Author: Mario Lang 
Date:   Mon Jul 28 17:30:46 2014 +0200

Release 2.0.4
---
 chess.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chess.el b/chess.el
index 6ed5cd1..96d23f9 100644
--- a/chess.el
+++ b/chess.el
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
-;; Version: 2.0.3
+;; Version: 2.0.4
 ;; Package-Requires: ((cl-lib "0.5"))
 ;; Keywords: games
 ;; Compatibility: Emacs24
@@ -89,7 +89,7 @@
   :group 'games
   :link '(custom-manual "(chess)Top"))
 
-(defconst chess-version "2.0.3"
+(defconst chess-version "2.0.4"
   "The version of the Emacs chess program.")
 
 (defcustom chess-default-display



[elpa] branch externals/chess updated (4ab6c33 -> 00792b5)

2014-07-28 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  4ab6c33   * chess-pos.el (chess-pos-search*) * chess-input.el 
(chess-input-display-moves): cl-delete-duplicates -> delete-dups.
   new  cf74979   * chess-algebraic.el (chess-algebraic-to-ply): Remove 
dead code.
   new  8d03ece   Misc. fixes.
   new  970a24c   * chess-ply.el (chess-ply-keyword): Add docstring.
   new  25e9d04   * chess-database.el (chess-database-do-open): Require 
modules here. (chess-database-open): Instead of only requiring modules from 
`chess-database-modules'.
   new  ad0bd9d   * chess-display.el (chess-display-draw-square): Add 
docstring.
   new  00792b5   Update NEWS.

The 6 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:
 ChangeLog  |   39 +
 Makefile   |2 +
 NEWS   |   14 ++
 chess-algebraic.el |   20 +++-
 chess-database.el  |   26 ++--
 chess-display.el   |   60 +++---
 chess-eco.el   |3 +-
 chess-engine.el|1 +
 chess-ics1.el  |2 +-
 chess-images.el|8 +---
 chess-input.el |  121 ++--
 chess-pgn.el   |3 +
 chess-ply.el   |   33 --
 chess-polyglot.el  |4 +-
 chess-pos.el   |   32 +++---
 chess-uci.el   |   11 +++--
 16 files changed, 232 insertions(+), 147 deletions(-)



[elpa] 01/06: * chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit cf7497969a25b9424ca7aeff230b720c75c75a88
Author: Mario Lang 
Date:   Sun Jun 29 17:16:37 2014 +0200

* chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
---
 ChangeLog  |4 
 chess-algebraic.el |   14 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e597fa6..935ae2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-29  Mario Lang  
+
+   * chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
+
 2014-06-25  Mario Lang  
 
* chess-pos.el (chess-pos-search*)
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 808d3e0..42b64f1 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -138,13 +138,12 @@ This regexp matches short, long and figurine notation.")
   (list (car candidates) target)
 (if (null source)
 (chess-error 'clarify-piece)
-  (nconc changes (list :which source))
   (while candidates
 (if (if (>= source ?a)
 (eq (chess-index-file (car candidates))
 (- source ?a))
-  (eq (chess-index-rank (car candidates))
-  (- 7 (- source ?1
+  (= (chess-index-rank (car candidates))
+ (- 7 (- source ?1
 (setq which (car candidates)
   candidates nil)
   (setq candidates (cdr candidates
@@ -220,12 +219,9 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(setq rank (1+ rank)))
  (when (= (chess-index-file candidate) from-file)
(setq file (1+ file
-   (cond
-((= file 1)
- (setq differentiator (+ from-file ?a)))
-((= rank 1)
- (setq differentiator (+ (- 7 from-rank) ?1)))
-(t (chess-error 'could-not-diff)))
+   (cond ((= file 1) (setq differentiator (+ from-file ?a)))
+ ((= rank 1) (setq differentiator (+ (- 7 from-rank) ?1)))
+ (t (chess-error 'could-not-diff)))
(chess-ply-set-keyword ply :which differentiator
  (concat
   (unless (= (upcase from-piece) ?P)



[elpa] 05/06: * chess-display.el (chess-display-draw-square): Add docstring.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit ad0bd9df140309728b2bbed737380299480cefc3
Author: Mario Lang 
Date:   Mon Jul 28 12:07:54 2014 +0200

* chess-display.el (chess-display-draw-square): Add docstring.
---
 ChangeLog|2 ++
 chess-display.el |7 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 245d8b7..308c3e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-07-28  Mario Lang  
 
+   * chess-display.el (chess-display-draw-square): Add docstring.
+
* chess-database.el (chess-database-do-open): Require modules here.
(chess-database-open): Instead of only requiring modules from
`chess-database-modules'.
diff --git a/chess-display.el b/chess-display.el
index a5db238..f7238d2 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -352,6 +352,13 @@ also view the same game."
 (aref chess-display-index-positions index)))
 
 (defun chess-display-draw-square (display index &optional piece pos)
+  "(Re)draw the square of DISPLAY indicated by INDEX.
+Optional argument PIECE indicates the piece (or blank) to draw.
+If it is not provided, `chess-display-position' is consulted.
+Optional argument POS indicates the buffer position to draw the square at.
+If that is not provided, `chess-display-index-pos' is called.
+
+This function is especially useful to clear a previously set highlight."
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
   (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))



[elpa] 04/06: * chess-database.el (chess-database-do-open): Require modules here. (chess-database-open): Instead of only requiring modules from `chess-database-modules'.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 25e9d04f38da45c2fb1b76b8b2cc6ff9fd8c51e4
Author: Mario Lang 
Date:   Mon Jul 28 12:03:44 2014 +0200

* chess-database.el (chess-database-do-open): Require modules here.
(chess-database-open): Instead of only requiring modules from
`chess-database-modules'.

* chess-pgn.el (chess-pgn-read-plies): Avoid copying comments
(annotations in PGN-jargon) to all following positions in a game.
(chess-create-display): Declare.

* chess-ics1.el (chess-debug-position): Use `chess-display-position'
instead of `chess-engine-position'.

* chess-engine.el (chess-pgn): Require it.
* chess-eco.el (chess-algebraic): Same here.

* chess-input.el (chess-display-highlight-legal)
(chess-display-redraw, chess-display-highlight): Declare.
---
 ChangeLog |   17 +
 Makefile  |2 ++
 NEWS  |   12 
 chess-database.el |   26 +-
 chess-eco.el  |3 ++-
 chess-engine.el   |1 +
 chess-ics1.el |2 +-
 chess-input.el|4 
 chess-pgn.el  |3 +++
 9 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c0fdb9b..245d8b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2014-07-28  Mario Lang  
 
+   * chess-database.el (chess-database-do-open): Require modules here.
+   (chess-database-open): Instead of only requiring modules from
+   `chess-database-modules'.
+
+   * chess-pgn.el (chess-pgn-read-plies): Avoid copying comments
+   (annotations in PGN-jargon) to all following positions in a game.
+   (chess-create-display): Declare.
+
+   * chess-ics1.el (chess-debug-position): Use `chess-display-position'
+   instead of `chess-engine-position'.
+
+   * chess-engine.el (chess-pgn): Require it.
+   * chess-eco.el (chess-algebraic): Same here.
+
+   * chess-input.el (chess-display-highlight-legal)
+   (chess-display-redraw, chess-display-highlight): Declare.
+
* chess-ply.el (chess-ply-keyword): Add docstring.
 
* chess-input.el (chess-input): New custom group.
diff --git a/Makefile b/Makefile
index 4c9f462..59c366e 100644
--- a/Makefile
+++ b/Makefile
@@ -18,9 +18,11 @@ chess-eco.fen: chess-eco.pos
 dir: chess.info
$(INSTALL_INFO) $< $@
 
+chess-algebraic.elc: chess-ply.elc chess-pos.elc
 chess-database.elc: chess-message.elc chess-file.elc chess-scid.elc
 chess-file.elc: chess-fen.elc chess-pgn.elc
 chess-perft.elc: chess-fen.elc chess-ply.elc chess-pos.elc
+chess-pgn.elc: chess-algebraic.elc chess-game.elc
 chess-test.elc: chess-database.elc chess-game.elc chess-perft.elc
 
 .el.elc:
diff --git a/NEWS b/NEWS
index bc12c23..ac0f31d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,18 @@ This is the NEWS file for Emacs Chess, a chess client and 
analysis library
 written in Emacs Lisp.
 
 
+* Release 2.0.4:
+
+This is yet another bugfix release, no new features.
+
+** Fix a bug in PGN annotation parsing.
+
+** Fix missing dependencies in the ECO module.
+
+** Make the third argument of `chess-display-redraw' optional, as expected
+   by the rest of the code.
+
+
 * Release 2.0.3:
 
 This is a bugfix release which fixes a recursive dependency between
diff --git a/chess-database.el b/chess-database.el
index c801947..0e29593 100644
--- a/chess-database.el
+++ b/chess-database.el
@@ -41,17 +41,18 @@
 
 (defun chess-database-do-open (module file)
   "Returns the opened database object, or nil."
-  (let* ((name (symbol-name module))
-(handler (intern-soft (concat name "-handler"
-(unless handler
-  (chess-error 'no-such-database name))
-(let ((buffer (funcall handler 'open file)))
-  (when buffer
-   (with-current-buffer buffer
- (setq chess-database-handler handler)
- (add-hook 'kill-buffer-hook 'chess-database-close nil t)
- (add-hook 'after-revert-hook 'chess-database-rescan nil t)
- (current-buffer))
+  (when (require module nil t)
+(let* ((name (symbol-name module))
+  (handler (intern-soft (concat name "-handler"
+  (unless handler
+   (chess-error 'no-such-database name))
+  (let ((buffer (funcall handler 'open file)))
+   (when buffer
+ (with-current-buffer buffer
+   (setq chess-database-handler handler)
+   (add-hook 'kill-buffer-hook 'chess-database-close nil t)
+   (add-hook 'after-revert-hook 'chess-database-rescan nil t)
+   (current-buffer)))
 
 (defun chess-database-open (file &optional module)
   "Returns the opened database object, or nil."
@@ -60,8 +61,7 @@
 (let (result)
   (setq module chess-database-modules)
   (while module
-   (if (and (require (car module) nil t)

[elpa] 03/06: * chess-ply.el (chess-ply-keyword): Add docstring.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 970a24cfcc8bf71a15e5dbc9db6f5538e2fb2920
Author: Mario Lang 
Date:   Mon Jul 28 10:47:03 2014 +0200

* chess-ply.el (chess-ply-keyword): Add docstring.

* chess-input.el (chess-input): New custom group.
(chess-input-notation-type): Put into `chess-input' group.
(chess-input-test-move): Use `chess-ply-keyword' to check for
castling plies instead of doing a string-match on the algebraic
notation string.

* chess-images.el (chess-images-determine-size): Don't use
`x-display-pixel-height' and `x-display-pixel-width' directly.

* chess-display.el (chess-display-draw-square): Make third argument
PIECE optional.
---
 ChangeLog|   16 
 chess-display.el |2 +-
 chess-images.el  |8 ++--
 chess-input.el   |   24 +++-
 chess-ply.el |6 +-
 5 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 935ae2b..c0fdb9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-07-28  Mario Lang  
+
+   * chess-ply.el (chess-ply-keyword): Add docstring.
+
+   * chess-input.el (chess-input): New custom group.
+   (chess-input-notation-type): Put into `chess-input' group.
+   (chess-input-test-move): Use `chess-ply-keyword' to check for
+   castling plies instead of doing a string-match on the algebraic
+   notation string.
+
+   * chess-images.el (chess-images-determine-size): Don't use
+   `x-display-pixel-height' and `x-display-pixel-width' directly.
+
+   * chess-display.el (chess-display-draw-square): Make third argument
+   PIECE optional.
+
 2014-06-29  Mario Lang  
 
* chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
diff --git a/chess-display.el b/chess-display.el
index 857e86d..a5db238 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -351,7 +351,7 @@ also view the same game."
  (point-min))
 (aref chess-display-index-positions index)))
 
-(defun chess-display-draw-square (display index piece &optional pos)
+(defun chess-display-draw-square (display index &optional piece pos)
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
   (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
diff --git a/chess-images.el b/chess-images.el
index 9b45593..f2e0f03 100644
--- a/chess-images.el
+++ b/chess-images.el
@@ -212,16 +212,12 @@ called."
 (setq cursor-type nil
  chess-images-cache nil
  chess-images-size (chess-images-best-size
-(- (if display
-   (x-display-pixel-height display)
- (display-pixel-height))
+(- (display-pixel-height display)
;; On Macs and Windows, account for
;; the Start/Status bar
(if (memq window-system '(mac windows w32))
80 20))
-(- (if display
-   (x-display-pixel-width display)
- (display-pixel-width)) 20)
+(- (display-pixel-width display) 20)
 
 (defun chess-images-initialize ()
   (let ((map (current-local-map)))
diff --git a/chess-input.el b/chess-input.el
index e34ee50..dc7c8d1 100644
--- a/chess-input.el
+++ b/chess-input.el
@@ -48,8 +48,13 @@
 (make-variable-buffer-local 'chess-input-position-function)
 (make-variable-buffer-local 'chess-input-move-function)
 
+(defgroup chess-input nil
+  "Move input related otpions."
+  :group 'chess)
+
 (defcustom chess-input-notation-type :san
   "Define the notation type to use for move input."
+  :group 'chess-input
   :type '(choice (const :tag "Standard (short) algebraic notation" :san)
 (const :tag "Numeric notation" :numeric)))
 
@@ -59,19 +64,20 @@
 (i 0) (x 0) (l (length move))
 (xl (length chess-input-move-string)))
 (unless (or (and (equal (downcase chess-input-move-string) "ok")
-(string-match "\\`O-O[+#]?\\'" move))
+(chess-ply-keyword ply :castle))
(and (equal (downcase chess-input-move-string) "oq")
-(string-match "\\`O-O-O[+#]?\\'" move)))
+(chess-ply-keyword ply :long-castle)))
   (while (and (< i l) (< x xl))
(let ((move-char (aref move i))
  (entry-char (aref chess-input-move-string x)))
- (cond
-  ((or (and (= move-char ?x) (/= entry-char ?x))
-   (and (= move-char ?=) (/= entry-char ?=)))
-   (s

[elpa] 02/06: Misc. fixes.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 8d03eceef113557406163d110f6a2b04b4a1596b
Author: Mario Lang 
Date:   Mon Jul 7 14:33:21 2014 +0200

Misc. fixes.
---
 chess-algebraic.el |   12 +++---
 chess-display.el   |   51 +++-
 chess-input.el |   93 +++
 chess-ply.el   |   27 +++
 chess-polyglot.el  |4 +-
 chess-pos.el   |   32 ++
 chess-uci.el   |   11 +++---
 7 files changed, 121 insertions(+), 109 deletions(-)

diff --git a/chess-algebraic.el b/chess-algebraic.el
index 42b64f1..3a07310 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -140,10 +140,10 @@ This regexp matches short, long and figurine notation.")
 (chess-error 'clarify-piece)
   (while candidates
 (if (if (>= source ?a)
-(eq (chess-index-file (car candidates))
-(- source ?a))
+(= (chess-index-file (car candidates))
+   (chess-file-from-char source))
   (= (chess-index-rank (car candidates))
- (- 7 (- source ?1
+ (chess-rank-from-char source)))
 (setq which (car candidates)
   candidates nil)
   (setq candidates (cdr candidates
@@ -219,8 +219,8 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(setq rank (1+ rank)))
  (when (= (chess-index-file candidate) from-file)
(setq file (1+ file
-   (cond ((= file 1) (setq differentiator (+ from-file ?a)))
- ((= rank 1) (setq differentiator (+ (- 7 from-rank) ?1)))
+   (cond ((= file 1) (setq differentiator (chess-file-to-char 
from-file)))
+ ((= rank 1) (setq differentiator (chess-rank-to-char 
from-rank)))
  (t (chess-error 'could-not-diff)))
(chess-ply-set-keyword ply :which differentiator
  (concat
@@ -234,7 +234,7 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(differentiator (char-to-string differentiator))
((and (not (eq type :lan)) (= (upcase from-piece) ?P)
  (/= from-file (chess-index-file to)))
-(char-to-string (+ from-file ?a
+(char-to-string (chess-file-to-char from-file
   (if (or (/= ?  (chess-pos-piece pos to))
   (chess-ply-keyword ply :en-passant))
   "x" (if (eq type :lan) "-"))
diff --git a/chess-display.el b/chess-display.el
index fa4358c..857e86d 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -395,35 +395,38 @@ also view the same game."
   "Return non-nil if the displayed chessboard reflects an active game.
 Basically, it means we are playing, not editing or reviewing."
   (and (chess-game-data chess-module-game 'active)
-   (= chess-display-index
- (chess-game-index chess-module-game))
+   (= chess-display-index (chess-game-index chess-module-game))
(not (chess-game-over-p chess-module-game))
(not chess-display-edit-mode)))
 
 (defun chess-display-move (display ply)
   "Move a piece on DISPLAY, by applying the given PLY.
-The position of PLY must match the currently displayed position."
+The position of PLY must match the currently displayed position.
+
+This adds PLY to the game associated with DISPLAY."
   (chess-with-current-buffer display
-(if (and (chess-display-active-p)
-;; `active' means we're playing against an engine
-(chess-game-data chess-module-game 'active)
-(not (eq (chess-game-data chess-module-game 'my-color)
- (chess-game-side-to-move chess-module-game
-   (chess-error 'not-your-move)
-  (if (and (= chess-display-index
- (chess-game-index chess-module-game))
-  (chess-game-over-p chess-module-game))
- (chess-error 'game-is-over)))
-(if (= chess-display-index (chess-game-index chess-module-game))
-   (let ((chess-display-handling-event t))
- (chess-game-move chess-module-game ply)
- (chess-display-paint-move nil ply)
- (chess-display-set-index* nil (chess-game-index chess-module-game))
- (redisplay)   ; FIXME: This is clearly necessary, but 
why?
- (chess-game-run-hooks chess-module-game 'post-move))
-  ;; jww (2002-03-28): This should beget a variation within the
-  ;; game, or alt

[elpa] 06/06: Update NEWS.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 00792b5d68aa5c2e8acd3bc816792822fd6bde9a
Author: Mario Lang 
Date:   Mon Jul 28 12:09:39 2014 +0200

Update NEWS.
---
 NEWS |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index ac0f31d..8e980d9 100644
--- a/NEWS
+++ b/NEWS
@@ -10,9 +10,11 @@ This is yet another bugfix release, no new features.
 
 ** Fix missing dependencies in the ECO module.
 
-** Make the third argument of `chess-display-redraw' optional, as expected
+** Make the third argument of `chess-display-draw-square' optional, as expected
by the rest of the code.
 
+** Fix a bug where PGN mode could not load the `chess-file' module.
+
 
 * Release 2.0.3:
 



[elpa] branch externals/chess updated (95d1dec -> 4ab6c33)

2014-06-28 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  95d1dec   Remove obsolete arguments and use more cl-check-type.
   new  4ab6c33   * chess-pos.el (chess-pos-search*) * chess-input.el 
(chess-input-display-moves): cl-delete-duplicates -> delete-dups.

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:
 ChangeLog  |   15 +++
 chess-algebraic.el |2 +-
 chess-display.el   |2 +-
 chess-fen.el   |8 
 chess-input.el |2 +-
 chess-plain.el |2 +-
 chess-ply.el   |4 ++--
 chess-pos.el   |   22 +++---
 8 files changed, 36 insertions(+), 21 deletions(-)



[elpa] 01/01: * chess-pos.el (chess-pos-search*) * chess-input.el (chess-input-display-moves): cl-delete-duplicates -> delete-dups.

2014-06-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 4ab6c335594387cf66efb28c528946a3d3c1db8f
Author: Mario Lang 
Date:   Sat Jun 28 13:27:58 2014 +0200

* chess-pos.el (chess-pos-search*)
* chess-input.el (chess-input-display-moves): cl-delete-duplicates ->
delete-dups.

* chess-pos.el (chess-pos-piece-p, chess-pos-search*)
(chess-search-position)
* chess-ply.el (chess-ply-create, chess-legal-plies)
* chess-plain.el (chess-plain-piece-text)
* chess-fen.el (chess-pos-to-fen)
* chess-display.el (chess-display-select-piece)
* chess-algebraic.el (chess-algebraic-to-ply): Use `=' instead of `eq'
to compare pieces.
---
 ChangeLog  |   15 +++
 chess-algebraic.el |2 +-
 chess-display.el   |2 +-
 chess-fen.el   |8 
 chess-input.el |2 +-
 chess-plain.el |2 +-
 chess-ply.el   |4 ++--
 chess-pos.el   |   22 +++---
 8 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e5b9a71..e597fa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-06-25  Mario Lang  
+
+   * chess-pos.el (chess-pos-search*)
+   * chess-input.el (chess-input-display-moves): cl-delete-duplicates ->
+   delete-dups.
+
+   * chess-pos.el (chess-pos-piece-p, chess-pos-search*)
+   (chess-search-position)
+   * chess-ply.el (chess-ply-create, chess-legal-plies)
+   * chess-plain.el (chess-plain-piece-text)
+   * chess-fen.el (chess-pos-to-fen)
+   * chess-display.el (chess-display-select-piece)
+   * chess-algebraic.el (chess-algebraic-to-ply): Use `=' instead of `eq'
+   to compare pieces.
+
 2014-06-24  Mario Lang  
 
* chess-ply.el (chess-ply-p): New function.
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 5ca7895..808d3e0 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -102,7 +102,7 @@ This regexp matches short, long and figurine notation.")
(mate (match-string 8 move))
(piece (aref move 0))
changes type)
-   (if (or (eq piece ?O) (eq piece ?0))
+   (if (or (= piece ?O) (= piece ?0))
(setq changes (chess-ply-castling-changes
   position (= (length (match-string 1 move)) 5)))
  (let ((promotion (match-string 7 move)))
diff --git a/chess-display.el b/chess-display.el
index 537ac6c..fa4358c 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -1233,7 +1233,7 @@ Clicking once on a piece selects it; then click on the 
target location."
(setq chess-display-last-selected nil))
(let ((piece (chess-pos-piece position coord)))
  (cond
-  ((eq piece ? )
+  ((= piece ? )
(throw 'message (chess-string 'selected-empty)))
   ((not (or chess-display-edit-mode
 (not (chess-display-active-p))
diff --git a/chess-fen.el b/chess-fen.el
index f3a2eb0..52bdf9e 100644
--- a/chess-fen.el
+++ b/chess-fen.el
@@ -145,11 +145,11 @@ If FULL is non-nil, represent trailing spaces as well."
   (if (and index
   (let ((pawn (if (chess-pos-side-to-move position) ?P ?p)))
 (or (and (chess-incr-index index 0 -1)
- (eq (chess-pos-piece position (chess-incr-index
-index 0 -1)) pawn))
+ (chess-pos-piece-p position (chess-incr-index
+  index 0 -1) pawn))
 (and (chess-incr-index index 0 1)
- (eq (chess-pos-piece position (chess-incr-index
-index 0 1)) pawn)
+ (chess-pos-piece-p position (chess-incr-index
+  index 0 1) pawn)
  (concat str (chess-index-to-coord
   (if (chess-pos-side-to-move position)
   (chess-incr-index index -1 0)
diff --git a/chess-input.el b/chess-input.el
index f3cc893..500fd21 100644
--- a/chess-input.el
+++ b/chess-input.el
@@ -83,7 +83,7 @@
   (when (> (length chess-input-move-string) 0)
 (when chess-display-highlight-legal
   (apply #'chess-display-highlight
-nil (cl-delete-duplicates (mapcar #'chess-ply-target move-list
+nil (delete-dups (mapcar #'chess-ply-target move-list
 (message "[%s] %s" chess-input-move-string
 (mapconcat (lambda (ply)
  (chess-ply-to-algebraic ply 
chess-input-notation-type))
diff --git a/chess-plain.el b/chess-plain.el
index e5e1412..190d263 100644
--- a/chess-plain.el
+++ b/chess-plain.el
@@ -256,7 +256,7 @@ modify `chess-plain-piece-chars' t

[elpa] branch master updated (4e171a5 -> 9b6551e)

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

  from  4e171a5   Merge branch 'master' of github.com:leoliu/ggtags
   new  9b6551e   Release 0.1.

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/metar/metar.el |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)



[elpa] 01/01: Release 0.1.

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

commit 9b6551e1e71ffa00f4b4d4e78d2efcbd3d9204fd
Author: Mario Lang 
Date:   Tue Jun 24 11:09:47 2014 +0200

Release 0.1.
---
 packages/metar/metar.el |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/packages/metar/metar.el b/packages/metar/metar.el
index 82b83b7..7b78f07 100644
--- a/packages/metar/metar.el
+++ b/packages/metar/metar.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2007, 2014  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang 
-;; Version: 0
+;; Version: 0.1
 ;; Package-Requires: ((cl-lib "0.5"))
 ;; Keywords: comm
 
@@ -545,7 +545,7 @@ Otherwise, determine the best station via 
latitude/longitude."
 nil t
 (let ((info (metar-decode (metar-get-record station
   (if info
- (message "%d minutes ago at %s: %d°%c, %d%% relative humidity%s"
+ (message "%d minutes ago at %s: %d°%c, %s%d%% humidity, %.1f %S."
   (/ (truncate (float-time (time-since
 (cdr (assoc 'timestamp info)
  60)
@@ -555,11 +555,11 @@ Otherwise, determine the best station via 
latitude/longitude."
   (cond
((eq (cdr (assq 'temperature metar-units)) 'degC) ?C)
((eq (cdr (assq 'temperature metar-units)) 'degF) ?F))
-  (cadr (assoc 'humidity info))
   (if (assoc 'phenomena info)
-  (concat "\n" "Phenomena: "
-  (cdr (assoc 'phenomena info)))
-""))
+  (concat (cdr (assoc 'phenomena info)) ", ")
+"")
+  (cadr (assoc 'humidity info))
+  (cadr (assoc 'pressure info)) (cddr (assoc 'pressure info)))
(message "No weather information found, sorry.")
   
 (defun metar-station-countries ()
@@ -619,7 +619,8 @@ Otherwise, determine the best station via 
latitude/longitude."
 (format "%.1f°%c"
 (car dewpoint)
 (cond ((eq (cdr dewpoint) 'degC) ?C)
-  ((eq (cdr dewpoint) 'degF) ?F)
+  ((eq (cdr dewpoint) 'degF) ?F)
+  ((eq (cdr dewpoint) 'degK) ?K)
 (cons ?h
   (let ((humidity (cdr (assq 'humidity report
 (format "%d%%" (car humidity



[elpa] 01/01: Remove obsolete arguments and use more cl-check-type.

2014-06-23 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 95d1decf4ca8e3830a50c5095ae7ff69bd577e3f
Author: Mario Lang 
Date:   Tue Jun 24 01:01:39 2014 +0200

Remove obsolete arguments and use more cl-check-type.

* chess-ply.el (chess-ply-p): New function.
Change `cl-assert' to `cl-check-type' based on this predicate.
(chess-ply-final-p): Only call `chess-ply-any-keyword' if we actually
found a preceding ply.
(chess-ply--add): Remove obsolte and unused arguments RANK-ADJ and
FILE-ADJ.
(chess-legal-plies): Adjust for `chess-ply--add' argument removal.
---
 ChangeLog|   10 ++
 chess-ply.el |   99 +
 2 files changed, 60 insertions(+), 49 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d042ec..e5b9a71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-06-24  Mario Lang  
+
+   * chess-ply.el (chess-ply-p): New function.
+   Change `cl-assert' to `cl-check-type' based on this predicate.
+   (chess-ply-final-p): Only call `chess-ply-any-keyword' if we actually
+   found a preceding ply.
+   (chess-ply--add): Remove obsolte and unused arguments RANK-ADJ and
+   FILE-ADJ.
+   (chess-legal-plies): Adjust for `chess-ply--add' argument removal.
+
 2014-06-19  Eli Zaretskii  
 
* chess.texi: Proofread and fix the manual.  All the Next, Prev,
diff --git a/chess-ply.el b/chess-ply.el
index fd5dc21..46cba39 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -67,26 +67,29 @@
   "Routines for manipulating chess plies."
   :group 'chess)
 
+(defsubst chess-ply-p (ply)
+  (and (consp ply) (chess-pos-p (car ply
+
 (defsubst chess-ply-pos (ply)
   "Returns the base position associated with PLY."
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (car ply))
 
 (defsubst chess-ply-set-pos (ply position)
   "Set the base position of PLY."
-  (cl-assert (listp ply))
-  (cl-assert (vectorp position))
+  (cl-check-type ply chess-ply)
+  (cl-check-type position chess-pos)
   (setcar ply position))
 
 (gv-define-simple-setter chess-ply-pos chess-ply-set-pos)
 
 (defsubst chess-ply-changes (ply)
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (cdr ply))
 
 (defsubst chess-ply-set-changes (ply changes)
-  (cl-assert (listp ply))
-  (cl-assert (listp changes))
+  (cl-check-type ply chess-ply)
+  (cl-check-type changes list)
   (setcdr ply changes))
 
 (gv-define-simple-setter chess-ply-changes chess-ply-set-changes)
@@ -94,7 +97,7 @@
 (defun chess-ply-any-keyword (ply &rest keywords)
   "Return non-nil if PLY contains at least one of KEYWORDS."
   (declare (side-effect-free t))
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (catch 'found
 (dolist (keyword keywords)
   (if (memq keyword (chess-ply-changes ply))
@@ -102,14 +105,14 @@
 
 (defun chess-ply-keyword (ply keyword)
   (declare (side-effect-free t))
-  (cl-assert (listp ply))
-  (cl-assert (symbolp keyword))
+  (cl-check-type ply chess-ply)
+  (cl-check-type keyword symbol)
   (let ((item (memq keyword (chess-ply-changes ply
 (and item (if (not (cdr item)) t (cadr item)
 
 (defun chess-ply-set-keyword (ply keyword &optional value)
-  (cl-assert (listp ply))
-  (cl-assert (symbolp keyword))
+  (cl-check-type ply chess-ply)
+  (cl-check-type keyword symbol)
   (let* ((changes (chess-ply-changes ply))
 (item (memq keyword changes)))
 (if item
@@ -124,21 +127,21 @@
 
 (defsubst chess-ply-source (ply)
   "Returns the source square index value of PLY."
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (let ((changes (chess-ply-changes ply)))
 (and (listp changes) (not (symbolp (car changes)))
 (car changes
 
 (defsubst chess-ply-target (ply)
   "Returns the target square index value of PLY."
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (let ((changes (chess-ply-changes ply)))
 (and (listp changes) (not (symbolp (car changes)))
 (cadr changes
 
 (defsubst chess-ply-next-pos (ply)
   "Return the position that results from executing PLY."
-  (cl-assert (listp ply))
+  (cl-check-type ply chess-ply)
   (or (chess-ply-keyword ply :next-pos)
   (let ((position (apply 'chess-pos-move
 (chess-pos-copy (chess-ply-pos ply))
@@ -148,7 +151,7 @@
 
 (defun chess-ply-castling-changes (position &optional long king-index)
   "Create castling changes; this function supports Fischer Random castling."
-  (cl-assert (vectorp position))
+  (cl-check-type position chess-pos)
   (let* ((color (chess-pos-side-to-move position))
 (king (or king-index (chess-pos-king-index position color)))
 (rook (chess-pos-can-castle position (if color
@@ -174,7 +177,7 @@
 (defvar chess-ply-checking-mate nil)
 
 (defsubst 

[elpa] branch externals/chess updated (7074fb6 -> 95d1dec)

2014-06-23 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  7074fb6   Release 2.0.3.
   new  95d1dec   Remove obsolete arguments and use more cl-check-type.

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:
 ChangeLog|   10 ++
 chess-ply.el |   99 +
 2 files changed, 60 insertions(+), 49 deletions(-)



[elpa] 01/01: Release 2.0.3.

2014-06-22 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 7074fb64c66fb84be9a1c8ee3abeb956da355fd9
Author: Mario Lang 
Date:   Mon Jun 23 01:40:04 2014 +0200

Release 2.0.3.
---
 NEWS |8 
 chess.el |4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 2054058..bc12c23 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,14 @@ This is the NEWS file for Emacs Chess, a chess client and 
analysis library
 written in Emacs Lisp.
 
 
+* Release 2.0.3:
+
+This is a bugfix release which fixes a recursive dependency between
+`chess-display' and `chess-pgn' which was accidentally missed in 2.0.2.
+
+Also included is further proof-reading of the Info manual.
+
+
 * Release 2.0.2:
 
 ** Major updates to the Info manual.
diff --git a/chess.el b/chess.el
index 00f06ac..6ed5cd1 100644
--- a/chess.el
+++ b/chess.el
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
-;; Version: 2.0.2
+;; Version: 2.0.3
 ;; Package-Requires: ((cl-lib "0.5"))
 ;; Keywords: games
 ;; Compatibility: Emacs24
@@ -89,7 +89,7 @@
   :group 'games
   :link '(custom-manual "(chess)Top"))
 
-(defconst chess-version "2.0.2"
+(defconst chess-version "2.0.3"
   "The version of the Emacs chess program.")
 
 (defcustom chess-default-display



[elpa] branch externals/chess updated (754fd7d -> 7074fb6)

2014-06-22 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  754fd7d   Update chess.info and fix a minor misunderstanding in 
chess-display-update documentation.
   new  7074fb6   Release 2.0.3.

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:
 NEWS |8 
 chess.el |4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)



[elpa] branch externals/chess updated (9d174fe -> 754fd7d)

2014-06-19 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  9d174fe   Fix Texinfo usage and markup in the Chess manual.
   new  754fd7d   Update chess.info and fix a minor misunderstanding in 
chess-display-update documentation.

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:
 chess.info | 1041 ++--
 chess.texi |2 +-
 2 files changed, 586 insertions(+), 457 deletions(-)



[elpa] 02/02: Unbreak recursive require between chess-display and chess-pgn.

2014-06-18 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit a4443ab82ddd636db096c96c531787bf9c4e79f6
Author: Mario Lang 
Date:   Wed Jun 18 23:48:45 2014 +0200

Unbreak recursive require between chess-display and chess-pgn.
---
 chess-ai.el  |6 --
 chess-common.el  |3 ++-
 chess-display.el |7 +--
 chess-engine.el  |2 ++
 chess-pgn.el |1 -
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/chess-ai.el b/chess-ai.el
index 06cee58..1a19f34 100644
--- a/chess-ai.el
+++ b/chess-ai.el
@@ -30,11 +30,11 @@
 
 ;;; Code:
 
-(require 'chess)
+(require 'chess-algebraic)
 (require 'chess-common)
 (require 'chess-polyglot)
-(require 'chess-pos)
 (require 'chess-ply)
+(require 'chess-pos)
 (require 'cl-lib)
 
 (defgroup chess-ai ()
@@ -306,6 +306,8 @@ DEPTH defaults to the value of `chess-ai-depth'."
  (1+ most-negative-fixnum) most-positive-fixnum
  (or eval-fn #'chess-ai-eval-static
 
+(defvar chess-full-name)
+
 (defun chess-ai-handler (game event &rest args)
   (unless chess-engine-handling-event
 (cond
diff --git a/chess-common.el b/chess-common.el
index 7de9196..a574288 100644
--- a/chess-common.el
+++ b/chess-common.el
@@ -31,7 +31,6 @@
 
 ;;; Code:
 
-(require 'chess)
 (require 'chess-engine)
 (require 'chess-message)
 
@@ -57,6 +56,8 @@
 (illegal-move  . "Illegal move")
 (not-yet-implemented   . "This feature is not yet implemented")))
 
+(defvar chess-full-name)
+
 (defun chess-common-handler (game event &rest args)
   "Initialize the network chess engine."
   (cond
diff --git a/chess-display.el b/chess-display.el
index 439bc2d..537ac6c 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -29,7 +29,6 @@
 (require 'chess-input)
 (require 'chess-message)
 (require 'chess-module)
-(require 'chess-pgn)
 (require 'chess-random)
 (require 'chess-var)
 
@@ -714,6 +713,8 @@ The key bindings available in this mode are:
   (interactive "sSet from FEN string: ")
   (chess-display-set-position nil (chess-fen-to-pos fen)))
 
+(declare-function chess-game-to-pgn "chess-pgn" (game &optional indented 
to-string))
+
 (defun chess-display-kill-board (&optional arg)
   "Send the current board configuration to the user."
   (interactive "P")
@@ -725,6 +726,8 @@ The key bindings available in this mode are:
(buffer-string)))
   (kill-new (chess-pos-to-fen (chess-display-position nil) t)
 
+(declare-function chess-pgn-to-game "chess-pgn" (&optional string))
+
 (defun chess-display-yank-board ()
   "Send the current board configuration to the user."
   (interactive)
@@ -1042,7 +1045,7 @@ to the end or beginning."
 
 (define-key map [(control ?l)] 'chess-display-redraw)
 (define-key map [(control ?i)] 'chess-display-invert)
-(define-key map [tab] 'chess-display-invert)
+(define-key map "\t" 'chess-display-invert)
 
 (define-key map [??] 'describe-mode)
 (define-key map [?L] 'chess-display-list-buffers)
diff --git a/chess-engine.el b/chess-engine.el
index 0fef4b0..3672a43 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -19,6 +19,8 @@
 
 ;;; Code:
 
+(require 'chess-algebraic)
+(require 'chess-fen)
 (require 'chess-module)
 
 (defgroup chess-engine nil
diff --git a/chess-pgn.el b/chess-pgn.el
index 8001c67..347f28b 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -54,7 +54,6 @@
 
 ;;; Code:
 
-(require 'chess)
 (require 'chess-algebraic)
 (require 'chess-display)
 (require 'chess-fen)



[elpa] branch externals/chess updated (2549435 -> a4443ab)

2014-06-18 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  2549435   Release 2.0.2.
   new  dc18a3b   * chess.el Add to games menu.
   new  a4443ab   Unbreak recursive require between chess-display and 
chess-pgn.

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:
 chess-ai.el  |6 --
 chess-common.el  |3 ++-
 chess-display.el |7 +--
 chess-engine.el  |2 ++
 chess-ics.el |3 +++
 chess-pgn.el |1 -
 chess.el |3 +++
 7 files changed, 19 insertions(+), 6 deletions(-)



[elpa] 01/02: * chess.el Add to games menu.

2014-06-18 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit dc18a3b41633b13104329e85903ff15097f7bfcd
Author: Mario Lang 
Date:   Wed Jun 18 23:44:39 2014 +0200

* chess.el Add to games menu.
---
 chess-ics.el |3 +++
 chess.el |3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/chess-ics.el b/chess-ics.el
index 0e44187..ca2aaab 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -827,6 +827,9 @@ This function should be put on 
`comint-preoutput-filter-functions'."
(accept-process-output (get-buffer-process (current-buffer)) 0 100)))
 (switch-to-buffer buf)))
 
+;;;###autoload
+(define-key menu-bar-games-menu [chess-ics] '(menu-item "Internet Chess 
Servers" chess-ics :help "Play Chess on the Internet"))
+
 ;;; ICC datagrams
 
 ;; See http://www.chessclub.com/resources/formats/formats.txt
diff --git a/chess.el b/chess.el
index e45eee9..00f06ac 100644
--- a/chess.el
+++ b/chess.el
@@ -235,6 +235,9 @@ Otherwise use `chess-default-engine' to determine the 
engine."
 (defalias 'chess-session 'chess)
 
 ;;;###autoload
+(define-key menu-bar-games-menu [chess] '(menu-item "Chess" chess :help "Play 
Chess"))
+
+;;;###autoload
 (defun chess-create-display (perspective &optional modules-too)
   "Create a display, letting the user's customization decide the style.
 If MODULES-TOO is non-nil, also create and associate the modules



[elpa] branch master updated (4e3f655 -> d8c84a1)

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

  from  4e3f655   [poker] Add to the games menu.
   new  d8c84a1   [chess] Package is maintained *in* ELPA.

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:
 externals-list |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)



[elpa] 01/01: [chess] Package is maintained *in* ELPA.

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

commit d8c84a139e138264f39ca5fbe2817f954b3cbc6b
Author: Mario Lang 
Date:   Wed Jun 18 21:25:33 2014 +0200

[chess] Package is maintained *in* ELPA.
---
 externals-list |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/externals-list b/externals-list
index adfb0ff..473b867 100644
--- a/externals-list
+++ b/externals-list
@@ -20,7 +20,7 @@
 (("ack":subtree "https://github.com/leoliu/ack-el";)
  ("auctex" :external "git://git.sv.gnu.org/auctex.git")
  ;;FIXME:("cedet"  :external "??")
- ("chess"  :external "https://github.com/jwiegley/emacs-chess.git";)
+ ("chess"  :external "moved from 
https://github.com/jwiegley/emacs-chess.git";)
  ("coffee-mode":subtree 
"https://github.com/defunkt/coffee-mode";)
  ("company":subtree 
"https://github.com/company-mode/company-mode.git";)
  ("diff-hl":subtree "https://github.com/dgutov/diff-hl.git";)



[elpa] branch master updated (69899e9 -> 4e3f655)

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

  from  69899e9   README: Use remote.origin.url to avoid loosing write 
access and save some typing.
   new  4e3f655   [poker] Add to the games menu.

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/poker/poker.el |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)



[elpa] 01/01: [poker] Add to the games menu.

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

commit 4e3f655eb2b26cabef9d0d533fdad844ab0b5e7b
Author: Mario Lang 
Date:   Wed Jun 18 13:38:49 2014 +0200

[poker] Add to the games menu.
---
 packages/poker/poker.el |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/packages/poker/poker.el b/packages/poker/poker.el
index d57a851..c7a33a5 100644
--- a/packages/poker/poker.el
+++ b/packages/poker/poker.el
@@ -830,6 +830,12 @@ FCR-FN specifies a function to use when a fold-call-raise 
decision is required."
 
 (cons players rounds)))
 
+
+;;;###autoload
+(define-key menu-bar-games-menu
+  [poker] '(menu-item "Texas hold'em poker" poker
+ :help "Play texas hold'em poker"))
+
 ;;; Tests:
 
 (ert-deftest poker-combinations ()



[elpa] branch externals/chess updated (6a27f61 -> 2549435)

2014-06-17 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  6a27f61   * chess-display.el (chess-display-highlight-legal): 
Rename misleading argument pos to index.
   new  2549435   Release 2.0.2.

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:
 NEWS |   37 +
 chess.el |4 ++--
 2 files changed, 39 insertions(+), 2 deletions(-)



[elpa] 01/01: Release 2.0.2.

2014-06-17 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 254943553395eef88611e3dfa39139200ddb88d4
Author: Mario Lang 
Date:   Wed Jun 18 00:30:35 2014 +0200

Release 2.0.2.
---
 NEWS |   37 +
 chess.el |4 ++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 8220873..2054058 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,43 @@ This is the NEWS file for Emacs Chess, a chess client and 
analysis library
 written in Emacs Lisp.
 
 
+* Release 2.0.2:
+
+** Major updates to the Info manual.
+
+** Algebraic move input:
+
+*** It is now possible to enter moves in numeric notation by
+customizing `chess-input-notation-type'.
+
+*** Backspace (DEL) on terminals now deletes input as expected.
+
+*** If `chess-display-highlight-legal' is non-nil, target squares of
+posssible moves are highlighted while you type.
+
+** The board and modeline is now correctly updated when making a move against
+   the internal engine (AI).
+
+** An error when editing positions with the `chess-plain' display has been 
fixed.
+
+** Legal move target highlights are now properly removed again once a move
+   has been selected, or the selected piece has been deselected.
+
+*** As a consequence of this fix, `chess-display-highlight-legal' is now
+on by default.
+
+** `chess-ply-to-algebraic' can now generate figurine algebraic and
+   numeric notation.
+
+** `chess-algebraic-to-ply' can now handle figurine algebraic notation.
+
+** Several compiler warnings have been fixed.
+   
+** The `chess-autosave' module is disabled by default for now.
+
+** The incomplete and unused constant `chess-piece-name-table' has been 
removed.
+
+
 * Release 2.0.1:
 
 ** chess-polyglot now works on 32-bit platforms.
diff --git a/chess.el b/chess.el
index f470370..e45eee9 100644
--- a/chess.el
+++ b/chess.el
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
-;; Version: 2.0.1
+;; Version: 2.0.2
 ;; Package-Requires: ((cl-lib "0.5"))
 ;; Keywords: games
 ;; Compatibility: Emacs24
@@ -89,7 +89,7 @@
   :group 'games
   :link '(custom-manual "(chess)Top"))
 
-(defconst chess-version "2.0.1"
+(defconst chess-version "2.0.2"
   "The version of the Emacs chess program.")
 
 (defcustom chess-default-display



[elpa] branch master updated (6c23ac4 -> 69899e9)

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

  from  6c23ac4   Update README to tell how to checkout a single external 
package.
   new  69899e9   README: Use remote.origin.url to avoid loosing write 
access and save some typing.

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:
 README |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)



[elpa] 01/01: README: Use remote.origin.url to avoid loosing write access and save some typing.

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

commit 69899e958bc15611b6d6392abc2231763ead9cd6
Author: Mario Lang 
Date:   Tue Jun 17 18:34:37 2014 +0200

README: Use remote.origin.url to avoid loosing write access and save some 
typing.
---
 README |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/README b/README
index be8d5b2..a688040 100644
--- a/README
+++ b/README
@@ -102,7 +102,7 @@ You can check out a specific external PACKAGE into the 
`packages'
 directory with these commands:
 
cd packages
-   git clone --reference .. --single-branch --branch externals/PACKAGE 
git://git.sv.gnu.org/srv/git/emacs/elpa PACKAGE
+   git clone --reference .. --single-branch --branch externals/PACKAGE $(git 
config remote.origin.url) PACKAGE
 
 If you already have a packages/PACKAGE directory with a previous
 checkout, you can update it like this:



[elpa] branch externals/chess updated (5b4adfc -> 6a27f61)

2014-06-17 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  5b4adfc   * chess.texi: Include FDL.
   new  6a27f61   * chess-display.el (chess-display-highlight-legal): 
Rename misleading argument pos to index.

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:
 chess-display.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)



[elpa] 01/01: * chess-display.el (chess-display-highlight-legal): Rename misleading argument pos to index.

2014-06-17 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 6a27f6184f1766c2d613d7b7852187c8d665bf75
Author: Mario Lang 
Date:   Tue Jun 17 18:13:41 2014 +0200

* chess-display.el (chess-display-highlight-legal): Rename misleading 
argument pos to index.
---
 chess-display.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/chess-display.el b/chess-display.el
index 003511e..439bc2d 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -438,10 +438,10 @@ that is supported by most displays, and is the default 
mode."
(setq mode arg)
  (funcall chess-display-event-handler 'highlight arg mode))
 
-(defun chess-display-highlight-legal (display pos)
-  "Highlight all legal move targets from POS."
+(defun chess-display-highlight-legal (display index)
+  "Highlight all legal move targets from INDEX."
   (chess-with-current-buffer display
-(dolist (ply (chess-legal-plies (chess-display-position nil) :index pos))
+(dolist (ply (chess-legal-plies (chess-display-position nil) :index index))
   (chess-display-highlight nil "pale green"
   (chess-ply-target ply)
 



[elpa] branch externals/chess updated (965e2be -> 5b4adfc)

2014-06-16 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  965e2be   Work on the manual.
   new  5b4adfc   * chess.texi: Include FDL.

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:
 chess.info |  689 
 chess.texi |   54 +++--
 fdl.texi   |  505 
 3 files changed, 1135 insertions(+), 113 deletions(-)
 create mode 100644 fdl.texi



[elpa] 01/01: Work on the manual.

2014-06-16 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 965e2be5838a5a8cfac3e63d9e6ff686d7cd0114
Author: Mario Lang 
Date:   Mon Jun 16 20:59:44 2014 +0200

Work on the manual.
---
 chess.info |  206 
 chess.texi |   54 +---
 2 files changed, 168 insertions(+), 92 deletions(-)

diff --git a/chess.info b/chess.info
index 7bd37ca..42814be 100644
--- a/chess.info
+++ b/chess.info
@@ -529,10 +529,28 @@ File: chess.info,  Node: Creating plies,  Next: Ply 
details,  Prev: Plies,  Up:
  Return a list of all legal plies in POSITION.  KEYWORDS allowed
  are:
 
- :any return t if any piece can move at all :color  :piece
-  :file  [can only be used if :piece
- is present] :index  :target  :candidates 
+ ‘:any’
+  Return ‘t’ if any piece can move at all.
+
+ ‘:color’
+  If ‘t’, return plies for white, if ‘nil’, return plies for
+  black.
+
+ ‘:piece’
+  Return plies for a specific piece (a character).
+
+ ‘:file’
+  Given a file number (0-7), return plies for any piece or color
+  present on that file.  ‘:piece’ or ‘:color’ must be present.
+
+ ‘:index’
+  Return plies for the piece at INDEX.
+
+ ‘:target’
+  Return plies that go to a specific coordinate.
+
+ ‘:candidates’
+  If provided, only consider these source coordinates.
 
  These will constrain the plies generated to those matching the
  above criteria.
@@ -1332,9 +1350,13 @@ File: chess.info,  Node: Basic operations,  Next: 
Selecting pieces with the keyb
  Resign the current game (‘chess-display-resign’).
 
 ‘M-w’
+‘C-u M-w’
  Copy the currently displayed position to the kill ring as a FEN
  string (‘chess-display-kill-board’).
 
+ With prefix argument, copy the current game in PGN to the kill
+ ring.
+
 ‘C-y’
  Set the current display position via a FEN string from the kill
  ring (‘chess-display-yank-board’).
@@ -1532,7 +1554,7 @@ File: chess.info,  Node: Engines,  Next: Chess Session,  
Prev: Chessboard displa
 4 Engines
 *
 
-Engines are the representation of an opponent in Chess.  THe main type
+Engines are the representation of an opponent in Chess.  The main type
 of engine interfaces with an external chess program.  However, there can
 be other uses for engine objects, such as providing networked engined
 for playing with opponent over different types of transports.
@@ -1540,6 +1562,7 @@ for playing with opponent over different types of 
transports.
 * Menu:
 
 * Common functions::
+* The Null Engine::
 * AI::
 * Crafty::
 * Fruit::
@@ -1550,7 +1573,7 @@ for playing with opponent over different types of 
transports.
 * Stockfish::
 
 
-File: chess.info,  Node: Common functions,  Next: AI,  Prev: Engines,  Up: 
Engines
+File: chess.info,  Node: Common functions,  Next: The Null Engine,  Prev: 
Engines,  Up: Engines
 
 4.1 Common functions
 
@@ -1577,9 +1600,25 @@ File: chess.info,  Node: Common functions,  Next: AI,  
Prev: Engines,  Up: Engin
  handler can take care of the data.
 
 
-File: chess.info,  Node: AI,  Next: Crafty,  Prev: Common functions,  Up: 
Engines
+File: chess.info,  Node: The Null Engine,  Next: AI,  Prev: Common functions,  
Up: Engines
+
+4.2 The Null Engine
+===
 
-4.2 AI
+The most basic engine module is ‘chess-none’, a stub module that does
+nothing.  This is useful for a game of chess against another human,
+where both use the same computer to enter moves and display the current
+chess position.
+
+   It can also be useful for creating FEN strings of specific positions.
+
+   To bring up a chessboard with no active engine attached, use ‘C-u M-x
+chess  none ’.
+
+
+File: chess.info,  Node: AI,  Next: Crafty,  Prev: The Null Engine,  Up: 
Engines
+
+4.3 AI
 ==
 
 The AI engine module defines a pure Emacs Lisp implementation of an
@@ -1607,7 +1646,7 @@ entry point.
 
 File: chess.info,  Node: Crafty,  Next: Fruit,  Prev: AI,  Up: Engines
 
-4.3 Crafty
+4.4 Crafty
 ==
 
 "Crafty" is a chess program written by Michael Byrne, UAB professor Dr.
@@ -1628,7 +1667,7 @@ play against Crafty by invoking ‘C-u M-x chess  
crafty ’.
 
 File: chess.info,  Node: Fruit,  Next: Glaurung,  Prev: Crafty,  Up: Engines
 
-4.4 Fruit
+4.5 Fruit
 =
 
 "Fruit" is a chess engine developed by Fabien Letouzey.  It was
@@ -1652,7 +1691,7 @@ play against Fruit by invoking ‘C-u M-x chess  fruit 
’.
 
 File: chess.info,  Node: Glaurung,  Next: GNU Chess,  Prev: Fruit,  Up: Engines
 
-4.5 Glaurung
+4.6 Glaurung
 
 
 "Glaurung" is another freely distributed strong computer chess engine.
@@ -1670,7 +1709,7 @@ play against Glaurung by invoking ‘C-u M-x chess  
glaurung ’.
 
 File: chess.info,  Node: GNU Chess,  Next: Phalanx,  Prev: Glaurung,  Up: 
Engines
 
-4.6 GNU Chess
+4.7 GNU Chess
 

[elpa] branch externals/chess updated (642abf9 -> 965e2be)

2014-06-16 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  642abf9   * chess-input.el (chess-input-notation-type): New 
variable. (chess-input-test-move, chess-input-display-moves): Use it. 
(chess-input-shortcut): Generate initial ply list for numeric notation.
   new  965e2be   Work on the manual.

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:
 chess.info |  206 
 chess.texi |   54 +---
 2 files changed, 168 insertions(+), 92 deletions(-)



[elpa] 02/02: * chess-input.el (chess-input-notation-type): New variable. (chess-input-test-move, chess-input-display-moves): Use it. (chess-input-shortcut): Generate initial ply list for numeric nota

2014-06-16 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 642abf9348814ce7ec217fcba99df919ac16c9e7
Author: Mario Lang 
Date:   Mon Jun 16 15:50:46 2014 +0200

* chess-input.el (chess-input-notation-type): New variable.
(chess-input-test-move, chess-input-display-moves): Use it.
(chess-input-shortcut): Generate initial ply list for numeric
notation.
---
 ChangeLog  |5 +
 chess-input.el |   26 ++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c7c40c3..654731e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-06-16  Mario Lang  
 
+   * chess-input.el (chess-input-notation-type): New variable.
+   (chess-input-test-move, chess-input-display-moves): Use it.
+   (chess-input-shortcut): Generate initial ply list for numeric
+   notation.
+
* chess-ply.el (chess-legal-plies): Make :file keyword usable if :color
is specified.
 
diff --git a/chess-input.el b/chess-input.el
index 7d5c946..f3cc893 100644
--- a/chess-input.el
+++ b/chess-input.el
@@ -48,9 +48,14 @@
 (make-variable-buffer-local 'chess-input-position-function)
 (make-variable-buffer-local 'chess-input-move-function)
 
+(defcustom chess-input-notation-type :san
+  "Define the notation type to use for move input."
+  :type '(choice (const :tag "Standard (short) algebraic notation" :san)
+(const :tag "Numeric notation" :numeric)))
+
 (defun chess-input-test-move (ply)
   "Return the given PLY if it matches the user's current input."
-  (let* ((move (chess-ply-to-algebraic ply))
+  (let* ((move (chess-ply-to-algebraic ply chess-input-notation-type))
 (i 0) (x 0) (l (length move))
 (xl (length chess-input-move-string)))
 (unless (or (and (equal (downcase chess-input-move-string) "ok")
@@ -71,7 +76,7 @@
 
 (defun chess-input-display-moves (&optional move-list)
   (unless move-list
-(setq chess-input-test-move
+(setq move-list
  (delq nil (mapcar #'chess-input-test-move (cdr chess-input-moves)
   (when chess-display-highlight-legal
 (chess-display-redraw nil))
@@ -80,7 +85,9 @@
   (apply #'chess-display-highlight
 nil (cl-delete-duplicates (mapcar #'chess-ply-target move-list
 (message "[%s] %s" chess-input-move-string
-(mapconcat #'chess-ply-to-algebraic move-list " "
+(mapconcat (lambda (ply)
+ (chess-ply-to-algebraic ply 
chess-input-notation-type))
+   move-list " "
 
 (defun chess-input-shortcut-delete ()
   (interactive)
@@ -134,7 +141,18 @@
  (function
   (lambda (left right)
 (string-lessp (chess-ply-to-algebraic left)
-  (chess-ply-to-algebraic right))
+  (chess-ply-to-algebraic right)))
+   (if (and (>= char ?1) (<= char ?8))
+   (setq chess-input-moves-pos position
+ chess-input-moves
+ (cons
+  char
+  (sort
+   (chess-legal-plies position :color color :file (- char ?1))
+   (function
+(lambda (left right)
+  (string-lessp (chess-ply-to-algebraic left)
+(chess-ply-to-algebraic right)))
   (let ((moves (delq nil (mapcar 'chess-input-test-move
 (cdr chess-input-moves)
 (cond



[elpa] branch externals/chess updated (cafc796 -> 642abf9)

2014-06-16 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  cafc796   * chess-input.el (chess-input-display-moves): Highlight 
valid target squares if `chess-display-highlight-legal' is non-nil. 
(chess-input-shortcut): Redraw board to remove highlights if a ply was 
submitted and `chess-display-highlight-legal' is non-nil.
   new  eecd6f4   * chess-ply.el (chess-legal-plies): Make :file keyword 
usable if :color is specified.
   new  642abf9   * chess-input.el (chess-input-notation-type): New 
variable. (chess-input-test-move, chess-input-display-moves): Use it. 
(chess-input-shortcut): Generate initial ply list for numeric notation.

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:
 ChangeLog  |8 
 chess-input.el |   26 ++
 chess-ply.el   |4 ++--
 3 files changed, 32 insertions(+), 6 deletions(-)



[elpa] 01/02: * chess-ply.el (chess-legal-plies): Make :file keyword usable if :color is specified.

2014-06-16 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit eecd6f4f1a3ff3e955b62871deb9701d656f6e3f
Author: Mario Lang 
Date:   Mon Jun 16 15:22:54 2014 +0200

* chess-ply.el (chess-legal-plies): Make :file keyword usable if :color
is specified.
---
 ChangeLog|3 +++
 chess-ply.el |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ec4d840..c7c40c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2014-06-16  Mario Lang  
 
+   * chess-ply.el (chess-legal-plies): Make :file keyword usable if :color
+   is specified.
+
* chess-input.el (chess-input-display-moves): Highlight valid target
squares if `chess-display-highlight-legal' is non-nil.
(chess-input-shortcut): Redraw board to remove highlights if a ply
diff --git a/chess-ply.el b/chess-ply.el
index cf463cb..fd5dc21 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -305,7 +305,7 @@ KEYWORDS allowed are:
   :any   return t if any piece can move at all
   :color 
   :piece 
-  :file  [can only be used if :piece is present]
+  :file  [:piece or :color must be present]
   :index 
   :target 
   :candidates 
@@ -358,7 +358,7 @@ position object passed in."
 (let (candidates)
   (dotimes (rank 8)
 (setq pos (chess-rf-to-index rank file))
-(if (chess-pos-piece-p position pos piece)
+(if (chess-pos-piece-p position pos (or piece color))
 (push pos candidates)))
   candidates))
(t



[elpa] 01/01: * chess-input.el (chess-input-display-moves): Highlight valid target squares if `chess-display-highlight-legal' is non-nil. (chess-input-shortcut): Redraw board to remove highlights if a

2014-06-16 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit cafc796e65de08c84583a53dfd9e4962e566f5cc
Author: Mario Lang 
Date:   Mon Jun 16 10:09:43 2014 +0200

* chess-input.el (chess-input-display-moves): Highlight valid target
squares if `chess-display-highlight-legal' is non-nil.
(chess-input-shortcut): Redraw board to remove highlights if a ply
was submitted and `chess-display-highlight-legal' is non-nil.
---
 ChangeLog  |5 +
 chess-input.el |   22 ++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cbb7a13..ec4d840 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-06-16  Mario Lang  
 
+   * chess-input.el (chess-input-display-moves): Highlight valid target
+   squares if `chess-display-highlight-legal' is non-nil.
+   (chess-input-shortcut): Redraw board to remove highlights if a ply
+   was submitted and `chess-display-highlight-legal' is non-nil.
+
* chess-display.el (chess-display-move): Fix repainting when playing
against the internal engine (AI) which runs off the `post-move' game
event by adding a `redisplay' call just before the `post-move' emision.
diff --git a/chess-input.el b/chess-input.el
index ce7b348..7d5c946 100644
--- a/chess-input.el
+++ b/chess-input.el
@@ -69,14 +69,18 @@
   (t (setq i (1+ i) x (1+ x)))
 ply))
 
-(defsubst chess-input-display-moves (&optional move-list)
-  (if (> (length chess-input-move-string) 0)
-  (message "[%s] %s" chess-input-move-string
-  (mapconcat #'chess-ply-to-algebraic
- (or move-list
- (delq nil (mapcar 'chess-input-test-move
-   (cdr chess-input-moves
- " "
+(defun chess-input-display-moves (&optional move-list)
+  (unless move-list
+(setq chess-input-test-move
+ (delq nil (mapcar #'chess-input-test-move (cdr chess-input-moves)
+  (when chess-display-highlight-legal
+(chess-display-redraw nil))
+  (when (> (length chess-input-move-string) 0)
+(when chess-display-highlight-legal
+  (apply #'chess-display-highlight
+nil (cl-delete-duplicates (mapcar #'chess-ply-target move-list
+(message "[%s] %s" chess-input-move-string
+(mapconcat #'chess-ply-to-algebraic move-list " "
 
 (defun chess-input-shortcut-delete ()
   (interactive)
@@ -144,6 +148,8 @@
(downcase (chess-ply-to-algebraic (cadr moves
   (setq moves (cdr moves
   (funcall chess-input-move-function nil (car moves))
+  (when chess-display-highlight-legal
+   (chess-display-redraw nil))
   (setq chess-input-move-string nil
chess-input-moves nil
chess-input-moves-pos nil))



[elpa] branch externals/chess updated (ce0e128 -> cafc796)

2014-06-16 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  ce0e128   (chess-display-mode-map): Bind DEL to 
`chess-input-shortcut-delete
   new  cafc796   * chess-input.el (chess-input-display-moves): Highlight 
valid target squares if `chess-display-highlight-legal' is non-nil. 
(chess-input-shortcut): Redraw board to remove highlights if a ply was 
submitted and `chess-display-highlight-legal' is non-nil.

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:
 ChangeLog  |5 +
 chess-input.el |   22 ++
 2 files changed, 19 insertions(+), 8 deletions(-)



[elpa] 01/01: (chess-display-mode-map): Bind DEL to `chess-input-shortcut-delete

2014-06-15 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit ce0e1286c30f67ee87a95220fe8d160779731ae1
Author: Mario Lang 
Date:   Mon Jun 16 02:21:00 2014 +0200

(chess-display-mode-map): Bind DEL to `chess-input-shortcut-delete
---
 ChangeLog|2 ++
 chess-display.el |1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 621a5c4..cbb7a13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
event by adding a `redisplay' call just before the `post-move' emision.
(chess-display-select-piece): Use `chess-display-draw-square'.
(chess-display-draw-square): Make PIECE argument optional.
+   (chess-display-mode-map): Bind DEL to `chess-input-shortcut-delete'
+   as intended.
 
 2014-06-15  Mario Lang  
 
diff --git a/chess-display.el b/chess-display.el
index dfde368..003511e 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -644,6 +644,7 @@ See `chess-display-type' for the different kinds of 
displays."
   ?o ?O ?x ?=))
   (define-key map (vector key) 'chess-input-shortcut))
 (define-key map [backspace] 'chess-input-shortcut-delete)
+(define-key map "\d" 'chess-input-shortcut-delete)
 
 (define-key map [(control ?m)] 'chess-display-select-piece)
 (define-key map [return] 'chess-display-select-piece)



[elpa] branch externals/chess updated (9b32e8a -> ce0e128)

2014-06-15 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  9b32e8a   * chess-display.el (chess-display-move): Fix repainting 
when playing against the internal engine (AI) which runs off the `post-move' 
game event by adding a `redisplay' call just before the `post-move' emision. 
(chess-display-select-piece): Use `chess-display-draw-square'. 
(chess-display-draw-square): Make PIECE argument optional.
   new  ce0e128   (chess-display-mode-map): Bind DEL to 
`chess-input-shortcut-delete

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:
 ChangeLog|2 ++
 chess-display.el |1 +
 2 files changed, 3 insertions(+), 0 deletions(-)



[elpa] 01/01: * chess-display.el (chess-display-move): Fix repainting when playing against the internal engine (AI) which runs off the `post-move' game event by adding a `redisplay' call just before t

2014-06-15 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 9b32e8a76fa91acb7a33f4227833280398741168
Author: Mario Lang 
Date:   Mon Jun 16 01:08:48 2014 +0200

* chess-display.el (chess-display-move): Fix repainting when playing
against the internal engine (AI) which runs off the `post-move' game
event by adding a `redisplay' call just before the `post-move' emision.
(chess-display-select-piece): Use `chess-display-draw-square'.
(chess-display-draw-square): Make PIECE argument optional.
---
 ChangeLog|8 
 chess-display.el |   12 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 436fe5b..621a5c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-06-16  Mario Lang  
+
+   * chess-display.el (chess-display-move): Fix repainting when playing
+   against the internal engine (AI) which runs off the `post-move' game
+   event by adding a `redisplay' call just before the `post-move' emision.
+   (chess-display-select-piece): Use `chess-display-draw-square'.
+   (chess-display-draw-square): Make PIECE argument optional.
+
 2014-06-15  Mario Lang  
 
* chess-display.el (chess-display-draw-square): New function.
diff --git a/chess-display.el b/chess-display.el
index 0287487..dfde368 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -355,11 +355,13 @@ also view the same game."
 (defun chess-display-draw-square (display index piece &optional pos)
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
-  (cl-check-type piece (member ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
+  (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
   (chess-with-current-buffer display
 (cl-check-type pos (or null (number ((point-min)) ((point-max)
 (funcall chess-display-event-handler 'draw-square
-(or pos (chess-display-index-pos nil index)) piece index)))
+(or pos (chess-display-index-pos nil index))
+(or piece (chess-pos-piece (chess-display-position nil) index))
+index)))
 
 (defun chess-display-paint-move (display ply)
   (cl-check-type display (or null buffer))
@@ -418,6 +420,7 @@ The position of PLY must match the currently displayed 
position."
  (chess-game-move chess-module-game ply)
  (chess-display-paint-move nil ply)
  (chess-display-set-index* nil (chess-game-index chess-module-game))
+ (redisplay)   ; FIXME: This is clearly necessary, but 
why?
  (chess-game-run-hooks chess-module-game 'post-move))
   ;; jww (2002-03-28): This should beget a variation within the
   ;; game, or alter the game, just as SCID allows
@@ -1222,10 +1225,7 @@ Clicking once on a piece selects it; then click on the 
target location."
  position
  :index (cdr last-sel
(unless (= index coord)
- (funcall chess-display-event-handler 'draw-square
-(chess-display-index-pos nil index)
-(chess-pos-piece position index)
-index
+ (chess-display-draw-square nil index
(setq chess-display-last-selected nil))
(let ((piece (chess-pos-piece position coord)))
  (cond



[elpa] branch externals/chess updated (f3d3337 -> 9b32e8a)

2014-06-15 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  f3d3337   * chess-display.el (chess-fen, chess-pgn): Require.
   new  9b32e8a   * chess-display.el (chess-display-move): Fix repainting 
when playing against the internal engine (AI) which runs off the `post-move' 
game event by adding a `redisplay' call just before the `post-move' emision. 
(chess-display-select-piece): Use `chess-display-draw-square'. 
(chess-display-draw-square): Make PIECE argument optional.

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:
 ChangeLog|8 
 chess-display.el |   12 ++--
 2 files changed, 14 insertions(+), 6 deletions(-)



[elpa] 01/01: * chess-display.el (chess-fen, chess-pgn): Require.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit f3d3337b2dc1a030d4d87a430d87ddcf56bf65f1
Author: Mario Lang 
Date:   Sun Jun 15 04:18:24 2014 +0200

* chess-display.el (chess-fen, chess-pgn): Require.
---
 chess-display.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/chess-display.el b/chess-display.el
index f92a213..0287487 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -25,11 +25,13 @@
 
 ;;; Code:
 
+(require 'chess-fen)
+(require 'chess-input)
 (require 'chess-message)
 (require 'chess-module)
-(require 'chess-var)
-(require 'chess-input)
+(require 'chess-pgn)
 (require 'chess-random)
+(require 'chess-var)
 
 (defgroup chess-display nil
   "Options common to all chessboard displays."



[elpa] branch externals/chess updated (3fa2b4d -> f3d3337)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  3fa2b4d   (chess-display-highlight-move): Simplify.
   new  f3d3337   * chess-display.el (chess-fen, chess-pgn): Require.

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:
 chess-display.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)



[elpa] branch externals/chess updated (0a5389e -> 3fa2b4d)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  0a5389e   * chess-display.el (chess-display-draw-square): New 
function. (chess-display-paint-move, chess-display-set-piece): Use it.
   new  3fa2b4d   (chess-display-highlight-move): Simplify.

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:
 ChangeLog|1 +
 chess-display.el |9 +
 2 files changed, 6 insertions(+), 4 deletions(-)



[elpa] 01/01: (chess-display-highlight-move): Simplify.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 3fa2b4db0eb930f763353cd3b72623215d30341a
Author: Mario Lang 
Date:   Sun Jun 15 04:05:03 2014 +0200

(chess-display-highlight-move): Simplify.
---
 ChangeLog|1 +
 chess-display.el |9 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a89732..436fe5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
* chess-display.el (chess-display-draw-square): New function.
(chess-display-paint-move, chess-display-set-piece): Use it.
+   (chess-display-highlight-move): Simplify.
 
* chess-plain.el (chess-plain-handler): Fix error if unknown event
is received.
diff --git a/chess-display.el b/chess-display.el
index 61a3ca2..f92a213 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -353,12 +353,14 @@ also view the same game."
 (defun chess-display-draw-square (display index piece &optional pos)
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
+  (cl-check-type piece (member ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
   (chess-with-current-buffer display
 (cl-check-type pos (or null (number ((point-min)) ((point-max)
 (funcall chess-display-event-handler 'draw-square
 (or pos (chess-display-index-pos nil index)) piece index)))
 
 (defun chess-display-paint-move (display ply)
+  (cl-check-type display (or null buffer))
   (chess-with-current-buffer display
 (if chess-display-highlight-last-move
(chess-display-redraw))
@@ -440,10 +442,9 @@ that is supported by most displays, and is the default 
mode."
 
 (defun chess-display-highlight-move (display ply)
   "Highlight the last move made in the current game."
-  (chess-with-current-buffer display
- (chess-display-highlight nil "medium sea green"
- (chess-ply-source ply)
- (chess-ply-target ply
+  (chess-display-highlight display "medium sea green"
+  (chess-ply-source ply)
+  (chess-ply-target ply)))
 
 (defun chess-display-highlight-passed-pawns (&optional display)
   (interactive)



[elpa] 01/01: * chess-display.el (chess-display-draw-square): New function. (chess-display-paint-move, chess-display-set-piece): Use it.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 0a5389e92c0ba865048b7ef0f433b4f7f0e08e31
Author: Mario Lang 
Date:   Sun Jun 15 03:44:40 2014 +0200

* chess-display.el (chess-display-draw-square): New function.
(chess-display-paint-move, chess-display-set-piece): Use it.

* chess-plain.el (chess-plain-handler): Fix error if unknown event
is received.
---
 ChangeLog|6 ++
 chess-display.el |   41 ++---
 chess-plain.el   |3 ++-
 3 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9d7115d..2a89732 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-06-15  Mario Lang  
 
+   * chess-display.el (chess-display-draw-square): New function.
+   (chess-display-paint-move, chess-display-set-piece): Use it.
+
+   * chess-plain.el (chess-plain-handler): Fix error if unknown event
+   is received.
+
* chess-display.el (chess-display-select-piece): Redraw legal targets
if a move is either accepted or the same piece is selected again.
This fixes ...
diff --git a/chess-display.el b/chess-display.el
index a6e675e..61a3ca2 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -350,6 +350,14 @@ also view the same game."
  (point-min))
 (aref chess-display-index-positions index)))
 
+(defun chess-display-draw-square (display index piece &optional pos)
+  (cl-check-type display (or null buffer))
+  (cl-check-type index (integer 0 63))
+  (chess-with-current-buffer display
+(cl-check-type pos (or null (number ((point-min)) ((point-max)
+(funcall chess-display-event-handler 'draw-square
+(or pos (chess-display-index-pos nil index)) piece index)))
+
 (defun chess-display-paint-move (display ply)
   (chess-with-current-buffer display
 (if chess-display-highlight-last-move
@@ -361,20 +369,15 @@ also view the same game."
(setq ch nil)
  (let ((from (car ch))
(to (cadr ch)))
-   (funcall chess-display-event-handler 'draw-square
-(chess-display-index-pos nil from) ?  from)
-   (funcall chess-display-event-handler 'draw-square
-(chess-display-index-pos nil to)
-(or (let ((new-piece (chess-ply-keyword ply :promote)))
-  (when new-piece
-(if (chess-pos-side-to-move position)
-new-piece (downcase new-piece
-(chess-pos-piece position from))
-to)
+   (chess-display-draw-square nil from ? )
+   (chess-display-draw-square
+nil to (or (let ((new-piece (chess-ply-keyword ply :promote)))
+ (when new-piece
+   (if (chess-pos-side-to-move position)
+   new-piece (downcase new-piece
+   (chess-pos-piece position from)))
(when (chess-ply-keyword ply :en-passant)
- (funcall chess-display-event-handler 'draw-square
-  (chess-display-index-pos nil (chess-pos-en-passant 
position))
-  ?  (chess-pos-en-passant position
+ (chess-display-draw-square nil (chess-pos-en-passant position) ? 
)))
  (setq ch (cddr ch)
 (if chess-display-highlight-last-move
(chess-display-highlight-move display ply
@@ -1116,12 +1119,12 @@ to the end or beginning."
 (defun chess-display-set-piece (&optional piece)
   "Set the piece under point to command character, or space for clear."
   (interactive)
-  (if (or (null piece) (characterp piece))
-  (let ((index (get-text-property (point) 'chess-coord)))
-   (chess-pos-set-piece chess-display-edit-position index
-(or piece last-command-event))
-   (funcall chess-display-event-handler 'draw-square
-(point) (or piece last-command-event) index
+  (when (or (null piece) (characterp piece))
+(let ((index (get-text-property (point) 'chess-coord)))
+  (chess-pos-set-piece chess-display-edit-position index
+  (or piece last-command-event))
+  (chess-display-draw-square nil index
+(or piece last-command-event) (point)
 
 (unless (fboundp 'event-window)
   (defalias 'event-point 'ignore))
diff --git a/chess-plain.el b/chess-plain.el
index d4cab93..e5e1412 100644
--- a/chess-plain.el
+++ b/chess-plain.el
@@ -245,7 +245,8 @@ modify `chess-plain-piece-chars' to avoid real confusion.)"
   (cond
((eq event 'initialize) t)
((eq event 'popup) (funcall chess-plain-popup-function))
-   (t (apply (intern-soft (concat "chess-plain-" (symbol-name event))) args
+   (t (let ((handler (inte

[elpa] branch externals/chess updated (c2e7e1b -> 0a5389e)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  c2e7e1b   * chess-display.el (chess-display): Link to info node.
   new  0a5389e   * chess-display.el (chess-display-draw-square): New 
function. (chess-display-paint-move, chess-display-set-piece): Use it.

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:
 ChangeLog|6 ++
 chess-display.el |   41 ++---
 chess-plain.el   |3 ++-
 3 files changed, 30 insertions(+), 20 deletions(-)



[elpa] 01/02: Work on the manual.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 294553e21dcae3b95368fa76375b0e717a1f0097
Author: Mario Lang 
Date:   Sun Jun 15 01:40:17 2014 +0200

Work on the manual.
---
 chess.info |  222 +---
 chess.texi |  149 +---
 2 files changed, 154 insertions(+), 217 deletions(-)

diff --git a/chess.info b/chess.info
index e29a790..7bd37ca 100644
--- a/chess.info
+++ b/chess.info
@@ -255,7 +255,7 @@ square, or set that square’s value:
  It is only necessary to call this function if setting up a position
  manually.  Note that all newly created positions have full castling
  privileges set, unless the position is created blank, in which case
- castling privileges are unset.  See ‘chess-pos-copy’.
+ castling privileges are unset.  See ‘chess-pos-create’.
 
  -- Function: chess-pos-en-passant position
  Return the index of any pawn on POSITION that can be captured en
@@ -267,8 +267,8 @@ square, or set that square’s value:
 
  -- Function: chess-pos-status position
  Return whether the side to move in the POSITION is in a special
- state.  nil is returned if not, otherwise one of the symbols:
- ‘check’, ‘checkmate’, ‘stalemate’.
+ state.  nil is returned if not, otherwise one of the keywords:
+ ‘:check’, ‘:checkmate’ or ‘:stalemate’.
 
  -- Function: chess-pos-set-status position value
  Set whether the side to move in POSITION is in a special state.
@@ -322,7 +322,7 @@ File: chess.info,  Node: FEN notation,  Next: EPD notation, 
 Prev: Annotations,
 "FEN (Forsyth-Edwards Notation)" encodes a chess position using a simple
 string.  The format is:
 
-   POSITION SIDE CASTLING EN-PASSANT
+   ‘POSITION SIDE CASTLING EN-PASSANT’
 
The POSITION gives all eight ranks, by specifying a letter for each
 piece on the position, and a number for any intervening spaces, ranks
@@ -547,7 +547,7 @@ File: chess.info,  Node: Ply details,  Next: The "next" 
position,  Prev: Creatin
 -
 
  -- Function: chess-ply-pos ply
- Returns the base position associated with PLY.
+ Return the base position associated with PLY.
 
  -- Function: chess-ply-set-pos ply position
  Set the base position of PLY.
@@ -606,6 +606,9 @@ function:
  -- Function: chess-algebraic-to-ply position move &optional trust
  Convert the algebraic notation MOVE for POSITION to a ply.
 
+ If optional argument TRUST is non-nil, accept check or checkmate
+ symbols (‘+’ and ‘#’) as given.
+
The function also checks if a move is legal, and will raise an error
 if not.
 
@@ -618,7 +621,9 @@ if not.
  generate.  ‘:san’ (the default) generates short (or standard)
  algebraic notation.  ‘:lan’ generates long algebraic notation (like
  ‘Nb1-c3’).  ‘:fan’ generates figurine algebraic notation (uppercase
- letters will be replaced by Unicode chess figures).
+ letters will be replaced by Unicode chess figures).  ‘:numeric’
+ generates ICCF numeric notation as used in corespondence chess
+ (like ‘2133’).
 
Lastly, there is a regexp for quickly checking if a string is in
 algebraic notation or not, or searching out algebraic strings in a
@@ -626,7 +631,7 @@ buffer:
 
  -- Variable: chess-algebraic-regexp
  A regular expression that matches all possible algebraic moves.
- This regexp handles both long and short form.
+ This regexp handles short, long and figurine algebraic notation.
 
 
 File: chess.info,  Node: Variations,  Next: Games,  Prev: Plies,  Up: The 
chess.el library
@@ -911,6 +916,9 @@ File: chess.info,  Node: Opening Databases,  Next: Querying 
Databases,  Prev: Co
  called.
 
  -- Function: chess-database-open file &optional module
+ Open a game database specified by FILE.  You can optionally specify
+ the database MODULE to use.
+
  Returns the opened database object, or nil.
 
 
@@ -1020,7 +1028,7 @@ supported.  There is a default polyglot book file shipped 
with chess.el
 to support engines which do not have built-in support for looking up
 positions in opening books (such as some UCI protocol based engines).
 
- -- Variable: chess-polyglot-book-file
+ -- User Option: chess-polyglot-book-file
  Path to default polyglot book file.
 
  -- Variable: chess-polyglot-book
@@ -1212,10 +1220,12 @@ File: chess.info,  Node: Generic display manipulation 
functions,  Next: Chess di
  Setup the current board for editing.
 
  -- Function: chess-display-highlight display &rest args
- Highlight the square at INDEX on the current position.  The given
- highlighting MODE is used, or the default if the style you are
- displaying with doesn’t support that mode.  ‘selected’ is a mode
- that is supported by most displays, and is the default mode.
+ In DISPLAY highlight the squares given in ARGS on the current
+ position.
+
+ ARGS is a list of

[elpa] branch externals/chess updated (aebafa9 -> c2e7e1b)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  aebafa9   * chess-display.el (chess-display-select-piece): Redraw 
legal targets if a move is either accepted or the same piece is selected again. 
This fixes ... (chess-display-highlight-legal): Now set to `t' by default.
   new  294553e   Work on the manual.
   new  c2e7e1b   * chess-display.el (chess-display): Link to info node.

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:
 chess-display.el |   23 +++---
 chess.info   |  222 ++
 chess.texi   |  149 
 3 files changed, 165 insertions(+), 229 deletions(-)



[elpa] 02/02: * chess-display.el (chess-display): Link to info node.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit c2e7e1b029eceb4c9b9cc512f6b6a8c9afeb0ee7
Author: Mario Lang 
Date:   Sun Jun 15 02:17:40 2014 +0200

* chess-display.el (chess-display): Link to info node.
---
 chess-display.el |   23 +++
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/chess-display.el b/chess-display.el
index 1fc0295..a6e675e 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -32,8 +32,9 @@
 (require 'chess-random)
 
 (defgroup chess-display nil
-  "Common code used by chess displays."
-  :group 'chess)
+  "Options common to all chessboard displays."
+  :group 'chess
+  :link '(custom-manual "(chess)Chessboard displays"))
 
 (defcustom chess-display-popup t
   "If non-nil (the default), popup displays whenever a significant event
@@ -362,16 +363,14 @@ also view the same game."
(to (cadr ch)))
(funcall chess-display-event-handler 'draw-square
 (chess-display-index-pos nil from) ?  from)
-   (let ((new-piece (chess-ply-keyword ply :promote)))
- (if new-piece
- (funcall chess-display-event-handler 'draw-square
-  (chess-display-index-pos nil to)
-  (if (chess-pos-side-to-move position)
-  new-piece
-(downcase new-piece)) to)
-   (funcall chess-display-event-handler 'draw-square
-(chess-display-index-pos nil to)
-(chess-pos-piece position from) to)))
+   (funcall chess-display-event-handler 'draw-square
+(chess-display-index-pos nil to)
+(or (let ((new-piece (chess-ply-keyword ply :promote)))
+  (when new-piece
+(if (chess-pos-side-to-move position)
+new-piece (downcase new-piece
+(chess-pos-piece position from))
+to)
(when (chess-ply-keyword ply :en-passant)
  (funcall chess-display-event-handler 'draw-square
   (chess-display-index-pos nil (chess-pos-en-passant 
position))



[elpa] 01/01: * chess-display.el (chess-display-select-piece): Redraw legal targets if a move is either accepted or the same piece is selected again. This fixes ... (chess-display-highlight-legal): No

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit aebafa98c17557b889b5a8b1bcb24854fcf9f5e9
Author: Mario Lang 
Date:   Sun Jun 15 01:10:36 2014 +0200

* chess-display.el (chess-display-select-piece): Redraw legal targets
if a move is either accepted or the same piece is selected again.
This fixes ...
(chess-display-highlight-legal): Now set to `t' by default.
---
 ChangeLog|7 +++
 chess-display.el |   19 ++-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1420d5f..9d7115d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-15  Mario Lang  
+
+   * chess-display.el (chess-display-select-piece): Redraw legal targets
+   if a move is either accepted or the same piece is selected again.
+   This fixes ...
+   (chess-display-highlight-legal): Now set to `t' by default.
+
 2014-06-14  Mario Lang  
 
* chess-test.el (chess-test): Renamed to...
diff --git a/chess-display.el b/chess-display.el
index 804f9fc..1fc0295 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -43,7 +43,7 @@ occurs."
 
 (make-variable-buffer-local 'chess-display-popup)
 
-(defcustom chess-display-highlight-legal nil
+(defcustom chess-display-highlight-legal t
   "If non-nil, highlight legal target squares when a piece is selected."
   :type 'boolean
   :group 'chess-display)
@@ -432,8 +432,7 @@ that is supported by most displays, and is the default 
mode."
 (defun chess-display-highlight-legal (display pos)
   "Highlight all legal move targets from POS."
   (chess-with-current-buffer display
-(dolist (ply (chess-legal-plies (chess-display-position nil)
-   :index pos))
+(dolist (ply (chess-legal-plies (chess-display-position nil) :index pos))
   (chess-display-highlight nil "pale green"
   (chess-ply-target ply)
 
@@ -1184,8 +1183,7 @@ Clicking once on a piece selects it; then click on the 
target location."
  (if chess-display-last-selected
  (let ((last-sel chess-display-last-selected))
;; if they select the same square again, just deselect
-   ;; it by redrawing the display and removing all
-   ;; highlights
+   ;; it by redrawing the square to remove highlights.
(if (= (point) (car last-sel))
(funcall chess-display-event-handler 'draw-square
 (car last-sel)
@@ -1212,6 +1210,17 @@ Clicking once on a piece selects it; then click on the 
target location."
  (chess-display-move nil ply)
(error
 (throw 'message (error-message-string err)))
+   ;; Redraw legal targets to clear highlight.
+   (when chess-display-highlight-legal
+ (dolist (index (mapcar #'chess-ply-target
+(chess-legal-plies
+ position
+ :index (cdr last-sel
+   (unless (= index coord)
+ (funcall chess-display-event-handler 'draw-square
+(chess-display-index-pos nil index)
+(chess-pos-piece position index)
+index
(setq chess-display-last-selected nil))
(let ((piece (chess-pos-piece position coord)))
  (cond



[elpa] branch externals/chess updated (08fc4c6 -> aebafa9)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  08fc4c6   (chess-pgn-mode-map): New variable, split out from... 
(chess-pgn-mode): Fix autogenerated docstring to include keymap description.
   new  aebafa9   * chess-display.el (chess-display-select-piece): Redraw 
legal targets if a move is either accepted or the same piece is selected again. 
This fixes ... (chess-display-highlight-legal): Now set to `t' by default.

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:
 ChangeLog|7 +++
 chess-display.el |   19 ++-
 2 files changed, 21 insertions(+), 5 deletions(-)



[elpa] 01/01: (chess-pgn-mode-map): New variable, split out from... (chess-pgn-mode): Fix autogenerated docstring to include keymap description.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 08fc4c6b3dc6ef43e2d6891f9dc40344d907126e
Author: Mario Lang 
Date:   Sat Jun 14 16:55:00 2014 +0200

(chess-pgn-mode-map): New variable, split out from...
(chess-pgn-mode): Fix autogenerated docstring to include keymap
description.
---
 ChangeLog|4 
 chess-pgn.el |   39 +++
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 798ff02..1420d5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
* Makefile: Adjust and use the predefined MAKEINFO variable from GNU 
Make.
* chess-pgn.el (chess-game): Require.
(chess-pgn-parse): Use `rx'.
+   (chess-pgn-mode-map): New variable, split out from...
+   (chess-pgn-mode): Fix autogenerated docstring to include keymap
+   description.
+
* chess-game.el (chess-pgn): Do not require.
(chess-game-to-string, chess-game-from-string): Remove, all callers
updated to use chess-pgn functions directly.
diff --git a/chess-pgn.el b/chess-pgn.el
index 9c9c647..8001c67 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -63,9 +63,7 @@
 (require 'chess-message)
 (require 'mm-decode)
 (require 'mm-view)
-
-(eval-when-compile
-  (require 'pcomplete nil t))
+(require 'pcomplete)
 
 (defvar chess-pgn-fill-column 60)
 
@@ -298,6 +296,18 @@ PGN text."
 game)
   (chess-error 'could-not-read-pgn
 
+(defvar chess-pgn-mode-map
+  (let ((map (make-sparse-keymap)))
+(set-keymap-parent map text-mode-map)
+(define-key map [(control ?c) (control ?c)] 'chess-pgn-show-position)
+(define-key map [mouse-2] 'chess-pgn-mouse-show-position)
+
+;;(define-key map [(control ?m)] 'chess-pgn-move)
+;;(define-key map [space] 'chess-pgn-move)
+(define-key map [? ] 'chess-pgn-insert-and-show-position)
+(define-key map [tab] 'chess-pgn-complete-move)
+map))
+
 ;;;###autoload
 (define-derived-mode chess-pgn-mode text-mode "PGN"
   "A mode for editing chess PGN files."
@@ -310,23 +320,12 @@ PGN text."
 
   (if (fboundp 'font-lock-mode)
   (font-lock-mode 1))
-
-  (let ((map (current-local-map)))
-(define-key map [(control ?c) (control ?c)] 'chess-pgn-show-position)
-(define-key map [mouse-2] 'chess-pgn-mouse-show-position)
-
-;;(define-key map [(control ?m)] 'chess-pgn-move)
-;;(define-key map [space] 'chess-pgn-move)
-(define-key map [? ] 'chess-pgn-insert-and-show-position)
-
-(when (require 'pcomplete nil t)
-  (set (make-local-variable 'pcomplete-default-completion-function)
-   'chess-pgn-completions)
-  (set (make-local-variable 'pcomplete-command-completion-function)
-   'chess-pgn-completions)
-  (set (make-local-variable 'pcomplete-parse-arguments-function)
-   'chess-pgn-current-word)
-  (define-key map [tab] 'chess-pgn-complete-move
+  (set (make-local-variable 'pcomplete-default-completion-function)
+   'chess-pgn-completions)
+  (set (make-local-variable 'pcomplete-command-completion-function)
+   'chess-pgn-completions)
+  (set (make-local-variable 'pcomplete-parse-arguments-function)
+   'chess-pgn-current-word))
 
 ;;;###autoload
 (defalias 'pgn-mode 'chess-pgn-mode)



[elpa] branch externals/chess updated (e872564 -> 08fc4c6)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  e872564   * chess-test.el (chess-test): Renamed to... 
(chess-test-database): More descriptive name. (chess-perft): Require as this is 
our entry-point for testing. * doc/chess.texi: Renamed to... * chess.texi: 
Top-level file, keeping doc/ for just one file is useless. * Makefile: Adjust 
and use the predefined MAKEINFO variable from GNU Make. * chess-pgn.el 
(chess-game): Require. (chess-pgn-parse): Use `rx'. * chess-game.el 
(chess-pgn): Do not require. (chess-game-to-string, che [...]
   new  08fc4c6   (chess-pgn-mode-map): New variable, split out from... 
(chess-pgn-mode): Fix autogenerated docstring to include keymap description.

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:
 ChangeLog|4 
 chess-pgn.el |   39 +++
 2 files changed, 23 insertions(+), 20 deletions(-)



[elpa] branch externals/chess updated (3a44294 -> e872564)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  3a44294   (chess-algebraic-regexp, chess-algebraic-to-ply): 
Optionally allow "0-0" and "0-0-0" in addition to "O-O" and "O-O-O" to mean 
castling. (chess-algebraic-regexp, chess-algebraic-to-ply): Handle figurine 
notation.
   new  e872564   * chess-test.el (chess-test): Renamed to... 
(chess-test-database): More descriptive name. (chess-perft): Require as this is 
our entry-point for testing. * doc/chess.texi: Renamed to... * chess.texi: 
Top-level file, keeping doc/ for just one file is useless. * Makefile: Adjust 
and use the predefined MAKEINFO variable from GNU Make. * chess-pgn.el 
(chess-game): Require. (chess-pgn-parse): Use `rx'. * chess-game.el 
(chess-pgn): Do not require. (chess-game-to-string, che [...]

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:
 .elpaignore  |1 -
 ChangeLog|   12 
 Makefile |   13 ++---
 chess-crafty.el  |3 ++-
 chess-file.el|1 +
 chess-game.el|   11 ---
 chess-gnuchess.el|3 ++-
 chess-network.el |3 ++-
 chess-pgn.el |   26 +++---
 chess-sjeng.el   |3 ++-
 chess-test.el|3 ++-
 doc/chess.texi => chess.texi |0
 12 files changed, 48 insertions(+), 31 deletions(-)
 rename doc/chess.texi => chess.texi (100%)



[elpa] 01/01: * chess-test.el (chess-test): Renamed to... (chess-test-database): More descriptive name. (chess-perft): Require as this is our entry-point for testing. * doc/chess.texi: Renamed to... *

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit e8725641a89ef55181f9e27750faeb0c44e678ab
Author: Mario Lang 
Date:   Sat Jun 14 16:08:04 2014 +0200

* chess-test.el (chess-test): Renamed to...
(chess-test-database): More descriptive name.
(chess-perft): Require as this is our entry-point for testing.
* doc/chess.texi: Renamed to...
* chess.texi: Top-level file, keeping doc/ for just one file is useless.
* Makefile: Adjust and use the predefined MAKEINFO variable from GNU Make.
* chess-pgn.el (chess-game): Require.
(chess-pgn-parse): Use `rx'.
* chess-game.el (chess-pgn): Do not require.
(chess-game-to-string, chess-game-from-string): Remove, all callers
updated to use chess-pgn functions directly.
---
 .elpaignore  |1 -
 ChangeLog|   12 
 Makefile |   13 ++---
 chess-crafty.el  |3 ++-
 chess-file.el|1 +
 chess-game.el|   11 ---
 chess-gnuchess.el|3 ++-
 chess-network.el |3 ++-
 chess-pgn.el |   26 +++---
 chess-sjeng.el   |3 ++-
 chess-test.el|3 ++-
 doc/chess.texi => chess.texi |0
 12 files changed, 48 insertions(+), 31 deletions(-)

diff --git a/.elpaignore b/.elpaignore
index b34bc39..9777460 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -3,6 +3,5 @@
 .elpaignore
 chess-eco.pos
 chess-test.el
-doc
 ChangeLog
 Makefile
diff --git a/ChangeLog b/ChangeLog
index 400a5e6..798ff02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2014-06-14  Mario Lang  
 
+   * chess-test.el (chess-test): Renamed to...
+   (chess-test-database): More descriptive name.
+   (chess-perft): Require as this is our entry-point for testing.
+   * doc/chess.texi: Renamed to...
+   * chess.texi: Top-level file, keeping doc/ for just one file is useless.
+   * Makefile: Adjust and use the predefined MAKEINFO variable from GNU 
Make.
+   * chess-pgn.el (chess-game): Require.
+   (chess-pgn-parse): Use `rx'.
+   * chess-game.el (chess-pgn): Do not require.
+   (chess-game-to-string, chess-game-from-string): Remove, all callers
+   updated to use chess-pgn functions directly.
+
* chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric',
generate ICCF numeric notation.
(chess-algebraic-regexp, chess-algebraic-to-ply): Optionally allow "0-0"
diff --git a/Makefile b/Makefile
index 5b1bfa8..4c9f462 100644
--- a/Makefile
+++ b/Makefile
@@ -4,25 +4,24 @@
 # If you update chess.texi or chess-eco.pos, run make on this file.
 
 EMACS = emacs --batch --no-site-file
-MAKEINFO = makeinfo
+MAKEINFO_FLAGS = --no-split
 INSTALL_INFO = install-info
 
 all: chess-eco.fen chess.info dir
 
-test: chess-perft.elc
-   $(EMACS) -L . -l chess-perft -f ert-run-tests-batch
+test: chess-test.elc
+   $(EMACS) -L . -l chess-test -f ert-run-tests-batch
 
 chess-eco.fen: chess-eco.pos
$(EMACS) -L . -l chess-eco.el -f chess-generate-fen-table $< $@
 
-chess.info: doc/chess.texi
-   $(MAKEINFO) --no-split -o $@ $<
-
 dir: chess.info
$(INSTALL_INFO) $< $@
 
+chess-database.elc: chess-message.elc chess-file.elc chess-scid.elc
+chess-file.elc: chess-fen.elc chess-pgn.elc
 chess-perft.elc: chess-fen.elc chess-ply.elc chess-pos.elc
-chess-ply.elc: chess-algebraic.elc
+chess-test.elc: chess-database.elc chess-game.elc chess-perft.elc
 
 .el.elc:
@$(EMACS) -L . -f batch-byte-compile $<
diff --git a/chess-crafty.el b/chess-crafty.el
index 24265ed..3335f8e 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -23,6 +23,7 @@
 
 (require 'chess-common)
 (require 'chess-fen)
+(require 'chess-pgn)
 (require 'chess-var)
 
 (defgroup chess-crafty nil
@@ -150,7 +151,7 @@
 
  ((eq event 'setup-game)
   (let ((file (chess-with-temp-file
- (insert (chess-game-to-string (car args)) ?\n
+ (chess-insert-pgn (car args)) (insert ?\n
(chess-engine-send nil (format "read %s\n" file
 
  ((eq event 'set-option)
diff --git a/chess-file.el b/chess-file.el
index 1b3028b..95a5e9e 100644
--- a/chess-file.el
+++ b/chess-file.el
@@ -28,6 +28,7 @@
 ;;; Code:
 
 (require 'chess-fen)
+(require 'chess-pgn)
 
 (defvar chess-file-locations nil
   "A list of starting positions of individual records of this collection.")
diff --git a/chess-game.el b/chess-game.el
index a61438a..d86f159 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -28,7 +28,6 @@
 
 (eval-when-compile (require 'cl-lib))
 (require 'chess-ply)
-(require 'chess-pgn)
 
 (defvar chess-game-inhibit-events nil)
 
@@ -267,16 +266,6 @@ If INDEX is non-nil, the last played ply is returned."
 (and last-ply (chess-ply-final

[elpa] 02/02: (chess-algebraic-regexp, chess-algebraic-to-ply): Optionally allow "0-0" and "0-0-0" in addition to "O-O" and "O-O-O" to mean castling. (chess-algebraic-regexp, chess-algebraic-to-ply):

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 3a442940cedaf94d4ddd2805b79f8f08b06cd54e
Author: Mario Lang 
Date:   Sat Jun 14 13:30:39 2014 +0200

(chess-algebraic-regexp, chess-algebraic-to-ply): Optionally allow "0-0"
and "0-0-0" in addition to "O-O" and "O-O-O" to mean castling.
(chess-algebraic-regexp, chess-algebraic-to-ply): Handle figurine
notation.
---
 ChangeLog  |4 +++
 chess-algebraic.el |   61 ---
 2 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2ae3d04..400a5e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
* chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric',
generate ICCF numeric notation.
+   (chess-algebraic-regexp, chess-algebraic-to-ply): Optionally allow "0-0"
+   and "0-0-0" in addition to "O-O" and "O-O-O" to mean castling.
+   (chess-algebraic-regexp, chess-algebraic-to-ply): Handle figurine
+   notation.
 
 2014-06-13  Mario Lang  
 
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 13ae97b..5ca7895 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -52,36 +52,39 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl-lib))
-
 (require 'chess-message)
 (require 'chess-ply)
 (require 'chess-pos)
+(require 'cl-lib)
+
+(defconst chess-algebraic-figurine-pieces
+  '((?K . #x2654) (?Q . #x2655) (?R . #x2656)
+(?B . #x2657) (?N . #x2658) (?P . #x2659)
+(?k . #x265A) (?q . #x265B) (?r . #x265C)
+(?b . #x265D) (?n . #x265E) (?p . #x265F))
+  "Map internal piece representation to Unicode chess figures (as used in 
figurine
+notation.")
 
 (defconst chess-algebraic-regexp
-  (rx (group (or (or "O-O" "O-O-O")
-(and (optional (group (char ?N ?B ?R ?Q ?K)))
+  (rx (group (or (or "O-O" "O-O-O" "0-0" "0-0-0")
+(and (optional (group (char ?N ?B ?R ?Q ?K
+?♔ ?♕ ?♖ ?♗ ?♘
+?♚ ?♛ ?♜ ?♝ ?♞)))
  (optional (char ?/))
  (group (optional (char "a-h")) (optional (char "1-8")))
  (optional (group (char ?- ?x)))
  (group (char "a-h") (char "1-8"))
- (optional (group ?= (group (char ?N ?B ?R ?Q ?K)))
+ (optional (group ?= (group (char ?N ?B ?R ?Q ?K
+  ?♔ ?♕ ?♖ ?♗ ?♘
+  ?♚ ?♛ ?♜ ?♝ ?♞)))
   (optional (group (char ?+ ?#
   "A regular expression that matches all possible algebraic moves.
-This regexp handles both long and short form.")
+This regexp matches short, long and figurine notation.")
 
 (defconst chess-algebraic-regexp-entire (concat chess-algebraic-regexp "$"))
 
 (defconst chess-algebraic-regexp-ws (concat chess-algebraic-regexp "\\s-"))
 
-(defconst chess-algebraic-figurine-pieces
-  '((?K . #x2654) (?Q . #x2655) (?R . #x2656)
-(?B . #x2657) (?N . #x2658) (?P . #x2659)
-(?k . #x265A) (?q . #x265B) (?r . #x265C)
-(?b . #x265D) (?n . #x265E) (?p . #x265F))
-  "Map internal piece characters to Unicode chess figures (as used in figurine
-notation.")
-
 (chess-message-catalog 'english
   '((clarify-piece . "Clarify piece to move by rank or file")
 (could-not-clarify . "Could not determine which piece to use")
@@ -90,9 +93,7 @@ notation.")
 (at-move-string. "At algebraic move '%s': %s")))
 
 (defun chess-algebraic-to-ply (position move &optional trust)
-  "Convert the (short or long) algebraic notation MOVE for POSITION to a ply.
-
-Figurine notation is currently not supported."
+  "Convert (short, long or figurine) algebraic notation MOVE for POSITION to a 
ply."
   (cl-check-type position chess-pos)
   (cl-check-type move string)
   (let ((case-fold-search nil))
@@ -100,8 +101,8 @@ Figurine notation is currently not supported."
   (let ((color (chess-pos-side-to-move position))
(mate (match-string 8 move))
(piece (aref move 0))
-   changes long-style)
-   (if (eq piece ?O)
+   changes type)
+   (if (or (eq piece ?O) (eq piece ?0))
(setq changes (chess-ply-castling-changes
   position (= (length (match-string 1 move)) 5)))
  (let ((promotion (match-string 7 move)))
@@ -112,11 +113,17 @@ Figurine notation is currently not supported."
   (if (and source (= (length source) 2))
   (prog1
 

[elpa] branch externals/chess updated (9295c19 -> 3a44294)

2014-06-14 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  9295c19   * chess-pos.el (chess-pos-en-passant, chess-pos-status) 
(chess-pos-side-to-move, chess-pos-annotations) (chess-pos-preceding-ply): 
Enable use as generalized variables. (chess-pos-p): New function.
   new  d26ae3b   * chess-algebraic.el (chess-ply-to-algebraic): If TYPE is 
`:numeric', generate ICCF numeric notation.
   new  3a44294   (chess-algebraic-regexp, chess-algebraic-to-ply): 
Optionally allow "0-0" and "0-0-0" in addition to "O-O" and "O-O-O" to mean 
castling. (chess-algebraic-regexp, chess-algebraic-to-ply): Handle figurine 
notation.

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:
 ChangeLog  |9 ++
 chess-algebraic.el |   80 ++-
 chess-polyglot.el  |4 +--
 3 files changed, 63 insertions(+), 30 deletions(-)



[elpa] 01/02: * chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric', generate ICCF numeric notation.

2014-06-14 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit d26ae3b157f0374e43cef34f798d633107d456d8
Author: Mario Lang 
Date:   Sat Jun 14 12:12:20 2014 +0200

* chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric',
generate ICCF numeric notation.
---
 ChangeLog  |5 +
 chess-algebraic.el |   19 +++
 chess-polyglot.el  |4 +---
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1a073c7..2ae3d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-14  Mario Lang  
+
+   * chess-algebraic.el (chess-ply-to-algebraic): If TYPE is `:numeric',
+   generate ICCF numeric notation.
+
 2014-06-13  Mario Lang  
 
* chess-pos.el (chess-pos-en-passant, chess-pos-status)
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 49a95d6..13ae97b 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -165,17 +165,28 @@ Figurine notation is currently not supported."
 (defun chess-ply-to-algebraic (ply &optional type)
   "Convert the given PLY to algebraic notation.
 Optional argument TYPE specifies the kind of algebraic notation to generate.
-`:san' (the default) generates short (or standard) algebraic notation.
-`:lan' generates long algebraic notation (like \"Nb1-c3\".
-`:fan' generates figurine algebraic notation (like \"♘c3\"."
+`:san' (the default) generates short (or standard) algebraic notation
+\(like \"Nc3\").  `:lan' generates long algebraic notation (like \"Nb1-c3\".
+`:fan' generates figurine algebraic notation (like \"♘c3\".
+Finally, `:numeric' generates ICCF numeric notation (like \"2133\"."
   (cl-check-type ply (and list (not null)))
-  (cl-check-type type (member nil :san :fan :lan))
+  (cl-check-type type (member nil :san :fan :lan :numeric))
   (unless type (setq type :san))
   (or (chess-ply-keyword ply type)
   (and (null (chess-ply-source ply)) "")
   (chess-ply-set-keyword
ply type
(or
+   (and (eq type :numeric)
+(apply
+ #'string
+ (+ (chess-index-file (chess-ply-source ply)) ?1)
+ (+ (chess-index-rank (logxor (chess-ply-source ply) #o70)) ?1)
+ (+ (chess-index-file (chess-ply-target ply)) ?1)
+ (+ (chess-index-rank (logxor (chess-ply-target ply) #o70)) ?1)
+ (when (chess-ply-keyword ply :promote)
+   (list (+ (cl-position (chess-ply-keyword ply :promote)
+ '(?Q ?R ?B ?N)) ?1)
(and (chess-ply-keyword ply :castle) "O-O")
(and (chess-ply-keyword ply :long-castle) "O-O-O")
(let* ((pos (chess-ply-pos ply))
diff --git a/chess-polyglot.el b/chess-polyglot.el
index 717e1c4..96a918c 100644
--- a/chess-polyglot.el
+++ b/chess-polyglot.el
@@ -135,9 +135,7 @@ On reaching end or beginning of buffer, stop and signal 
error."
   "Non-nil if the polyglot key LHS is less than or equal to RHS."
   (while (and lhs rhs (= (car lhs) (car rhs)))
 (setq lhs (cdr lhs) rhs (cdr rhs)))
-  (if (and (null lhs) (null rhs))
-  t
-(<= (car lhs) (car rhs
+  (or (and (null lhs) (null rhs)) (<= (car lhs) (car rhs
 
 (defun chess-polyglot-read-moves (key)
   "Read all moves associated with KEY from the current buffer."



[elpa] 01/01: * chess-pos.el (chess-pos-en-passant, chess-pos-status) (chess-pos-side-to-move, chess-pos-annotations) (chess-pos-preceding-ply): Enable use as generalized variables. (chess-pos-p): New

2014-06-13 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 9295c19fcd9ea1148fa2ecb43ee3a8197a1ec8bc
Author: Mario Lang 
Date:   Fri Jun 13 23:37:23 2014 +0200

* chess-pos.el (chess-pos-en-passant, chess-pos-status)
(chess-pos-side-to-move, chess-pos-annotations)
(chess-pos-preceding-ply): Enable use as generalized variables.
(chess-pos-p): New function.

* chess-ply.el (chess-ply-pos, chess-ply-changes)
(chess-ply-keyword): Enable use as generalized variables.
(chess-ply-castling-changes): Convert to using
`chess-next-index'.

* chess-polyglot.el (chess-polyglot-pos-to-key): Use logxor to invert
rank instead of two loops to keep rank/file apart.
---
 ChangeLog  |   15 
 chess-ai.el|2 +-
 chess-algebraic.el |6 +-
 chess-fen.el   |4 +-
 chess-ply.el   |   34 ++
 chess-polyglot.el  |   35 +-
 chess-pos.el   |  191 ++--
 7 files changed, 154 insertions(+), 133 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 05c0d9c..1a073c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-06-13  Mario Lang  
+
+   * chess-pos.el (chess-pos-en-passant, chess-pos-status)
+   (chess-pos-side-to-move, chess-pos-annotations)
+   (chess-pos-preceding-ply): Enable use as generalized variables.
+   (chess-pos-p): New function.
+
+   * chess-ply.el (chess-ply-pos, chess-ply-changes)
+   (chess-ply-keyword): Enable use as generalized variables.
+   (chess-ply-castling-changes): Convert to using
+   `chess-next-index'.
+
+   * chess-polyglot.el (chess-polyglot-pos-to-key): Use logxor to invert
+   rank instead of two loops to keep rank/file apart.
+
 2014-06-11  Mario Lang  
 
* chess-pos.el (chess-ply-castling-changes): Declare.
diff --git a/chess-ai.el b/chess-ai.el
index d3a1e5c..06cee58 100644
--- a/chess-ai.el
+++ b/chess-ai.el
@@ -102,7 +102,7 @@ this ply depth limit has been reached."
 
 (defun chess-ai-eval-static (position)
   "Calculate the static score for POSITION."
-  (cl-assert (vectorp position))
+  (cl-check-type position chess-pos)
   (let ((v 0)
(status (chess-pos-status position)))
 (if (eq status :checkmate)
diff --git a/chess-algebraic.el b/chess-algebraic.el
index c0951cf..49a95d6 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -93,8 +93,8 @@ notation.")
   "Convert the (short or long) algebraic notation MOVE for POSITION to a ply.
 
 Figurine notation is currently not supported."
-  (cl-assert (vectorp position))
-  (cl-assert (stringp move))
+  (cl-check-type position chess-pos)
+  (cl-check-type move string)
   (let ((case-fold-search nil))
 (when (string-match chess-algebraic-regexp-entire move)
   (let ((color (chess-pos-side-to-move position))
@@ -168,7 +168,7 @@ Optional argument TYPE specifies the kind of algebraic 
notation to generate.
 `:san' (the default) generates short (or standard) algebraic notation.
 `:lan' generates long algebraic notation (like \"Nb1-c3\".
 `:fan' generates figurine algebraic notation (like \"♘c3\"."
-  (cl-assert (listp ply))
+  (cl-check-type ply (and list (not null)))
   (cl-check-type type (member nil :san :fan :lan))
   (unless type (setq type :san))
   (or (chess-ply-keyword ply type)
diff --git a/chess-fen.el b/chess-fen.el
index 001c2c4..f3a2eb0 100644
--- a/chess-fen.el
+++ b/chess-fen.el
@@ -65,7 +65,7 @@
 
 (defun chess-fen-to-pos (fen)
   "Convert a FEN-like notation string to a chess position."
-  (cl-assert (stringp fen))
+  (cl-check-type fen string)
   (let ((i 0) (l (length fen))
(rank 0) (file 0) (c ?0)
(position (chess-pos-create t))
@@ -118,7 +118,7 @@
 (defun chess-pos-to-fen (position &optional full)
   "Convert a chess POSITION to FEN-like notation.
 If FULL is non-nil, represent trailing spaces as well."
-  (cl-assert (vectorp position))
+  (cl-check-type position chess-pos)
   (let ((blank 0) (str "") output)
 (dotimes (rank 8)
   (dotimes (file 8)
diff --git a/chess-ply.el b/chess-ply.el
index 0f2bc2c..cf463cb 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -78,6 +78,8 @@
   (cl-assert (vectorp position))
   (setcar ply position))
 
+(gv-define-simple-setter chess-ply-pos chess-ply-set-pos)
+
 (defsubst chess-ply-changes (ply)
   (cl-assert (listp ply))
   (cdr ply))
@@ -87,7 +89,11 @@
   (cl-assert (listp changes))
   (setcdr ply changes))
 
+(gv-define-simple-setter chess-ply-changes chess-ply-set-changes)
+
 (defun chess-ply-any-keyword (ply &rest keywords)
+  "Return non-nil if PLY contains at least one of KEYWORDS."
+  (declare (side-effect-free t))
   (cl-assert (listp ply))
   (catch 'found
 (dolist (keyword keywords)
@@ -95,13 +101,11 @@
  (throw 'found keyword)
 
 (defun chess-ply-keyword (ply keyw

[elpa] branch externals/chess updated (eb15e97 -> 9295c19)

2014-06-13 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  eb15e97   Fix "makeinfo --html".
   new  9295c19   * chess-pos.el (chess-pos-en-passant, chess-pos-status) 
(chess-pos-side-to-move, chess-pos-annotations) (chess-pos-preceding-ply): 
Enable use as generalized variables. (chess-pos-p): New function.

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:
 ChangeLog  |   15 
 chess-ai.el|2 +-
 chess-algebraic.el |6 +-
 chess-fen.el   |4 +-
 chess-ply.el   |   34 ++
 chess-polyglot.el  |   35 +-
 chess-pos.el   |  191 ++--
 7 files changed, 154 insertions(+), 133 deletions(-)



[elpa] 01/01: Fix "makeinfo --html".

2014-06-13 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit eb15e97bc9ac0cfe111cedc09416eb21039a23d8
Author: Mario Lang 
Date:   Fri Jun 13 11:31:16 2014 +0200

Fix "makeinfo --html".
---
 doc/chess.texi |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/chess.texi b/doc/chess.texi
index 590f678..1f19805 100644
--- a/doc/chess.texi
+++ b/doc/chess.texi
@@ -55,7 +55,7 @@ any later version published by the Free Software Foundation.
 @c   The real text starts here
 @c 
 
-@ifinfo
+@ifnottex
 @node Top, The chess.el library, (dir), (dir)
 @top Emacs Chess: chess.el
 
@@ -67,7 +67,7 @@ multitude of other purposes.
 
 The purpose of this manual is to help you understand how Chess.el is
 structured for use as a library, and also how to use it as a client.
-@end ifinfo
+@end ifnottex
 
 @menu
 * The chess.el library::Basic objects required to deal with Chess



[elpa] branch externals/chess updated (c7e551d -> eb15e97)

2014-06-13 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  c7e551d   Work on the manual.
   new  eb15e97   Fix "makeinfo --html".

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:
 doc/chess.texi |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)



[elpa] 01/01: Work on the manual.

2014-06-12 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit c7e551d9a9bc0ff29068ae8953c1e50bd39e831b
Author: Mario Lang 
Date:   Thu Jun 12 08:24:08 2014 +0200

Work on the manual.
---
 chess.info |   93 -
 doc/chess.texi |   98 
 2 files changed, 119 insertions(+), 72 deletions(-)

diff --git a/chess.info b/chess.info
index 5075235..e29a790 100644
--- a/chess.info
+++ b/chess.info
@@ -1450,6 +1450,9 @@ customisable ASCII board diagram display.
  -- User Option: chess-plain-spacing
  Number of spaces between files.
 
+   To customize options of ‘chess-plain’, use ‘M-x customize-group 
+chess-plain ’.
+
 
 File: chess.info,  Node: ICS1 style ASCII displays,  Next: Graphical displays, 
 Prev: Plain ASCII diagram displays,  Up: Chessboard displays
 
@@ -1482,6 +1485,9 @@ File: chess.info,  Node: ICS1 style ASCII displays,  
Next: Graphical displays,
  -- User Option: chess-ics1-separate-frame
  If non-nil, display the chessboard in its own frame.
 
+   To customize options of ‘chess-ics1’, use ‘M-x customize-group 
+chess-ics1 ’.
+
 
 File: chess.info,  Node: Graphical displays,  Prev: ICS1 style ASCII displays, 
 Up: Chessboard displays
 
@@ -1500,6 +1506,12 @@ create a visually appealing chessboard in a buffer.
 
  The only image format currently supported is XPM.
 
+ -- User Option: chess-images-separate-frame
+ If non-nil, display the chessboard in its own frame.
+
+   For all customization options of ‘chess-images’, use ‘M-x
+customize-group  chess-images ’.
+
 
 File: chess.info,  Node: Engines,  Next: Chess Session,  Prev: Chessboard 
displays,  Up: Top
 
@@ -1647,13 +1659,13 @@ File: chess.info,  Node: GNU Chess,  Next: Phalanx,  
Prev: Glaurung,  Up: Engine
 4.6 GNU Chess
 =
 
-"GNU Chess" is free software, licensed under the terms of the GNU
-General Public License version 3 or any later version, and is maintained
-by collaborating developers.  As one of the earliest computer chess
+"GNU Chess" (http://gnu.org/software/chess/) is free software, licensed
+under the terms of the GNU General Public License, and is maintained by
+collaborating developers.  As one of the earliest computer chess
 programs with full source code available, it’s one of the oldest for
 Unix-based systems and has since been ported to many other platforms.
 
-   If the ‘gnuChess’ program is installed and can be found in the
+   If the ‘gnuchess’ program is installed and can be found in the
 program search path (‘exec-path’), the ‘chess-gnuchess’ engine module
 will automatically detect it.
 
@@ -1661,7 +1673,7 @@ will automatically detect it.
 ‘chess-gnuchess-path’ can be set to point to the executable.
 
If you have multiple engines installed you can explicitly select to
-play against GNU Chess by invoking .
+play against GNU Chess by invoking ‘C-u M-x chess  gnuchess ’.
 
 
 File: chess.info,  Node: Phalanx,  Next: Sjeng,  Prev: GNU Chess,  Up: Engines
@@ -1754,6 +1766,16 @@ used to keep track of the currently active game.
 later described in this manual make use of this, *Note Internet Chess
 Servers::.
 
+   To interactively start a chess session, invoke ‘M-x chess ’.
+This uses ‘chess-default-display’ to determine the chessboard display to
+use, and ‘chess-default-engine’ to determine an opponent.
+
+   If you want to play against a specific engine, provide a prefix
+argument as in ‘C-u M-x chess ’, which will prompt for an engine
+module.  The module name has the common prefix ‘chess-’ stripped.  So
+you enter ‘gnuchess’ to indicate you’d like to play against the
+‘chess-gnuchess’ module.
+
 
 File: chess.info,  Node: Internet Chess Servers,  Next: Concept Index,  Prev: 
Chess Session,  Up: Top
 
@@ -2151,6 +2173,8 @@ Function and Variable Index
 * chess-database-query:  Querying Databases.  (line  12)
 * chess-database-read:   Querying Databases.  (line   9)
 * chess-database-read-only-p:Modifying Databases. (line   6)
+* chess-default-display: Chess Session.   (line  31)
+* chess-default-engine:  Chess Session.   (line  31)
 * chess-default-modules: ECO Classification.  (line   6)
 * chess-direction-east:  Position coordinates.
   (line  37)
@@ -2254,6 +2278,7 @@ Function and Variable Index
 * chess-ics1-separate-frame: ICS1 style ASCII displays.
   (line  29)
 * chess-images-directory:Graphical displays.  (line   9)
+* chess-images-separate-frame:   Graphical displays.  (line  18)
 * chess-index-file:  Position coordinates.
   (line  13)
 * chess-index-rank:  

  1   2   3   >