unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Want some advice on defcustom. Association list?
@ 2006-03-24 23:59 Lennart Borgman
  0 siblings, 0 replies; only message in thread
From: Lennart Borgman @ 2006-03-24 23:59 UTC (permalink / raw)


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)

;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-24 23:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-24 23:59 Want some advice on defcustom. Association list? Lennart Borgman

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).