Subject: further analysis of the problem

From: [email-masked]
Date: Mon, 04 Jul 2011 20:50:32 -0700

I did some further investigation and have more information to share.

The recent change made in `define-derived-mode' adds :parents abbrev
property to the derived mode's abbrev table, e.g.,
`lisp-interaction-mode-abbrev-table'.  Unfortunately this results in
cyclic data where :parent abbrev property of
lisp-interaction-mode-abbrev-table is itself, i.e., the following is
true:

  (eq 
   lisp-interaction-mode-abbrev-table
   (car (abbrev-table-get lisp-interaction-mode-abbrev-table :parents)))

This cyclic relationship (i.e., being its own parent) causes infinite
loop within `abbrev-symbol' which has code similar to this:

  (while tables
    (setq table (pop tables))
    (setq tables (append (abbrev-table-get table :parents) tables))
    ...)

This loop within `abbrev-symbol' in conjunction with
lisp-interaction-mode-abbrev-table being its own parent causes the
infinite loop.

Why is `lisp-interaction-mode-abbrev-table' its own parent?
I think the answer is that the following items have something to do with
it.

A. lisp-interaction-mode and emacs-lisp-mode are both defined via 
   define-derived-mode macro.

B. Both modes call `lisp-mode-variables' utility function which sets
   local-abbrev-table.

C. define-derived-mode macro uses local-abbrev-table as the value of
   parent *before* setting it, i.e., it uses the value of
   local-abbrev-table (whatever it is) as the parent!

I hope this helps.