Mercurial > emacs
annotate lisp/cedet/semantic/symref/filter.el @ 110763:0fe64d68a522
Merge changes made in Gnus trunk.
shr.el: Implement table rendering.
shr.el (shr-make-table): Tweak table generation.
shr.el (shr-make-table): Fix typo.
nnimap.el (nnimap-open-connection): Allow tls as a synonym for ssl.
gnus-util.el (gnus-emacs-completing-read): Mapcar collection to list, for XEmacs.
nnimap.el (nnimap-close-server): Implement.
gnus-salt.el: Remove all gnus-carpal stuff -- it's not useful.
nnir.el (nnir-run-imap): Remove spurious space in search string.
message.el (message-idna-to-ascii-rhs-1): Don't bug out on addresses without @ signs.
gnus-sum.el (gnus-widen-article-window): New variable.
shr.el (browse-url): Required.
shr.el (shr-ensure-paragraph): Don't insert a new newline after empty-ish lines.
shr.el (shr-show-alt-text, shr-browse-image): New commands.
gravatar.el (gravatar-retrieved): kill buffer when retrieved.
shr.el (shr-browse-url, shr-copy-url): New commands.
shr.el (shr-render-td): Protect against too-wide text.
spam-report.el (spam-report-url-ping-plain): Don't query about killing the process.
nnimap.el (nnimap-finish-retrieve-group-infos): Message while waiting for data.
shr.el (shr-tag-blockquote): Ensure paragraph after quote, too.
mml-smime.el: Fix gnus-completing-read usage.
shr.el (shr-get-image-data): Ensure against the cache file missing.
nnimap.el (nnimap-open-connection): Give an error if nnimap-stream is unknown.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Mon, 04 Oct 2010 22:26:51 +0000 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/symref/filter.el --- Filter symbol reference hits for accuracy. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; (at your option) any later version. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Filter symbol reference hits for accuracy. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Most symbol referencing tools, such as find/grep only find matching |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; strings, but cannot determine the difference between an actual use, |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; and something else with a similar name, or even a string in a comment. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; This file provides utilities for filtering down to accurate matches |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; starting at a basic filter level that doesn't use symref, up to filters |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; across symref results. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;;; Code: |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (require 'semantic) |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
104493
diff
changeset
|
37 (require 'semantic/analyze) |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
38 (declare-function srecode-active-template-region "srecode/fields") |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
39 (declare-function srecode-delete "srecode/fields") |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
40 (declare-function srecode-field "srecode/fields") |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
41 (declare-function srecode-template-inserted-region "srecode/fields") |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
42 (declare-function srecode-overlaid-activate "srecode/fields") |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
104493
diff
changeset
|
43 (declare-function semantic-idle-summary-useful-context-p "semantic/idle") |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;;; FILTERS |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (defun semantic-symref-filter-hit (target &optional position) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 "Determine if the tag TARGET is used at POSITION in the current buffer. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 Return non-nil for a match." |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (semantic-analyze-current-symbol |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (lambda (start end prefix) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (let ((tag (car (nreverse prefix)))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (and (semantic-tag-p tag) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (semantic-equivalent-tag-p target tag)))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 position)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;;; IN-BUFFER FILTERING |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 ;; The following does filtering in-buffer only, and not against |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;; a symref results object. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (defun semantic-symref-hits-in-region (target hookfcn start end) |
105340 | 63 "Find all occurrences of the symbol TARGET that match TARGET the tag. |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 For each match, call HOOKFCN. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 HOOKFCN takes three arguments that match |
105340 | 66 `semantic-analyze-current-symbol's use of HOOKFCN. |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 ( START END PREFIX ) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 Search occurs in the current buffer between START and END." |
104496
8c4870c15962
* cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
104493
diff
changeset
|
70 (require 'semantic/idle) |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (save-excursion |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (goto-char start) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (let* ((str (semantic-tag-name target)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (case-fold-search semantic-case-fold) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (regexp (concat "\\<" (regexp-quote str) "\\>"))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (while (re-search-forward regexp end t) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (when (semantic-idle-summary-useful-context-p) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (semantic-analyze-current-symbol |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (lambda (start end prefix) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (let ((tag (car (nreverse prefix)))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 ;; check for semantic match on the text match. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (when (and (semantic-tag-p tag) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (semantic-equivalent-tag-p target tag)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (save-excursion |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (funcall hookfcn start end prefix))))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (point))))))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (defun semantic-symref-rename-local-variable () |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 "Fancy way to rename the local variable under point. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 Depends on the SRecode Field editing API." |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (interactive) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 ;; Do the replacement as needed. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (let* ((ctxt (semantic-analyze-current-context)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (target (car (reverse (oref ctxt prefix)))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (tag (semantic-current-tag)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (when (or (not target) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (not (semantic-tag-with-position-p target))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (error "Cannot identify symbol under point")) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (when (not (semantic-tag-of-class-p target 'variable)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (error "Can only rename variables")) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (when (or (< (semantic-tag-start target) (semantic-tag-start tag)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (> (semantic-tag-end target) (semantic-tag-end tag))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (error "Can only rename variables declared in %s" |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (semantic-tag-name tag))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 ;; I think we're good for this example. Give it a go through |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ;; our fancy interface from SRecode. |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104454
diff
changeset
|
112 (require 'srecode/fields) |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 ;; Make sure there is nothing active. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (let ((ar (srecode-active-template-region))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (when ar (srecode-delete ar))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (let ((srecode-field-archive nil) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (region nil) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 ) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (semantic-symref-hits-in-region |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 target (lambda (start end prefix) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 ;; For every valid hit, create one field. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (srecode-field "LOCAL" :name "LOCAL" :start start :end end)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (semantic-tag-start tag) (semantic-tag-end tag)) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 ;; Now that the fields are setup, create the region. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (setq region (srecode-template-inserted-region |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 "REGION" :start (semantic-tag-start tag) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 :end (semantic-tag-end tag))) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;; Activate the region. |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (srecode-overlaid-activate region) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 ) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 )) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (provide 'semantic/symref/filter) |
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
105377 | 140 ;; arch-tag: 14b9e795-02bf-408b-b375-c3f8ff6a4e38 |
104454
e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;;; semantic/symref/filter.el ends here |