Function: ad-find-some-advice

ad-find-some-advice is a byte-compiled function defined in advice.el.gz.

Signature

(ad-find-some-advice FUNCTION CLASS NAME)

Documentation

Find the first of FUNCTION's advices in CLASS matching NAME.

NAME can be a symbol or a regular expression matching part of an advice name. If CLASS is any all valid advice classes will be checked.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/advice.el.gz
(defun ad-find-some-advice (function class name)
  "Find the first of FUNCTION's advices in CLASS matching NAME.
NAME can be a symbol or a regular expression matching part of an advice name.
If CLASS is `any' all valid advice classes will be checked."
  (if (ad-is-advised function)
      (let (found-advice)
	(cl-dolist (advice-class ad-advice-classes)
	  (if (or (eq class 'any) (eq advice-class class))
	      (setq found-advice
		    (cl-dolist (advice (ad-get-advice-info-field
					function advice-class))
		      (if (or (and (stringp name)
				   (string-match
				    name (symbol-name
					  (ad-advice-name advice))))
			      (eq name (ad-advice-name advice)))
			  (cl-return advice)))))
	  (if found-advice (cl-return found-advice))))))