Ronan Waide <[EMAIL PROTECTED]> writes:

> to query the signature of a lisp function programmatically,
> i.e. determine how many parameters it's expecting?

Ripped from describe-function-1 in Emacs 20.7:

(defun arglist (function)
  (let* ((def (if (symbolp function)
                  (symbol-function function)
                function)))
    (setq def (indirect-function def))
    ;; If definition is a macro, find the function inside it.
    (if (eq (car-safe def) 'macro)
        (setq def (cdr def)))
    (let ((arglist (cond ((byte-code-function-p def)
                          (car (append def nil)))
                         ((eq (car-safe def) 'lambda)
                          (nth 1 def))
                         (t t))))
        arglist)))

Some examples:

(arglist 'kill-buffer)
(arglist 'bbdb)
(arglist 'describe-function-1)
(arglist 'when)

Dunno about XEmacs.

Alex.
-- 
http://www.geocities.com/kensanata/emacs.html
http://www.emacswiki.org/

_______________________________________________
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to