   ;; Integer, mirrors the value we see in JS
   (id nil :read-only t)
 
-  ;; Process to which this thing belongs, or nil if this is a special,
-  ;; immortal handle
+  ;; Process to which this thing belongs
   (process nil))
 
 (defvar espresso--js-references nil


(defvar espresso--js-last-gcs-done nil
  "Last number of gcs we GCed with")

(defconst espresso--js-global
  (make-espresso--js-handle :id -1)
  "Handle of the current Javascript global object. Never appears
as the value of an expression: i.e., you can send this to
Javascript, but you will never receive it in reply.")

(defconst espresso--js-null
  (make-espresso--js-handle :id 0)
  "Handle of Javascript null")

(defconst espresso--js-true
  (make-espresso--js-handle :id 1)
  "Handle of Javascript true")

(defconst espresso--js-false
  (make-espresso--js-handle :id 2)
  "Handle of Javascript false")

(defconst espresso--js-undefined
  (make-espresso--js-handle :id 3)
  "Handle of Javascript undefined")

(defconst espresso--js-getprop
  (make-espresso--js-handle :id 4)
  "Handle of the getprop pseudo-function")

(defconst espresso--js-putprop
  (make-espresso--js-handle :id 5)
  "Handle of the putprop pseudo-function")

(defconst espresso--js-delprop
  (make-espresso--js-handle :id 6)
  "Handle of the elprop pseudo-function")

(defconst espresso--js-typeof
  (make-espresso--js-handle :id 7)
  "Handle of the typeof pseudo-function")

(defconst espresso--js-repl
  (make-espresso--js-handle :id 8)
  "Handle of the REPL itself")

(defconst espresso--js-new
  (make-espresso--js-handle :id 9)
  "Handle to the new pseudo-func")

(defun espresso--make-handle-hash ()
  "Make a Javascript handle table"
  (loop with table = (make-hash-table :test 'eq :weakness t)
        for special-value in (list espresso--js-null
                                   espresso--js-true
                                   espresso--js-false
                                   espresso--js-undefined
                                   espresso--js-getprop
                                   espresso--js-putprop
                                   espresso--js-delprop
                                   espresso--js-typeof
                                   espresso--js-repl
                                   espresso--js-new)
        do (puthash (espresso--js-handle-id special-value)
                    special-value table)
        finally return table))

(defconst espresso--moz-interactor
  (replace-regexp-in-string
   "[ \n]+" " "
"(function(repl) {
  repl.defineInteractor('espresso', {
    onStart: function onStart(repl) {
      if(!repl._espressoObjects) {
        repl._espressoObjects = ({
          /*  -1: current global object, */
          0: null,
          1: true,
          2: false,
          3: undefined,
          4: this._getProp,
          5: this._putProp,
          6: this._delProp,
          7: this._typeOf,
          8: repl,
          9: this._callNew});
        repl._espressoLastID = 9;
        repl._espressoGC = this._espressoGC;
      }
    },

    _espressoGC: function _espressoGC(ids_in_use) {

  (run-mode-hooks 'espresso-mode-hook))


(eval-after-load 'hideshow
  '(add-to-list 'hs-special-modes-alist
                '(espresso-mode "{" "}" "/[*/]"
                                nil hs-c-like-adjust-block-beginning)))

(eval-after-load 'folding
  '(when (fboundp 'folding-add-to-marks-list)
     (folding-add-to-marks-list 'espresso-mode "// {{{" "// }}}" )))

(eval-after-load 'speedbar
  '(speedbar-add-supported-extension ".js"))


;;; Emacs
(provide 'espresso)
;; Local Variables:
;; outline-regexp: ";;; "
;; End:
