summaryrefslogtreecommitdiff
path: root/chess-pgn.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-08 03:57:32 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-08 03:57:32 +0000
commit0d6259a7e56089d3ca25a53ad290b7c27baa0157 (patch)
tree97eec61825d32d75e6d9c023d1407273f9cefe88 /chess-pgn.el
parentf3fb03223eb03e1a362dbae4c1b48f8e07a48c0e (diff)
Beautify output
Diffstat (limited to 'chess-pgn.el')
-rw-r--r--chess-pgn.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/chess-pgn.el b/chess-pgn.el
index 5437a6d..cd02371 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -9,6 +9,8 @@
(require 'chess-algebraic)
(require 'chess-fen)
+(defvar chess-pgn-fill-column 60)
+
(defun chess-pgn-read-plies (game position &optional top-level)
(let ((plies (list t)) prevpos done)
(while (not (or done (eobp)))
@@ -71,7 +73,7 @@
(defun chess-pgn-insert-annotations (game index ply)
(dolist (ann (chess-pos-annotations (chess-ply-pos ply)))
(if (stringp ann)
- (insert (format " {%s}" ann))
+ (insert "\n{" ann "}")
(assert (listp ann))
(chess-pgn-insert-plies game index ann))))
@@ -81,6 +83,8 @@
(while plies
(unless for-black
(when (chess-ply-changes (car plies))
+ (if (> (current-column) chess-pgn-fill-column)
+ (insert ?\n))
(insert (format "%d. %s" index (chess-ply-to-algebraic (car plies))))
(unless no-annotations
(chess-pgn-insert-annotations game index (car plies))))
@@ -88,6 +92,8 @@
(when plies
(when (chess-ply-changes (car plies))
(when for-black
+ (if (> (current-column) chess-pgn-fill-column)
+ (insert ?\n))
(insert (format "%d. ..." index))
(setq for-black nil))
(insert (format " %s" (chess-ply-to-algebraic (car plies))))
@@ -113,8 +119,7 @@ If INDENTED is non-nil, indent the move texts."
(insert ?\n)
(let ((begin (point)))
(chess-pgn-insert-plies game 1 (chess-game-plies game))
- (insert (or (chess-game-tag game "Result") "*") ?\n)
- (fill-region begin (point))))
+ (insert (or (chess-game-tag game "Result") "*") ?\n)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;