       (unless (looking-at ")")
         (insert ", "))
       (search-forward "{")
+      (setq beg (point))
       (backward-char)
       (forward-list)
       (forward-char)

      (insert name)
      (unless (looking-at ")")
        (insert ", "))
      (replace-string name short t 0 end))))

(provide 'javascript-defuns)

  (save-excursion
    (let* ((name (buffer-substring-no-properties (region-beginning) (region-end)))
           (short (buster--global-shortcut name))
           beg end)
      (unless (search-backward-regexp js--iife-regexp)
        (error "No immediately invoked function expression found."))
      (deactivate-mark)
