From mboxrd@z Thu Jan 1 00:00:00 1970
Path: main.gmane.org!not-for-mail
From: Phillip Lord
Newsgroups: gmane.emacs.help
Subject: Using custom as a type checker:- ramble
Date: 25 Mar 2003 18:22:54 +0000
Organization: BIOSCI/MRC Human Genome Mapping Project Resource Centre
Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org
Message-ID:
NNTP-Posting-Host: main.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: main.gmane.org 1048678134 26964 80.91.224.249 (26 Mar 2003 11:28:54 GMT)
X-Complaints-To: usenet@main.gmane.org
NNTP-Posting-Date: Wed, 26 Mar 2003 11:28:54 +0000 (UTC)
Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 26 12:28:52 2003
Return-path:
Original-Received: from monty-python.gnu.org ([199.232.76.173])
by main.gmane.org with esmtp (Exim 3.35 #1 (Debian))
id 18y95Q-00070O-00
for ; Wed, 26 Mar 2003 12:28:52 +0100
Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org)
by monty-python.gnu.org with esmtp (Exim 4.10.13)
id 18y8ya-0007TT-06
for gnu-help-gnu-emacs@m.gmane.org; Wed, 26 Mar 2003 06:21:48 -0500
Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!fu-berlin.de!server1.netnews.ja.net!hgmp.mrc.ac.uk!not-for-mail
Original-Newsgroups: gnu.emacs.help
Original-Lines: 58
Original-NNTP-Posting-Host: bromine.hgmp.mrc.ac.uk
Original-X-Trace: niobium.hgmp.mrc.ac.uk 1048677493 22120 193.62.192.35 (26 Mar 2003
11:18:13 GMT)
Original-X-Complaints-To: news@net.bio.net
Original-NNTP-Posting-Date: Wed, 26 Mar 2003 11:18:13 +0000 (UTC)
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.93
Original-Xref: shelby.stanford.edu gnu.emacs.help:111408
Original-To: help-gnu-emacs@gnu.org
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Help:
List-Post:
List-Subscribe: ,
List-Archive:
List-Unsubscribe: ,
Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org
Xref: main.gmane.org gmane.emacs.help:7908
X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7908
One of the really nice things about custom is that it provides a
degree of type checking for lisp variables. This is particularly nice
for settings variables, as these are often easy to get wrong, if you
do not know the underlying code base. Should you have a int? Or a
string? Or a list? Or what. Custom gets around these problems by
constraining the user at the time they change the value.
More over custom is quite clever about this. If you set the variable
up elsewhere, or a variable changes its type, custom displays
"mismatch" in the custom window.
However, custom has some disadvantages over the old "type lots of
(setq) forms into your .emacs". It's harder to comment settings
So for instance....
;;this variable controls completion. i never want to edit
;;.class files so i may as well ignore them
(add-to-list 'completion-ignored-extensions ".class" )
Also I can look at a package, and see just those variables I have need
to change. I can grep for the changes I have made. I can version my
changes more easily, by sticking my .emacs into cvs.
And finally I can do fairly complex conditional logic, so ....
if I am using emacs over X, onto a small screen, set
compilation-window-height to 4, else make it big.
All hard to do in custom.
Now what I would want to do is combine the two. So have something like
(custom-setq compilation-window-height)
Where custom-setq would use the custom mechanism to set a variable. If
it was of the wrong type (so would display "mismatch" in the dialog),
then at this point an error would be signalled. This way I would have
most of the advantages of both systems. I could do conditional logic,
I could comment, I could grep, and so on. But I would also get good
"type safety."
Now I realise that this is not what custom was intended for, but a lot
of the information that its necessary for it to work has already been
put into all the emacs packages. It seems to me that this could be
very useful indeed.
Does this make any sense?
Cheers
Phil