summaryrefslogtreecommitdiff
path: root/chess-file.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-file.el')
-rw-r--r--chess-file.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/chess-file.el b/chess-file.el
index dfbd3b6..1f99b58 100644
--- a/chess-file.el
+++ b/chess-file.el
@@ -13,14 +13,17 @@
(cond
((eq event 'open)
(with-current-buffer (find-file-noselect (car args))
- (chess-file-handler 'rescan)
- (current-buffer)))
+ (when (or (string-match "\\.pgn\\'" (car args))
+ (save-excursion
+ (re-search-forward "^\\[Event" nil t)))
+ (chess-file-handler 'rescan)
+ (current-buffer))))
((eq event 'rescan)
(save-excursion
(goto-char (point-min))
(setq chess-file-locations nil)
- (while (search-forward "[Event " nil t)
+ (while (re-search-forward "^\\[Event " nil t)
(goto-char (match-beginning 0))
(push (point) chess-file-locations)
(forward-char 1))