emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 01/02: Encode promotions when sending ICS moves.


From: Mario Lang
Subject: [elpa] 01/02: Encode promotions when sending ICS moves.
Date: Sat, 24 May 2014 23:39:52 +0000

mlang pushed a commit to branch externals/chess
in repository elpa.

commit a84f9bbc1959e8fca4c2d76594d17707f7b62ba3
Author: Mario Lang <address@hidden>
Date:   Sun May 25 01:37:57 2014 +0200

    Encode promotions when sending ICS moves.
    
    * chess.ics.el: (chess-ics-handler) Encode promotion like =Q when handling
    the move event.
---
 chess-ics.el |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/chess-ics.el b/chess-ics.el
index 13f40c3..6f94454 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -1051,17 +1051,19 @@ This function should be put on 
`comint-preoutput-filter-functions'."
        nil (format "match %s\n"
                   (read-string (chess-string 'challenge-whom)))))
 
-     ;; this handler is taken from chess-common; we need to send long
-     ;; algebraic notation to the ICS server, not short
+     ;; we need to send long algebraic notation to the ICS server, not short
      ((eq event 'move)
-      (chess-ics-send
-       (if (chess-ply-any-keyword (car args) :castle :long-castle)
-          (chess-ply-to-algebraic (car args))
-        (concat (chess-index-to-coord
-                 (chess-ply-source (car args))) "-"
-                 (chess-index-to-coord
-                  (chess-ply-target (car args)))))
-       (chess-game-data game 'ics-buffer))
+      (let ((ply (car args)))
+       (chess-ics-send
+        (if (chess-ply-any-keyword ply :castle :long-castle)
+            (chess-ply-to-algebraic ply)
+          (concat (chess-index-to-coord (chess-ply-source ply))
+                  "-"
+                  (chess-index-to-coord (chess-ply-target ply))
+                  (if (characterp (chess-ply-keyword ply :promote))
+                      (format "=%c" (chess-ply-keyword ply :promote))
+                    "")))
+        (chess-game-data game 'ics-buffer)))
       (if (chess-game-over-p game)
          (chess-game-set-data game 'active nil)))
 



reply via email to

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