emacs-devel
[Top][All Lists]
Advanced

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

Re: doc elisp intro cross reference fixes


From: David Kastrup
Subject: Re: doc elisp intro cross reference fixes
Date: 28 Nov 2003 21:08:32 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Luc Teirlinck <address@hidden> writes:

> David Kastrup wrote:
> 
>    defcustoms can get impossible if we are talking about describing
>    recursive data structures.  There is no way to customize something
>    that can result in (+ (* (- 3 5) 2) 5) or so except by giving up
>    completely and allowing a general Lisp expression.
> 
> Does this contradict what I said?
> 
> :type 'sexp
> 
> is perfectly acceptable and would appear to do what you want.

It does not offer me checkboxes for choosing between + - * /.  It
does not offer me any possibility at all to give the user of
customize an idea what kind of data structure would be allowed.  For
example, I have the following in preview-latex:

    (defconst preview-expandable-string
      ((lambda (f) (funcall f (funcall f 'sexp)))
       (lambda (x)
         `(choice
           string
           (repeat :tag "Concatenate"
            (choice
             string
             (cons :tag "Separated list" (string :tag "Separator") ,x)
             (symbol :tag "Indirect variable (no separator)")))
           (symbol :tag "Indirect variable (with separator)"))))
      "Type to be used for `preview-string-expand'.
    Just a hack until we get to learn how to do this properly.
    Recursive definitions are not popular with Emacs,
    so we define this type just two levels deep.  This
    kind of expandible string can either be just a string, or a
    cons cell with a separator string in the CAR, and either
    an explicit list of elements in the CDR, or a symbol to
    be consulted recursively.")

    (defcustom preview-default-preamble
      '("\\RequirePackage[" ("," . preview-default-option-list)
                                          "]{preview}")
      "*Specifies default preamble code to add to a LaTeX document.
    If the document does not itself load the preview package, that is,
    when you use preview on a document not configured for preview, this
    list of LaTeX commands is inserted just before \\begin{document}."
      :group 'preview-latex
      :type preview-expandable-string)


What one would actually need would be

    (defconst preview-expandable-string
      ((lambda (f) (funcall f (funcall f (funcall f (funcall f (...)))))))

I actually tried being smart and spliced together a self-referential
data structure for preview-expandable-string via setcar/setcdr that
would look just like that, but customize died a horrible death when I
threw it at it.

The purpose of customize is not to make things just sexp when they
get complicated.  It is exactly when things get complicated that the
user needs to be lead by his hand.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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