diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-10-30 02:16:41 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2009-10-30 02:16:41 +0000 |
commit | 0816d744fb81400c736c1827b9c4332abd8fbabc (patch) | |
tree | e4978f1987feb94a10c3301050cfcedd0c7318c9 /lisp/cedet/semantic | |
parent | ca0a881a3512c1f9495833e15a801f5af5b89893 (diff) | |
download | emacs-0816d744fb81400c736c1827b9c4332abd8fbabc.tar.gz |
* 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.
Diffstat (limited to 'lisp/cedet/semantic')
27 files changed, 67 insertions, 128 deletions
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index a4d5664f226..d7e18102b81 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el @@ -710,8 +710,7 @@ Optional argument CTXT is the context to show." (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)))))) diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index f7c390784d6..2b5325f848d 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -104,8 +104,7 @@ Argument COMP are possible completions here." ;; 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 @@ with the command: (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 @@ with the command: (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 @@ or implementing a version specific to ") (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 @@ PARENT is a possible parent (by nesting) tag." 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) diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index de7ed48edfd..064e231c9e9 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el @@ -703,8 +703,7 @@ the regular parser." (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 diff --git a/lisp/cedet/semantic/bovine/gcc.el b/lisp/cedet/semantic/bovine/gcc.el index 7ad7aba5998..197e9b0065a 100644 --- a/lisp/cedet/semantic/bovine/gcc.el +++ b/lisp/cedet/semantic/bovine/gcc.el @@ -40,8 +40,7 @@ to give to the program." ;; (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 diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el index 154defb417a..9f68c9f2436 100644 --- a/lisp/cedet/semantic/complete.el +++ b/lisp/cedet/semantic/complete.el @@ -947,8 +947,7 @@ Calculate the cache if there isn't one." "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 @@ inserted into the current context.") (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 @@ one in the source buffer." (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 @@ prompts. these are calculated from the CONTEXT variable passed in." :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 "." "") diff --git a/lisp/cedet/semantic/db-debug.el b/lisp/cedet/semantic/db-debug.el index 619dd601186..40b311ca285 100644 --- a/lisp/cedet/semantic/db-debug.el +++ b/lisp/cedet/semantic/db-debug.el @@ -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))))) diff --git a/lisp/cedet/semantic/db-ebrowse.el b/lisp/cedet/semantic/db-ebrowse.el index 9b915935c66..d8f14a765c3 100644 --- a/lisp/cedet/semantic/db-ebrowse.el +++ b/lisp/cedet/semantic/db-ebrowse.el @@ -118,8 +118,7 @@ EBROWSE is a C/C++ parser for use with `ebrowse' Emacs program.") (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 @@ is specified by `semanticdb-default-save-directory'." (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 @@ is specified by `semanticdb-default-save-directory'." (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 @@ is specified by `semanticdb-default-save-directory'." ;; 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) diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el index 7e491a21efb..4b232278a39 100644 --- a/lisp/cedet/semantic/db-el.el +++ b/lisp/cedet/semantic/db-el.el @@ -109,8 +109,7 @@ For Emacs Lisp, creates a specialized table." "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)) diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el index 4bd042ecefe..ec8ffdccb28 100644 --- a/lisp/cedet/semantic/db-file.el +++ b/lisp/cedet/semantic/db-file.el @@ -281,8 +281,7 @@ Restore the overlays after writting. 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) diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index fd5b7706c31..b2ec243f506 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -469,12 +469,11 @@ a new path from the provided PATH." 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 @@ Returns result." "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 @@ Returns result." (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 @@ Returns result." (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") diff --git a/lisp/cedet/semantic/db-javascript.el b/lisp/cedet/semantic/db-javascript.el index 8fa3f15f5ba..cfd6575902c 100644 --- a/lisp/cedet/semantic/db-javascript.el +++ b/lisp/cedet/semantic/db-javascript.el @@ -147,8 +147,7 @@ Create one of our special tables that can act as an intermediary." "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 diff --git a/lisp/cedet/semantic/db-typecache.el b/lisp/cedet/semantic/db-typecache.el index 4c841494a97..b3ae2540e26 100644 --- a/lisp/cedet/semantic/db-typecache.el +++ b/lisp/cedet/semantic/db-typecache.el @@ -540,8 +540,7 @@ If there isn't one, create it. (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))) diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el index cfde30b7585..48531513ad6 100644 --- a/lisp/cedet/semantic/db.el +++ b/lisp/cedet/semantic/db.el @@ -552,8 +552,7 @@ The file associated with OBJ does not need to be in a buffer." (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)) diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el index ac8b4b1314e..94cba53b942 100644 --- a/lisp/cedet/semantic/debug.el +++ b/lisp/cedet/semantic/debug.el @@ -118,8 +118,7 @@ These buffers are brought into view when layout occurs.") (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 @@ These buffers are brought into view when layout occurs.") (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 @@ These buffers are brought into view when layout occurs.") ;; 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 @@ Argument ONOFF is non-nil when we are entering debug mode. (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 @@ Argument ONOFF is non-nil when we are entering debug mode. (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 @@ Argument ONOFF is non-nil when we are entering debug mode. (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) diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el index e0162f52c8d..e19234bb812 100644 --- a/lisp/cedet/semantic/ede-grammar.el +++ b/lisp/cedet/semantic/ede-grammar.el @@ -129,8 +129,7 @@ Lays claim to all -by.el, and -wy.el files." (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 @@ Lays claim to all -by.el, and -wy.el files." (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) " "))) diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index d9da329bd0b..07377703774 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el @@ -640,8 +640,7 @@ the median calculation, and return nil." (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) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index f4d34def561..3600c1917bf 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1877,8 +1877,7 @@ Optional argument COLOR determines if color is added to the text." (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)) diff --git a/lisp/cedet/semantic/ia-sb.el b/lisp/cedet/semantic/ia-sb.el index 3b57133d0c3..98eeeeda141 100644 --- a/lisp/cedet/semantic/ia-sb.el +++ b/lisp/cedet/semantic/ia-sb.el @@ -104,8 +104,7 @@ DIRECTORY is the current directory, which is ignored, and ZERO is 0." )) (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 @@ TEXT, TAG, and INDENT are speedbar function arguments." (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)))) diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index b93ed65c1f5..ec2af3e36be 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -350,8 +350,7 @@ Disable to prevent lots of excessive parsing in idle time." "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 @@ visible, then highlight it." (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)) diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index b078a25b28e..d7bbee5d5e6 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -864,8 +864,7 @@ and variable state from the current buffer." 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)) diff --git a/lisp/cedet/semantic/sb.el b/lisp/cedet/semantic/sb.el index 582eea39d8b..277b28a81b3 100644 --- a/lisp/cedet/semantic/sb.el +++ b/lisp/cedet/semantic/sb.el @@ -391,8 +391,7 @@ Returns the tag list, or t for an error." ;; 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) diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el index 429e9026021..16f351ce15e 100644 --- a/lisp/cedet/semantic/symref.el +++ b/lisp/cedet/semantic/symref.el @@ -476,8 +476,7 @@ The symref TOOL should already contain the search criteria." "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)) diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index 08c79ed842e..949a44980ac 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el @@ -156,8 +156,7 @@ GREPPATTERN is the pattern used by grep." (ans nil) ) - (save-excursion - (set-buffer b) + (with-current-buffer b (erase-buffer) (setq default-directory rootdir) diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el index 94114c14f6e..d8f29940c8e 100644 --- a/lisp/cedet/semantic/symref/list.el +++ b/lisp/cedet/semantic/symref/list.el @@ -217,8 +217,7 @@ BUTTON is the button that was clicked." (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)) diff --git a/lisp/cedet/semantic/tag-file.el b/lisp/cedet/semantic/tag-file.el index 70d6b9cd688..0be88ea0469 100644 --- a/lisp/cedet/semantic/tag-file.el +++ b/lisp/cedet/semantic/tag-file.el @@ -193,12 +193,10 @@ file prototypes belong in." (: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)))))) diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el index 2d12b03e248..3456ce8769b 100644 --- a/lisp/cedet/semantic/tag-ls.el +++ b/lisp/cedet/semantic/tag-ls.el @@ -49,8 +49,7 @@ search locally, then semanticdb for that tag (when enabled.)") (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)) diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el index 126c587a801..9a4d7dd26ac 100644 --- a/lisp/cedet/semantic/util.el +++ b/lisp/cedet/semantic/util.el @@ -67,8 +67,7 @@ If FILE is not loaded, and semanticdb is not available, find the file 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 @@ If FILE is not loaded, and semanticdb is not available, find the file ;; 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 @@ buffer, or a filename. If SOMETHING is nil return nil." 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 @@ The return item is of the form (BUFFER TOKEN) where BUFFER is the buffer 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 @@ THIS ISN'T USED IN SEMANTIC. DELETE ME SOON." (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 @@ If TAG is not specified, use the tag at point." (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) |