From de3a1fe9358d3d833a15dc4fb559b902cdc1168b Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 27 Feb 2010 20:22:44 -0500 Subject: [PATCH] Fix more save-excursion warnings. * textmodes/reftex-toc.el (reftex-toc-promote-prepare): * emacs-lisp/elint.el (elint-add-required-env): * cedet/semantic/db-find.el (semanticdb-find-translate-path-brutish-default): * cedet/ede/make.el (ede-make-check-version): * calendar/icalendar.el (icalendar--add-diary-entry): * calc/calcalg2.el (math-tracing-integral): Use with-current-buffer instead of save-excursion. --- lisp/ChangeLog | 7 +++++++ lisp/calc/calcalg2.el | 4 ++-- lisp/calendar/icalendar.el | 3 +-- lisp/cedet/ede/make.el | 3 +-- lisp/cedet/semantic/db-find.el | 5 ++--- lisp/emacs-lisp/elint.el | 3 +-- lisp/textmodes/reftex-toc.el | 3 +-- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 27890d66ba6..1c91ebe4831 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2010-02-28 Chong Yidong + * textmodes/reftex-toc.el (reftex-toc-promote-prepare): + * emacs-lisp/elint.el (elint-add-required-env): + * cedet/semantic/db-find.el + (semanticdb-find-translate-path-brutish-default): + * cedet/ede/make.el (ede-make-check-version): + * calendar/icalendar.el (icalendar--add-diary-entry): + * calc/calcalg2.el (math-tracing-integral): * files.el (recover-session-finish): Use with-current-buffer instead of save-excursion. diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 3d90de3f0b3..2b45ce1b2f0 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -670,8 +670,8 @@ (defmacro math-tracing-integral (&rest parts) (list 'and 'trace-buffer - (list 'save-excursion - '(set-buffer trace-buffer) + (list 'with-current-buffer + 'trace-buffer '(goto-char (point-max)) (list 'and '(bolp) diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 535956be140..a07402aa031 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el @@ -2246,8 +2246,7 @@ the entry." 'make-diary-entry) string non-marking diary-file))) ;; Würgaround to remove the trailing blank char - (save-excursion - (set-buffer (find-file diary-file)) + (with-current-buffer (find-file diary-file) (goto-char (point-max)) (if (= (char-before) ? ) (delete-char -1))) diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el index e9bc4b3b8e0..6b59f510bed 100644 --- a/lisp/cedet/ede/make.el +++ b/lisp/cedet/ede/make.el @@ -76,9 +76,8 @@ If NOERROR is nil, then throw an error on failure. Return t otherwise." (rev nil) (ans nil) ) - (save-excursion + (with-current-buffer b ;; Setup, and execute make. - (set-buffer b) (setq default-directory cd) (erase-buffer) (call-process ede-make-command nil b nil diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index eba04a7ee02..754ba231c37 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -326,9 +326,8 @@ Default action as described in `semanticdb-find-translate-path'." (cond ((null path) semanticdb-current-database) ((semanticdb-table-p path) (oref path parent-db)) (t (let ((tt (semantic-something-to-tag-table path))) - (save-excursion - ;; @todo - What does this DO ??!?! - (set-buffer (semantic-tag-buffer (car tt))) + ;; @todo - What does this DO ??!?! + (with-current-buffer (semantic-tag-buffer (car tt)) semanticdb-current-database)))))) (apply #'nconc diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index 6e0758680d5..b9aa29decd0 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -505,11 +505,10 @@ Return nil if there are no more forms, t otherwise." ;; (Messes up the "Initializing elint..." message.) ;;; (message nil) (if lib - (save-excursion + (with-current-buffer (find-file-noselect lib) ;; FIXME this doesn't use a temp buffer, because it ;; stores the result in buffer-local variables so that ;; it can be reused. - (set-buffer (find-file-noselect lib)) (elint-update-env) (setq env (elint-env-add-env env elint-buffer-env))) ;;; (with-temp-buffer diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 1066066462d..ae1690416b9 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -665,9 +665,8 @@ promotion/demotion later." (if (and (markerp marker) (marker-buffer marker)) ;; Buffer is still live and we have the marker. (progn - (save-excursion + (with-current-buffer (marker-buffer marker) ;; Goto the buffer and check of section is unchanged - (set-buffer (marker-buffer marker)) (goto-char (marker-position marker)) (if (looking-at (regexp-quote literal)) ;; OK, get the makro name -- 2.39.5