 s-expression. Resolve in favor of the original version if NEW is
 nil; otherwise resolve in favor of the new version. TABLE is a
 hash table of `el-patch-let' bindings, which maps symbols to
-their bindings."
+their bindings. Set `el-patch--feature' to the last value
+specified in a `el-patch-feature' directive."
   (let ((table (or table (make-hash-table :test 'equal))))
     (if (listp form)
         (let* ((directive (nth 0 form))

;; Yet to come.

;;; Code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Libraries

  `(defun ,(el-patch--advice-name (cadr definition))
       ,@(cddr definition)))

(defun el-patch--autoload-function (function-name feature)
  (let ((recursive-autoload
         (intern (format "el-patch--recursive-autoload--%S"
                         function-name))))
    `(defun ,function-name (&rest args)
       ,(format "This function is a stub generated by el-patch. The patch for
`%S' has been loaded (see the `:override' advice on this function),
but the original definition of `%S', which is provided by feature `%S'
has not yet been loaded.

If you the `:override' advice and then call this function, it will
load feature `%S' and then invoke the actual definition of `%S',
just like an autoload."
                function-name function-name feature feature function-name)
       (if (boundp ',recursive-autoload)
           (error "Autoload of `%S' failed to define `%S'"
                  feature function-name)
         (require ',feature)
         (apply ',function-name args)))))

(defun el-patch--stealthy-defun (function-name definition)
  ;; FIXME should prevent `load-history' from being updated
  (eval definition))

(defun el-patch--definition (patch-definition)
  "Activate a PATCH-DEFINITION.
