Mercurial > emacs
annotate lisp/cedet/semantic/symref/list.el @ 107150:b6358fb91b0b
Fix typos.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sun, 14 Feb 2010 18:34:09 +0100 |
parents | 1d1d5d9bd884 |
children | a5ad4f188e19 |
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) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (require 'pulse) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;;; Code: |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
40 ;;;###autoload |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (defun semantic-symref () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 "Find references to the current tag. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 This command uses the currently configured references tool within the |
105340 | 44 current project to find references to the current tag. The |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 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
|
46 they are used in. |
105340 | 47 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
|
48 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (semantic-fetch-tags) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (let ((ct (semantic-current-tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (res nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; Must have a tag... |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (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
|
55 ;; Check w/ user. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (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
|
57 (error "Quit")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;; Gather results and tags |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (message "Gathering References...") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (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
|
61 (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
|
62 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
63 ;;;###autoload |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (defun semantic-symref-symbol (sym) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 "Find references to the symbol SYM. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 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
|
67 current project to find references to the input SYM. The |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 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
|
69 they are used in. |
105340 | 70 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
|
71 (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
|
72 "Symrefs for: ")))) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (semantic-fetch-tags) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (let ((res nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 ;; Gather results and tags |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (message "Gathering References...") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (setq res (semantic-symref-find-references-by-name sym)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (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
|
80 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (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
|
83 "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
|
84 (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
|
85 (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
|
86 (message "Gathering References...done") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 ;; Build a refrences buffer. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (let ((buff (get-buffer-create |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (format "*Symref %s" str))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (set-buffer buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (semantic-symref-results-mode res)) |
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 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 ;;; RESULTS MODE |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ;; |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (defgroup semantic-symref-results-mode nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 "Symref Results group." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 :group 'semantic) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (defvar semantic-symref-results-mode-map |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (let ((km (make-sparse-keymap))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (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
|
105 (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
|
106 (define-key km " " 'push-button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (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
|
108 (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
|
109 (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
|
110 (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
|
111 (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
|
112 (define-key km "q" 'semantic-symref-hide-buffer) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 km) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 "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
|
115 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (defcustom semantic-symref-results-mode-hook nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 "*Hook run when `semantic-symref-results-mode' starts." |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 :group 'semantic-symref |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 :type 'hook) |
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-current-results nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 "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
|
123 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (defun semantic-symref-results-mode (results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 "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
|
126 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
|
127 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (kill-all-local-variables) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (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
|
130 mode-name "Symref" |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (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
|
133 (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
|
134 results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (semantic-symref-results-dump results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (goto-char (point-min)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (buffer-disable-undo) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (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
|
139 (font-lock-mode -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (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
|
141 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (defun semantic-symref-hide-buffer () |
105340 | 144 "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
|
145 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (bury-buffer)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (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
|
149 "*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
|
150 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
|
151 :group 'semantic-symref |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 :type semantic-format-tag-custom-list) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (defun semantic-symref-results-dump (results) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 "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
|
156 ;; Get ready for the insert. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (toggle-read-only -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (erase-buffer) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ;; Insert the contents. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (let ((lastfile nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (dolist (T (oref results :hit-tags)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (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
|
166 (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
|
167 (insert-button lastfile |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 'mouse-face 'custom-button-pressed-face |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 'action 'semantic-symref-rb-goto-file |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 'tag T |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (insert "\n")) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (insert-button "[+]" |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 'mouse-face 'highlight |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 '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
|
179 'tag T |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 'state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (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
|
183 T nil t) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 'mouse-face 'custom-button-pressed-face |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 'action 'semantic-symref-rb-goto-tag |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 'tag T) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (insert "\n") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 |
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 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 ;; Clean up the mess |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (toggle-read-only 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (set-buffer-modified-p nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ;;; Commands for semantic-symref-results |
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 (defun semantic-symref-list-toggle-showing () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 "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
|
201 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (beginning-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (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
|
204 (forward-char -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (push-button))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (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
|
208 "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
|
209 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
|
210 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (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
|
214 (state (button-get button 'state)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (text nil) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (cond |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 ((eq state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (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
|
220 (with-current-buffer buff |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (dolist (H hits) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (goto-char (point-min)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (forward-line (1- H)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (beginning-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (back-to-indentation) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (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
|
227 (setq text (nreverse text)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (goto-char (button-start button)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (delete-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (insert "-") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (button-put button 'state 'open) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (end-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (while text |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (insert "\n") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (insert " ") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (insert-button (car text) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 'mouse-face 'highlight |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 'face nil |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 'action 'semantic-symref-rb-goto-match |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 'tag tag |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 'line (car hits)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (setq text (cdr text) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 hits (cdr hits)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (toggle-read-only 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 ((eq state 'open) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (toggle-read-only -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (button-put button 'state 'closed) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 ;; Delete the various bits. |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (goto-char (button-start button)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (delete-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (insert "+") |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (end-of-line) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (delete-region (point) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (save-excursion |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (forward-char 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (forward-line (length hits)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (point)))) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (toggle-read-only 1) |
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 ) |
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-rb-goto-file (&optional button) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 "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
|
272 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
|
273 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (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
|
279 (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
|
280 )) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (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
|
284 "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
|
285 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
|
286 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (switch-to-buffer-other-window buff) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (semantic-go-to-tag tag) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (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
|
294 (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
|
295 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (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
|
299 "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
|
300 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
|
301 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (let* ((tag (button-get button 'tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (line (button-get button 'line)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (buff (semantic-tag-buffer tag)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (win (selected-window)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (switch-to-buffer-other-window buff) |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
308 (with-no-warnings (goto-line line)) |
104422
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (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
|
310 (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
|
311 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 ) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (defun semantic-symref-list-next-line () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 "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
|
316 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (forward-line 1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (back-to-indentation)) |
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 (defun semantic-symref-list-prev-line () |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 "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
|
322 (interactive) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (forward-line -1) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (back-to-indentation)) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (provide 'semantic/symref/list) |
36f56620b2ae
cedet/semantic/symref.el, cedet/semantic/symref/cscope.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 |
104456
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
328 ;; Local variables: |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
329 ;; generated-autoload-file: "../loaddefs.el" |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
330 ;; 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
|
331 ;; End: |
6065d66f0c99
lisp/cedet/semantic/db-ref.el: Require semantic/db.
Chong Yidong <cyd@stupidchicken.com>
parents:
104422
diff
changeset
|
332 |
105377 | 333 ;; 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
|
334 ;;; semantic/symref/list.el ends here |