summaryrefslogtreecommitdiff
path: root/chess-images.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-19 18:49:00 -0500
committerCraig Jennings <c@cjennings.net>2025-10-19 18:49:00 -0500
commite1d60d2110987f1060c0b37d032621c669d97d5e (patch)
tree2ff171a86f28593da724bb754d80278e74cf8f5d /chess-images.el
parent865b2ab11469f3bd1bc4d7b3669cb4626c37be08 (diff)
fix: all: fixes to get emacs-chess working on 30.2
- added lexical-binding headers to all source files - replaced make-variable-buffer-local with defvar-local throughout source code - replaced deprecated cl library with cl-lib, including replacing assert with cl-assert to emacs-chess-steps.el - added proper headers and footers to test files when missing - populated chess images and chess sounds directory - fixed defcustom calling directory-files without error handling. xboard installation no longer required.
Diffstat (limited to 'chess-images.el')
-rw-r--r--chess-images.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/chess-images.el b/chess-images.el
index aacd153..edc87f2 100644
--- a/chess-images.el
+++ b/chess-images.el
@@ -1,4 +1,4 @@
-;;; chess-images.el --- Chessboard display style using graphical images
+;;; chess-images.el --- Chessboard display style using graphical images -*- lexical-binding: t; -*-
;; Copyright (C) 2002, 2005, 2008, 2014 Free Software Foundation, Inc.
@@ -40,13 +40,9 @@
"Module for drawing a chess-display using graphical images."
:group 'chess-display)
-(defvar chess-images-cache nil)
-(defvar chess-images-size nil)
-(defvar chess-images-sizes nil)
-
-(make-variable-buffer-local 'chess-images-cache)
-(make-variable-buffer-local 'chess-images-size)
-(make-variable-buffer-local 'chess-images-sizes)
+(defvar-local chess-images-cache nil)
+(defvar-local chess-images-size nil)
+(defvar-local chess-images-sizes nil)
(defun chess-images-clear-image-cache (sym value)
(set sym value)
@@ -58,9 +54,11 @@
:group 'chess-images)
(defcustom chess-images-directory
- (if (directory-files "/usr/share/games/xboard/pixmaps" nil "\\.xpm")
- "/usr/share/games/xboard/pixmaps"
- (expand-file-name "pieces/xboard"
+ (or (ignore-errors
+ (when (and (file-directory-p "/usr/share/games/xboard/pixmaps")
+ (directory-files "/usr/share/games/xboard/pixmaps" nil "\\.xpm"))
+ "/usr/share/games/xboard/pixmaps"))
+ (expand-file-name "pieces/xboard"
(file-name-directory
(or load-file-name buffer-file-name))))
"Directory containing the chess piece bitmap images.