Function: advice--make

advice--make is a byte-compiled function defined in nadvice.el.gz.

Signature

(advice--make WHERE FUNCTION MAIN PROPS)

Documentation

Build a function value that adds FUNCTION to MAIN at WHERE.

WHERE is a symbol to select an entry in advice--where-alist.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/nadvice.el.gz
(defun advice--make (where function main props)
  "Build a function value that adds FUNCTION to MAIN at WHERE.
WHERE is a symbol to select an entry in `advice--where-alist'."
  (let ((fd (or (cdr (assq 'depth props)) 0))
        (md (if (advice--p main)
                (or (cdr (assq 'depth (advice--props main))) 0))))
    (if (and md (> fd md))
        ;; `function' should go deeper.
        (let ((rest (advice--make where function (advice--cdr main) props)))
          (advice--make-1 (aref main 1) (aref main 3)
                          (advice--car main) rest (advice--props main)))
      (let ((desc (assq where advice--where-alist)))
        (unless desc (error "Unknown add-function location `%S'" where))
        (advice--make-1 (nth 1 desc) (nth 2 desc)
                        function main props)))))