     (tern-update-argument-hints-async)))
 
 (defun tern-left-buffer ()
-  (declare (special buffer-list-update-hook))
   (when (and tern-buffer-is-dirty (not (buffer-file-name (car (buffer-list)))))
     (setf tern-buffer-is-dirty nil)
     (let ((buffer-list-update-hook ()))

(require 'url)
(require 'url-http)

(defun tern-message (fmt &rest objects)
  (apply 'message fmt objects))

(defun tern-req (port doc c)
  (declare (special url-mime-charset-string url-request-method url-request-data url-show-status))
  (let* ((url-mime-charset-string nil) ; Suppress huge, useless header
         (url-request-method "POST")
         (deactivate-mark nil) ; Prevents json-encode from interfering with shift-selection-mode

         (url (url-parse-make-urlobj "http" nil nil tern-server port "/" nil nil nil)))
    (url-http url #'tern-req-finished (list c))))

(defun tern-req-finished (c)
  (defvar url-http-process)
  (defvar url-callback-function)
  (let ((is-error (and (consp c) (eq (car c) :error)))
        (found-body (search-forward "\n\n" nil t))
        (deactivate-mark nil))
