[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: (chess-pgn-mode-map): New variable, split out from... (che
From: |
Mario Lang |
Subject: |
[elpa] 01/01: (chess-pgn-mode-map): New variable, split out from... (chess-pgn-mode): Fix autogenerated docstring to include keymap description. |
Date: |
Sat, 14 Jun 2014 14:56:47 +0000 |
mlang pushed a commit to branch externals/chess
in repository elpa.
commit 08fc4c6b3dc6ef43e2d6891f9dc40344d907126e
Author: Mario Lang <address@hidden>
Date: Sat Jun 14 16:55:00 2014 +0200
(chess-pgn-mode-map): New variable, split out from...
(chess-pgn-mode): Fix autogenerated docstring to include keymap
description.
---
ChangeLog | 4 ++++
chess-pgn.el | 39 +++++++++++++++++++--------------------
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 798ff02..1420d5f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
* Makefile: Adjust and use the predefined MAKEINFO variable from GNU
Make.
* chess-pgn.el (chess-game): Require.
(chess-pgn-parse): Use `rx'.
+ (chess-pgn-mode-map): New variable, split out from...
+ (chess-pgn-mode): Fix autogenerated docstring to include keymap
+ description.
+
* chess-game.el (chess-pgn): Do not require.
(chess-game-to-string, chess-game-from-string): Remove, all callers
updated to use chess-pgn functions directly.
diff --git a/chess-pgn.el b/chess-pgn.el
index 9c9c647..8001c67 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -63,9 +63,7 @@
(require 'chess-message)
(require 'mm-decode)
(require 'mm-view)
-
-(eval-when-compile
- (require 'pcomplete nil t))
+(require 'pcomplete)
(defvar chess-pgn-fill-column 60)
@@ -298,6 +296,18 @@ PGN text."
game)
(chess-error 'could-not-read-pgn))))
+(defvar chess-pgn-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map text-mode-map)
+ (define-key map [(control ?c) (control ?c)] 'chess-pgn-show-position)
+ (define-key map [mouse-2] 'chess-pgn-mouse-show-position)
+
+ ;;(define-key map [(control ?m)] 'chess-pgn-move)
+ ;;(define-key map [space] 'chess-pgn-move)
+ (define-key map [? ] 'chess-pgn-insert-and-show-position)
+ (define-key map [tab] 'chess-pgn-complete-move)
+ map))
+
;;;###autoload
(define-derived-mode chess-pgn-mode text-mode "PGN"
"A mode for editing chess PGN files."
@@ -310,23 +320,12 @@ PGN text."
(if (fboundp 'font-lock-mode)
(font-lock-mode 1))
-
- (let ((map (current-local-map)))
- (define-key map [(control ?c) (control ?c)] 'chess-pgn-show-position)
- (define-key map [mouse-2] 'chess-pgn-mouse-show-position)
-
- ;;(define-key map [(control ?m)] 'chess-pgn-move)
- ;;(define-key map [space] 'chess-pgn-move)
- (define-key map [? ] 'chess-pgn-insert-and-show-position)
-
- (when (require 'pcomplete nil t)
- (set (make-local-variable 'pcomplete-default-completion-function)
- 'chess-pgn-completions)
- (set (make-local-variable 'pcomplete-command-completion-function)
- 'chess-pgn-completions)
- (set (make-local-variable 'pcomplete-parse-arguments-function)
- 'chess-pgn-current-word)
- (define-key map [tab] 'chess-pgn-complete-move))))
+ (set (make-local-variable 'pcomplete-default-completion-function)
+ 'chess-pgn-completions)
+ (set (make-local-variable 'pcomplete-command-completion-function)
+ 'chess-pgn-completions)
+ (set (make-local-variable 'pcomplete-parse-arguments-function)
+ 'chess-pgn-current-word))
;;;###autoload
(defalias 'pgn-mode 'chess-pgn-mode)