Function: ad-access-argument

ad-access-argument is a byte-compiled function defined in advice.el.gz.

Signature

(ad-access-argument ARGLIST INDEX)

Documentation

Tell how to access ARGLIST's actual argument at position INDEX.

For a required/optional arg it simply returns it, if a rest argument has to be accessed, it returns a list with the index and name.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/advice.el.gz
(defun ad-access-argument (arglist index)
  "Tell how to access ARGLIST's actual argument at position INDEX.
For a required/optional arg it simply returns it, if a rest argument has
to be accessed, it returns a list with the index and name."
  (let* ((parsed-arglist (ad-parse-arglist arglist))
	 (reqopt-args (append (nth 0 parsed-arglist)
			      (nth 1 parsed-arglist)))
	 (rest-arg (nth 2 parsed-arglist)))
    (cond ((< index (length reqopt-args))
	   (nth index reqopt-args))
	  (rest-arg
	   (list (- index (length reqopt-args)) rest-arg)))))