damerell@NSFNET-RELAY.AC.UK (Dr R M Damerell, RHBNC) (05/07/89)
I am trying to write something in GNU Emacs Lisp and would much appreciate advice: 1. The Manual says defvar defines a global variable intended to be advert- ised to users. What is the proper way to define ditto NOT to be advertised? 2. If 2 separate E-Lisp files define variables (etc) of same name, that sets up an interaction between them that will surely create all sorts of insidious bugs. Is there any program that searches a set of files for such multiple definitions? Thank you, Mark. Jesus is the saviour of the world.
mcgrath@paris.Berkeley.EDU (Roland McGrath) (05/08/89)
In article <8905071551.AA21768@AENEAS.MIT.EDU> damerell@NSFNET-RELAY.AC.UK (Dr R M Damerell, RHBNC) writes:
1. The Manual says defvar defines a global variable intended to be advert-
ised to users. What is the proper way to define ditto NOT to be advertised?
Use `defvar'. If you want something to be a user configuration variable,
begin its docstring with a `*':
(defvar config-var nil "*Foo will happen if non-nil.")
vs
(defvar internal-var nil "Current state of the foobar.")
2. If 2 separate E-Lisp files define variables (etc) of same name, that
sets up an interaction between them that will surely create all sorts of
insidious bugs. Is there any program that searches a set of files for such
multiple definitions?
There is no way to detect this except grepping lisp/*.el for defvar.
A good way to prevent problems is to prefix all the symbols in your package
with something descriptive like `foo-pkg-'.
Jesus is the saviour of the world.
This seems highly unlikely.
--
Roland McGrath
Free Software Foundation, Inc.
roland@wheaties.ai.mit.edu, mit-eddie!wheaties.ai.mit.edu!roland
Copyright 1989 Roland McGrath, under the GNU General Public License, version 1.