Skip to content

Commit

Permalink
Use with-current-buffer instead of save-excursion + set-buffer
Browse files Browse the repository at this point in the history
to fix the deprecation warnings

Closes mooz#28
  • Loading branch information
daimrod authored and dgutov committed Dec 28, 2011
1 parent 5805a68 commit 5d5a7cc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions js2-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4512,8 +4512,7 @@ Function also calls `js2-node-add-children' to add the parent link."
pos)
(unless buf
(error "No buffer available for node %s" node))
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(buffer-substring-no-properties (setq pos (js2-node-abs-pos node))
(+ pos (js2-node-len node))))))

Expand Down Expand Up @@ -7330,8 +7329,7 @@ leaving a statement, an expression, or a function definition."
ast)
(or buf (setq buf (current-buffer)))
(message nil) ; clear any error message from previous parse
(save-excursion
(set-buffer buf)
(with-current-buffer buf
(setq js2-scanned-comments nil
js2-parsed-errors nil
js2-parsed-warnings nil
Expand Down

0 comments on commit 5d5a7cc

Please sign in to comment.