Mercurial > emacs
annotate lisp/cedet/semantic/symref/list.el @ 110523:a5ad4f188e19
Synch Semantic to CEDET 1.0.
Move CEDET ChangeLog entries to new file lisp/cedet/ChangeLog.
* semantic.el (semantic-version): Update to 2.0.
(semantic-mode-map): Add "," and "m" bindings.
(navigate-menu): Update.
* semantic/symref.el (semantic-symref-calculate-rootdir):
New function.
(semantic-symref-detect-symref-tool): Use it.
* semantic/symref/grep.el (semantic-symref-grep-shell): New var.
(semantic-symref-perform-search): Use it. Calculate root dir with
semantic-symref-calculate-rootdir.
(semantic-symref-derive-find-filepatterns): Improve error message.
* semantic/symref/list.el
(semantic-symref-results-mode-map): New bindings.
(semantic-symref-auto-expand-results): New option.
(semantic-symref-results-dump): Obey auto-expand.
(semantic-symref-list-expand-all, semantic-symref-regexp)
(semantic-symref-list-contract-all)
(semantic-symref-list-map-open-hits)
(semantic-symref-list-update-open-hits)
(semantic-symref-list-create-macro-on-open-hit)
(semantic-symref-list-call-macro-on-open-hits): New functions.
(semantic-symref-list-menu-entries)
(semantic-symref-list-menu): New vars.
(semantic-symref-list-map-open-hits): Move cursor to beginning of
match before calling the mapped function.
* semantic/doc.el
(semantic-documentation-comment-preceeding-tag): Do nothing if the
mode doesn't provide comment-start-skip.
* semantic/scope.el
(semantic-analyze-scope-nested-tags-default): Strip duplicates.
(semantic-analyze-scoped-inherited-tag-map): Take the tag we are
looking for as part of the scoped tags list.
* semantic/html.el (semantic-default-html-setup): Add
senator-step-at-tag-classes.
* semantic/decorate/include.el
(semantic-decoration-on-unknown-includes): Change light bgcolor.
(semantic-decoration-on-includes-highlight-default): Check that
the include tag has a postion.
* semantic/complete.el (semantic-collector-local-members):
(semantic-complete-read-tag-local-members)
(semantic-complete-jump-local-members): New class and functions.
(semantic-complete-self-insert): Save excursion before completing.
* semantic/analyze/complete.el
(semantic-analyze-possible-completions-default): If no completions
are found, return the raw by-name-only completion list. Add FLAGS
arguments. Add support for 'no-tc (type constraint) and
'no-unique, or no stripping duplicates.
(semantic-analyze-possible-completions-default): Add FLAGS arg.
* semantic/util-modes.el
(semantic-stickyfunc-show-only-functions-p): New option.
(semantic-stickyfunc-fetch-stickyline): Don't show stickytext for
the very first line in a buffer.
* semantic/util.el (semantic-hack-search)
(semantic-recursive-find-nonterminal-by-name)
(semantic-current-tag-interactive): Deleted.
(semantic-describe-buffer): Fix expand-nonterminal. Add
lex-syntax-mods, type relation separator char, and command
separation char.
(semantic-sanity-check): Only message if called interactively.
* semantic/tag.el (semantic-tag-deep-copy-one-tag): Copy the
:filename property and the tag position.
* semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
Add recursion limit.
* semantic/imenu.el (semantic-imenu-bucketize-type-members):
Make this buffer local, not the obsoleted variable.
* semantic/idle.el: Add breadcrumbs support.
(semantic-idle-summary-current-symbol-info-default)
(semantic-idle-tag-highlight)
(semantic-idle-completion-list-default): Use
semanticdb-without-unloaded-file-searches for speed, and to
conform to the controls that specify if the idle timer is supposed
to be parsing unparsed includes.
(semantic-idle-symbol-highlight-face)
(semantic-idle-symbol-maybe-highlight): Rename from *-summary-*.
Callers changed.
(semantic-idle-work-parse-neighboring-files-flag): Default to nil.
(semantic-idle-work-update-headers-flag): New var.
(semantic-idle-work-for-one-buffer): Use it.
(semantic-idle-local-symbol-highlight): Rename from
semantic-idle-tag-highlight.
(semantic-idle-truncate-long-summaries): New option.
* semantic/ia.el (semantic-ia-cache)
(semantic-ia-get-completions): Deleted. Callers changed.
(semantic-ia-show-variants): New command.
(semantic-ia-show-doc): If doc is empty, don't make a temp buffer.
(semantic-ia-show-summary): If there isn't anything to show, say so.
* semantic/grammar.el (semantic-grammar-create-package):
Save the buffer even in batch mode.
* semantic/fw.el
(semanticdb-without-unloaded-file-searches): New macro.
* semantic/dep.el (semantic-dependency-find-file-on-path):
Fix case dereferencing ede-object when it is a list.
* semantic/db-typecache.el (semanticdb-expand-nested-tag)
(semanticdb-typecache-faux-namespace): New functions.
(semanticdb-typecache-file-tags)
(semanticdb-typecache-merge-streams): Use them.
(semanticdb-typecache-file-tags): When deriving tags from a file,
give the mode a chance to monkey with the tag copy.
(semanticdb-typecache-find-default): Wrap find in save-excursion.
(semanticdb-typecache-find-by-name-helper): Merge found names down.
* semantic/db-global.el
(semanticdb-enable-gnu-global-in-buffer): Don't show messages if
GNU Global is not available and we don't want to throw an error.
* semantic/db-find.el (semanticdb-find-result-nth-in-buffer):
When trying to normalize the tag to a buffer, don't error if
set-buffer method doesn't exist.
* semantic/db-file.el (semanticdb-save-db): Simplify msg.
* semantic/db.el (semanticdb-refresh-table): If forcing a
refresh on a file not in a buffer, use semantic-find-file-noselect
and delete the buffer after use.
(semanticdb-current-database-list): When calculating root via
hooks, force it through true-filename and skip the list of
possible roots.
* semantic/ctxt.el (semantic-ctxt-imported-packages): New.
* semantic/analyze/debug.el
(semantic-analyzer-debug-insert-tag): Reset standard output to
current buffer.
(semantic-analyzer-debug-global-symbol)
(semantic-analyzer-debug-missing-innertype): Change "prefix" to
"symbol" in messages.
* semantic/analyze/refs.el: (semantic-analyze-refs-impl)
(semantic-analyze-refs-proto): When calculating value, make sure
the found tag is 'similar' to the originating tag.
(semantic--analyze-refs-find-tags-with-parent): Attempt to
identify matches via imported symbols of parents.
(semantic--analyze-refs-full-lookup-with-parents): Do a deep
search during the brute search.
* semantic/analyze.el
(semantic-analyze-find-tag-sequence-default): Be robust to
calculated scopes being nil.
* semantic/bovine/c.el (semantic-c-describe-environment): Add
project macro symbol array.
(semantic-c-parse-lexical-token): Add recursion limit.
(semantic-ctxt-imported-packages, semanticdb-expand-nested-tag):
New overrides.
(semantic-expand-c-tag-namelist): Split a full type from a typedef
out to its own tag.
(semantic-expand-c-tag-namelist): Do not split out a typedef'd
inline type if it is an anonymous type.
(semantic-c-reconstitute-token): Use the optional initializers as
a clue that some function is probably a constructor. When
defining the type of these constructors, split the parent name,
and use only the class part, if applicable.
* semantic/bovine/c-by.el:
* semantic/wisent/python-wy.el: Regenerate.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 18 Sep 2010 22:49:54 -0400 |
parents | 1d1d5d9bd884 |
children | 93141d34a175 |
rev | line source |
---|---|
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/symref/list.el --- Symref Output List UI. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
105290 | 9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation, either version 3 of the License, or | |
12 ;; (at your option) any later version. | |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
105290 | 14 ;; GNU Emacs is distributed in the hope that it will be useful, |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
105290 | 20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Provide a simple user facing API to finding symbol references. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
105340 | 26 ;; This UI is the base of some refactoring tools. For any refactor, |
27 ;; the user will execture [FIXME what?] `semantic-symref' in a tag. | |
28 ;; Once that data is collected, the output will be listed in a buffer. | |
29 ;; In the output buffer, the user can then initiate different | |
30 ;; refactoring operations. | |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; NOTE: Need to add some refactoring tools. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic/symref) |
104522
2a2b8ae24b17
* cedet/semantic/symref/list.el: Require semantic/complete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
35 (require 'semantic/complete) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
36 (require 'semantic/senator) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (require 'pulse) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;;; Code: |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
41 ;;;###autoload |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (defun semantic-symref () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 "Find references to the current tag. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 This command uses the currently configured references tool within the |
105340 | 45 current project to find references to the current tag. The |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
46 references are organized by file and the name of the function |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 they are used in. |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
48 Display the references in `semantic-symref-results-mode'." |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (semantic-fetch-tags) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (let ((ct (semantic-current-tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (res nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;; Must have a tag... |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (when (not ct) (error "Place cursor inside tag to be searched for")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ;; Check w/ user. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 (when (not (y-or-n-p (format "Find references for %s? " (semantic-tag-name ct)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (error "Quit")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 ;; Gather results and tags |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (message "Gathering References...") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (setq res (semantic-symref-find-references-by-name (semantic-tag-name ct))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (semantic-symref-produce-list-on-results res (semantic-tag-name ct)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
64 ;;;###autoload |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (defun semantic-symref-symbol (sym) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 "Find references to the symbol SYM. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 This command uses the currently configured references tool within the |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 current project to find references to the input SYM. The |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
69 references are organized by file and the name of the function |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
70 they are used in. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
71 Display the references in `semantic-symref-results-mode'." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
72 (interactive (list (semantic-tag-name (semantic-complete-read-tag-buffer-deep |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
73 "Symrefs for: ")))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
74 (semantic-fetch-tags) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
75 (let ((res nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
76 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
77 ;; Gather results and tags |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
78 (message "Gathering References...") |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
79 (setq res (semantic-symref-find-references-by-name sym)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
80 (semantic-symref-produce-list-on-results res sym))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
81 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
82 ;;;###autoload |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
83 (defun semantic-symref-regexp (sym) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
84 "Find references to the a symbol regexp SYM. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
85 This command uses the currently configured references tool within the |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
86 current project to find references to the input SYM. The |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 references are the organized by file and the name of the function |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 they are used in. |
105340 | 89 Display the references in`semantic-symref-results-mode'." |
104522
2a2b8ae24b17
* cedet/semantic/symref/list.el: Require semantic/complete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
90 (interactive (list (semantic-tag-name (semantic-complete-read-tag-buffer-deep |
2a2b8ae24b17
* cedet/semantic/symref/list.el: Require semantic/complete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104456
diff
changeset
|
91 "Symrefs for: ")))) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (semantic-fetch-tags) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (let ((res nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ;; Gather results and tags |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (message "Gathering References...") |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
97 (setq res (semantic-symref-find-text sym)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (semantic-symref-produce-list-on-results res sym))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (defun semantic-symref-produce-list-on-results (res str) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 "Produce a symref list mode buffer on the results RES." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (when (not res) (error "No references found")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (semantic-symref-result-get-tags res t) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (message "Gathering References...done") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ;; Build a refrences buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (let ((buff (get-buffer-create |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (format "*Symref %s" str))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (set-buffer buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (semantic-symref-results-mode res)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 ;;; RESULTS MODE |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 ;; |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (defgroup semantic-symref-results-mode nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 "Symref Results group." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 :group 'semantic) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 (defvar semantic-symref-results-mode-map |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (let ((km (make-sparse-keymap))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (define-key km "\C-i" 'forward-button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (define-key km "\M-C-i" 'backward-button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (define-key km " " 'push-button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (define-key km "-" 'semantic-symref-list-toggle-showing) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (define-key km "=" 'semantic-symref-list-toggle-showing) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (define-key km "+" 'semantic-symref-list-toggle-showing) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (define-key km "n" 'semantic-symref-list-next-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (define-key km "p" 'semantic-symref-list-prev-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (define-key km "q" 'semantic-symref-hide-buffer) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
132 (define-key km "\C-c\C-e" 'semantic-symref-list-expand-all) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
133 (define-key km "\C-c\C-r" 'semantic-symref-list-contract-all) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
134 (define-key km "R" 'semantic-symref-list-rename-open-hits) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
135 (define-key km "(" 'semantic-symref-list-create-macro-on-open-hit) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
136 (define-key km "E" 'semantic-symref-list-call-macro-on-open-hits) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 km) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 "Keymap used in `semantic-symref-results-mode'.") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
140 (defvar semantic-symref-list-menu-entries |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
141 (list |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
142 "Symref" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
143 (semantic-menu-item |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
144 ["Toggle Line Open" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
145 semantic-symref-list-toggle-showing |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
146 :active t |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
147 :help "Toggle the current line open or closed." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
148 ]) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
149 (semantic-menu-item |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
150 ["Expand All Entries" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
151 semantic-symref-list-expand-all |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
152 :active t |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
153 :help "Expand every expandable entry." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
154 ]) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
155 (semantic-menu-item |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
156 ["Contract All Entries" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
157 semantic-symref-list-contract-all |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
158 :active t |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
159 :help "Close every expandable entry." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
160 ]) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
161 (semantic-menu-item |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
162 ["Rename Symbol in Open hits" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
163 semantic-symref-list-rename-open-hits |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
164 :active t |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
165 :help "Rename the searched for symbol in all hits that are currently open." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
166 ]) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
167 ) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
168 "Menu entries for the Semantic Symref list mode.") |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
169 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
170 (defvar semantic-symref-list-menu nil |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
171 "Menu keymap build from `semantic-symref-results-mode'.") |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
172 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
173 (easy-menu-define semantic-symref-list-menu |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
174 semantic-symref-results-mode-map |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
175 "Symref Mode Menu" |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
176 semantic-symref-list-menu-entries) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
177 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
178 (defcustom semantic-symref-auto-expand-results nil |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
179 "Non-nil to expand symref results on buffer creation." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
180 :group 'semantic-symref |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
181 :type 'boolean) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
182 |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (defcustom semantic-symref-results-mode-hook nil |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
184 "Hook run when `semantic-symref-results-mode' starts." |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 :group 'semantic-symref |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 :type 'hook) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (defvar semantic-symref-current-results nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 "The current results in a results mode buffer.") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (defun semantic-symref-results-mode (results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 "Major-mode for displaying Semantic Symbol Reference RESULTS. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 RESULTS is an object of class `semantic-symref-results'." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (kill-all-local-variables) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (setq major-mode 'semantic-symref-results-mode |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 mode-name "Symref" |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (use-local-map semantic-symref-results-mode-map) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (set (make-local-variable 'semantic-symref-current-results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (semantic-symref-results-dump results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (goto-char (point-min)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (buffer-disable-undo) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (set (make-local-variable 'font-lock-global-modes) nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (font-lock-mode -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (run-hooks 'semantic-symref-results-mode-hook) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (defun semantic-symref-hide-buffer () |
105340 | 211 "Hide buffer with semantic-symref results." |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (bury-buffer)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (defcustom semantic-symref-results-summary-function 'semantic-format-tag-prototype |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 "*Function to use when creating items in Imenu. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 Some useful functions are found in `semantic-format-tag-functions'." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 :group 'semantic-symref |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 :type semantic-format-tag-custom-list) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (defun semantic-symref-results-dump (results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 "Dump the RESULTS into the current buffer." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; Get ready for the insert. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (toggle-read-only -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (erase-buffer) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 ;; Insert the contents. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (let ((lastfile nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (dolist (T (oref results :hit-tags)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (when (not (equal lastfile (semantic-tag-file-name T))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (setq lastfile (semantic-tag-file-name T)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (insert-button lastfile |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 'mouse-face 'custom-button-pressed-face |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 'action 'semantic-symref-rb-goto-file |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 'tag T |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (insert "\n")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (insert-button "[+]" |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 'mouse-face 'highlight |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 'action 'semantic-symref-rb-toggle-expand-tag |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 'tag T |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 'state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (insert-button (funcall semantic-symref-results-summary-function |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 T nil t) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 'mouse-face 'custom-button-pressed-face |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 'action 'semantic-symref-rb-goto-tag |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 'tag T) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (insert "\n") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 )) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
259 ;; Auto expand |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
260 (when semantic-symref-auto-expand-results |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
261 (semantic-symref-list-expand-all)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
262 |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 ;; Clean up the mess |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (toggle-read-only 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (set-buffer-modified-p nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 ;;; Commands for semantic-symref-results |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ;; |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (defun semantic-symref-list-toggle-showing () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 "Toggle showing the contents below the current line." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (beginning-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (when (re-search-forward "\\[[-+]\\]" (point-at-eol) t) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (forward-char -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (push-button))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (defun semantic-symref-rb-toggle-expand-tag (&optional button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 "Go to the file specified in the symref results buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 BUTTON is the button that was clicked." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 (hits (semantic--tag-get-property tag :hit)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (state (button-get button 'state)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 (text nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (cond |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 ((eq state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 (toggle-read-only -1) |
105799
3fe6da4a95a9
* cedet/srecode/srt-mode.el (semantic-analyze-possible-completions):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
291 (with-current-buffer buff |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (dolist (H hits) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (goto-char (point-min)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (forward-line (1- H)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (beginning-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (back-to-indentation) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (setq text (cons (buffer-substring (point) (point-at-eol)) text))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (setq text (nreverse text)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (goto-char (button-start button)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (delete-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (insert "-") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (button-put button 'state 'open) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (end-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (while text |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (insert "\n") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (insert-button (car text) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 'mouse-face 'highlight |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 'action 'semantic-symref-rb-goto-match |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 'tag tag |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 'line (car hits)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (setq text (cdr text) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 hits (cdr hits)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (toggle-read-only 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 ((eq state 'open) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (toggle-read-only -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (button-put button 'state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 ;; Delete the various bits. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (goto-char (button-start button)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (delete-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (insert "+") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (end-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (delete-region (point) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (forward-line (length hits)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (point)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (toggle-read-only 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 )) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (defun semantic-symref-rb-goto-file (&optional button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 "Go to the file specified in the symref results buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 BUTTON is the button that was clicked." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (pulse-momentary-highlight-one-line (point)) |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
350 (when (eq last-command-event ?\s) (select-window win)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 )) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (defun semantic-symref-rb-goto-tag (&optional button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 "Go to the file specified in the symref results buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 BUTTON is the button that was clicked." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (semantic-go-to-tag tag) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (pulse-momentary-highlight-one-line (point)) |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
365 (when (eq last-command-event ?\s) (select-window win)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (defun semantic-symref-rb-goto-match (&optional button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 "Go to the file specified in the symref results buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 BUTTON is the button that was clicked." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (line (button-get button 'line)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (switch-to-buffer-other-window buff) |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
379 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
380 (forward-line (1- line)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (pulse-momentary-highlight-one-line (point)) |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
382 (when (eq last-command-event ?\s) (select-window win)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (defun semantic-symref-list-next-line () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 "Next line in `semantic-symref-results-mode'." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (forward-line 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (back-to-indentation)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 (defun semantic-symref-list-prev-line () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 "Next line in `semantic-symref-results-mode'." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (forward-line -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (back-to-indentation)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 |
110523
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
398 (defun semantic-symref-list-expand-all () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
399 "Expand all the nodes in the current buffer." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
400 (interactive) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
401 (let ((start (make-marker))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
402 (move-marker start (point)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
403 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
404 (while (re-search-forward "\\[[+]\\]" nil t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
405 (semantic-symref-list-toggle-showing)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
406 ;; Restore position |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
407 (goto-char start))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
408 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
409 (defun semantic-symref-list-contract-all () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
410 "Expand all the nodes in the current buffer." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
411 (interactive) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
412 (let ((start (make-marker))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
413 (move-marker start (point)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
414 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
415 (while (re-search-forward "\\[[-]\\]" nil t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
416 (semantic-symref-list-toggle-showing)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
417 ;; Restore position |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
418 (goto-char start))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
419 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
420 ;;; UTILS |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
421 ;; |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
422 ;; List mode utils for understadning the current line |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
423 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
424 (defun semantic-symref-list-on-hit-p () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
425 "Return the line number if the cursor is on a buffer line with a hit. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
426 Hits are the line of code from the buffer, not the tag summar or file lines." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
427 (save-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
428 (end-of-line) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
429 (let* ((ol (car (semantic-overlays-at (1- (point)))))) ;; trust this for now |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
430 (when ol (semantic-overlay-get ol 'line))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
431 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
432 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
433 ;;; Keyboard Macros on a Hit |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
434 ;; |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
435 ;; Record a macro on a hit, and store in a special way for execution later. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
436 (defun semantic-symref-list-create-macro-on-open-hit () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
437 "Record a keyboard macro at the location of the hit in the current list. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
438 Under point should be one hit for the active keyword. Move |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
439 cursor to the beginning of that symbol, then record a macro as if |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
440 `kmacro-start-macro' was pressed. Use `kmacro-end-macro', |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
441 {kmacro-end-macro} to end the macro, and return to the symbol found list." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
442 (interactive) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
443 (let* ((oldsym (oref (oref semantic-symref-current-results |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
444 :created-by) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
445 :searchfor)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
446 (ol (save-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
447 (end-of-line) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
448 (car (semantic-overlays-at (1- (point)))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
449 (tag (when ol (semantic-overlay-get ol 'tag))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
450 (line (when ol (semantic-overlay-get ol 'line)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
451 (when (not line) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
452 (error "Cannot create macro on a non-hit line")) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
453 ;; Go there, and do something useful. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
454 (switch-to-buffer-other-window (semantic-tag-buffer tag)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
455 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
456 (forward-line (1- line)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
457 (when (not (re-search-forward (regexp-quote oldsym) (point-at-eol) t)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
458 (error "Cannot find hit. Cannot record macro")) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
459 (goto-char (match-beginning 0)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
460 ;; Cursor is now in the right location. Start recording a macro. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
461 (kmacro-start-macro nil) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
462 ;; Notify the user |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
463 (message "Complete with C-x ). Use E in the symref buffer to call this macro."))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
464 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
465 (defun semantic-symref-list-call-macro-on-open-hits () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
466 "Call the most recently created keyboard macro on each hit. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
467 Cursor is placed at the beginning of the symbol found, even if |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
468 there is more than one symbol on the current line. The |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
469 previously recorded macro is then executed." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
470 (interactive) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
471 (save-window-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
472 (let ((count (semantic-symref-list-map-open-hits |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
473 (lambda () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
474 (switch-to-buffer (current-buffer)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
475 (kmacro-call-macro nil))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
476 (semantic-symref-list-update-open-hits) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
477 (message "Executed Macro %d times." count)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
478 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
479 ;;; REFACTORING EDITS |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
480 ;; |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
481 ;; Utilities and features for refactoring across a list of hits. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
482 ;; |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
483 (defun semantic-symref-list-rename-open-hits (newname) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
484 "Rename the discovered symbol references to NEWNAME. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
485 Only renames the locations that are open in the symref list. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
486 Closed items will be skipped." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
487 (interactive |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
488 (list (read-string "Rename to: " |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
489 (oref (oref semantic-symref-current-results |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
490 :created-by) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
491 :searchfor)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
492 (let ((count (semantic-symref-list-map-open-hits |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
493 (lambda () (replace-match newname nil t))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
494 (semantic-symref-list-update-open-hits) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
495 (message "Renamed %d occurances." count))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
496 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
497 ;;; REFACTORING UTILITIES |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
498 ;; |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
499 ;; Refactoring tools want to operate on only the "good" stuff the |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
500 ;; user selected. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
501 (defun semantic-symref-list-map-open-hits (function) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
502 "For every open hit in the symref buffer, perform FUNCTION. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
503 The `match-data' will be set to a successful hit of the searched for symbol. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
504 Return the number of occurances FUNCTION was operated upon." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
505 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
506 ;; First Pass in this function - a straight rename. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
507 ;; Second Pass - Allow context specification based on |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
508 ;; class members. (Not Done) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
509 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
510 (let ((oldsym (oref (oref semantic-symref-current-results |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
511 :created-by) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
512 :searchfor)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
513 (count 0)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
514 (save-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
515 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
516 (while (not (eobp)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
517 ;; Is this line a "hit" line? |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
518 (let* ((ol (car (semantic-overlays-at (1- (point))))) ;; trust this for now |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
519 (tag (when ol (semantic-overlay-get ol 'tag))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
520 (line (when ol (semantic-overlay-get ol 'line)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
521 (when line |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
522 ;; The "line" means we have an open hit. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
523 (with-current-buffer (semantic-tag-buffer tag) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
524 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
525 (forward-line (1- line)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
526 (beginning-of-line) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
527 (while (re-search-forward (regexp-quote oldsym) (point-at-eol) t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
528 (setq count (1+ count)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
529 (save-excursion ;; Leave cursor after the matched name. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
530 (goto-char (match-beginning 0)) ;; Go to beginning of that sym |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
531 (funcall function)))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
532 ;; Go to the next line |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
533 (forward-line 1) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
534 (end-of-line))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
535 count)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
536 |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
537 (defun semantic-symref-list-update-open-hits () |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
538 "Update the text for all the open hits in the symref list." |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
539 (save-excursion |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
540 (goto-char (point-min)) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
541 (while (re-search-forward "\\[-\\]" nil t) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
542 (end-of-line) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
543 (let* ((ol (car (semantic-overlays-at (1- (point))))) ;; trust this for now |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
544 (tag (when ol (semantic-overlay-get ol 'tag)))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
545 ;; If there is a tag, then close/open it. |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
546 (when tag |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
547 (semantic-symref-list-toggle-showing) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
548 (semantic-symref-list-toggle-showing)))))) |
a5ad4f188e19
Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
549 |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (provide 'semantic/symref/list) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
552 ;; Local variables: |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
553 ;; generated-autoload-file: "../loaddefs.el" |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
554 ;; generated-autoload-load-name: "semantic/symref/list" |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
555 ;; End: |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
556 |
105377 | 557 ;; arch-tag: e355d9c6-26e0-42d1-9bf1-f4801a54fffa |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 ;;; semantic/symref/list.el ends here |