summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2004-01-26 07:23:27 +0000
committerMario Lang <mlang@delysid.org>2004-01-26 07:23:27 +0000
commit3e425d21a34ace87287572bd69637406248cc6c4 (patch)
treec89de195458c0d87622e6d40e9d6e6a324b2b541
parent01d81baed9ef3bcf544f456668c985c29d7f91c5 (diff)
new function chess-database-filename, also support it in scid and file dbs
-rw-r--r--chess-database.el4
-rw-r--r--chess-file.el6
-rw-r--r--chess-scid.el10
3 files changed, 16 insertions, 4 deletions
diff --git a/chess-database.el b/chess-database.el
index 6db8ba7..0c03484 100644
--- a/chess-database.el
+++ b/chess-database.el
@@ -74,6 +74,10 @@
"Return non-nil if DATABASE is read only."
(chess-database-command database 'read-only-p))
+(defun chess-database-filename (database)
+ "Return the filename of an already opened DATABASE."
+ (chess-database-command database 'filename))
+
(defun chess-database-read (database index)
"Return from DATABASE the chess game object at INDEX."
(chess-database-command database 'read index))
diff --git a/chess-file.el b/chess-file.el
index 1f99b58..509f3e6 100644
--- a/chess-file.el
+++ b/chess-file.el
@@ -29,6 +29,12 @@
(forward-char 1))
(setq chess-file-locations (nreverse chess-file-locations))))
+ ((eq event 'read-only-p)
+ buffer-read-only)
+
+ ((eq event 'filename)
+ buffer-file-name)
+
((eq event 'save)
(save-buffer))
diff --git a/chess-scid.el b/chess-scid.el
index 6e5be20..dfb3a39 100644
--- a/chess-scid.el
+++ b/chess-scid.el
@@ -54,6 +54,9 @@
nil
t))
+ ((eq event 'filename)
+ (chess-scid-get-result "sc_base filename"))
+
((eq event 'count)
(string-to-int (chess-scid-get-result "sc_base numGames")))
@@ -78,14 +81,14 @@
(with-temp-buffer
(chess-pgn-insert-plies
(cadr args) 1 (chess-game-plies (cadr args)))
- (insert (or (chess-game-tag (cadr args) "Result") "*"))
+ (insert " " (or (chess-game-tag (cadr args) "Result") "*"))
(buffer-string))))
"PGN text imported with no errors or warnings.")
(let ((here (point-max)))
(chess-scid-send "sc_tree search")
(accept-process-output chess-scid-process)
+ (goto-char here)
(let ((lines (list t)))
- (goto-char here)
(while
(re-search-forward
(concat "\\s-*\\([1-9][0-9]*\\):\\s-+\\([^ ]+\\)\\s-+"
@@ -94,8 +97,7 @@
"\\([0-9]+\\| \\)\\s-+\\([0-9]+\\| \\)\\s-+"
"\\([0-9.]+\\)%")
nil t)
- (let ((num (string-to-int (match-string 1)))
- (move (match-string 2))
+ (let ((move (match-string 2))
(freq (string-to-int (match-string 3)))
(score (string-to-number (match-string 5)))
(avgelo (string-to-int (match-string 6)))