Sync with upstream verilog-mode revision 78e66ba.
[bpt/emacs.git] / lisp / progmodes / js.el
index 96e6039..49a2193 100644 (file)
@@ -55,7 +55,6 @@
 
 (eval-when-compile
   (require 'cl-lib)
-  (require 'comint)
   (require 'ido))
 
 (defvar inferior-moz-buffer)
@@ -1785,13 +1784,13 @@ statement spanning multiple lines; otherwise, return nil."
                         (or (eq (char-before) ?,)
                             (and (not (eq (char-before) ?\;))
                                  (prog2
-                                     (skip-chars-backward "[[:punct:]]")
+                                     (skip-syntax-backward ".")
                                      (looking-at js--indent-operator-re)
                                    (js--backward-syntactic-ws))
                                  (not (eq (char-before) ?\;)))
                             (and (>= pos (point-at-bol))
                                  (<= pos (point-at-eol)))))))
-          (condition-case err
+          (condition-case nil
               (backward-sexp)
             (scan-error (setq at-opening-bracket t))))
         (when (looking-at js--declaration-keyword-re)
@@ -2217,6 +2216,9 @@ marker."
 
 (defvar find-tag-marker-ring)           ; etags
 
+;; etags loads ring.
+(declare-function ring-insert "ring" (ring item))
+
 (defun js-find-symbol (&optional arg)
   "Read a JavaScript symbol and jump to it.
 With a prefix argument, restrict symbols to those from the
@@ -2242,11 +2244,8 @@ current buffer.  Pushes a mark onto the tag ring just like
 
 ;;; MozRepl integration
 
-(put 'js-moz-bad-rpc 'error-conditions '(error timeout))
-(put 'js-moz-bad-rpc 'error-message "Mozilla RPC Error")
-
-(put 'js-js-error 'error-conditions '(error js-error))
-(put 'js-js-error 'error-message "Javascript Error")
+(define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error))
+(define-error 'js-js-error "Javascript Error") ;; '(js-error error))
 
 (defun js--wait-for-matching-output
   (process regexp timeout &optional start)
@@ -2639,6 +2638,11 @@ with `js--js-encode-value'."
    ;; order to catch a prompt that's only partially arrived
    (save-excursion (forward-line 0) (point))))
 
+;; Presumably "inferior-moz-process" loads comint.
+(declare-function comint-send-string "comint" (process string))
+(declare-function comint-send-input "comint"
+                  (&optional no-newline artificial))
+
 (defun js--js-enter-repl ()
   (inferior-moz-process) ; called for side-effect
   (with-current-buffer inferior-moz-buffer
@@ -2697,6 +2701,10 @@ with `js--js-encode-value'."
 (defsubst js--js-true (value)
   (not (js--js-not value)))
 
+;; The somewhat complex code layout confuses the byte-compiler into
+;; thinking this function "might not be defined at runtime".
+(declare-function js--optimize-arglist "js" (arglist))
+
 (eval-and-compile
   (defun js--optimize-arglist (arglist)
     "Convert immediate js< and js! references to deferred ones."
@@ -2824,6 +2832,8 @@ If nil, the whole Array is treated as a JS symbol.")
     (`error (signal 'js-js-error (list (cl-second result))))
     (x (error "Unmatched case in js--js-decode-retval: %S" x))))
 
+(defvar comint-last-input-end)
+
 (defun js--js-funcall (function &rest arguments)
   "Call the Mozilla function FUNCTION with arguments ARGUMENTS.
 If function is a string, look it up as a property on the global
@@ -2996,6 +3006,8 @@ left-to-right."
 
 (defvar js-read-tab-history nil)
 
+(declare-function ido-chop "ido" (items elem))
+
 (defun js--read-tab (prompt)
   "Read a Mozilla tab with prompt PROMPT.
 Return a cons of (TYPE . OBJECT).  TYPE is either 'window or
@@ -3405,8 +3417,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
   ;; calls to syntax-propertize wherever it's really needed.
   (syntax-propertize (point-max)))
 
-;;;###autoload
-(defalias 'javascript-mode 'js-mode)
+;;;###autoload (defalias 'javascript-mode 'js-mode)
 
 (eval-after-load 'folding
   '(when (fboundp 'folding-add-to-marks-list)