annotate lisp/cedet/semantic/senator.el @ 109115:71150397fb59

Fix prototypes. * src/cm.c (evalcost): Fix arg type. * src/cm.h (evalcost): Fix prototype. * src/lisp.h (memory_warnings): Fix prototype. * lib-src/ebrowse.c (match_qualified_namespace_alias): Pass sym* to find_namespace, not link*. * lib-src/emacsclient.c (send_to_emacs, quote_argument): Arg s is HSOCKET. * lib-src/sorted-doc.c (qsort_compare): New typedef. (main): Use it to cast cmpdoc.
author Juanma Barranquero <lekktu@gmail.com>
date Sat, 03 Jul 2010 09:44:17 +0200
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; semantic/senator.el --- SEmantic NAvigaTOR
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106197
diff changeset
4 ;; 2009, 2010 Free Software Foundation, Inc.
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: David Ponce <david@dponce.com>
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Maintainer: FSF
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; Created: 10 Nov 2000
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; Keywords: syntax
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; (at your option) any later version.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;;; Commentary:
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; This file defines some user commands for navigating between
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; Semantic tags. This is a subset of the version of senator.el in
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; the upstream CEDET package; the rest is incorporated into other
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; parts of Semantic or Emacs.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;;; Code:
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 (require 'ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 (require 'semantic)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 (require 'semantic/ctxt)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (require 'semantic/decorate)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (require 'semantic/format)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (eval-when-compile (require 'semantic/find))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; (eval-when-compile (require 'hippie-exp))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (declare-function semantic-analyze-tag-references "semantic/analyze/refs")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (declare-function semantic-analyze-refs-impl "semantic/analyze/refs")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (declare-function semantic-analyze-find-tag "semantic/analyze")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (declare-function semantic-analyze-tag-type "semantic/analyze/fcn")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (declare-function semantic-tag-external-class "semantic/sort")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (declare-function imenu--mouse-menu "imenu")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;;; Customization
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (defgroup senator nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 "Semantic Navigator."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 :group 'semantic)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 (defcustom senator-step-at-tag-classes nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 "List of tag classes recognized by Senator's navigation commands.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 A tag class is a symbol, such as `variable', `function', or `type'.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 As a special exception, if the value is nil, Senator's navigation
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 commands recognize all tag classes."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 :group 'senator
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 :type '(repeat (symbol)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (make-variable-buffer-local 'senator-step-at-tag-classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 (defcustom senator-step-at-start-end-tag-classes nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 "List of tag classes at which Senator's navigation commands should stop.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 A tag class is a symbol, such as `variable', `function', or `type'.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 The navigation commands stop at the start and end of each tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 class in this list, provided the tag class is recognized (see
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 `senator-step-at-tag-classes').
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 As a special exception, if the value is nil, the navigation
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 commands stop at the beginning of every tag.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 If t, the navigation commands stop at the start and end of any
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 tag, where possible."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 :group 'senator
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 :type '(choice :tag "Identifiers"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (repeat :menu-tag "Symbols" (symbol))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (const :tag "All" t)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (make-variable-buffer-local 'senator-step-at-start-end-tag-classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (defcustom senator-highlight-found nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 "If non-nil, Senator commands momentarily highlight found tags."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 :group 'senator
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 :type 'boolean)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (make-variable-buffer-local 'senator-highlight-found)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;;; Faces
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (defface senator-momentary-highlight-face
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 '((((class color) (background dark))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (:background "gray30"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (((class color) (background light))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (:background "gray70")))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 "Face used to momentarily highlight tags."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 :group 'semantic-faces)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 ;;; Common functions
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (defun senator-momentary-highlight-tag (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 "Momentarily highlight TAG.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 Does nothing if `senator-highlight-found' is nil."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (and senator-highlight-found
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (semantic-momentary-highlight-tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 tag 'senator-momentary-highlight-face)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (defun senator-step-at-start-end-p (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 "Return non-nil if must step at start and end of TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (and tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (or (eq senator-step-at-start-end-tag-classes t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (memq (semantic-tag-class tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 senator-step-at-start-end-tag-classes))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (defun senator-skip-p (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 "Return non-nil if must skip TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (and tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 senator-step-at-tag-classes
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (not (memq (semantic-tag-class tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 senator-step-at-tag-classes))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (defun senator-middle-of-tag-p (pos tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 "Return non-nil if POS is between start and end of TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (and (> pos (semantic-tag-start tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (< pos (semantic-tag-end tag))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (defun senator-step-at-parent (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 "Return TAG's outermost parent if must step at start/end of it.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 Return nil otherwise."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (if tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 (let (parent parents)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (setq parents (semantic-find-tag-by-overlay
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (semantic-tag-start tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (while (and parents (not parent))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (setq parent (car parents)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 parents (cdr parents))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (if (or (eq tag parent)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (senator-skip-p parent)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (not (senator-step-at-start-end-p parent)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (setq parent nil)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 parent)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (defun senator-previous-tag-or-parent (pos)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 "Return the tag before POS or one of its parent where to step."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (let (ol tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (while (and pos (> pos (point-min)) (not tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (setq pos (semantic-overlay-previous-change pos))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (when pos
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 ;; Get overlays at position
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (setq ol (semantic-overlays-at pos))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 ;; find the overlay that belongs to semantic
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 ;; and STARTS or ENDS at the found position.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (while (and ol (not tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (setq tag (semantic-overlay-get (car ol) 'semantic))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (unless (and tag (semantic-tag-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (or (= (semantic-tag-start tag) pos)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (= (semantic-tag-end tag) pos)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (setq tag nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 ol (cdr ol))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (or (senator-step-at-parent tag) tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 ;;; Search functions
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (defun senator-search-tag-name (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 "Search for TAG name in current buffer.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 Limit the search to TAG bounds.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 If found, set point to the end of the name, and return point. The
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 beginning of the name is at (match-beginning 0).
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 Return nil if not found, that is if TAG name doesn't come from the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 source."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (let ((name (semantic-tag-name tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (setq name (if (string-match "\\`\\([^[]+\\)[[]" name)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (match-string 1 name)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 name))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (goto-char (semantic-tag-start tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (when (re-search-forward (concat
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 ;; The tag name is expected to be
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 ;; between word delimiters, whitespaces,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 ;; or punctuations.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 "\\(\\<\\|\\s-+\\|\\s.\\)"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (regexp-quote name)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 "\\(\\>\\|\\s-+\\|\\s.\\)")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (semantic-tag-end tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (goto-char (match-beginning 0))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (search-forward name))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (defcustom senator-search-ignore-tag-classes
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 '(code block)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 "List of ignored tag classes.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 Tags of those classes are excluded from search."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 :group 'senator
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 :type '(repeat (symbol :tag "class")))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (defun senator-search-default-tag-filter (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 "Default function that filters searched tags.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 Ignore tags of classes in `senator-search-ignore-tag-classes'"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (not (memq (semantic-tag-class tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 senator-search-ignore-tag-classes)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (defvar senator-search-tag-filter-functions
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 '(senator-search-default-tag-filter)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 "List of functions to be called to filter searched tags.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104519
diff changeset
209 Each function is passed a tag. If one of them returns nil, the tag is
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 excluded from the search.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (defun senator-search (searcher text &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 "Use the SEARCHER function to search from point for TEXT in a tag name.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 SEARCHER is typically the function `search-forward', `search-backward',
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 `word-search-forward', `word-search-backward', `re-search-forward', or
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 `re-search-backward'. See one of the above function to see how the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 TEXT, BOUND, NOERROR, and COUNT arguments are interpreted."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (let* ((origin (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (count (or count 1))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (step (cond ((> count 0) 1)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 ((< count 0) (setq count (- count)) -1)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (0)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 found next sstart send tag tstart tend)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (or (zerop step)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (while (and (not found)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (setq next (funcall searcher text bound t step)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (setq sstart (match-beginning 0)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 send (match-end 0))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (if (= sstart send)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (setq found t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (and (setq tag (semantic-current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (run-hook-with-args-until-failure
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 'senator-search-tag-filter-functions tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (setq tend (senator-search-tag-name tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (setq tstart (match-beginning 0)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 found (and (>= sstart tstart)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (<= send tend)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (zerop (setq count (1- count))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (goto-char next))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (cond ((null found)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 (setq next origin
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 send origin))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 ((= next sstart)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (setq next send
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 send sstart))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 (setq next sstart)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (goto-char next)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 ;; Setup the returned value and the `match-data' or maybe fail!
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (funcall searcher text send noerror step)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 ;;; Navigation commands
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (defun senator-next-tag ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 "Navigate to the next Semantic tag.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 Return the tag or nil if at end of buffer."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (let ((pos (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (tag (semantic-current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 where)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (if (and tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (not (senator-skip-p tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (senator-step-at-start-end-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 (or (= pos (semantic-tag-start tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 (senator-middle-of-tag-p pos tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (if (setq tag (senator-step-at-parent tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (setq tag (semantic-find-tag-by-overlay-next pos))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (while (and tag (senator-skip-p tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (setq tag (semantic-find-tag-by-overlay-next
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (semantic-tag-start tag))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (if (not tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 (progn
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (goto-char (point-max))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 (message "End of buffer"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (cond ((and (senator-step-at-start-end-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (or (= pos (semantic-tag-start tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (senator-middle-of-tag-p pos tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (setq where "end")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 (goto-char (semantic-tag-end tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (setq where "start")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (goto-char (semantic-tag-start tag))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (senator-momentary-highlight-tag tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (message "%S: %s (%s)"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (semantic-tag-class tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (semantic-tag-name tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 where))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (defun senator-previous-tag ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 "Navigate to the previous Semantic tag.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 Return the tag or nil if at beginning of buffer."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (let ((pos (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (tag (semantic-current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 where)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 (if (and tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (not (senator-skip-p tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 (senator-step-at-start-end-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 (or (= pos (semantic-tag-end tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (senator-middle-of-tag-p pos tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (if (setq tag (senator-step-at-parent tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (setq tag (senator-previous-tag-or-parent pos))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (while (and tag (senator-skip-p tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (setq tag (senator-previous-tag-or-parent
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (semantic-tag-start tag))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 (if (not tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 (progn
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 (goto-char (point-min))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 (message "Beginning of buffer"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 (cond ((or (not (senator-step-at-start-end-p tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (= pos (semantic-tag-end tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (senator-middle-of-tag-p pos tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 (setq where "start")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (goto-char (semantic-tag-start tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 (setq where "end")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (goto-char (semantic-tag-end tag))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 (senator-momentary-highlight-tag tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 (message "%S: %s (%s)"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (semantic-tag-class tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (semantic-tag-name tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 where))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 ;;; Search commands
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (defun senator-search-forward (string &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 "Search in tag names forward from point for STRING.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 Set point to the end of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 See also the function `search-forward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (interactive "sSemantic search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 (senator-search 'search-forward string bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 (defun senator-re-search-forward (regexp &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 "Search in tag names forward from point for regular expression REGEXP.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 Set point to the end of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 See also the function `re-search-forward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (interactive "sSemantic regexp search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (senator-search 're-search-forward regexp bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (defun senator-word-search-forward (word &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 "Search in tag names forward from point for WORD.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 Set point to the end of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 See also the function `word-search-forward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (interactive "sSemantic word search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (senator-search 'word-search-forward word bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (defun senator-search-backward (string &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 "Search in tag names backward from point for STRING.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 Set point to the beginning of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 See also the function `search-backward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (interactive "sSemantic backward search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (senator-search 'search-backward string bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (defun senator-re-search-backward (regexp &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 "Search in tag names backward from point for regular expression REGEXP.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 Set point to the beginning of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 See also the function `re-search-backward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 (interactive "sSemantic backward regexp search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (senator-search 're-search-backward regexp bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (defun senator-word-search-backward (word &optional bound noerror count)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 "Search in tag names backward from point for WORD.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 Set point to the beginning of the occurrence found, and return point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 See also the function `word-search-backward' for details on the BOUND,
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 NOERROR and COUNT arguments."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (interactive "sSemantic backward word search: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (senator-search 'word-search-backward word bound noerror count))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 ;;; Other useful search commands (minor mode menu)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 (defvar senator-last-search-type nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 "Type of last non-incremental search command called.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 (defun senator-nonincremental-repeat-search-forward ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 "Search forward for the previous search string or regexp."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 (cond
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 ((and (eq senator-last-search-type 'string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 search-ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 (senator-search-forward (car search-ring)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 ((and (eq senator-last-search-type 'regexp)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 regexp-search-ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (senator-re-search-forward (car regexp-search-ring)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (error "No previous search"))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 (defun senator-nonincremental-repeat-search-backward ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 "Search backward for the previous search string or regexp."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (cond
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 ((and (eq senator-last-search-type 'string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 search-ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (senator-search-backward (car search-ring)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 ((and (eq senator-last-search-type 'regexp)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 regexp-search-ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (senator-re-search-backward (car regexp-search-ring)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (error "No previous search"))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (defun senator-nonincremental-search-forward (string)
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104519
diff changeset
414 "Search for STRING nonincrementally."
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 (interactive "sSemantic search for string: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 (setq senator-last-search-type 'string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 (if (equal string "")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 (senator-search-forward (car search-ring))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 (isearch-update-ring string nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 (senator-search-forward string)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (defun senator-nonincremental-search-backward (string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 "Search backward for STRING nonincrementally."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 (interactive "sSemantic search for string: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 (setq senator-last-search-type 'string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 (if (equal string "")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 (senator-search-backward (car search-ring))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 (isearch-update-ring string nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (senator-search-backward string)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 (defun senator-nonincremental-re-search-forward (string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 "Search for the regular expression STRING nonincrementally."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (interactive "sSemantic search for regexp: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (setq senator-last-search-type 'regexp)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (if (equal string "")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (senator-re-search-forward (car regexp-search-ring))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (isearch-update-ring string t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (senator-re-search-forward string)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (defun senator-nonincremental-re-search-backward (string)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 "Search backward for the regular expression STRING nonincrementally."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 (interactive "sSemantic search for regexp: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 (setq senator-last-search-type 'regexp)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (if (equal string "")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 (senator-re-search-backward (car regexp-search-ring))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 (isearch-update-ring string t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 (senator-re-search-backward string)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (defvar senator--search-filter nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 (defun senator-search-set-tag-class-filter (&optional classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 "In current buffer, limit search scope to tag CLASSES.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 CLASSES is a list of tag class symbols or nil. If nil only global
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 filters in `senator-search-tag-filter-functions' remain active."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 (interactive "sClasses: ")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 (setq classes
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 (cond
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 ((null classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 ((symbolp classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (list classes))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 ((stringp classes)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 (mapcar 'read (split-string classes)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (signal 'wrong-type-argument (list classes)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 ))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 ;; Clear previous filter.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 (remove-hook 'senator-search-tag-filter-functions
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 senator--search-filter t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 (kill-local-variable 'senator--search-filter)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 (if classes
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 (let ((tag (make-symbol "tag"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 (names (mapconcat 'symbol-name classes "', `")))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 (set (make-local-variable 'senator--search-filter)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 `(lambda (,tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 (memq (semantic-tag-class ,tag) ',classes)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 (add-hook 'senator-search-tag-filter-functions
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 senator--search-filter nil t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 (message "Limit search to `%s' tags" names))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 (message "Default search filter restored")))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 ;;; Folding
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 ;;
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 ;; Use new folding state. It might be wise to extend the idea
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 ;; of folding for hiding all but this, or show all children, etc.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (defun senator-fold-tag (&optional tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 "Fold the current TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 (semantic-set-tag-folded (or tag (semantic-current-tag)) t))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (defun senator-unfold-tag (&optional tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 "Fold the current TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 (semantic-set-tag-folded (or tag (semantic-current-tag)) nil))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 (defun senator-fold-tag-toggle (&optional tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 "Fold the current TAG."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (let ((tag (or tag (semantic-current-tag))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (if (semantic-tag-folded-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (senator-unfold-tag tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 (senator-fold-tag tag))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 ;; @TODO - move this to some analyzer / refs tool
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 (define-overloadable-function semantic-up-reference (tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 "Return a tag that is referred to by TAG.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 A \"reference\" could be any interesting feature of TAG.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 In C++, a function may have a 'parent' which is non-local.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 If that parent which is only a reference in the function tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 is found, we can jump to it.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 Some tags such as includes have other reference features.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (defun senator-go-to-up-reference (&optional tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 "Move up one reference from the current TAG.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 A \"reference\" could be any interesting feature of TAG.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 In C++, a function may have a 'parent' which is non-local.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 If that parent which is only a reference in the function tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 is found, we can jump to it.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 Some tags such as includes have other reference features."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (let ((result (semantic-up-reference (or tag (semantic-current-tag)))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (if (not result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (error "No up reference found")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (push-mark)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (cond
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 ;; A tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 ((semantic-tag-p result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (semantic-go-to-tag result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 (switch-to-buffer (current-buffer))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 (semantic-momentary-highlight-tag result))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 ;; Buffers
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 ((bufferp result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 (switch-to-buffer result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 (pulse-momentary-highlight-one-line (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 ;; Files
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 ((and (stringp result) (file-exists-p result))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 (find-file result)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 (pulse-momentary-highlight-one-line (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 (t
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 (error "Unknown result type from `semantic-up-reference'"))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 (defun semantic-up-reference-default (tag)
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104519
diff changeset
545 "Return a tag that is referred to by TAG.
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 Makes C/C++ language like assumptions."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 (cond ((semantic-tag-faux-p tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 ;; Faux tags should have a real tag in some other location.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 (require 'semantic/sort)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 (let ((options (semantic-tag-external-class tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 ;; I should do something a little better than
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 ;; this. Oy!
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 (car options)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 ))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 ;; Include always point to another file.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 ((eq (semantic-tag-class tag) 'include)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (let ((file (semantic-dependency-tag-file tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (cond
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 ((or (not file) (not (file-exists-p file)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561 (error "Could not location include %s"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 (semantic-tag-name tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 ((get-file-buffer file)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 (get-file-buffer file))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 ((stringp file)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 file)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 )))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 ;; Is there a parent of the function to jump to?
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 ((and (semantic-tag-of-class-p tag 'function)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 (semantic-tag-function-parent tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 (let* ((scope (semantic-calculate-scope (point))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 ;; @todo - it would be cool to ask the user which one if
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 ;; more than one.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 (car (oref scope parents))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 ))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 ;; Is there a non-prototype version of the tag to jump to?
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 ((semantic-tag-get-attribute tag :prototype-flag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 (require 'semantic/analyze/refs)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 (let* ((sar (semantic-analyze-tag-references tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 (car (semantic-analyze-refs-impl sar t)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 )
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 ;; If this is a datatype, and we have superclasses
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 ((and (semantic-tag-of-class-p tag 'type)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (semantic-tag-type-superclasses tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 (require 'semantic/analyze)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 (let ((scope (semantic-calculate-scope (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 (parents (semantic-tag-type-superclasses tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 (semantic-analyze-find-tag (car parents) 'type scope)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 ;; Get the data type, and try to find that.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 ((semantic-tag-type tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (require 'semantic/analyze)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 (let ((scope (semantic-calculate-scope (point))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 (semantic-analyze-tag-type tag scope))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 )
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (t nil)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (defvar senator-isearch-semantic-mode nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 "Non-nil if isearch does semantic search.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 This is a buffer local variable.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 (make-variable-buffer-local 'senator-isearch-semantic-mode)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 (defun senator-beginning-of-defun (&optional arg)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 "Move backward to the beginning of a defun.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608 Use semantic tags to navigate.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 ARG is the number of tags to navigate (not yet implemented)."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 (let* ((senator-highlight-found nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 ;; Step at beginning of next tag with class specified in
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 ;; `senator-step-at-tag-classes'.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (senator-step-at-start-end-tag-classes t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 (tag (senator-previous-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616 (when tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (if (= (point) (semantic-tag-end tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 (goto-char (semantic-tag-start tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (beginning-of-line))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 (defun senator-end-of-defun (&optional arg)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 "Move forward to next end of defun.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 Use semantic tags to navigate.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 ARG is the number of tags to navigate (not yet implemented)."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 (let* ((senator-highlight-found nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 ;; Step at end of next tag with class specified in
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 ;; `senator-step-at-tag-classes'.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 (senator-step-at-start-end-tag-classes t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 (tag (senator-next-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 (when tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632 (if (= (point) (semantic-tag-start tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 (goto-char (semantic-tag-end tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 (skip-chars-forward " \t")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 (if (looking-at "\\s<\\|\n")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 (forward-line 1)))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 (defun senator-narrow-to-defun ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 "Make text outside current defun invisible.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 The defun visible is the one that contains point or follows point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 Use semantic tags to navigate."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 (save-excursion
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 (widen)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 (senator-end-of-defun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 (let ((end (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 (senator-beginning-of-defun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 (narrow-to-region (point) end))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 (defun senator-mark-defun ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 "Put mark at end of this defun, point at beginning.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 The defun marked is the one that contains point or follows point.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 Use semantic tags to navigate."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 (let ((origin (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 (end (progn (senator-end-of-defun) (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 (start (progn (senator-beginning-of-defun) (point))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 (goto-char origin)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 (push-mark (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 (goto-char end) ;; end-of-defun
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (push-mark (point) nil t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (goto-char start) ;; beginning-of-defun
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (re-search-backward "^\n" (- (point) 1) t)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 ;;; Tag Cut & Paste
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 ;; To copy a tag, means to put a tag definition into the tag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 ;; ring. To kill a tag, put the tag into the tag ring AND put
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 ;; the body of the tag into the kill-ring.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 ;;
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 ;; To retrieve a killed tag's text, use C-y (yank), but to retrieve
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 ;; the tag as a reference of some sort, use senator-yank-tag.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (defvar senator-tag-ring (make-ring 20)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 "Ring of tags for use with cut and paste.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (defun senator-copy-tag ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 "Take the current tag, and place it in the tag ring."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (let ((ft (semantic-obtain-foreign-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (when ft
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (ring-insert senator-tag-ring ft)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 (kill-ring-save (semantic-tag-start ft) (semantic-tag-end ft))
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
687 (when (called-interactively-p 'interactive)
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
688 (message "Use C-y to yank text. \
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
689 Use `senator-yank-tag' for prototype insert.")))
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 ft))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 (defun senator-kill-tag ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 "Take the current tag, place it in the tag ring, and kill it.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 Killing the tag removes the text for that tag, and places it into
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 the kill ring. Retrieve that text with \\[yank]."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 (let ((ct (senator-copy-tag))) ;; this handles the reparse for us.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 (kill-region (semantic-tag-start ct)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (semantic-tag-end ct))
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
701 (when (called-interactively-p 'interactive)
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
702 (message "Use C-y to yank text. \
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
703 Use `senator-yank-tag' for prototype insert."))))
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 (defun senator-yank-tag ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 "Yank a tag from the tag ring.
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104519
diff changeset
708 The form the tag takes is different depending on where it is being
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709 yanked to."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 (or (ring-empty-p senator-tag-ring)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 (let ((ft (ring-ref senator-tag-ring 0)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 (semantic-foreign-tag-check ft)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 (semantic-insert-foreign-tag ft)
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
715 (when (called-interactively-p 'interactive)
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (message "Use C-y to recover the yank the text of %s."
106197
019d906c8f48 * cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents: 106055
diff changeset
717 (semantic-tag-name ft))))))
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
720 (defun senator-copy-tag-to-register (register &optional kill-flag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
721 "Copy the current tag into REGISTER.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 Optional argument KILL-FLAG will delete the text of the tag to the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 kill ring."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (interactive "cTag to register: \nP")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 (let ((ft (semantic-obtain-foreign-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727 (when ft
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 (set-register register ft)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 (if kill-flag
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 (kill-region (semantic-tag-start ft)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 (semantic-tag-end ft))))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (defun senator-transpose-tags-up ()
105340
118ad0cdd9a8 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104519
diff changeset
735 "Transpose the current tag, and the preceding tag."
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 (let* ((current-tag (semantic-current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739 (prev-tag (save-excursion
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (goto-char (semantic-tag-start current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 (semantic-find-tag-by-overlay-prev)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742 (ct-parent (semantic-find-tag-parent-by-overlay current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 (pt-parent (semantic-find-tag-parent-by-overlay prev-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 (if (not (eq ct-parent pt-parent))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 (error "Cannot transpose tags"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746 (let ((txt (buffer-substring (semantic-tag-start current-tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747 (semantic-tag-end current-tag)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748 (line (count-lines (semantic-tag-start current-tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749 (point)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 (insert-point nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 )
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752 (delete-region (semantic-tag-start current-tag)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 (semantic-tag-end current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
754 (delete-blank-lines)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 (goto-char (semantic-tag-start prev-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 (setq insert-point (point))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 (insert txt)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758 (if (/= (current-column) 0)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 (insert "\n"))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760 (insert "\n")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 (goto-char insert-point)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 (forward-line line)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 )))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765 ;;;###autoload
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766 (defun senator-transpose-tags-down ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 "Transpose the current tag, and the following tag."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 (semantic-fetch-tags)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 (let* ((current-tag (semantic-current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 (next-tag (save-excursion
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 (goto-char (semantic-tag-end current-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (semantic-find-tag-by-overlay-next)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774 (end-pt (point-marker))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775 )
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776 (goto-char (semantic-tag-start next-tag))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777 (forward-char 1)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778 (senator-transpose-tags-up)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 ;; I know that the above fcn deletes the next tag, so our pt marker
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 ;; will be stable.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 (goto-char end-pt)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783 ;;; Using semantic search in isearch mode
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785 (defun senator-lazy-highlight-update ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786 "Force lazy highlight update."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787 (lazy-highlight-cleanup t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
788 (set 'isearch-lazy-highlight-last-string nil)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789 (setq isearch-adjusted t)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790 (isearch-update))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792 ;; Recent versions of GNU Emacs allow to override the isearch search
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
793 ;; function for special needs, and avoid to advice the built-in search
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
794 ;; function :-)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
795 (defun senator-isearch-search-fun ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
796 "Return the function to use for the search.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
797 Use a senator search function when semantic isearch mode is enabled."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
798 (intern
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
799 (concat (if senator-isearch-semantic-mode
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
800 "senator-"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
801 "")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
802 (cond (isearch-word "word-")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
803 (isearch-regexp "re-")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
804 (t ""))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805 "search-"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 (if isearch-forward
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807 "forward"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808 "backward"))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 (defun senator-isearch-toggle-semantic-mode ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811 "Toggle semantic searching on or off in isearch mode."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
812 (interactive)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
813 (setq senator-isearch-semantic-mode
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814 (not senator-isearch-semantic-mode))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
815 (if isearch-mode
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
816 ;; force lazy highlight update
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
817 (senator-lazy-highlight-update)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818 (message "Isearch semantic mode %s"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
819 (if senator-isearch-semantic-mode
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820 "enabled"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
821 "disabled"))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823 (defvar senator-old-isearch-search-fun nil
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 "Hold previous value of `isearch-search-fun-function'.")
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826 (defun senator-isearch-mode-hook ()
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827 "Isearch mode hook to setup semantic searching."
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 (if (and isearch-mode senator-isearch-semantic-mode)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 (progn
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 ;; When `senator-isearch-semantic-mode' is on save the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 ;; previous `isearch-search-fun-function' and install the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
832 ;; senator one.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833 (when (and (local-variable-p 'isearch-search-fun-function)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 (not (local-variable-p 'senator-old-isearch-search-fun)))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 (set (make-local-variable 'senator-old-isearch-search-fun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836 isearch-search-fun-function))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837 (set (make-local-variable 'isearch-search-fun-function)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
838 'senator-isearch-search-fun))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 ;; When `senator-isearch-semantic-mode' is off restore the
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 ;; previous `isearch-search-fun-function'.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 (when (eq isearch-search-fun-function 'senator-isearch-search-fun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842 (if (local-variable-p 'senator-old-isearch-search-fun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
843 (progn
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844 (set (make-local-variable 'isearch-search-fun-function)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845 senator-old-isearch-search-fun)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 (kill-local-variable 'senator-old-isearch-search-fun))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 (kill-local-variable 'isearch-search-fun-function)))))
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 ;; (add-hook 'isearch-mode-hook 'senator-isearch-mode-hook)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850 ;; (add-hook 'isearch-mode-end-hook 'senator-isearch-mode-hook)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852 ;; ;; Keyboard shortcut to toggle semantic search in isearch mode.
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 ;; (define-key isearch-mode-map
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 ;; [(control ?,)]
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 ;; 'senator-isearch-toggle-semantic-mode)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857 (provide 'semantic/senator)
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859 ;; Local variables:
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 ;; generated-autoload-file: "loaddefs.el"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861 ;; generated-autoload-load-name: "semantic/senator"
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862 ;; End:
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
863
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105340
diff changeset
864 ;; arch-tag: 397100d0-e2db-467e-8c19-d8d4d99d51f1
104519
934691bc93ed * cedet/semantic/idle.el (semantic-idle-scheduler-work-timer):
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865 ;;; semantic/senator.el ends here