Skip to content

Commit

Permalink
Call looking-back with two arguments
Browse files Browse the repository at this point in the history
Beginning with Emacs v25.1 the second argument to `looking-back' is
mandatory.  It may be `nil' though, in which case it continues to
behave as before (without the second argument).
  • Loading branch information
tarsius committed May 2, 2016
1 parent 08b3ee5 commit e389fc2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
26 changes: 15 additions & 11 deletions js3-mode.el
Expand Up @@ -6717,7 +6717,7 @@ nor always false."
(defun js3-delete-semicolons ()
"backspace over semicolons in the output buffer"
(set-buffer (get-buffer-create js3-temp-buffer))
(while (looking-back "\\(;\\|\\s-\\|\n\\)+")
(while (looking-back "\\(;\\|\\s-\\|\n\\)+" nil)
(delete-char -1))
(set-buffer js3-current-buffer))

Expand Down Expand Up @@ -10474,7 +10474,8 @@ nil."
(current-column))

((looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
(point-min) t)
Expand Down Expand Up @@ -10508,7 +10509,8 @@ nil."
(current-column))

((looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
(point-min) t)
Expand All @@ -10527,7 +10529,8 @@ nil."
(save-excursion
(js3-backward-sexp)
(if (looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(progn
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
Expand All @@ -10544,7 +10547,8 @@ nil."
(save-excursion
(js3-backward-sexp)
(if (looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(progn
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
Expand Down Expand Up @@ -10620,7 +10624,7 @@ nil."
(goto-char fpabs))

((looking-back
"\\(\n\\|\\`\\)[ \t]*;?[ \t]*(?[ \t]*")
"\\(\n\\|\\`\\)[ \t]*;?[ \t]*(?[ \t]*" nil)
(back-to-indentation))

((eq fptype js3-CALL)
Expand Down Expand Up @@ -11093,7 +11097,7 @@ This ensures that the counts and `next-error' are correct."
(current-column)))
(save-excursion
(goto-char string-beg)
(if (looking-back "\\+\\s-+")
(if (looking-back "\\+\\s-+" nil)
(goto-char (match-beginning 0)))
(current-column))))))
(insert quote-char "\n")
Expand Down Expand Up @@ -11420,15 +11424,15 @@ already have been inserted."
(save-excursion
(insert quote-string))))
((looking-at quote-string)
(if (looking-back "[^\\]\\\\")
(if (looking-back "[^\\]\\\\" nil)
(insert quote-string)
(forward-char 1)))
((and js3-mode-escape-quotes
(save-excursion
(save-match-data
(re-search-forward quote-string (point-at-eol) t))))
;; inside terminated string, escape quote (unless already escaped)
(insert (if (looking-back "[^\\]\\\\")
(insert (if (looking-back "[^\\]\\\\" nil)
quote-string
(concat "\\" quote-string))))
(t
Expand Down Expand Up @@ -11885,7 +11889,7 @@ destroying the region selection."
(js3-with-underscore-as-word-syntax
(save-excursion
(if (and (not (looking-at "[A-Za-z0-9_$]"))
(looking-back "[A-Za-z0-9_$]"))
(looking-back "[A-Za-z0-9_$]" nil))
(setq beg (progn (forward-word -1) (point))
end (progn (forward-word 1) (point)))
(setq beg (progn (forward-word 1) (point))
Expand Down Expand Up @@ -12008,7 +12012,7 @@ it marks the next defun after the ones already marked."
(if (not (re-search-forward "[*]/" nil t))
(message "Invalid global declaration")
(delete-char -2)
(when (not (looking-back " "))
(when (not (looking-back " " nil))
(insert " "))
(insert (concat var " */")))))))

Expand Down
2 changes: 1 addition & 1 deletion lib/js3-ast.el
Expand Up @@ -3349,7 +3349,7 @@ nor always false."
(defun js3-delete-semicolons ()
"backspace over semicolons in the output buffer"
(set-buffer (get-buffer-create js3-temp-buffer))
(while (looking-back "\\(;\\|\\s-\\|\n\\)+")
(while (looking-back "\\(;\\|\\s-\\|\n\\)+" nil)
(delete-char -1))
(set-buffer js3-current-buffer))

Expand Down
10 changes: 5 additions & 5 deletions lib/js3-foot.el
Expand Up @@ -396,7 +396,7 @@ This ensures that the counts and `next-error' are correct."
(current-column)))
(save-excursion
(goto-char string-beg)
(if (looking-back "\\+\\s-+")
(if (looking-back "\\+\\s-+" nil)
(goto-char (match-beginning 0)))
(current-column))))))
(insert quote-char "\n")
Expand Down Expand Up @@ -723,15 +723,15 @@ already have been inserted."
(save-excursion
(insert quote-string))))
((looking-at quote-string)
(if (looking-back "[^\\]\\\\")
(if (looking-back "[^\\]\\\\" nil)
(insert quote-string)
(forward-char 1)))
((and js3-mode-escape-quotes
(save-excursion
(save-match-data
(re-search-forward quote-string (point-at-eol) t))))
;; inside terminated string, escape quote (unless already escaped)
(insert (if (looking-back "[^\\]\\\\")
(insert (if (looking-back "[^\\]\\\\" nil)
quote-string
(concat "\\" quote-string))))
(t
Expand Down Expand Up @@ -1188,7 +1188,7 @@ destroying the region selection."
(js3-with-underscore-as-word-syntax
(save-excursion
(if (and (not (looking-at "[A-Za-z0-9_$]"))
(looking-back "[A-Za-z0-9_$]"))
(looking-back "[A-Za-z0-9_$]" nil))
(setq beg (progn (forward-word -1) (point))
end (progn (forward-word 1) (point)))
(setq beg (progn (forward-word 1) (point))
Expand Down Expand Up @@ -1311,7 +1311,7 @@ it marks the next defun after the ones already marked."
(if (not (re-search-forward "[*]/" nil t))
(message "Invalid global declaration")
(delete-char -2)
(when (not (looking-back " "))
(when (not (looking-back " " nil))
(insert " "))
(insert (concat var " */")))))))

Expand Down
14 changes: 9 additions & 5 deletions lib/js3-indent.el
Expand Up @@ -541,7 +541,8 @@ nil."
(current-column))

((looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
(point-min) t)
Expand Down Expand Up @@ -575,7 +576,8 @@ nil."
(current-column))

((looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
(point-min) t)
Expand All @@ -594,7 +596,8 @@ nil."
(save-excursion
(js3-backward-sexp)
(if (looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(progn
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
Expand All @@ -611,7 +614,8 @@ nil."
(save-excursion
(js3-backward-sexp)
(if (looking-back (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re))
js3-skip-newlines-re)
nil)
(progn
(re-search-backward (concat "^[ \t]*[^ \t\n].*"
js3-skip-newlines-re)
Expand Down Expand Up @@ -687,7 +691,7 @@ nil."
(goto-char fpabs))

((looking-back
"\\(\n\\|\\`\\)[ \t]*;?[ \t]*(?[ \t]*")
"\\(\n\\|\\`\\)[ \t]*;?[ \t]*(?[ \t]*" nil)
(back-to-indentation))

((eq fptype js3-CALL)
Expand Down

1 comment on commit e389fc2

@dgutov
Copy link

@dgutov dgutov commented on e389fc2 Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be `nil' though, in which case it continues to behave as before (without the second argument).

I.e. slowly.

Please sign in to comment.