[comp.emacs] Major mode loading time: dependent on file length?

randy@uw-june.UUCP (William Randy Day) (05/21/87)

I have a major mode that's invoked by the command bibTeX-mode. It does
nothing but invoke tex-mode, define a few keys, local-unset a few key,
and setq a few variables. However, I have noticed that the execution of
this bibTeX-mode command (which is not byte compiled) varies tremendously
with the size of the file in the buffer where I execute the bibTeX-mode
command. Executing the command in an empty buffer is instantanious. Executing
the command in a buffer with 12k of text takes several minutes.

Any ideas why the major mode execution times vary so much?
I'm using GNU emacs, version 18.32. The actual code for bibTeX-mode is
included below:

(defun bibTeX-mode ()
  "bibTeX-mode changes the mode to a style suitable for bibTeX files."
  (interactive)
  (tex-mode)

  (define-key TeX-mode-map "\en" 'next-field)
  (define-key TeX-mode-map "\ej" 'justify-field)
  (define-key TeX-mode-map "\e]" 'next-key)
  (local-unset-key "\"")
  (setq mode-name "BibTeX-mode")
  (setq Key-Search-String "")
  (novalue)
)

Thanks,
Randy Day.
Internet (ARPA): randy@dbnet.cs.washington.edu
CSNET: randy%washington@relay.cs.net
UUCP: {decvax|ihnp4}!uw-beaver!uw-june!randy