-(eval-when-compile (require 'cl))
-(require 'reporter)
-
-(defcustom xwidget-webkit-scroll-behaviour 'native
- "Scroll behaviour of the webkit instance.
-'native or 'image."
- :group 'xwidgets)
-
-(defun xwidget-insert (pos type title width height)
- "Insert an xwidget at POS.
-given ID, TYPE, TITLE WIDTH and
-HEIGHT in the current buffer.
-
-Return ID
-
-see `make-xwidget' for types suitable for TYPE."
+(require 'cl-lib)
+(require 'bookmark)
+
+(declare-function make-xwidget "xwidget.c"
+ (type title width height arguments &optional buffer))
+(declare-function xwidget-set-adjustment "xwidget.c"
+ (xwidget axis relative value))
+(declare-function xwidget-buffer "xwidget.c" (xwidget))
+(declare-function xwidget-webkit-get-title "xwidget.c" (xwidget))
+(declare-function xwidget-size-request "xwidget.c" (xwidget))
+(declare-function xwidget-resize "xwidget.c" (xwidget new-width new-height))
+(declare-function xwidget-webkit-execute-script "xwidget.c" (xwidget script))
+(declare-function xwidget-webkit-goto-uri "xwidget.c" (xwidget uri))
+(declare-function xwidget-plist "xwidget.c" (xwidget))
+(declare-function set-xwidget-plist "xwidget.c" (xwidget plist))
+(declare-function xwidget-view-window "xwidget.c" (xwidget-view))
+(declare-function xwidget-view-model "xwidget.c" (xwidget-view))
+(declare-function delete-xwidget-view "xwidget.c" (xwidget-view))
+(declare-function get-buffer-xwidgets "xwidget.c" (buffer))
+(declare-function xwidget-query-on-exit-flag "xwidget.c" (xwidget))
+
+(defun xwidget-insert (pos type title width height &optional args)
+ "Insert an xwidget at position POS.
+Supply the xwidget's TYPE, TITLE, WIDTH, and HEIGHT.
+See `make-xwidget' for the possible TYPE values.
+The usage of optional argument ARGS depends on the xwidget.
+This returns the result of `make-xwidget'."