comparison lisp/emacs-lisp/advice.el @ 73251:25e1db3fd0ed

(ad-remove-advice, ad-parse-arglist, ad-make-mapped-call): Use `let', not `let*'.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 05 Oct 2006 15:53:30 +0000
parents b920ab84fba8
children 1d4b1a32fd66 8dd8c8286063
comparison
equal deleted inserted replaced
73250:cec4203a5097 73251:25e1db3fd0ed
2407 "Remove FUNCTION's advice with NAME from its advices in CLASS. 2407 "Remove FUNCTION's advice with NAME from its advices in CLASS.
2408 If such an advice was found it will be removed from the list of advices 2408 If such an advice was found it will be removed from the list of advices
2409 in that CLASS." 2409 in that CLASS."
2410 (interactive (ad-read-advice-specification "Remove advice of")) 2410 (interactive (ad-read-advice-specification "Remove advice of"))
2411 (if (ad-is-advised function) 2411 (if (ad-is-advised function)
2412 (let* ((advice-to-remove (ad-find-advice function class name))) 2412 (let ((advice-to-remove (ad-find-advice function class name)))
2413 (if advice-to-remove 2413 (if advice-to-remove
2414 (ad-set-advice-info-field 2414 (ad-set-advice-info-field
2415 function class 2415 function class
2416 (delq advice-to-remove (ad-get-advice-info-field function class))) 2416 (delq advice-to-remove (ad-get-advice-info-field function class)))
2417 (error "ad-remove-advice: `%s' has no %s advice `%s'" 2417 (error "ad-remove-advice: `%s' has no %s advice `%s'"
2745 (defun ad-parse-arglist (arglist) 2745 (defun ad-parse-arglist (arglist)
2746 "Parse ARGLIST into its required, optional and rest parameters. 2746 "Parse ARGLIST into its required, optional and rest parameters.
2747 A three-element list is returned, where the 1st element is the list of 2747 A three-element list is returned, where the 1st element is the list of
2748 required arguments, the 2nd is the list of optional arguments, and the 3rd 2748 required arguments, the 2nd is the list of optional arguments, and the 3rd
2749 is the name of an optional rest parameter (or nil)." 2749 is the name of an optional rest parameter (or nil)."
2750 (let* (required optional rest) 2750 (let (required optional rest)
2751 (setq rest (car (cdr (memq '&rest arglist)))) 2751 (setq rest (car (cdr (memq '&rest arglist))))
2752 (if rest (setq arglist (reverse (cdr (memq '&rest (reverse arglist)))))) 2752 (if rest (setq arglist (reverse (cdr (memq '&rest (reverse arglist))))))
2753 (setq optional (cdr (memq '&optional arglist))) 2753 (setq optional (cdr (memq '&optional arglist)))
2754 (if optional 2754 (if optional
2755 (setq required (reverse (cdr (memq '&optional (reverse arglist))))) 2755 (setq required (reverse (cdr (memq '&optional (reverse arglist)))))
2956 (nthcdr (length target-reqopt-args) 2956 (nthcdr (length target-reqopt-args)
2957 source-reqopt-args))))))))) 2957 source-reqopt-args)))))))))
2958 2958
2959 (defun ad-make-mapped-call (source-arglist target-arglist target-function) 2959 (defun ad-make-mapped-call (source-arglist target-arglist target-function)
2960 "Make form to call TARGET-FUNCTION with args from SOURCE-ARGLIST." 2960 "Make form to call TARGET-FUNCTION with args from SOURCE-ARGLIST."
2961 (let* ((mapped-form (ad-map-arglists source-arglist target-arglist))) 2961 (let ((mapped-form (ad-map-arglists source-arglist target-arglist)))
2962 (if (eq (car mapped-form) 'funcall) 2962 (if (eq (car mapped-form) 'funcall)
2963 (cons target-function (cdr (cdr mapped-form))) 2963 (cons target-function (cdr (cdr mapped-form)))
2964 (prog1 mapped-form 2964 (prog1 mapped-form
2965 (setcar (cdr mapped-form) (list 'quote target-function)))))) 2965 (setcar (cdr mapped-form) (list 'quote target-function))))))
2966 2966