From 81c84e9628adf820eea9209e9c0be341a429470a Mon Sep 17 00:00:00 2001 From: Mario Lang Date: Sun, 27 Dec 2009 20:11:07 +0100 Subject: char-valid-p is obsolete (as of Emacs 23.1); use characterp instead --- TODO | 2 +- chess-display.el | 2 +- chess-pos.el | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 0c3f48c..a689455 100644 --- a/TODO +++ b/TODO @@ -280,7 +280,7 @@ EMACS-CHESS -*- mode: org; fill-column: 78 -*- Well, I've played a little with a few transformations but I haven't managed to get any substantial speedup. Things I see are: - - char-valid-p is called at least three times, the value could be saved in + - characterp is called at least three times, the value could be saved in the toplevel let*. - I am not sure but I think I read inline quoted lists can be slower. I tried to define the direction lists as a alist in a defconst, but it diff --git a/chess-display.el b/chess-display.el index a7fa21d..2807a82 100644 --- a/chess-display.el +++ b/chess-display.el @@ -1097,7 +1097,7 @@ 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) (char-valid-p piece)) + (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-char)) diff --git a/chess-pos.el b/chess-pos.el index 453df5a..4958720 100644 --- a/chess-pos.el +++ b/chess-pos.el @@ -705,11 +705,11 @@ If NO-CASTLING is non-nil, do not consider castling moves." (assert (vectorp position)) (assert (and (>= target 0) (< target 64))) (assert (memq piece '(t nil ?K ?Q ?N ?B ?R ?P ?k ?q ?n ?b ?r ?p))) - (let* ((color (if (char-valid-p piece) + (let* ((color (if (characterp piece) (< piece ?a) piece)) (bias (if color -1 1)) - (test-piece (and (char-valid-p piece) + (test-piece (and (characterp piece) (upcase piece))) p pos candidates) (cond @@ -844,7 +844,7 @@ If NO-CASTLING is non-nil, do not consider castling moves." ;; prune from the discovered candidates list any moves which would ;; leave the king in check; castling through check has already ;; been eliminated. - (if (and candidates (char-valid-p piece)) + (if (and candidates (characterp piece)) (setq candidates (chess-pos-legal-candidates position color target candidates))) -- cgit v1.2.3