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: Mon, 2 Sep 2002 21:04:52 -0500 (CDT)

   > bug.)  There actually was a related "nuisance feature" for
   > syntax-tables, but since Stefan's patch can be used for that one too,
   > I do not see any reason to expand on this.

   I'd love for you to expand on it.  So you're saying that the default
   behavior of `define-derived-mode' w.r.t syntax-tables introduces problem
   but that using

           (defvar foo-mode-syntax-table bar-mode-syntax-table)
           (define-derived-mode foo-mode bar-mode "foo" "doc")

   works around the problem ?  Could you describe the problem ?

Maybe we disagree again on whether it actually is a problem or not.  I
believe it is, even though the absence of an analogue of M-x list-abbrevs
for syntax-tables makes it less serious than the analogous problem for
abbrev-tables.  Just to clear up in advance the main thing that seems
to be confusing you: it has absolutely nothing to do with inheritance.

>From the "unpatched" mailabbrev:

(define-derived-mode mail-mode text-mode "Mail"
  "Long Docstring"
  (setq local-abbrev-table text-mode-abbrev-table)

What is the problem here?
Your macro defined a mail-mode-abbrev-table.
The first line of the body makes this mail-mode-abbrev-table into
never to be collected garbage.  The existence of this garbage variable
may confuse the user, who might not realize that it is garbage.
The fact that M-x list-abbrevs lists the garbage variable makes it
easier for the user to get confused, but there are other ways the user
could discover about this variable and get confused.

If I would replace 

(setq local-abbrev-table text-mode-abbrev-table)

with

(set-syntax-table text-mode-syntax-table)

then I would equally well reduce the mail-mode-syntax-table, already
defined at this stage by the macro, into never to be collected
garbage.  There are ways for the user to come into contact with this
variable and get confused by it, although I must admit that the
absence of a M-x list-abbrevs analogue for syntax-tables makes this
less likely.

(defvar mail-mode-syntax-table text-mode-syntax-table)

would make take away the uncollectible garbage status of
mail-mode-syntax-table as well as any danger of misleading the user.

Sincerely,

Luc.


  




reply via email to

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