-(defvar default-key-translation-map
- (or key-translation-map (make-sparse-keymap))
- "Key translation you want to have effect, regardless of double mode.
-This will default to the value of `key-translation-map' when double was
-first loaded.")
-
-(make-variable-buffer-local 'key-translation-map)
-
-(defun double-setup ()
- ;; Setup key-translation-map as indicated by `double-map'.
- (setq key-translation-map (copy-keymap default-key-translation-map))
- (mapcar (function (lambda (entry)
- (define-key key-translation-map (vector (nth 0 entry))
- 'double-translate-key)))
- (append double-map '((magic-start) (magic-end)))))
+(defun double-setup (enable-flag)
+ (if enable-flag
+ (progn
+ ;; Set up key-translation-map as indicated by `double-map'.
+ (kill-local-variable 'key-translation-map)
+ (make-local-variable 'key-translation-map)
+ (setq key-translation-map (if (keymapp key-translation-map)
+ (copy-keymap key-translation-map)
+ (make-sparse-keymap)))
+ (mapcar (function (lambda (entry)
+ (define-key key-translation-map
+ (vector (nth 0 entry))
+ 'double-translate-key)))
+ (append double-map '((magic-start) (magic-end)))))
+ (kill-local-variable 'key-translation-map)))