comparison lisp/emacs-lisp/advice.el @ 22061:eed26995bfad

(ad-handle-definition, defadvice): Fix error messages.
author Richard M. Stallman <rms@gnu.org>
date Thu, 14 May 1998 05:39:59 +0000
parents db005054f15d
children c129b4c40a0c
comparison
equal deleted inserted replaced
22060:530d5f35aa4e 22061:eed26995bfad
3555 ;; different function won't count as such: 3555 ;; different function won't count as such:
3556 (not (ad-advised-definition-p current-definition))) 3556 (not (ad-advised-definition-p current-definition)))
3557 ;; we have a redefinition: 3557 ;; we have a redefinition:
3558 (if (not (memq ad-redefinition-action '(accept discard warn))) 3558 (if (not (memq ad-redefinition-action '(accept discard warn)))
3559 (error "ad-handle-definition (see its doc): `%s' %s" 3559 (error "ad-handle-definition (see its doc): `%s' %s"
3560 function "illegally redefined") 3560 function "invalidly redefined")
3561 (if (eq ad-redefinition-action 'discard) 3561 (if (eq ad-redefinition-action 'discard)
3562 (ad-safe-fset function original-definition) 3562 (ad-safe-fset function original-definition)
3563 (ad-set-orig-definition function current-definition) 3563 (ad-set-orig-definition function current-definition)
3564 (if (eq ad-redefinition-action 'warn) 3564 (if (eq ad-redefinition-action 'warn)
3565 (message "ad-handle-definition: `%s' got redefined" 3565 (message "ad-handle-definition: `%s' got redefined"
3792 documentation of the advised function can be dumped onto the `DOC' file 3792 documentation of the advised function can be dumped onto the `DOC' file
3793 during preloading. 3793 during preloading.
3794 3794
3795 Look at the file `advice.el' for comprehensive documentation." 3795 Look at the file `advice.el' for comprehensive documentation."
3796 (if (not (ad-name-p function)) 3796 (if (not (ad-name-p function))
3797 (error "defadvice: Illegal function name: %s" function)) 3797 (error "defadvice: Invalid function name: %s" function))
3798 (let* ((class (car args)) 3798 (let* ((class (car args))
3799 (name (if (not (ad-class-p class)) 3799 (name (if (not (ad-class-p class))
3800 (error "defadvice: Illegal advice class: %s" class) 3800 (error "defadvice: Invalid advice class: %s" class)
3801 (nth 1 args))) 3801 (nth 1 args)))
3802 (position (if (not (ad-name-p name)) 3802 (position (if (not (ad-name-p name))
3803 (error "defadvice: Illegal advice name: %s" name) 3803 (error "defadvice: Invalid advice name: %s" name)
3804 (setq args (nthcdr 2 args)) 3804 (setq args (nthcdr 2 args))
3805 (if (ad-position-p (car args)) 3805 (if (ad-position-p (car args))
3806 (prog1 (car args) 3806 (prog1 (car args)
3807 (setq args (cdr args)))))) 3807 (setq args (cdr args))))))
3808 (arglist (if (listp (car args)) 3808 (arglist (if (listp (car args))
3815 (let ((completion 3815 (let ((completion
3816 (try-completion (symbol-name flag) ad-defadvice-flags))) 3816 (try-completion (symbol-name flag) ad-defadvice-flags)))
3817 (cond ((eq completion t) flag) 3817 (cond ((eq completion t) flag)
3818 ((assoc completion ad-defadvice-flags) 3818 ((assoc completion ad-defadvice-flags)
3819 (intern completion)) 3819 (intern completion))
3820 (t (error "defadvice: Illegal or ambiguous flag: %s" 3820 (t (error "defadvice: Invalid or ambiguous flag: %s"
3821 flag)))))) 3821 flag))))))
3822 args)) 3822 args))
3823 (advice (ad-make-advice 3823 (advice (ad-make-advice
3824 name (memq 'protect flags) 3824 name (memq 'protect flags)
3825 (not (memq 'disable flags)) 3825 (not (memq 'disable flags))