summaryrefslogtreecommitdiff
path: root/chess-pgn.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-pgn.el')
-rw-r--r--chess-pgn.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/chess-pgn.el b/chess-pgn.el
index 67ec901..230dc18 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -66,11 +66,12 @@
(chess-parse-pgn)))
(defun chess-parse-pgn ()
- (when (search-forward "[" nil t)
+ (when (or (looking-at "\\[")
+ (and (search-forward "[" nil t)
+ (goto-char (match-beginning 0))))
(let ((game (chess-game-create)))
- (setcar game nil)
- (backward-char)
- (while (looking-at "^\\s-*\\[\\(\\S-+\\)\\s-+\\(\".+?\"\\)\\][ \t\n]+")
+ (chess-game-set-tags game nil)
+ (while (looking-at "\\[\\(\\S-+\\)\\s-+\\(\".+?\"\\)\\][ \t\n]+")
(chess-game-set-tag game (match-string-no-properties 1)
(read (match-string-no-properties 2)))
(goto-char (match-end 0)))