diff options
| -rw-r--r-- | chess-display.el | 8 | ||||
| -rw-r--r-- | chess-engine.el | 8 | ||||
| -rw-r--r-- | chess-pgn.el | 7 |
3 files changed, 17 insertions, 6 deletions
diff --git a/chess-display.el b/chess-display.el index 4f1d004..229a75a 100644 --- a/chess-display.el +++ b/chess-display.el @@ -74,20 +74,22 @@ cause the underlying game object to be shutdown when it is destroyed. If READ-ONLY is non-nil, then the display will not allow the user to makes moves, or any other changes to the underlying game." (let* ((name (symbol-name style)) - (handler (intern-soft (concat name "-handler")))) + (handler (intern-soft (concat name "-handler"))) + buffer) (unless handler (chess-error 'no-such-style name)) (with-current-buffer (generate-new-buffer "*Chessboard*") + (setq buffer (current-buffer)) (chess-display-mode read-only) (when (funcall handler 'initialize) + (add-hook 'kill-buffer-hook 'chess-display-quit nil t) (setq chess-display-style style chess-display-perspective perspective chess-display-event-handler handler) (if main (chess-display-set-main nil)) (chess-display-set-game* nil game) - (add-hook 'kill-buffer-hook 'chess-display-quit nil t) - (current-buffer))))) + buffer)))) (defun chess-display-clone (display style perspective) (let ((new-display (chess-display-create chess-display-game diff --git a/chess-engine.el b/chess-engine.el index d23778d..be48270 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -261,10 +261,13 @@ &rest handler-ctor-args) (let ((regexp-alist (intern-soft (concat (symbol-name module) "-regexp-alist"))) - (handler (intern-soft (concat (symbol-name module) "-handler")))) + (handler (intern-soft (concat (symbol-name module) "-handler"))) + buffer) (with-current-buffer (generate-new-buffer " *chess-engine*") + (setq buffer (current-buffer)) (let ((proc (apply handler 'initialize handler-ctor-args))) (when proc ;must be a process or t + (add-hook 'kill-buffer-hook 'chess-engine-on-kill nil t) (setq chess-engine-regexp-alist (symbol-value regexp-alist) chess-engine-event-handler handler chess-engine-response-handler @@ -277,8 +280,7 @@ (set-process-buffer proc (current-buffer)) (set-process-filter proc 'chess-engine-filter)) (setq chess-engine-current-marker (point-marker)) - (add-hook 'kill-buffer-hook 'chess-engine-on-kill nil t) - (current-buffer)))))) + buffer))))) (defun chess-engine-on-kill () "Function called when the buffer is killed." diff --git a/chess-pgn.el b/chess-pgn.el index a7433e0..10e71e0 100644 --- a/chess-pgn.el +++ b/chess-pgn.el @@ -198,6 +198,13 @@ If INDENTED is non-nil, indent the move texts." ;;;###autoload (add-to-list 'auto-mode-alist '("\\.pgn\\'" . chess-pgn-mode)) +(eval-after-load "mm-decode" + '(unless (fboundp 'mm-display-pgn-inline) + (defun mm-display-pgn-inline (handle) + (mm-display-inline-fontify handle 'chess-pgn-mode)) + (push ("application/x-chess-pgn" mm-display-pgn-inline identity) + mm-inline-media-tests))) + (defun chess-pgn-move () "Make a move from a PGN buffer." (interactive) |
