[net.emacs] bug in abbrev facility?

mrose%uci-750a@sri-unix.UUCP (02/07/84)

From:  Marshall Rose <mrose@uci-750a>

Does anyone have any ideas on how to handle this:

    You enter abbrev mode and define some local abbrevations.  One of
    them has a hook.  You then write an abbrev file.  If you read back
    in the abbrev file, you don't have the definition for the hook
    anymore, instead you have just the expansion text.

    This can cause bizarre behavior in emacs: you start-up a shell in a
    buffer using a routine that defines "cd" as an abbrev that expands
    to "cd" and calls a hook.  [What the hook does is unimportant to
    this example but important to the user.]  Later on you define some
    abbrevs in another table, unrelated to the shell buffer, and write
    an abbrev file.  This file contains abbrevs for all abbrev tables.
    You then exit emacs.  Later on you start emacs again, start a shell
    in a buffer, and then go to another buffer and do some editing.
    You then innocently read in the abbrev file that you wrote last
    time.  Poof!  The hook is gone for the "cd" abbrev in the shell
    buffer.

    Off hand, I can think of two solutions: 1) if the abbrev has a
    hook associated, don't write it out in the file; 2) if the abbrev
    has a hook associated, write both the expansion text and the name
    of the hook to the file.

Any ideas?  Is there a better way to handle this?

Thanks,

/mtr