From e389fc28cbead73924a02ede0c5c306c0b4644d7 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Mon, 2 May 2016 22:38:13 +0200 Subject: [PATCH] Call looking-back with two arguments 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). --- js3-mode.el | 26 +++++++++++++++----------- lib/js3-ast.el | 2 +- lib/js3-foot.el | 10 +++++----- lib/js3-indent.el | 14 +++++++++----- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/js3-mode.el b/js3-mode.el index 5e5b5d7..b65a3d4 100644 --- a/js3-mode.el +++ b/js3-mode.el @@ -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)) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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") @@ -11420,7 +11424,7 @@ 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 @@ -11428,7 +11432,7 @@ already have been inserted." (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 @@ -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)) @@ -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 " */"))))))) diff --git a/lib/js3-ast.el b/lib/js3-ast.el index 0272e61..6a05c2f 100644 --- a/lib/js3-ast.el +++ b/lib/js3-ast.el @@ -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)) diff --git a/lib/js3-foot.el b/lib/js3-foot.el index 5b3f5f6..70c1d07 100644 --- a/lib/js3-foot.el +++ b/lib/js3-foot.el @@ -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") @@ -723,7 +723,7 @@ 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 @@ -731,7 +731,7 @@ already have been inserted." (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 @@ -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)) @@ -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 " */"))))))) diff --git a/lib/js3-indent.el b/lib/js3-indent.el index 6b68e39..0dfdcce 100644 --- a/lib/js3-indent.el +++ b/lib/js3-indent.el @@ -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) @@ -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) @@ -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) @@ -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) @@ -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)