help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Want some advice on defcustom. Association list?


From: Lennart Borgman
Subject: Want some advice on defcustom. Association list?
Date: Sat, 25 Mar 2006 00:59:04 +0100
User-agent: Thunderbird 1.5 (Windows/20051201)

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)

;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]