[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnugo.el diff: 1.24 -> 1.26
From: |
Thien-Thi Nguyen |
Subject: |
gnugo.el diff: 1.24 -> 1.26 |
Date: |
Tue, 28 Jan 2003 18:37:08 -0800 |
please find below a diff for gnugo.el that fixes some of the shoddy
integration work previously posted -- sorry for the noise. there are
still bugs but it is at least playable. the first bug i am betting is
an emacs bug, actually. (to reproduce it, just toggle to image-display
mode and evaluate (point) after moving to the apparent point-min; i see
1 but expect 45.)
thi
____________
2003-01-28
* gnugo.el: Add testing info and BUGS in commentary.
(gnugo-showboard): When using images, don't render "()"
last-pos marker, and use a more sane spacing offset for
captured stones info.
(gnugo-assign-images): Add initial pass to mark everything
except newlines as `bye'. No longer set `gnugo-assign-images'
text property.
(gnugo-toggle-image-display): Consult `gnugo-image-key' text
property directly instead of `gnugo-assign-images'. Rewrite
display pass to handle three cases: `bye', non-nil xpm key,
and nil.
2003-01-10
* gnugo.el (gnugo-toggle-image-display): Fix "fboundp" typo.
Fix caller sig error: remove arg to gnugo-assign-images.
* mokuxpms/make-xpms-file.el (make-xpms-file):
Also include `provide' form.
______________________________________________
*** gnugo.el 2003/01/10 23:41:35 1.24
--- gnugo.el 2003/01/29 00:10:52 1.26
***************
*** 17,23 ****
;;
;; Customization is presently limited to `gnugo-animation-string', q.v.
;;
! ;; This code was tested with Emacs 20.7 on a monochrome 80x24 terminal.
;;
;; For updates, see directory: http://www.glug.org/alt/gnugo/
--- 17,29 ----
;;
;; Customization is presently limited to `gnugo-animation-string', q.v.
;;
! ;; This code was tested with Emacs 21.3.50.8 and GNU Go 3.3.15.
! ;;
! ;; BUGS:
! ;; - When using XPMs to display board,
! ;; - stone cannot be placed in top row.
! ;; - dead-groups toggling not implemented.
! ;; - animation (dragons/worms) not implemented.
;;
;; For updates, see directory: http://www.glug.org/alt/gnugo/
***************
*** 123,129 ****
(defun gnugo-showboard ()
(interactive)
! (let ((board (cdr (gnugo-synchronous-send/return "showboard")))
white-captures black-captures)
(with-current-buffer (get 'gnugo 'bbuf)
(delete-region (point-min) (point-max))
--- 129,136 ----
(defun gnugo-showboard ()
(interactive)
! (let ((imagep (get 'gnugo 'display-using-images))
! (board (cdr (gnugo-synchronous-send/return "showboard")))
white-captures black-captures)
(with-current-buffer (get 'gnugo 'bbuf)
(delete-region (point-min) (point-max))
***************
*** 138,144 ****
(goto-char (point-max))
(move-to-column-force (get 'gnugo 'board-cols))
(delete-region (point) (point-max))
! (when (get 'gnugo 'display-using-images)
(put 'gnugo 'display-using-images nil) ; ugh
(gnugo-toggle-image-display))
(let (pos)
--- 145,151 ----
(goto-char (point-max))
(move-to-column-force (get 'gnugo 'board-cols))
(delete-region (point) (point-max))
! (when imagep
(put 'gnugo 'display-using-images nil) ; ugh
(gnugo-toggle-image-display))
(let (pos)
***************
*** 152,160 ****
(setq pos (and (not (string= "PASS" move)) move))
(format "%s: %s (%s to play)\n%scaptures: black %s white %s"
color move (gnugo-other color)
! (make-string (get 'gnugo 'board-cols) 32) ; space
black-captures white-captures)))))
! (when pos
(gnugo-goto-pos pos)
(delete-char -1) (insert "(")
(forward-char 1) (delete-char 1) (insert ")")))
--- 159,170 ----
(setq pos (and (not (string= "PASS" move)) move))
(format "%s: %s (%s to play)\n%scaptures: black %s white %s"
color move (gnugo-other color)
! (make-string (if imagep
! 6
! (get 'gnugo 'board-cols))
! 32) ; space
black-captures white-captures)))))
! (when (and pos (not imagep))
(gnugo-goto-pos pos)
(delete-char -1) (insert "(")
(forward-char 1) (delete-char 1) (insert ")")))
***************
*** 495,500 ****
--- 505,518 ----
(Z-col (+ A-col (* 2 (1- size))))
(top-line 2)
(bot-line (+ top-line (1- size))))
+ (goto-line (1+ bot-line))
+ (re-search-forward "\\([A-Z] \\)+[A-Z] [A-Z]")
+ (put-text-property (point-min) (point) 'gnugo-image-key 'bye)
+ (let (first)
+ (while (search-backward "\n" (point-min) t)
+ (setq first (point))
+ (remove-text-properties (point) (1+ (point)) '(gnugo-image-key nil)))
+ (put-text-property first (1+ first) 'gnugo-image-key 'bye))
(let ((line top-line))
(goto-line line)
(while (<= line bot-line)
***************
*** 518,534 ****
(?X (if lastp 'bpmoku 'bmoku))
(?O (if lastp 'wpmoku 'wmoku))
(t (error "badness"))))))
! (put-text-property p (1+ p) 'gnugo-image-key (cons type place))
! (put-text-property (+ 1 p) (+ 2 p) 'gnugo-image-key 'bye))
(setq col (+ 2 col))
(forward-char 2)))
(setq line (1+ line))
! (forward-line 1)))
! (put-text-property 1 2 'gnugo-assign-images t)))
(defun gnugo-toggle-image-display ()
(interactive)
! (unless (and (boundp 'display-images-p) (display-images-p))
(error "Display does not support images, sorry"))
(require 'gnugo-xpms)
(save-excursion
--- 536,550 ----
(?X (if lastp 'bpmoku 'bmoku))
(?O (if lastp 'wpmoku 'wmoku))
(t (error "badness"))))))
! (put-text-property p (1+ p) 'gnugo-image-key (cons type place)))
(setq col (+ 2 col))
(forward-char 2)))
(setq line (1+ line))
! (forward-line 1)))))
(defun gnugo-toggle-image-display ()
(interactive)
! (unless (and (fboundp 'display-images-p) (display-images-p))
(error "Display does not support images, sorry"))
(require 'gnugo-xpms)
(save-excursion
***************
*** 538,565 ****
(point-min) (point-max)
'(display nil invisible nil intangible nil))
(put 'gnugo 'display-using-images nil))
! (let ((p (point-min)))
! (unless (get-text-property 1 'gnugo-assign-images)
! (gnugo-assign-images (get 'gnugo 'board-size)))
(goto-char p)
! (while (setq p (next-single-property-change p 'gnugo-image-key))
! (let ((key (get-text-property p 'gnugo-image-key)))
! (if (eq 'bye key)
! (add-text-properties p (1+ p) '(invisible t intangible t))
! (put-text-property p (1+ p) 'display
! (cdr (assoc key gnugo-xpms)))))
! (goto-char p)))
! (let (all)
! (push (cons (point) (progn (beginning-of-line) (point))) all)
! (goto-char (point-min))
! (push (cons (point) (progn (end-of-line) (1+ (point)))) all)
! (while (re-search-forward "^\\( *[0-9]+ \\)[^0-9]*\\([0-9]+\\)$"
! (point-max) t)
! (push (cons (match-beginning 1) (match-end 1)) all)
! (push (cons (match-beginning 2) (match-end 2)) all))
! (dolist (b-e all)
! (add-text-properties (car b-e) (cdr b-e)
! '(invisible t intangible t))))
(put 'gnugo 'display-using-images t))))
;;;---------------------------------------------------------------------------
--- 554,575 ----
(point-min) (point-max)
'(display nil invisible nil intangible nil))
(put 'gnugo 'display-using-images nil))
! (unless (get-text-property 1 'gnugo-image-key)
! (gnugo-assign-images))
! (let ((p (point-min)) (key 'bye))
(goto-char p)
! (while (and
! (setq q (next-single-property-change p 'gnugo-image-key))
! (not (= (point-max) q)))
! (goto-char q)
! (cond ((eq 'bye key)
! (add-text-properties p q '(invisible t intangible t)))
! (key
! (put-text-property p q 'display
! (cdr (assoc key gnugo-xpms))))
! (t nil))
! (setq p q
! key (get-text-property q 'gnugo-image-key))))
(put 'gnugo 'display-using-images t))))
;;;---------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnugo.el diff: 1.24 -> 1.26,
Thien-Thi Nguyen <=