unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using custom as a type checker:- ramble
@ 2003-03-25 18:22 Phillip Lord
  2003-03-26 16:17 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Phillip Lord @ 2003-03-25 18:22 UTC (permalink / raw)





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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-03-27 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-25 18:22 Using custom as a type checker:- ramble Phillip Lord
2003-03-26 16:17 ` Stefan Monnier
2003-03-26 16:59   ` Phillip Lord
2003-03-26 19:14     ` Stefan Monnier
2003-03-27 10:25       ` Phillip Lord
2003-03-27 16:32         ` Stefan Monnier
2003-03-27 17:11           ` Phillip Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).