emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bugs caused by recent use of define-derived-mode


From: Luc Teirlinck
Subject: Re: Bugs caused by recent use of define-derived-mode
Date: Tue, 10 Sep 2002 23:30:07 -0500 (CDT)

Richard Stallman wrote:

   If a user manually creates a separate abbrev table for Mail mode, I
   think he will find it easy to understand the results of initializing
   it as a copy of the Text mode abbrev table.  As a form of
   "inheritance", it is inadequate, but if thought of as "copying", the
   user will think it works fine.

   So I think we should provide a function copy-abbrev-table which the
   user could call to make a copy of text-mode-abbrev-table for use in
   Mail mode.

Once the table is defined, the user could also "initialize" by killing
and yanking using M-x edit-abbrevs.  However, the function you suggest
would be more convenient.

If I understand you correctly, this would be strictly for
initialization.

There might actually be a way to relatively easily provide for
automatic updating similar to the present system, but in a bug-free
and unambiguous way.  It seems to require a lot less work than any other
solution we have been discussing.  I believe I might be able to
implement it myself, if desired, although I might first have to check
whether I am not underestimating certain difficulties.  I could not
promise anything before actually having done it.

The price to pay would be a moderate amount of added code and the need
to explain to non Lisp programmers how to set everything up in their
.emacs.  The code could either be added to abbrev.el or go into
a separate small new file. 

One way to achieve bug-free updating might conceivably be to use a new
variable, say inheriting-abbrev-table-list, whose value is a list of
abbrev tables, and two new commands: modified versions of
add-mode-abbrev and inverse-add-mode-abbrev.  The user could then
rebind C-x a l and C-x a i l to those new commands in the modes
involved (in our example, text-mode).

The behavior would be the following.

The user could, say, define a separate mail-mode-abbrev-table,
plain-tex-mode-abbrev-table and latex-mode-abbrev-table and set
inheriting-abbrev-table-list locally in text-mode to a list of these
three tables.  Then (s)he rebinds C-x a (i) l in text-mode to the new
modified variants.  The effect is that any abbrev defined using C-x a
(i) l in text-mode gets automatically inherited by these three
abbrev-tables, except when the abbrev already has an expansion in some
of these tables.  Then the commands ask the user whether (s)he wants
to redefine the abbrev, printing the mode involved.

The user could also keep the usual C-x a (i) l bindings and bind the
new commands to other key sequences of his or her choice.  That way
(s)he can decide on a case by case basis whether or not the abbrev
should be inherited by related modes.

Abbrevs defined using M-x edit-abbrevs would remain the user's
responsibility.  (S)he is already editing that buffer anyway, so it is
relatively easy to kill and yank.

Sincerely,

Luc.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]