emacs-devel
[Top][All Lists]
Advanced

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

defvaralias


From: Nick Roberts
Subject: defvaralias
Date: Fri, 6 May 2005 16:30:57 +1200

Luc Teirlinck writes:
 > The old docstrings of define-obsolete-{function,variable}-alias
 > contained statements that if no docstring was provided, that is,
 > `(define-obsolete-{function,variable}-alias 'old 'new)', then OLD
 > would get the docstring of NEW, _unless_ it already had one.  This has
 > been replaced with references to the `defalias' and `defvaralias '
 > docs, which have no such "unless" statements.  The "unless" appears to
 > be definitely false in the `function' case.  But it is true in the
 > variable case.  That is because it is false for defalias, but true for
 > defvaralias.

That was my mistake. I looked at the behaviour of defvaralias and assumed
defalias behaved the same way.

 > There are two solutions for the variable case.  Document the fact in
 > the docstring and Elisp documentation of defvaralias, or make
 > defvaralias behave exactly like defalias and get rid of the "unless"
 > behavior.  I prefer the latter.  The patch below would implement
 > it.  I can install if desired.
 > 
 > To be more concrete:
 > 
 > After:
 > 
 > (defvar var1 "DOC1")
 > (defvar var2 "DOC2")
 > (defvaralias 'var1 'var2)

I think if an alias is made only then only one of the variables needs to be
declared.

 > C-h v var1 RET
 > 
 > now shows "DOC1", whereas after the patch below it shows "DOC2", which
 > is behavior consistent with defalias.

As Stefan has pointed out defvaralias has a symmetry in its arguments (unlike
define-obsolete-variable-alias neither) but clearly it would make sense to be
consistent with defalias.

Nick




reply via email to

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