[comp.emacs] loadst dies

rbj@dsys.ncsl.nist.GOV (Root Boy Jim) (06/05/89)

? From: att!mcdchg!rave!lynn@cis.ohio-state.edu  (Lynn D. Newton)

? I never had any problem with this before. I can't absolutely
? guarantee that I didn't do something inadvertent to change
? something related in the course of making the upgrade. I did a
? lot of work on my .emacs (248 lines -- too long to quote).

? Any ideas anyone?

Yes, but not specifically on your problem. I merely wish to point
out that 248 lines in your .emacs is too much. Remember that .emacs
is not byte compiled, it is much more efficient to put only (load)'s
in there, plus maybe a few variable settings. Put function definitions
in your lisp directory and byte compile them. Here is my .emacs:

(set-input-mode nil t)
(setq debug-on-error t)
(setq inhibit-startup-message t)
(setq load-path (list (expand-file-name "~rbj/gnu") "/gnu/lisp"))
(load "vars")				; setq only
(load "fns")				; defun, fset, autoload only
;(load "keys")				; def-key only
(load "bondage")			; def-key only
(load "term-hook")			; {sun,vt[12]00,tvi950}-hook
(load "i-search")			; new isearch
(load "find-files")
(load-library "ehelp")			; electric help
(fset 'help-command ehelp-map)		; plug it in
(setq debug-on-error nil)
(put 'eval-expression 	'disabled nil)
(put 'narrow-to-region	'disabled nil)
(put 'narrow-to-page	'disabled nil)

Note also the (put ... 'disabled nil)'s, which was added by emacs itself.
To debug my .emacs, I do `emacs -q .emacs' followed by sequences of
ESC ^X ^N, which executes (eval-defun) and (next-line). Note also
the division between setq's, defun's, and key-bindings.

? =================================================================
? Lynn D. Newton		  | System Test
? Motorola MCD, Tempe, AZ	  | (Department of Heuristic Methodology)
? (602) 437-3739		  | "The bug stops here!"
? lynn@rave.phx.mcd.mot.com |

	Root Boy Jim is what I am
	Are you what you are or what?

tale@pawl.rpi.edu (David C Lawrence) (06/06/89)

In <8906051517.AA01192@dsys.ncsl.nist.gov> rbj@dsys.ncsl.nist.GOV
(Root Boy Jim) writes:
RBJ> Yes, but not specifically on your problem. I merely wish to point
RBJ> out that 248 lines in your .emacs is too much. Remember that .emacs
RBJ> is not byte compiled, it is much more efficient to put only (load)'s
RBJ> in there, plus maybe a few variable settings. Put function definitions
RBJ> in your lisp directory and byte compile them. Here is my .emacs:

Yes and no.   I just checked my .emacs and it is 115 lines of code.
Here is why I don't consider it a problem:

a) it _is_ byte-compiled.  You can have a byte-compiled .emacs ...

  % ls -l .emacs emacs/.emacs*
  lrwxrwxrwx  1 tale           16 Mar 23 17:24 .emacs -> emacs/.emacs.elc
  -rw-r--r--  1 tale         5704 May 15 16:12 emacs/.emacs.el
  -rw-r--r--  1 tale         4175 May 15 16:12 emacs/.emacs.elc

b) The bulk of it (56 lines) is hook definitions.  The hook
definitions are that long because seven of them are lambda
expressions, one of which is 20 lines long (my gnus-Startup-hook,
which makes sure that whichever of my accounts I happen to be on I
will be using my most current .newsrc).

c) The other large grouped areas are variable definitions and key
bindings.  Since I use page-menu-mode, though, I don't need to bother
with breaking all of these things up into seperate files ... managing
them in one file is easy:

  pg  siz  text
   1   72  ;;; setq's and hook defs
   2   10  ;;; Declarations dependent on environment
   3    7  ;;; Enabled commands: eval-expression, narrow-to-region, narrow-to-
   4   22  ;;; Key bindings; most are for autoloaded functions in ~emacs/local
   5   16  ;;; elisp loading and autoloading
   6    6  ;;; Miscellaneous

I do keep two things seperate -- emacs/loadmisc.el and emacs/gnus-etc.el.
loadmisc is defuns.  I don't keep any defuns in my .emacs.  gnus-etc
has all of my variables declared for GNUS, except for gnus-Startup-hook.
That cuts down on overhead some.  It also has some function definitions/
redefinitions to add to/customize GNUS.  It is required in the gnus=
Startup-hook.

So you can have a byte-compiled .emacs and since the file can be made
manageable with some simple organization, there really isn't a
drawback to having a seemingly long .emacs.  I could make my .emacs
424 lines longer if I just put the loadmisc in it instead; the net
effect for Emacs wouldn't be any different.  But I do agree that
modularity is A Good Thing.  I just don't happen to like a bunch of
ten to twenty-five line files in my directory when they can do just as
well as one file.

(For the curious, page 1 is actually just one setq and one setq-default.)

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))