From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help Subject: Want some advice on defcustom. Association list? Date: Sat, 25 Mar 2006 00:59:04 +0100 Message-ID: <442487C8.8030509@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1143244782 17124 80.91.229.2 (24 Mar 2006 23:59:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Mar 2006 23:59:42 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 25 00:59:38 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FMwBt-0007HR-Cn for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Mar 2006 00:59:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMwBs-0006Hl-JV for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Mar 2006 18:59:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FMwBQ-0006F0-Af for help-gnu-emacs@gnu.org; Fri, 24 Mar 2006 18:59:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FMwBP-0006DW-8H for help-gnu-emacs@gnu.org; Fri, 24 Mar 2006 18:59:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FMwBP-0006DO-0n for help-gnu-emacs@gnu.org; Fri, 24 Mar 2006 18:59:07 -0500 Original-Received: from [81.228.11.159] (helo=pne-smtpout2-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FMwCK-0000AQ-6m for help-gnu-emacs@gnu.org; Fri, 24 Mar 2006 19:00:04 -0500 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout2-sn1.fre.skanova.net (7.2.070) id 43F9B8E9007F0580 for help-gnu-emacs@gnu.org; Sat, 25 Mar 2006 00:59:05 +0100 User-Agent: Thunderbird 1.5 (Windows/20051201) Original-To: "help-gnu-emacs@gnu.org" X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:33976 Archived-At: I would be glad for some advice about what I think is a rather difficult defcustom. In html-site.el I have a definition of a "web sites", defcustom html-site-list. A "web site" has many different properties, like local location on the users pc, web url, ftp url etc. Unfortunately I found myself adding more and more properties to "web sites". This creates a compatibility problem which I would like to avoid. Does anyone have good suggestions for implementing html-site-list so I can avoid this? The current definition looks like this (see also http://ourcomments.org/Emacs/DL/elisp/nxhtml/single-files/): defcustom html-site-list nil "Known site directories and corresponding attributes." :type '(repeat (list (string :tag "*** Site name ***") (directory :tag "Site root directory") (file :tag "Page list file") (file :tag "Frames file") (file :tag "Contents file for frames") (directory :tag "Output directory for pages with TOC" :help-echo "Where to put the merged files") (file :tag "Template file for pages with TOC" :help-echo "HTML template for merging") (choice :tag "Extra function for pages with TOC" (const nil :tag "Default function") (function) ) (string :tag "Ftp host address") (string :tag "Ftp user") (string :tag "Ftp password") (string :tag "Ftp directory root") (string :tag "Ftp directory root for pages with TOC") (string :tag "Web host address") (string :tag "Web directory root") (string :tag "Web directory root for pages with TOC") )) :set (lambda(symbol value) (dolist (e value) (let ( (name (elt e 0)) (site-dir (elt e 1)) (pag-file (elt e 2)) (frm-file (elt e 3)) (toc-file (elt e 4)) (out-dir (elt e 5)) (tpl-file (elt e 6)) (fun (elt e 7)) (ftp-host (elt e 8)) (ftp-user (elt e 9)) (ftp-pw (elt e 10)) (ftp-dir (elt e 11)) (ftp-wtoc-dir (elt e 12)) (web-host (elt e 13)) (web-dir (elt e 14)) (web-wtoc-dir (elt e 15)) ) ;;(message "%s, %s" site-dir out-dir)(sit-for 2) (unless (file-directory-p site-dir) (error "Site directory not found: %s" site-dir)) ;; (unless (file-exists-p pag-file) ;; (error "Pages list file does not exist: %s" pag-file)) ;; (unless (file-exists-p tpl-file) ;; (error "Template file does not exist: %s" tpl-file)) (html-site-chk-outdir out-dir site-dir) (when fun (unless (functionp fun) (error "Unknown function: %s" fun))) )) (set-default symbol value)) :group 'html-site) ;