Subject: Re: bug#7630: 23.2; cannot use view-mode-map in emacs23.2

From: Glenn Morris <[email-masked]>
Date: Mon, 13 Dec 2010 13:47:30 -0500

"WANG Denny" wrote:

> i found i cannot use view-mode-map to define any key to emacs, when
> emacs start up, it always show the invalid view-mode-map error, but this
> .emacs.el file is really working well on my another machine, the
> difference between these two machine is now what i'm reporting error for
> is a windows OS, and the emacs version is 23.2, and the other which
> works well is a nuix OS, and emacs version is 23.1

I don't think this is an Emacs bug. view-mode-map is not defined at
startup in Emacs 23.1 either. You can test this by doing

emacs-23.1 -Q

then immediately evaluating view-mode-map. Many things, including
doing C-h v on a variable will load view.el, so probably something
happens on one system to load it.

If you want to change view-mode-map in your .emacs, you can do it
in various ways:

1)

(eval-after-load "view"
  '(progn
    (define-key view-mode-map ...)
     ...)))

2)

(require 'view)
(define-key view-mode-map ...)
...

3)

(add-hook 'view-mode-hook (lambda ()
   (define-key view-mode-map ...)
     ...))