annotate lisp/cedet/cedet-global.el @ 106748:f99663857782

Merge from trunk.
author Jan D. <jan.h.d@swipnet.se>
date Wed, 06 Jan 2010 15:33:57 +0100
parents 019d906c8f48
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; cedet-global.el --- GNU Global support for CEDET.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; Basic support for calling GNU Global, and testing version numbers.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 (declare-function inversion-check-version "inversion")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 (defvar cedet-global-min-version "5.0"
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 "Minimum version of GNU global required.")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 (defcustom cedet-global-command "global"
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 "Command name for the GNU Global executable."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 :type 'string
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 :group 'cedet)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;;; Code:
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (defun cedet-gnu-global-search (searchtext texttype type scope)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 "Perform a search with GNU Global, return the created buffer.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 SEARCHTEXT is text to find.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname,
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 'tagregexp, or 'tagcompletions.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 TYPE is the type of search, meaning that SEARCHTEXT is compared to
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 filename, tagname (tags table), references (uses of a tag) , or
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 symbol (uses of something not in the tag table.)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 SCOPE is the scope of the search, such as 'project or 'subdirs."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (let ((flgs (cond ((eq type 'file)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 "-a")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (t "-xa")))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (scopeflgs (cond
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ((eq scope 'project)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ""
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 )
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 ((eq scope 'target)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 "l")))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 (stflag (cond ((or (eq texttype 'tagname)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 (eq texttype 'tagregexp))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 "")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 ((eq texttype 'tagcompletions)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 "c")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 ((eq texttype 'regexp)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 "g")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (t "r"))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 (cedet-gnu-global-call (list (concat flgs scopeflgs stflag)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 searchtext))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 (defun cedet-gnu-global-call (flags)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 "Call GNU Global with the list of FLAGS."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (let ((b (get-buffer-create "*CEDET Global*"))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 (cd default-directory))
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
70 (with-current-buffer b
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 (setq default-directory cd)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 (erase-buffer))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 (apply 'call-process cedet-global-command
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 nil b nil
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 flags)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 b))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 (defun cedet-gnu-global-expand-filename (filename)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 "Expand the FILENAME with GNU Global.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 Return a fully qualified filename."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 (interactive "sFile: ")
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
82 (let ((ans (with-current-buffer (cedet-gnu-global-call (list "-Pa" filename))
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 (goto-char (point-min))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (if (looking-at "global: ")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (error "GNU Global not available")
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 (split-string (buffer-string) "\n" t)))))
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 105799
diff changeset
87 (when (called-interactively-p 'interactive)
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (if ans
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (if (= (length ans) 1)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (message "%s" (car ans))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 (message "%s + %d others" (car ans)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (length (cdr ans))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (error "No file found")))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 ans))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (defun cedet-gnu-global-show-root ()
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 "Show the root of a GNU Global area under the current buffer."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (interactive)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (message "%s" (cedet-gnu-global-root)))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (defun cedet-gnu-global-root (&optional dir)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 "Return the root of any GNU Global scanned project.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 If a default starting DIR is not specified, the current buffer's
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 `default-directory' is used."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (let ((default-directory (or dir default-directory)))
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
106 (with-current-buffer (cedet-gnu-global-call (list "-pq"))
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (goto-char (point-min))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (when (not (eobp))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (file-name-as-directory
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (buffer-substring (point) (point-at-eol)))))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (defun cedet-gnu-global-version-check (&optional noerror)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 "Check the version of the installed GNU Global command.
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 If optional programatic argument NOERROR is non-nil, then
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 instead of throwing an error if Global isn't available, then
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 return nil."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (interactive)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (require 'inversion)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (let ((b (condition-case nil
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (cedet-gnu-global-call (list "--version"))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (error nil)))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (rev nil))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (if (not b)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (progn
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 105799
diff changeset
125 (when (called-interactively-p 'interactive)
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (message "GNU Global not found."))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 nil)
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
128 (with-current-buffer b
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (goto-char (point-min))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (re-search-forward "GNU GLOBAL \\([0-9.]+\\)" nil t)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (setq rev (match-string 1))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (if (inversion-check-version rev nil cedet-global-min-version)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (if noerror
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 nil
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (error "Version of GNU Global is %s. Need at least %s"
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 rev cedet-global-min-version))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;; Else, return TRUE, as in good enough.
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 105799
diff changeset
138 (when (called-interactively-p 'interactive)
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (message "GNU Global %s - Good enough for CEDET." rev))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 t)))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (defun cedet-gnu-global-scan-hits (buffer)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 "Scan all the hits from the GNU Global output BUFFER."
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (let ((hits nil)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (r1 "^\\([^ ]+\\) +\\([0-9]+\\) \\([^ ]+\\) "))
105799
3fe6da4a95a9 * cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105377
diff changeset
146 (with-current-buffer buffer
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (goto-char (point-min))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (while (re-search-forward r1 nil t)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (setq hits (cons (cons (string-to-number (match-string 2))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (match-string 3))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 hits)))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ;; Return the results
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (nreverse hits))))
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (provide 'cedet-global)
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105241
diff changeset
157 ;; arch-tag: 0d0d3ac2-91ef-4820-bb2b-1d59ccf38392
105241
130db1220dfd * cedet/cedet-cscope.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 ;;; cedet-global.el ends here