comparison lisp/cedet/semantic/util.el @ 104492:8db96f200ac8

Synch to Eric Ludlam's upstream CEDET repository. * cedet/semantic/db.el (semanticdb-get-buffer): Wrap find-file in save-match-data. * cedet/semantic/db-global.el (semanticdb-test-gnu-global): Wrap find-file in save-match-data. * cedet/semantic/util.el (semantic-file-tag-table) (semantic-recursive-find-nonterminal-by-name): Wrap find-file in save-match-data. * cedet/semantic/tag.el (semantic-tag-buffer): Wrap find-file in save-match-data. * cedet/semantic/tag-file.el (semantic-go-to-tag): Wrap the "goto" part with save-match-data. * cedet/semantic/lex-spp.el (semantic-lex-spp-lex-text-string): Save match data around calling the major mode to enable. * cedet/semantic/format.el (semantic-format-tag-short-doc-default): Wrap find-file in save-match-data. * cedet/semantic/fw.el (semantic-find-file-noselect): Wrap find-file in save-match-data
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 19 Sep 2009 17:25:30 +0000
parents d634157e6a91
children 90ca5d588aa9
comparison
equal deleted inserted replaced
104491:ee206d5b836f 104492:8db96f200ac8
66 If it is loaded, return the stream after making sure it's ok. 66 If it is loaded, return the stream after making sure it's ok.
67 If FILE is not loaded, check to see if `semanticdb' feature exists, 67 If FILE is not loaded, check to see if `semanticdb' feature exists,
68 and use it to get tags from files not in memory. 68 and use it to get tags from files not in memory.
69 If FILE is not loaded, and semanticdb is not available, find the file 69 If FILE is not loaded, and semanticdb is not available, find the file
70 and parse it." 70 and parse it."
71 (if (find-buffer-visiting file) 71 (save-match-data
72 (save-excursion 72 (if (find-buffer-visiting file)
73 (set-buffer (find-buffer-visiting file)) 73 (save-excursion
74 (semantic-fetch-tags)) 74 (set-buffer (find-buffer-visiting file))
75 ;; File not loaded 75 (semantic-fetch-tags))
76 (if (and (require 'semantic/db-mode) 76 ;; File not loaded
77 (semanticdb-minor-mode-p)) 77 (if (and (require 'semantic/db-mode)
78 ;; semanticdb is around, use it. 78 (semanticdb-minor-mode-p))
79 (semanticdb-file-stream file) 79 ;; semanticdb is around, use it.
80 ;; Get the stream ourselves. 80 (semanticdb-file-stream file)
81 (save-excursion 81 ;; Get the stream ourselves.
82 (set-buffer (find-file-noselect file)) 82 (save-excursion
83 (semantic-fetch-tags))))) 83 (set-buffer (find-file-noselect file))
84 (semantic-fetch-tags))))))
84 85
85 (semantic-alias-obsolete 'semantic-file-token-stream 86 (semantic-alias-obsolete 'semantic-file-token-stream
86 'semantic-file-tag-table) 87 'semantic-file-tag-table)
87 88
88 (defun semantic-something-to-tag-table (something) 89 (defun semantic-something-to-tag-table (something)
159 (unfound nil)) 160 (unfound nil))
160 (while (and (not found) includelist) 161 (while (and (not found) includelist)
161 (let ((fn (semantic-dependency-tag-file (car includelist)))) 162 (let ((fn (semantic-dependency-tag-file (car includelist))))
162 (if (and fn (not (member fn unfound))) 163 (if (and fn (not (member fn unfound)))
163 (save-excursion 164 (save-excursion
164 (set-buffer (find-file-noselect fn)) 165 (save-match-data
166 (set-buffer (find-file-noselect fn)))
165 (message "Scanning %s" (buffer-file-name)) 167 (message "Scanning %s" (buffer-file-name))
166 (setq stream (semantic-fetch-tags)) 168 (setq stream (semantic-fetch-tags))
167 (setq found (semantic-find-first-tag-by-name name stream)) 169 (setq found (semantic-find-first-tag-by-name name stream))
168 (if found 170 (if found
169 (setq found (cons (current-buffer) (list found))) 171 (setq found (cons (current-buffer) (list found)))