comparison lisp/cedet/semantic/tag-file.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 d66016869489
children bbd7017a25d9
comparison
equal deleted inserted replaced
104491:ee206d5b836f 104492:8db96f200ac8
43 "Go to the location of TAG. 43 "Go to the location of TAG.
44 TAG may be a stripped element, in which case PARENT specifies a 44 TAG may be a stripped element, in which case PARENT specifies a
45 parent tag that has position information. 45 parent tag that has position information.
46 PARENT can also be a `semanticdb-table' object." 46 PARENT can also be a `semanticdb-table' object."
47 (:override 47 (:override
48 (cond ((semantic-tag-in-buffer-p tag) 48 (save-match-data
49 ;; We have a linked tag, go to that buffer. 49 (cond ((semantic-tag-in-buffer-p tag)
50 (set-buffer (semantic-tag-buffer tag))) 50 ;; We have a linked tag, go to that buffer.
51 ((semantic-tag-file-name tag) 51 (set-buffer (semantic-tag-buffer tag)))
52 ;; If it didn't have a buffer, but does have a file 52 ((semantic-tag-file-name tag)
53 ;; name, then we need to get to that file so the tag 53 ;; If it didn't have a buffer, but does have a file
54 ;; location is made accurate. 54 ;; name, then we need to get to that file so the tag
55 (set-buffer (find-file-noselect (semantic-tag-file-name tag)))) 55 ;; location is made accurate.
56 ((and parent (semantic-tag-p parent) (semantic-tag-in-buffer-p parent)) 56 (set-buffer (find-file-noselect (semantic-tag-file-name tag))))
57 ;; The tag had nothing useful, but we have a parent with 57 ((and parent (semantic-tag-p parent) (semantic-tag-in-buffer-p parent))
58 ;; a buffer, then go there. 58 ;; The tag had nothing useful, but we have a parent with
59 (set-buffer (semantic-tag-buffer parent))) 59 ;; a buffer, then go there.
60 ((and parent (semantic-tag-p parent) (semantic-tag-file-name parent)) 60 (set-buffer (semantic-tag-buffer parent)))
61 ;; Tag had nothing, and the parent only has a file-name, then 61 ((and parent (semantic-tag-p parent) (semantic-tag-file-name parent))
62 ;; find that file, and switch to that buffer. 62 ;; Tag had nothing, and the parent only has a file-name, then
63 (set-buffer (find-file-noselect (semantic-tag-file-name parent)))) 63 ;; find that file, and switch to that buffer.
64 ((and parent (featurep 'semantic/db) 64 (set-buffer (find-file-noselect (semantic-tag-file-name parent))))
65 (semanticdb-table-child-p parent)) 65 ((and parent (featurep 'semantic/db)
66 (set-buffer (semanticdb-get-buffer parent))) 66 (semanticdb-table-child-p parent))
67 (t 67 (set-buffer (semanticdb-get-buffer parent)))
68 ;; Well, just assume things are in the current buffer. 68 (t
69 nil 69 ;; Well, just assume things are in the current buffer.
70 )) 70 nil
71 )))
71 ;; We should be in the correct buffer now, try and figure out 72 ;; We should be in the correct buffer now, try and figure out
72 ;; where the tag is. 73 ;; where the tag is.
73 (cond ((semantic-tag-with-position-p tag) 74 (cond ((semantic-tag-with-position-p tag)
74 ;; If it's a number, go there 75 ;; If it's a number, go there
75 (goto-char (semantic-tag-start tag))) 76 (goto-char (semantic-tag-start tag)))