Mercurial > emacs
changeset 105799:3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
* cedet/semantic/symref/list.el (semantic-symref-rb-toggle-expand-tag):
* cedet/semantic/symref/grep.el (semantic-symref-perform-search):
* cedet/semantic/bovine/gcc.el (semantic-gcc-query):
* cedet/semantic/bovine/c.el (semantic-c-parse-lexical-token):
* cedet/semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons)
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype)
(semantic-analyzer-debug-insert-include-summary):
* cedet/semantic/util.el (semantic-file-tag-table):
(semantic-describe-buffer-var-helper, semantic-something-to-tag-table)
(semantic-recursive-find-nonterminal-by-name):
* cedet/semantic/tag-ls.el (semantic-tag-calculate-parent-default):
* cedet/semantic/tag-file.el (semantic-prototype-file):
* cedet/semantic/symref.el (semantic-symref-parse-tool-output):
* cedet/semantic/sb.el (semantic-sb-fetch-tag-table):
* cedet/semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
* cedet/semantic/idle.el (semantic-idle-work-for-one-buffer):
(semantic-idle-summary-maybe-highlight):
* cedet/semantic/ia-sb.el (semantic-ia-speedbar)
(semantic-ia-sb-tag-info):
* cedet/semantic/grammar.el (semantic-analyze-possible-completions):
* cedet/semantic/find.el (semantic-brute-find-tag-by-position):
* cedet/semantic/ede-grammar.el (project-compile-target):
(ede-proj-makefile-insert-variables):
* cedet/semantic/debug.el (semantic-debug-set-parser-location):
(semantic-debug-set-source-location, semantic-debug-interface-layout)
(semantic-debug-mode, semantic-debug):
* cedet/semantic/db.el (semanticdb-needs-refresh-p):
* cedet/semantic/db-typecache.el (semanticdb-typecache-refresh-for-buffer):
* cedet/semantic/db-javascript.el (semanticdb-equivalent-mode):
* cedet/semantic/db-find.el (semanticdb-find-log-new-search)
(semanticdb-find-translate-path-includes--internal)
(semanticdb-reset-log, semanticdb-find-log-activity):
* cedet/semantic/db-file.el (object-write):
* cedet/semantic/db-el.el (semanticdb-equivalent-mode):
* cedet/semantic/db-ebrowse.el (semanticdb-ebrowse-C-file-p)
(semanticdb-create-ebrowse-database):
* cedet/semantic/db-debug.el (semanticdb-table-sanity-check):
* cedet/semantic/complete.el (semantic-displayor-focus-request)
(semantic-collector-calculate-completions-raw)
(semantic-complete-read-tag-analyzer):
* cedet/semantic/analyze.el (semantic-analyze-pulse):
* cedet/ede/util.el (ede-update-version-in-source):
* cedet/ede/proj.el (project-delete-target):
* cedet/ede/proj-elisp.el (ede-update-version-in-source)
(ede-proj-flush-autoconf):
* cedet/ede/pconf.el (ede-proj-configure-synchronize)
(ede-proj-configure-synchronize):
* cedet/ede/locate.el (ede-locate-file-in-project-impl):
* cedet/ede/linux.el (ede-linux-version):
* cedet/ede/emacs.el (ede-emacs-version):
* cedet/ede/dired.el (ede-dired-add-to-target):
* cedet/ede.el (ede-buffer-header-file, ede-find-target)
(ede-buffer-documentation-files, ede-project-buffers, ede-set)
(ede-target-buffers, ede-buffers, ede-make-project-local-variable):
* cedet/cedet-idutils.el (cedet-idutils-fnid-call):
(cedet-idutils-lid-call, cedet-idutils-expand-filename)
(cedet-idutils-version-check):
* cedet/cedet-global.el (cedet-gnu-global-call):
(cedet-gnu-global-expand-filename, cedet-gnu-global-root)
(cedet-gnu-global-version-check, cedet-gnu-global-scan-hits):
* cedet/cedet-cscope.el (cedet-cscope-call)
(cedet-cscope-expand-filename, cedet-cscope-version-check):
Use with-current-buffer.
* cedet/ede.el (ede-make-project-local-variable)
(ede-set-project-variables, ede-set): Use dolist.
line wrap: on
line diff
--- a/lisp/cedet/cedet-cscope.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/cedet-cscope.el Fri Oct 30 02:16:41 2009 +0000 @@ -77,8 +77,7 @@ (let ((b (get-buffer-create "*CEDET CScope*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-cscope-command @@ -90,8 +89,8 @@ "Expand the FILENAME with CScope. Return a fully qualified filename." (interactive "sFile: ") - (let* ((ans1 (save-excursion - (set-buffer (cedet-cscope-call (list "-d" "-L" "-7" filename))) + (let* ((ans1 (with-current-buffer + (cedet-cscope-call (list "-d" "-L" "-7" filename)) (goto-char (point-min)) (if (looking-at "[^ \n]*cscope: ") (error "CScope not available") @@ -137,8 +136,7 @@ (when (interactive-p) (message "CScope not found.")) nil) - (save-excursion - (set-buffer b) + (with-current-buffer b (goto-char (point-min)) (re-search-forward "cscope: version \\([0-9.]+\\)" nil t) (setq rev (match-string 1))
--- a/lisp/cedet/cedet-global.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/cedet-global.el Fri Oct 30 02:16:41 2009 +0000 @@ -67,8 +67,7 @@ "Call GNU Global with the list of FLAGS." (let ((b (get-buffer-create "*CEDET Global*")) (cd default-directory)) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-global-command @@ -80,8 +79,7 @@ "Expand the FILENAME with GNU Global. Return a fully qualified filename." (interactive "sFile: ") - (let ((ans (save-excursion - (set-buffer (cedet-gnu-global-call (list "-Pa" filename))) + (let ((ans (with-current-buffer (cedet-gnu-global-call (list "-Pa" filename)) (goto-char (point-min)) (if (looking-at "global: ") (error "GNU Global not available") @@ -105,8 +103,7 @@ If a default starting DIR is not specified, the current buffer's `default-directory' is used." (let ((default-directory (or dir default-directory))) - (save-excursion - (set-buffer (cedet-gnu-global-call (list "-pq"))) + (with-current-buffer (cedet-gnu-global-call (list "-pq")) (goto-char (point-min)) (when (not (eobp)) (file-name-as-directory @@ -128,8 +125,7 @@ (when (interactive-p) (message "GNU Global not found.")) nil) - (save-excursion - (set-buffer b) + (with-current-buffer b (goto-char (point-min)) (re-search-forward "GNU GLOBAL \\([0-9.]+\\)" nil t) (setq rev (match-string 1)) @@ -147,8 +143,7 @@ "Scan all the hits from the GNU Global output BUFFER." (let ((hits nil) (r1 "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) ")) - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (goto-char (point-min)) (while (re-search-forward r1 nil t) (setq hits (cons (cons (string-to-number (match-string 2))
--- a/lisp/cedet/cedet-idutils.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/cedet-idutils.el Fri Oct 30 02:16:41 2009 +0000 @@ -82,8 +82,7 @@ (let ((b (get-buffer-create "*CEDET fnid*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-idutils-file-command @@ -97,8 +96,7 @@ (let ((b (get-buffer-create "*CEDET lid*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process cedet-idutils-token-command @@ -112,8 +110,7 @@ "Expand the FILENAME with ID Utils. Return a filename relative to the default directory." (interactive "sFile: ") - (let ((ans (save-excursion - (set-buffer (cedet-idutils-fnid-call (list filename))) + (let ((ans (with-current-buffer (cedet-idutils-fnid-call (list filename)) (goto-char (point-min)) (if (looking-at "[^ \n]*fnid: ") (error "ID Utils not available") @@ -160,8 +157,7 @@ (when (interactive-p) (message "ID Utils not found.")) nil) - (save-excursion - (set-buffer b) + (with-current-buffer b (goto-char (point-min)) (re-search-forward "fnid - \\([0-9.]+\\)" nil t) (setq rev (match-string 1))
--- a/lisp/cedet/ede.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede.el Fri Oct 30 02:16:41 2009 +0000 @@ -1467,8 +1467,7 @@ (defmethod ede-buffer-header-file ((this ede-target) buffer) "There are no default header files in EDE. Do a quick check to see if there is a Header tag in this buffer." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (if (re-search-forward "::Header:: \\([a-zA-Z0-9.]+\\)" nil t) (buffer-substring-no-properties (match-beginning 1) (match-end 1)) @@ -1495,8 +1494,7 @@ (defmethod ede-buffer-documentation-files ((this ede-target) buffer) "Check for some documentation files for THIS. Also do a quick check to see if there is a Documentation tag in this BUFFER." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (if (re-search-forward "::Documentation:: \\([a-zA-Z0-9.]+\\)" nil t) (buffer-substring-no-properties (match-beginning 1) (match-end 1)) @@ -1743,8 +1741,7 @@ (defmethod ede-find-target ((proj ede-project) buffer) "Fetch the target in PROJ belonging to BUFFER or nil." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (or ede-object (if (ede-buffer-mine proj buffer) proj @@ -1781,8 +1778,7 @@ (let ((bl (buffer-list)) (pl nil)) (while bl - (save-excursion - (set-buffer (car bl)) + (with-current-buffer (car bl) (if (and ede-object (eq (ede-current-project) project)) (setq pl (cons (car bl) pl)))) (setq bl (cdr bl))) @@ -1793,8 +1789,7 @@ (let ((bl (buffer-list)) (pl nil)) (while bl - (save-excursion - (set-buffer (car bl)) + (with-current-buffer (car bl) (if (if (listp ede-object) (memq target ede-object) (eq ede-object target)) @@ -1807,8 +1802,7 @@ (let ((bl (buffer-list)) (pl nil)) (while bl - (save-excursion - (set-buffer (car bl)) + (with-current-buffer (car bl) (if ede-object (setq pl (cons (car bl) pl)))) (setq bl (cdr bl))) @@ -1897,22 +1891,18 @@ nil (oset project local-variables (cons (list variable) (oref project local-variables))) - (mapcar (lambda (b) (save-excursion - (set-buffer b) - (make-local-variable variable))) - (ede-project-buffers project)))) + (dolist (b (ede-project-buffers project)) + (with-current-buffer b + (make-local-variable variable))))) (defmethod ede-set-project-variables ((project ede-project) &optional buffer) "Set variables local to PROJECT in BUFFER." (if (not buffer) (setq buffer (current-buffer))) - (save-excursion - (set-buffer buffer) - (mapcar (lambda (v) - (make-local-variable (car v)) - ;; set it's value here? - (set (car v) (cdr v)) - ) - (oref project local-variables)))) + (with-current-buffer buffer + (dolist (v (oref project local-variables)) + (make-local-variable (car v)) + ;; set it's value here? + (set (car v) (cdr v))))) (defun ede-set (variable value &optional proj) "Set the project local VARIABLE to VALUE. @@ -1923,10 +1913,9 @@ (if (and p (setq a (assoc variable (oref p local-variables)))) (progn (setcdr a value) - (mapc (lambda (b) (save-excursion - (set-buffer b) - (set variable value))) - (ede-project-buffers p))) + (dolist (b (ede-project-buffers p)) + (with-current-buffer b + (set variable value)))) (set variable value)) (ede-commit-local-variables p)) value)
--- a/lisp/cedet/ede/dired.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/dired.el Fri Oct 30 02:16:41 2009 +0000 @@ -90,8 +90,7 @@ (project-add-file target (car files)) ;; Find the buffer for this files, and set it's ede-object (if (get-file-buffer (car files)) - (save-excursion - (set-buffer (get-file-buffer (car files))) + (with-current-buffer (get-file-buffer (car files)) (setq ede-object nil) (setq ede-object (ede-buffer-object (current-buffer))))) ;; Increment.
--- a/lisp/cedet/ede/emacs.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/emacs.el Fri Oct 30 02:16:41 2009 +0000 @@ -76,8 +76,7 @@ (let ((buff (get-buffer-create " *emacs-query*")) (emacs "Emacs") (ver "")) - (save-excursion - (set-buffer buff) + (with-current-buffer buff (erase-buffer) (setq default-directory (file-name-as-directory dir)) ;(call-process "egrep" nil buff nil "-n" "-e" "^version=" "Makefile")
--- a/lisp/cedet/ede/linux.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/linux.el Fri Oct 30 02:16:41 2009 +0000 @@ -72,8 +72,7 @@ (defun ede-linux-version (dir) "Find the Linux version for the Linux src in DIR." (let ((buff (get-buffer-create " *linux-query*"))) - (save-excursion - (set-buffer buff) + (with-current-buffer buff (erase-buffer) (setq default-directory (file-name-as-directory dir)) (insert-file-contents "Makefile" nil 0 512)
--- a/lisp/cedet/ede/locate.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/locate.el Fri Oct 30 02:16:41 2009 +0000 @@ -190,15 +190,13 @@ (b (get-buffer-create "*LOCATE*")) (cd default-directory) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (setq default-directory cd) (erase-buffer)) (apply 'call-process locate-command nil b nil searchstr nil) - (save-excursion - (set-buffer b) + (with-current-buffer b (split-string (buffer-string) "\n" t)) ) )
--- a/lisp/cedet/ede/pconf.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/pconf.el Fri Oct 30 02:16:41 2009 +0000 @@ -112,10 +112,10 @@ ;; Verify that we have a make system. (if (or (not (ede-expand-filename (ede-toplevel this) "Makefile")) ;; Now is this one of our old Makefiles? - (save-excursion - (set-buffer (find-file-noselect - (ede-expand-filename (ede-toplevel this) - "Makefile" t) t)) + (with-current-buffer + (find-file-noselect + (ede-expand-filename (ede-toplevel this) + "Makefile" t) t) (goto-char (point-min)) ;; Here is the unique piece for our makefiles. (re-search-forward "For use with: make" nil t))) @@ -128,8 +128,7 @@ (accept-process-output) (sit-for 1)) - (save-excursion - (set-buffer "*compilation*") + (with-current-buffer "*compilation*" (goto-char (point-max)) (when (not (string= mode-line-process ":exit [0]"))
--- a/lisp/cedet/ede/proj-elisp.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/proj-elisp.el Fri Oct 30 02:16:41 2009 +0000 @@ -151,9 +151,8 @@ (let ((vs (oref this versionsource)) (match nil)) (while vs - (save-excursion - (set-buffer (find-file-noselect - (ede-expand-filename this (car vs)))) + (with-current-buffer (find-file-noselect + (ede-expand-filename this (car vs))) (goto-char (point-min)) (let ((case-fold-search t)) (if (re-search-forward "-version\\s-+\"\\([^\"]+\\)\"" nil t) @@ -244,8 +243,7 @@ (let ((ec (ede-expand-filename this "elisp-comp" 'newfile)) ) (if (and ec (file-exists-p ec)) - (save-excursion - (set-buffer (find-file-noselect ec t)) + (with-current-buffer (find-file-noselect ec t) (goto-char (point-min)) (while (re-search-forward "(cons \\([^ ]+\\) load-path)" nil t)
--- a/lisp/cedet/ede/proj.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/proj.el Fri Oct 30 02:16:41 2009 +0000 @@ -407,8 +407,7 @@ (let* ((default-directory (oref this path)) (b (get-file-buffer (car ts)))) (if b - (save-excursion - (set-buffer b) + (with-current-buffer b (if (eq ede-object this) (progn (setq ede-object nil)
--- a/lisp/cedet/ede/util.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/ede/util.el Fri Oct 30 02:16:41 2009 +0000 @@ -64,9 +64,8 @@ (oref this versionsource)) (let ((vs (oref this versionsource))) (while vs - (save-excursion - (set-buffer (find-file-noselect - (ede-expand-filename this (car vs)))) + (with-current-buffer (find-file-noselect + (ede-expand-filename this (car vs))) (goto-char (point-min)) (let ((case-fold-search t)) (if (re-search-forward "version:\\s-*\\([^ \t\n]+\\)" nil t)
--- a/lisp/cedet/semantic/analyze.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/analyze.el Fri Oct 30 02:16:41 2009 +0000 @@ -710,8 +710,7 @@ (defmethod semantic-analyze-pulse ((context semantic-analyze-context)) "Pulse the region that CONTEXT affects." (require 'pulse) - (save-excursion - (set-buffer (oref context :buffer)) + (with-current-buffer (oref context :buffer) (let ((bounds (oref context :bounds))) (when bounds (pulse-momentary-highlight-region (car bounds) (cdr bounds))))))
--- a/lisp/cedet/semantic/analyze/debug.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/analyze/debug.el Fri Oct 30 02:16:41 2009 +0000 @@ -104,8 +104,7 @@ ;; NOTE: This line is copied from semantic-analyze-current-context. ;; You will need to update both places. (condition-case err - (save-excursion - (set-buffer origbuf) + (with-current-buffer origbuf (let* ((position (or (cdr-safe (oref ctxt bounds)) (point))) (prefixtypes nil) ; Used as type return (scope (semantic-calculate-scope position)) @@ -246,13 +245,11 @@ (princ "\nSemantic has found the datatype ") (semantic-analyzer-debug-insert-tag dt) (if (or (not (semantic-equivalent-tag-p ots dt)) - (not (save-excursion - (set-buffer orig-buffer) + (not (with-current-buffer orig-buffer (car (semantic-analyze-dereference-metatype ots (oref ctxt scope)))))) (let ((lasttype ots) - (nexttype (save-excursion - (set-buffer orig-buffer) + (nexttype (with-current-buffer orig-buffer (car (semantic-analyze-dereference-metatype ots (oref ctxt scope)))))) (if (eq nexttype lasttype) @@ -274,8 +271,7 @@ (princ "\n") (setq lasttype nexttype nexttype - (save-excursion - (set-buffer orig-buffer) + (with-current-buffer orig-buffer (car (semantic-analyze-dereference-metatype nexttype (oref ctxt scope))))) ) @@ -391,21 +387,17 @@ (let ((inc (semantic-find-tags-by-class 'include table)) ;;(path (semanticdb-find-test-translate-path-no-loading)) (unk - (save-excursion - (set-buffer (semanticdb-get-buffer table)) + (with-current-buffer (semanticdb-get-buffer table) semanticdb-find-lost-includes)) (ip - (save-excursion - (set-buffer (semanticdb-get-buffer table)) + (with-current-buffer (semanticdb-get-buffer table) semantic-dependency-system-include-path)) (edeobj - (save-excursion - (set-buffer (semanticdb-get-buffer table)) + (with-current-buffer (semanticdb-get-buffer table) (and (boundp 'ede-object) ede-object))) (edeproj - (save-excursion - (set-buffer (semanticdb-get-buffer table)) + (with-current-buffer (semanticdb-get-buffer table) (and (boundp 'ede-object-project) ede-object-project)))) @@ -589,9 +581,8 @@ Look for key expressions, and add push-buttons near them." (let ((orig-buffer (make-marker))) (set-marker orig-buffer (point) (current-buffer)) - (save-excursion - ;; Get a buffer ready. - (set-buffer "*Help*") + ;; Get a buffer ready. + (with-current-buffer "*Help*" (toggle-read-only -1) (goto-char (point-min)) (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer)
--- a/lisp/cedet/semantic/bovine/c.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/bovine/c.el Fri Oct 30 02:16:41 2009 +0000 @@ -703,8 +703,7 @@ (symtext (semantic-lex-token-text lexicaltoken)) (macros (get-text-property 0 'macros symtext)) ) - (save-excursion - (set-buffer buf) + (with-current-buffer buf (erase-buffer) (when (not (eq major-mode mode)) (save-match-data
--- a/lisp/cedet/semantic/bovine/gcc.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/bovine/gcc.el Fri Oct 30 02:16:41 2009 +0000 @@ -40,8 +40,7 @@ ;; (let ((buff (get-buffer-create " *gcc-query*")) (old-lc-messages (getenv "LC_ALL"))) - (save-excursion - (set-buffer buff) + (with-current-buffer buff (erase-buffer) (setenv "LC_ALL" "C") (condition-case nil
--- a/lisp/cedet/semantic/complete.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/complete.el Fri Oct 30 02:16:41 2009 +0000 @@ -947,8 +947,7 @@ "Calculate the completions for prefix from completionlist. Output must be in semanticdb Find result format." ;; Must output in semanticdb format - (let ((table (save-excursion - (set-buffer (oref obj buffer)) + (let ((table (with-current-buffer (oref obj buffer) semanticdb-current-table)) (result (semantic-find-tags-for-completion prefix @@ -1227,8 +1226,7 @@ (semantic-analyze-possible-completions (oref obj context)))) ;; search our cached completion list. make it look like a semanticdb ;; results type. - (list (cons (save-excursion - (set-buffer (oref (oref obj context) buffer)) + (list (cons (with-current-buffer (oref (oref obj context) buffer) semanticdb-current-table) (semantic-find-tags-for-completion prefix @@ -1463,8 +1461,7 @@ (and table (semanticdb-get-buffer table))))) ;; If no buffer is provided, then we can make up a summary buffer. (when (not buf) - (save-excursion - (set-buffer (get-buffer-create "*Completion Focus*")) + (with-current-buffer (get-buffer-create "*Completion Focus*") (erase-buffer) (insert "Focus on tag: \n") (insert (semantic-format-tag-summarize tag nil t) "\n\n") @@ -1893,8 +1890,7 @@ :buffer (oref context buffer) :context context) (semantic-displayor-traditional-with-focus-highlight "simple") - (save-excursion - (set-buffer (oref context buffer)) + (with-current-buffer (oref context buffer) (goto-char (cdr (oref context bounds))) (concat prompt (mapconcat 'identity syms ".") (if syms "." "")
--- a/lisp/cedet/semantic/db-debug.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-debug.el Fri Oct 30 02:16:41 2009 +0000 @@ -88,8 +88,7 @@ (let* ((full-filename (semanticdb-full-filename table)) (buff (find-buffer-visiting full-filename))) (if buff - (save-excursion - (set-buffer buff) + (with-current-buffer buff (semantic-sanity-check)) ;; We can't use the usual semantic validity check, so hack our own. (semanticdb-table-oob-sanity-check (semanticdb-get-tags table)))))
--- a/lisp/cedet/semantic/db-ebrowse.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-ebrowse.el Fri Oct 30 02:16:41 2009 +0000 @@ -118,8 +118,7 @@ (and (string-match "/\\w+$" file) (not (file-directory-p file)) (let ((tmp (get-buffer-create "*semanticdb-ebrowse-tmp*"))) - (save-excursion - (set-buffer tmp) + (with-current-buffer tmp (condition-case nil (insert-file-contents file nil 0 100 t) (error (insert-file-contents file nil nil nil t))) @@ -141,8 +140,7 @@ (regexp nil) ) ;; Create the input to the ebrowse command - (save-excursion - (set-buffer filebuff) + (with-current-buffer filebuff (buffer-disable-undo filebuff) (setq default-directory (expand-file-name dir)) @@ -156,8 +154,7 @@ (insert "\n"))) files) ;; Cleanup the ebrowse output buffer. - (save-excursion - (set-buffer (get-buffer-create "*EBROWSE OUTPUT*")) + (with-current-buffer (get-buffer-create "*EBROWSE OUTPUT*") (erase-buffer)) ;; Call the EBROWSE command. (message "Creating ebrowse file: %s ..." savein) @@ -169,8 +166,7 @@ ;; Create a short LOADER program for loading in this database. (let* ((lfn (concat savein "-load.el")) (lf (find-file-noselect lfn))) - (save-excursion - (set-buffer lf) + (with-current-buffer lf (erase-buffer) (insert "(semanticdb-ebrowse-load-helper \"" (expand-file-name dir)
--- a/lisp/cedet/semantic/db-el.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-el.el Fri Oct 30 02:16:41 2009 +0000 @@ -109,8 +109,7 @@ "Return non-nil if TABLE's mode is equivalent to BUFFER. Equivalent modes are specified by by `semantic-equivalent-major-modes' local variable." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (eq (or mode-local-active-mode major-mode) 'emacs-lisp-mode))) (defmethod semanticdb-full-filename ((obj semanticdb-table-emacs-lisp))
--- a/lisp/cedet/semantic/db-file.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-file.el Fri Oct 30 02:16:41 2009 +0000 @@ -281,8 +281,7 @@ Argument OBJ is the object to write." (when (semanticdb-live-p obj) (when (semanticdb-in-buffer-p obj) - (save-excursion - (set-buffer (semanticdb-in-buffer-p obj)) + (with-current-buffer (semanticdb-in-buffer-p obj) ;; Make sure all our tag lists are up to date. (semantic-fetch-tags)
--- a/lisp/cedet/semantic/db-find.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-find.el Fri Oct 30 02:16:41 2009 +0000 @@ -469,12 +469,11 @@ incfname (semanticdb-full-filename path)) ) ((bufferp path) - (save-excursion - (set-buffer path) + (with-current-buffer path (semantic-refresh-tags-safe)) (setq includetags (semantic-find-tags-included path) - curtable (save-excursion (set-buffer path) - semanticdb-current-table) + curtable (with-current-buffer path + semanticdb-current-table) incfname (buffer-file-name path))) (t (setq includetags (semantic-find-tags-included path)) @@ -1048,8 +1047,7 @@ "Reset the log buffer." (interactive) (when semanticdb-find-log-flag - (save-excursion - (set-buffer (get-buffer-create semanticdb-find-log-buffer-name)) + (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name) (erase-buffer) ))) @@ -1069,8 +1067,7 @@ (defun semanticdb-find-log-new-search (forwhat) "Start a new search FORWHAT." (when semanticdb-find-log-flag - (save-excursion - (set-buffer (get-buffer-create semanticdb-find-log-buffer-name)) + (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name) (insert (format "New Search: %S\n" forwhat)) ) (semanticdb-find-log-move-to-end))) @@ -1078,8 +1075,7 @@ (defun semanticdb-find-log-activity (table result) "Log that TABLE has been searched and RESULT was found." (when semanticdb-find-log-flag - (save-excursion - (set-buffer semanticdb-find-log-buffer-name) + (with-current-buffer semanticdb-find-log-buffer-name (insert "Table: " (object-print table) " Result: " (int-to-string (length result)) " tags" "\n")
--- a/lisp/cedet/semantic/db-javascript.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-javascript.el Fri Oct 30 02:16:41 2009 +0000 @@ -147,8 +147,7 @@ "Return non-nil if TABLE's mode is equivalent to BUFFER. Equivalent modes are specified by by `semantic-equivalent-major-modes' local variable." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (eq (or mode-local-active-mode major-mode) 'javascript-mode))) ;;; Usage
--- a/lisp/cedet/semantic/db-typecache.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db-typecache.el Fri Oct 30 02:16:41 2009 +0000 @@ -540,8 +540,7 @@ (defun semanticdb-typecache-refresh-for-buffer (buffer) "Refresh the typecache for BUFFER." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (let* ((tab semanticdb-current-table) ;(idx (semanticdb-get-table-index tab)) (tc (semanticdb-get-typecache tab)))
--- a/lisp/cedet/semantic/db.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/db.el Fri Oct 30 02:16:41 2009 +0000 @@ -552,8 +552,7 @@ (buff (semanticdb-in-buffer-p obj)) ) (if buff - (save-excursion - (set-buffer buff) + (with-current-buffer buff ;; Use semantic's magic tracker to determine of the buffer is up ;; to date or not. (not (semantic-parse-tree-up-to-date-p))
--- a/lisp/cedet/semantic/debug.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/debug.el Fri Oct 30 02:16:41 2009 +0000 @@ -118,8 +118,7 @@ (defmethod semantic-debug-set-parser-location ((iface semantic-debug-interface) point) "Set the parser location in IFACE to POINT." - (save-excursion - (set-buffer (oref iface parser-buffer)) + (with-current-buffer (oref iface parser-buffer) (if (not (slot-boundp iface 'parser-location)) (oset iface parser-location (make-marker))) (move-marker (oref iface parser-location) point)) @@ -127,8 +126,7 @@ (defmethod semantic-debug-set-source-location ((iface semantic-debug-interface) point) "Set the source location in IFACE to POINT." - (save-excursion - (set-buffer (oref iface source-buffer)) + (with-current-buffer (oref iface source-buffer) (if (not (slot-boundp iface 'source-location)) (oset iface source-location (make-marker))) (move-marker (oref iface source-location) point)) @@ -140,8 +138,7 @@ ;; Deal with the data buffer (when (slot-boundp iface 'data-buffer) (let ((lines (/ (frame-height (selected-frame)) 3)) - (cnt (save-excursion - (set-buffer (oref iface data-buffer)) + (cnt (with-current-buffer (oref iface data-buffer) (count-lines (point-min) (point-max)))) ) ;; Set the number of lines to 1/3, or the size of the data buffer. @@ -307,8 +304,7 @@ (let ((iface semantic-debug-current-interface)) (if onoff ;; Turn it on - (save-excursion - (set-buffer (oref iface parser-buffer)) + (with-current-buffer (oref iface parser-buffer) ;; Install our map onto this buffer (use-local-map semantic-debug-mode-map) ;; Make the buffer read only @@ -323,15 +319,13 @@ (run-hooks 'semantic-debug-mode-hook) ) ;; Restore old mode information - (save-excursion - (set-buffer - (oref semantic-debug-current-interface parser-buffer)) + (with-current-buffer + (oref semantic-debug-current-interface parser-buffer) (use-local-map (oref semantic-debug-current-interface parser-local-map)) ) - (save-excursion - (set-buffer - (oref semantic-debug-current-interface source-buffer)) + (with-current-buffer + (oref semantic-debug-current-interface source-buffer) (use-local-map (oref semantic-debug-current-interface source-local-map)) ) @@ -355,8 +349,7 @@ (semantic-debug-interface "Debug Interface" :parser-buffer parserb - :parser-local-map (save-excursion - (set-buffer parserb) + :parser-local-map (with-current-buffer parserb (current-local-map)) :source-buffer (current-buffer) :source-local-map (current-local-map)
--- a/lisp/cedet/semantic/ede-grammar.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/ede-grammar.el Fri Oct 30 02:16:41 2009 +0000 @@ -129,8 +129,7 @@ (proj (ede-target-parent obj)) (default-directory (oref proj directory))) (mapc (lambda (src) - (save-excursion - (set-buffer (find-file-noselect src)) + (with-current-buffer (find-file-noselect src) (save-excursion (semantic-grammar-create-package)) (save-buffer) @@ -162,8 +161,7 @@ (concat (ede-pmake-varname this) "_SEMANTIC_GRAMMAR_EL") (insert (mapconcat (lambda (src) - (save-excursion - (set-buffer (find-file-noselect src)) + (with-current-buffer (find-file-noselect src) (concat (semantic-grammar-package) ".el"))) (oref this source) " ")))
--- a/lisp/cedet/semantic/find.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/find.el Fri Oct 30 02:16:41 2009 +0000 @@ -640,8 +640,7 @@ (save-excursion (if (markerp position) (set-buffer (marker-buffer position))) (let* ((stream (if (bufferp streamorbuffer) - (save-excursion - (set-buffer streamorbuffer) + (with-current-buffer streamorbuffer (semantic-fetch-tags)) streamorbuffer)) (prev nil)
--- a/lisp/cedet/semantic/grammar.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/grammar.el Fri Oct 30 02:16:41 2009 +0000 @@ -1877,8 +1877,7 @@ (if (semantic-grammar-in-lisp-p) (with-mode-local emacs-lisp-mode (semantic-analyze-possible-completions context)) - (save-excursion - (set-buffer (oref context buffer)) + (with-current-buffer (oref context buffer) (let* ((prefix (car (oref context :prefix))) (completetext (cond ((semantic-tag-p prefix) (semantic-tag-name prefix))
--- a/lisp/cedet/semantic/ia-sb.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/ia-sb.el Fri Oct 30 02:16:41 2009 +0000 @@ -104,8 +104,7 @@ )) (error nil)) (select-frame cf) - (save-excursion - (set-buffer speedbar-buffer) + (with-current-buffer speedbar-buffer ;; If we have something, do something spiff with it. (erase-buffer) (speedbar-insert-separator "Buffer/Function") @@ -288,16 +287,14 @@ (setq ob (current-buffer)) (with-output-to-temp-buffer "*Tag Information*" ;; Output something about this tag: - (save-excursion - (set-buffer "*Tag Information*") + (with-current-buffer "*Tag Information*" (goto-char (point-max)) (insert (semantic-format-tag-prototype tag nil t) "\n") (let ((typetok (condition-case nil - (save-excursion - (set-buffer ob) + (with-current-buffer ob ;; @todo - We need a context to derive a scope from. (semantic-analyze-tag-type tag nil)) (error nil))))
--- a/lisp/cedet/semantic/idle.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/idle.el Fri Oct 30 02:16:41 2009 +0000 @@ -350,8 +350,7 @@ "Do long-processing work for for BUFFER. Uses `semantic-safe' and returns the output. Returns t of all processing succeeded." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (not (and ;; Just in case (semantic-safe "Idle Work Parse Error: %S" @@ -845,8 +844,7 @@ (pulse-flag nil) ) (cond ((semantic-overlay-p region) - (save-excursion - (set-buffer (semantic-overlay-buffer region)) + (with-current-buffer (semantic-overlay-buffer region) (goto-char (semantic-overlay-start region)) (when (pos-visible-in-window-p (point) (get-buffer-window (current-buffer) 'visible))
--- a/lisp/cedet/semantic/lex-spp.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/lex-spp.el Fri Oct 30 02:16:41 2009 +0000 @@ -864,8 +864,7 @@ semantic-lex-spp-expanded-macro-stack )) ) - (save-excursion - (set-buffer buf) + (with-current-buffer buf (erase-buffer) ;; Below is a painful hack to make sure everything is setup correctly. (when (not (eq major-mode mode))
--- a/lisp/cedet/semantic/sb.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/sb.el Fri Oct 30 02:16:41 2009 +0000 @@ -391,8 +391,7 @@ ;; Successful DB query. nil ;; No database, do it the old way. - (save-excursion - (set-buffer (find-file-noselect file)) + (with-current-buffer (find-file-noselect file) (if (or (not (featurep 'semantic)) (not semantic--parse-table)) (setq out t)
--- a/lisp/cedet/semantic/symref.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/symref.el Fri Oct 30 02:16:41 2009 +0000 @@ -476,8 +476,7 @@ "Parse the entire OUTPUTBUFFER of a symref tool. Calls the method `semantic-symref-parse-tool-output-one-line' over and over until it returns nil." - (save-excursion - (set-buffer outputbuffer) + (with-current-buffer outputbuffer (goto-char (point-min)) (let ((result nil) (hit nil))
--- a/lisp/cedet/semantic/symref/grep.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/symref/grep.el Fri Oct 30 02:16:41 2009 +0000 @@ -156,8 +156,7 @@ (ans nil) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (erase-buffer) (setq default-directory rootdir)
--- a/lisp/cedet/semantic/symref/list.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/symref/list.el Fri Oct 30 02:16:41 2009 +0000 @@ -217,8 +217,7 @@ (cond ((eq state 'closed) (toggle-read-only -1) - (save-excursion - (set-buffer buff) + (with-current-buffer buff (dolist (H hits) (goto-char (point-min)) (forward-line (1- H))
--- a/lisp/cedet/semantic/tag-file.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/tag-file.el Fri Oct 30 02:16:41 2009 +0000 @@ -193,12 +193,10 @@ (:override ;; Perform some default behaviors (if (and (fboundp 'ede-header-file) ede-minor-mode) - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (ede-header-file)) ;; No EDE options for a quick answer. Search. - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (if (re-search-forward "::Header:: \\([a-zA-Z0-9.]+\\)" nil t) (match-string 1))))))
--- a/lisp/cedet/semantic/tag-ls.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/tag-ls.el Fri Oct 30 02:16:41 2009 +0000 @@ -49,8 +49,7 @@ (defun semantic-tag-calculate-parent-default (tag) "Attempt to calculate the parent of TAG." (when (semantic-tag-in-buffer-p tag) - (save-excursion - (set-buffer (semantic-tag-buffer tag)) + (with-current-buffer (semantic-tag-buffer tag) (save-excursion (goto-char (semantic-tag-start tag)) (semantic-current-tag-parent))
--- a/lisp/cedet/semantic/util.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/semantic/util.el Fri Oct 30 02:16:41 2009 +0000 @@ -67,8 +67,7 @@ and parse it." (save-match-data (if (find-buffer-visiting file) - (save-excursion - (set-buffer (find-buffer-visiting file)) + (with-current-buffer (find-buffer-visiting file) (semantic-fetch-tags)) ;; File not loaded (if (and (require 'semantic/db-mode) @@ -76,8 +75,7 @@ ;; semanticdb is around, use it. (semanticdb-file-stream file) ;; Get the stream ourselves. - (save-excursion - (set-buffer (find-file-noselect file)) + (with-current-buffer (find-file-noselect file) (semantic-fetch-tags)))))) (semantic-alias-obsolete 'semantic-file-token-stream @@ -94,14 +92,12 @@ something) ;; A buffer ((bufferp something) - (save-excursion - (set-buffer something) + (with-current-buffer something (semantic-fetch-tags))) ;; A Tag: Get that tag's buffer ((and (semantic-tag-with-position-p something) (semantic-tag-in-buffer-p something)) - (save-excursion - (set-buffer (semantic-tag-buffer something)) + (with-current-buffer (semantic-tag-buffer something) (semantic-fetch-tags))) ;; Tag with a file name in it ((and (semantic-tag-p something) @@ -148,8 +144,7 @@ in which TOKEN (the token found to match NAME) was found. THIS ISN'T USED IN SEMANTIC. DELETE ME SOON." - (save-excursion - (set-buffer buffer) + (with-current-buffer buffer (let* ((stream (semantic-fetch-tags)) (includelist (or (semantic-find-tags-by-class 'include stream) "empty.silly.thing")) @@ -158,9 +153,8 @@ (while (and (not found) includelist) (let ((fn (semantic-dependency-tag-file (car includelist)))) (if (and fn (not (member fn unfound))) - (save-excursion - (save-match-data - (set-buffer (find-file-noselect fn))) + (with-current-buffer (save-match-data + (find-file-noselect fn)) (message "Scanning %s" (buffer-file-name)) (setq stream (semantic-fetch-tags)) (setq found (semantic-find-first-tag-by-name name stream)) @@ -287,8 +281,7 @@ (defun semantic-describe-buffer-var-helper (varsym buffer) "Display to standard out the value of VARSYM in BUFFER." (require 'data-debug) - (let ((value (save-excursion - (set-buffer buffer) + (let ((value (with-current-buffer buffer (symbol-value varsym)))) (cond ((and (consp value)
--- a/lisp/cedet/srecode/srt-mode.el Fri Oct 30 02:00:11 2009 +0000 +++ b/lisp/cedet/srecode/srt-mode.el Fri Oct 30 02:16:41 2009 +0000 @@ -629,8 +629,7 @@ (define-mode-local-override semantic-analyze-possible-completions srecode-template-mode (context) "Return a list of possible completions based on NONTEXT." - (save-excursion - (set-buffer (oref context buffer)) + (with-current-buffer (oref context buffer) (let* ((prefix (car (last (oref context :prefix)))) (prefixstr (cond ((stringp prefix) prefix)