summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-announce.el2
-rw-r--r--chess-display.el2
-rw-r--r--chess-ics1.el2
-rw-r--r--chess-images.el5
-rw-r--r--chess-pgn.el25
-rw-r--r--chess-plain.el2
-rw-r--r--chess-sound.el3
7 files changed, 34 insertions, 7 deletions
diff --git a/chess-announce.el b/chess-announce.el
index ca563e0..c69c7e1 100644
--- a/chess-announce.el
+++ b/chess-announce.el
@@ -52,7 +52,7 @@ See `chess-display-type' for the different kinds of displays."
(kill-buffer (current-buffer))
(set-buffer (generate-new-buffer " *chess-announce*"))
(funcall (nth 0 chess-announce-functions))
- t)
+ (current-buffer))
((eq event 'shutdown)
(funcall (nth 2 chess-announce-functions)))
diff --git a/chess-display.el b/chess-display.el
index 229a75a..432f959 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -81,7 +81,7 @@ makes moves, or any other changes to the underlying game."
(with-current-buffer (generate-new-buffer "*Chessboard*")
(setq buffer (current-buffer))
(chess-display-mode read-only)
- (when (funcall handler 'initialize)
+ (when (setq buffer (funcall handler 'initialize))
(add-hook 'kill-buffer-hook 'chess-display-quit nil t)
(setq chess-display-style style
chess-display-perspective perspective
diff --git a/chess-ics1.el b/chess-ics1.el
index f21c63e..ac8e485 100644
--- a/chess-ics1.el
+++ b/chess-ics1.el
@@ -39,7 +39,7 @@
(defun chess-ics1-handler (event &rest args)
(cond
- ((eq event 'initialize) t)
+ ((eq event 'initialize) (current-buffer))
((eq event 'popup)
(if chess-display-popup
(funcall chess-ics1-popup-function)))
diff --git a/chess-images.el b/chess-images.el
index d2e2256..96aa8eb 100644
--- a/chess-images.el
+++ b/chess-images.el
@@ -160,14 +160,17 @@ called."
(when (display-graphic-p)
(chess-images-initialize)
(if chess-images-size
- t
+ (current-buffer)
(chess-message 'no-images-fallback)
nil)))
+
((eq event 'popup)
(if chess-display-popup
(funcall chess-images-popup-function)))
+
((eq event 'draw)
(apply 'chess-images-draw args))
+
((eq event 'highlight)
(apply 'chess-images-highlight args))))
diff --git a/chess-pgn.el b/chess-pgn.el
index 63fe9fc..f9fc5c3 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -167,6 +167,10 @@ If INDENTED is non-nil, indent the move texts."
;; chess-pgn-mode for editing and browsing PGN files.
;;
+(defvar chess-pgn-database)
+
+(make-variable-buffer-local 'chess-pgn-database)
+
;;;###autoload
(define-derived-mode chess-pgn-mode text-mode "PGN"
"A mode for editing chess PGN files."
@@ -178,7 +182,8 @@ If INDENTED is non-nil, indent the move texts."
(let ((map (current-local-map)))
(define-key map [??] 'describe-mode)
(define-key map [?T] 'text-mode)
- (define-key map [return] 'chess-pgn-move)
+ (define-key map [return] 'chess-pgn-show-position)
+ (define-key map [mouse-1] 'chess-pgn-mouse-show-position)
(define-key map [(control ?m)] 'chess-pgn-move)))
(defalias 'pgn-mode 'chess-pgn-mode)
@@ -207,6 +212,24 @@ If INDENTED is non-nil, indent the move texts."
(push "application/x-chess-pgn" mm-inlined-types)
(push "application/x-chess-pgn" mm-automatic-display)))
+(defun chess-pgn-show-position ()
+ (interactive)
+ (unless chess-pgn-database
+ (save-excursion
+ (when (re-search-backward "\\[Event \"\\([^\"]+\\)\"\\]" nil t)
+ ))))
+
+(defun chess-pgn-mouse-show-position (event)
+ (interactive "e")
+ (if (fboundp 'event-window) ; XEmacs
+ (progn
+ (set-buffer (window-buffer (event-window event)))
+ (and (event-point event) (goto-char (event-point event))))
+ (progn
+ (set-buffer (window-buffer (posn-window (event-start event))))
+ (goto-char (posn-point (event-start event)))))
+ (chess-pgn-show-position))
+
(defun chess-pgn-move ()
"Make a move from a PGN buffer."
(interactive)
diff --git a/chess-plain.el b/chess-plain.el
index 693e5eb..3008ad5 100644
--- a/chess-plain.el
+++ b/chess-plain.el
@@ -70,7 +70,7 @@ modify `chess-plain-piece-chars' to avoid real confusion.)"
(defun chess-plain-handler (event &rest args)
(cond
- ((eq event 'initialize) t)
+ ((eq event 'initialize) (current-buffer))
((eq event 'popup)
(if chess-display-popup
(funcall chess-plain-popup-function)))
diff --git a/chess-sound.el b/chess-sound.el
index e5b0de3..8761f1d 100644
--- a/chess-sound.el
+++ b/chess-sound.el
@@ -62,7 +62,8 @@ See `chess-display-type' for the different kinds of displays."
(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))))
+ (file-executable-p chess-sound-program))
+ (current-buffer)))
((eq event 'move)
(let* ((ply (chess-game-ply chess-display-game