]> code.delx.au - gnu-emacs-elpa/blobdiff - chess-sound.el
Correctly indent `chess-with-current-buffer' in lisp-mode.
[gnu-emacs-elpa] / chess-sound.el
index 4a34121b3b697f8c845d60b45bc43701ab495d27..ed1ce532d5e51984c5fb988b74305ea5022a3e69 100644 (file)
   :group 'chess-sound)
 
 (defsubst chess-sound (file)
-  (funcall chess-sound-play-function
-          (expand-file-name (concat file ".wav")
-                            chess-sound-directory)))
+  (ignore-errors
+    (funcall chess-sound-play-function
+            (expand-file-name (concat file ".wav")
+                              chess-sound-directory))))
 
 (defsubst chess-sound-play (file)
   (apply 'call-process chess-sound-program
@@ -57,7 +58,8 @@
         (file-readable-p (expand-file-name "move.wav"
                                            chess-sound-directory))
         (or (eq chess-sound-play-function 'play-sound-file)
-            (file-executable-p chess-sound-program))))
+            (and chess-sound-program
+                 (file-executable-p chess-sound-program)))))
 
    ((eq event 'move)
     (let* ((ply (chess-game-ply game (1- (chess-game-index game))))
            (chess-sound (format "%c_" (downcase t-piece)))
            (chess-sound (chess-index-to-coord target))))
 
+         (if (chess-ply-keyword ply :promote)
+             (chess-sound
+              (format "%c_" (downcase
+                             (chess-ply-keyword ply :promote)))))
          (if (chess-ply-keyword ply :en-passant)
              (chess-sound "enpassant"))
          (if (chess-ply-keyword ply :check)