annotate lisp/cedet/semantic/fw.el @ 104454:e4842bf0f303

lisp/cedet/semantic/symref/filter.el: New file. lisp/cedet/semantic/idle.el (semantic-symref-hits-in-region): Require semantic/symref/filter.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 05 Sep 2009 21:09:25 +0000
parents 2bf481006ba4
children 8db96f200ac8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104412
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; semantic-fw.el --- Framework for Semantic
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;; 2007, 2008, 2009 Free Software Foundation, Inc.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; (at your option) any later version.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;; Commentary:
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; Semantic has several core features shared across it's lex/parse/util
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; stages. This used to clutter semantic.el some. These routines are all
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; simple things that are not parser specific, but aid in making
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; semantic flexible and compatible amongst different Emacs platforms.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;;; Code:
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'mode-local)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 (require 'eieio)
104444
2bf481006ba4 lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 104412
diff changeset
34 (require 'semantic/loaddefs)
104412
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;;; Compatibility
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (if (featurep 'xemacs)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (progn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (defalias 'semantic-buffer-local-value 'symbol-value-in-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (defalias 'semantic-overlay-live-p
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 (lambda (o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (and (extent-live-p o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (not (extent-detached-p o))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (bufferp (extent-buffer o)))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (defalias 'semantic-make-overlay
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (lambda (beg end &optional buffer &rest rest)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 "Xemacs `make-extent', supporting the front/rear advance options."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (let ((ol (make-extent beg end buffer)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (when rest
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 (set-extent-property ol 'start-open (car rest))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 (setq rest (cdr rest)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (when rest
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 (set-extent-property ol 'end-open (car rest)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ol)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 (defalias 'semantic-overlay-put 'set-extent-property)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 (defalias 'semantic-overlay-get 'extent-property)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 (defalias 'semantic-overlay-properties 'extent-properties)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 (defalias 'semantic-overlay-move 'set-extent-endpoints)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 (defalias 'semantic-overlay-delete 'delete-extent)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 (defalias 'semantic-overlays-at
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (lambda (pos)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 (condition-case nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 (extent-list nil pos pos)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 (error nil))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (defalias 'semantic-overlays-in
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (lambda (beg end) (extent-list nil beg end)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 (defalias 'semantic-overlay-buffer 'extent-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 (defalias 'semantic-overlay-start 'extent-start-position)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 (defalias 'semantic-overlay-end 'extent-end-position)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 (defalias 'semantic-overlay-size 'extent-length)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 (defalias 'semantic-overlay-next-change 'next-extent-change)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (defalias 'semantic-overlay-previous-change 'previous-extent-change)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 (defalias 'semantic-overlay-lists
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 (lambda () (list (extent-list))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 (defalias 'semantic-overlay-p 'extentp)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 (defalias 'semantic-event-window 'event-window)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 (defun semantic-read-event ()
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 (let ((event (next-command-event)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 (if (key-press-event-p event)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (let ((c (event-to-character event)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 (if (char-equal c (quit-char))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (keyboard-quit)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 c)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 event))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (defun semantic-popup-menu (menu)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 "Blockinig version of `popup-menu'"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (popup-menu menu)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;; Wait...
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 (while (popup-up-p) (dispatch-event (next-event))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 ;; Emacs Bindings
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (defalias 'semantic-buffer-local-value 'buffer-local-value)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 (defalias 'semantic-overlay-live-p 'overlay-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (defalias 'semantic-make-overlay 'make-overlay)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (defalias 'semantic-overlay-put 'overlay-put)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (defalias 'semantic-overlay-get 'overlay-get)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (defalias 'semantic-overlay-properties 'overlay-properties)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (defalias 'semantic-overlay-move 'move-overlay)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (defalias 'semantic-overlay-delete 'delete-overlay)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (defalias 'semantic-overlays-at 'overlays-at)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (defalias 'semantic-overlays-in 'overlays-in)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (defalias 'semantic-overlay-buffer 'overlay-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (defalias 'semantic-overlay-start 'overlay-start)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (defalias 'semantic-overlay-end 'overlay-end)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (defalias 'semantic-overlay-size 'overlay-size)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (defalias 'semantic-overlay-next-change 'next-overlay-change)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (defalias 'semantic-overlay-previous-change 'previous-overlay-change)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (defalias 'semantic-overlay-lists 'overlay-lists)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 (defalias 'semantic-overlay-p 'overlayp)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (defalias 'semantic-read-event 'read-event)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (defalias 'semantic-popup-menu 'popup-menu)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (defun semantic-event-window (event)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 "Extract the window from EVENT."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (car (car (cdr event))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (if (and (not (featurep 'xemacs))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (>= emacs-major-version 21))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (defalias 'semantic-make-local-hook 'identity)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (defalias 'semantic-make-local-hook 'make-local-hook)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (if (featurep 'xemacs)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (defalias 'semantic-mode-line-update 'redraw-modeline)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (defalias 'semantic-mode-line-update 'force-mode-line-update))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ;; Since Emacs 22 major mode functions should use `run-mode-hooks' to
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 ;; run major mode hooks.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (defalias 'semantic-run-mode-hooks
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (if (fboundp 'run-mode-hooks)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 'run-mode-hooks
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 'run-hooks))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ;; Fancy compat useage now handled in cedet-compat
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (defalias 'semantic-subst-char-in-string 'subst-char-in-string)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (defun semantic-delete-overlay-maybe (overlay)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 "Delete OVERLAY if it is a semantic token overlay."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (if (semantic-overlay-get overlay 'semantic)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (semantic-overlay-delete overlay)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (defalias 'semantic-compile-warn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (eval-when-compile
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (if (fboundp 'byte-compile-warn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 'byte-compile-warn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 'message)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (if (not (fboundp 'string-to-number))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (defalias 'string-to-number 'string-to-int))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 ;;; Menu Item compatibility
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (defun semantic-menu-item (item)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 "Build an XEmacs compatible menu item from vector ITEM.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 That is remove the unsupported :help stuff."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (if (featurep 'xemacs)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (let ((n (length item))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (i 0)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 slot l)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (while (< i n)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 (setq slot (aref item i))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (if (and (keywordp slot)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 (eq slot :help))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (setq i (1+ i))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (setq l (cons slot l)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 (setq i (1+ i)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 (apply #'vector (nreverse l)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 item))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 ;;; Positional Data Cache
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (defvar semantic-cache-data-overlays nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 "List of all overlays waiting to be flushed.")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (defun semantic-cache-data-to-buffer (buffer start end value name &optional lifespan)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 "In BUFFER over the region START END, remember VALUE.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 NAME specifies a special name that can be searched for later to
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 recover the cached data with `semantic-get-cache-data'.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 LIFESPAN indicates how long the data cache will be remembered.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 The default LIFESPAN is 'end-of-command.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 Possible Lifespans are:
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 'end-of-command - Remove the cache at the end of the currently
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 executing command.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 'exit-cache-zone - Remove when point leaves the overlay at the
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 end of the currently executing command."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 ;; Check if LIFESPAN is valid before to create any overlay
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (or lifespan (setq lifespan 'end-of-command))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (or (memq lifespan '(end-of-command exit-cache-zone))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (error "semantic-cache-data-to-buffer: Unknown LIFESPAN: %s"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 lifespan))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (let ((o (semantic-make-overlay start end buffer)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (semantic-overlay-put o 'cache-name name)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (semantic-overlay-put o 'cached-value value)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (semantic-overlay-put o 'lifespan lifespan)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (setq semantic-cache-data-overlays
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (cons o semantic-cache-data-overlays))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 ;;(message "Adding to cache: %s" o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (add-hook 'post-command-hook 'semantic-cache-data-post-command-hook)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (defun semantic-cache-data-post-command-hook ()
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 "Flush `semantic-cache-data-overlays' based 'lifespan property.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 Remove self from `post-command-hook' if it is empty."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (let ((newcache nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (oldcache semantic-cache-data-overlays))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (while oldcache
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (let* ((o (car oldcache))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (life (semantic-overlay-get o 'lifespan))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (if (or (eq life 'end-of-command)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 (and (eq life 'exit-cache-zone)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (not (member o (semantic-overlays-at (point))))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (progn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;;(message "Removing from cache: %s" o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (semantic-overlay-delete o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (setq newcache (cons o newcache))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (setq oldcache (cdr oldcache)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (setq semantic-cache-data-overlays (nreverse newcache)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 ;; Remove ourselves if we have removed all overlays.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (unless semantic-cache-data-overlays
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (remove-hook 'post-command-hook
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 'semantic-cache-data-post-command-hook)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (defun semantic-get-cache-data (name &optional point)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 "Get cached data with NAME from optional POINT."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (save-excursion
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (if point (goto-char point))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (let ((o (semantic-overlays-at (point)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (ans nil))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (while (and (not ans) o)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (if (equal (semantic-overlay-get (car o) 'cache-name) name)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (setq ans (car o))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (setq o (cdr o))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (when ans
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (semantic-overlay-get ans 'cached-value)))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (defun semantic-test-data-cache ()
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 "Test the data cache."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (interactive)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 (let ((data '(a b c)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 (save-excursion
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 (set-buffer (get-buffer-create " *semantic-test-data-cache*"))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (erase-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (insert "The Moose is Loose")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (goto-char (point-min))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (semantic-cache-data-to-buffer (current-buffer) (point) (+ (point) 5)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 data 'moose 'exit-cache-zone)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (if (equal (semantic-get-cache-data 'moose) data)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (message "Successfully retrieved cached data.")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (error "Failed to retrieve cached data"))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 )))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 ;;; Obsoleting various functions & variables
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (defun semantic-overload-symbol-from-function (name)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 "Return the symbol for overload used by NAME, the defined symbol."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (let ((sym-name (symbol-name name)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (if (string-match "^semantic-" sym-name)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (intern (substring sym-name (match-end 0)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 name)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 (defun semantic-alias-obsolete (oldfnalias newfn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 "Make OLDFNALIAS an alias for NEWFN.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 Mark OLDFNALIAS as obsolete, such that the byte compiler
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 will throw a warning when it encounters this symbol."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (defalias oldfnalias newfn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (make-obsolete oldfnalias newfn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (when (and (function-overload-p newfn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (not (overload-obsoleted-by newfn))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 ;; Only throw this warning when byte compiling things.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (boundp 'byte-compile-current-file)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 byte-compile-current-file
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (not (string-match "cedet" byte-compile-current-file))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (make-obsolete-overload oldfnalias newfn)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (semantic-compile-warn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 "%s: `%s' obsoletes overload `%s'"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 byte-compile-current-file
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 newfn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (semantic-overload-symbol-from-function oldfnalias))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (defun semantic-varalias-obsolete (oldvaralias newvar)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 "Make OLDVARALIAS an alias for variable NEWVAR.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 Mark OLDVARALIAS as obsolete, such that the byte compiler
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 will throw a warning when it encounters this symbol."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (make-obsolete-variable oldvaralias newvar)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (condition-case nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (defvaralias oldvaralias newvar)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 (error
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 ;; Only throw this warning when byte compiling things.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (when (and (boundp 'byte-compile-current-file)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 byte-compile-current-file)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (semantic-compile-warn
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 "variable `%s' obsoletes, but isn't alias of `%s'"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 newvar oldvaralias)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 ))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 ;;; Help debugging
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (defmacro semantic-safe (format &rest body)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 "Turn into a FORMAT message any error caught during eval of BODY.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 Return the value of last BODY form or nil if an error occurred.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 FORMAT can have a %s escape which will be replaced with the actual
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 error message.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 If `debug-on-error' is set, errors are not caught, so that you can
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 debug them.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 Avoid using a large BODY since it is duplicated."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 ;;(declare (debug t) (indent 1))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 `(if debug-on-error
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 ;;(let ((inhibit-quit nil)) ,@body)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 ;; Note to self: Doing the above screws up the wisent parser.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (progn ,@body)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (condition-case err
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 (progn ,@body)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (error
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 (message ,format (format "%S - %s" (current-buffer)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 (error-message-string err)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 nil))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 (put 'semantic-safe 'lisp-indent-function 1)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 ;;; Misc utilities
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (defsubst semantic-map-buffers (function)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 "Run FUNCTION for each Semantic enabled buffer found.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 FUNCTION does not have arguments. When FUNCTION is entered
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 `current-buffer' is a selected Semantic enabled buffer."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (mode-local-map-file-buffers function #'semantic-active-p))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (defalias 'semantic-map-mode-buffers
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 'mode-local-map-mode-buffers)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (semantic-alias-obsolete 'semantic-fetch-overload
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 'fetch-overload)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (semantic-alias-obsolete 'define-mode-overload-implementation
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 'define-mode-local-override)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (semantic-alias-obsolete 'semantic-with-mode-bindings
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 'with-mode-local)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (semantic-alias-obsolete 'define-semantic-child-mode
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 'define-child-mode)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (defun semantic-install-function-overrides (overrides &optional transient mode)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 "Install the function OVERRIDES in the specified environment.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 is a symbol identifying an overloadable entry, and FUNCTION is the
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 function to override it with.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 If optional argument TRANSIENT is non-nil, installed overrides can in
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 turn be overridden by next installation.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 If optional argument MODE is non-nil, it must be a major mode symbol.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 OVERRIDES will be installed globally for this major mode. If MODE is
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 nil, OVERRIDES will be installed locally in the current buffer. This
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 later installation should be done in MODE hook."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (mode-local-bind
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 ;; Add the semantic- prefix to OVERLOAD short names.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (mapcar
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 #'(lambda (e)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (let ((name (symbol-name (car e))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 (if (string-match "^semantic-" name)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 e
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 (cons (intern (format "semantic-%s" name)) (cdr e)))))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 overrides)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (list 'constant-flag (not transient)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 'override-flag t)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 mode))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 ;;; User Interrupt handling
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (defvar semantic-current-input-throw-symbol nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 "The current throw symbol for `semantic-exit-on-input'.")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (defmacro semantic-exit-on-input (symbol &rest forms)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 "Using SYMBOL as an argument to `throw', execute FORMS.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 If FORMS includes a call to `semantic-thow-on-input', then
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 if a user presses any key during execution, this form macro
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 will exit with the value passed to `semantic-throw-on-input'.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 If FORMS completes, then the return value is the same as `progn'."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 `(let ((semantic-current-input-throw-symbol ,symbol))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 (catch ,symbol
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 ,@forms)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 (put 'semantic-exit-on-input 'lisp-indent-function 1)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 (defmacro semantic-throw-on-input (from)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 "Exit with `throw' when in `semantic-exit-on-input' on user input.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 FROM is an indication of where this function is called from as a value
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 to pass to `throw'. It is recommended to use the name of the function
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 calling this one."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 `(when (and semantic-current-input-throw-symbol
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (or (input-pending-p) (accept-process-output)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (throw semantic-current-input-throw-symbol ,from)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (defun semantic-test-throw-on-input ()
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 "Test that throw on input will work."
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (interactive)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (semantic-throw-on-input 'done-die)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (message "Exit Code: %s"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (semantic-exit-on-input 'testing
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (let ((inhibit-quit nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (message-log-max nil))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (while t
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (message "Looping ... press a key to test")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (semantic-throw-on-input 'test-inner-loop))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 'exit)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (when (input-pending-p)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 (if (fboundp 'read-event)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (read-event)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (read-char)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 ;;; Special versions of Find File
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 (defun semantic-find-file-noselect (file &optional nowarn rawfile wildcards)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 "Call `find-file-noselect' with various features turned off.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 Use this when referencing a file that will be soon deleted.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 FILE, NOWARN, RAWFILE, and WILDCARDS are passed into `find-file-noselect'"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 (let* ((recentf-exclude '( (lambda (f) t) ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 ;; This is a brave statement. Don't waste time loading in
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 ;; lots of modes. Especially decoration mode can waste a lot
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 ;; of time for a buffer we intend to kill.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 (semantic-init-hooks nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 ;; This disables the part of EDE that asks questions
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (ede-auto-add-method 'never)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 ;; Ask font-lock to not colorize these buffers, nor to
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 ;; whine about it either.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 (font-lock-maximum-size 0)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (font-lock-verbose nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 ;; Disable revision control
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (vc-handled-backends nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 ;; Don't prompt to insert a template if we visit an empty file
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (auto-insert nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 ;; We don't want emacs to query about unsafe local variables
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 (enable-local-variables
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (if (featurep 'xemacs)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 ;; XEmacs only has nil as an option?
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 ;; Emacs 23 has the spiffy :safe option, nil otherwise.
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (if (>= emacs-major-version 22)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 nil
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 :safe)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 ;; ... or eval variables
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 (enable-local-eval nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 (if (featurep 'xemacs)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 (find-file-noselect file nowarn rawfile)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 (find-file-noselect file nowarn rawfile wildcards))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 ;;; Editor goodies ;-)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (defconst semantic-fw-font-lock-keywords
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 (eval-when-compile
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (let* (
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 ;; Variable declarations
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (vl nil)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 (kv (if vl (regexp-opt vl t) ""))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 ;; Function declarations
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (vf '(
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 "define-lex"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 "define-lex-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 "define-lex-block-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 "define-lex-regex-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 "define-lex-spp-macro-declaration-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 "define-lex-spp-macro-undeclaration-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 "define-lex-spp-include-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 "define-lex-simple-regex-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 "define-lex-keyword-type-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 "define-lex-sexp-type-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 "define-lex-regex-type-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 "define-lex-string-type-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 "define-lex-block-type-analyzer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 ;;"define-mode-overload-implementation"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 ;;"define-semantic-child-mode"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 "define-semantic-idle-service"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 "define-semantic-decoration-style"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 "define-wisent-lexer"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 "semantic-alias-obsolete"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 "semantic-varalias-obsolete"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 "semantic-make-obsolete-overload"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 "defcustom-mode-local-semantic-dependency-system-include-path"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (kf (if vf (regexp-opt vf t) ""))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 ;; Regexp depths
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (kv-depth (if kv (regexp-opt-depth kv) nil))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (kf-depth (if kf (regexp-opt-depth kf) nil))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 `((,(concat
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 ;; Declarative things
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 "(\\(" kv "\\|" kf "\\)"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 ;; Whitespaces & names
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 "\\>[ \t]*\\(\\sw+\\)?[ \t]*\\(\\sw+\\)?"
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (1 font-lock-keyword-face)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (,(+ 1 kv-depth kf-depth 1)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (cond ((match-beginning 2)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 font-lock-type-face)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 ((match-beginning ,(+ 1 kv-depth 1))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 font-lock-function-name-face)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 nil t)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 (,(+ 1 kv-depth kf-depth 1 1)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 (cond ((match-beginning 2)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 font-lock-variable-name-face)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 )
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 nil t)))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 ))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 "Highlighted Semantic keywords.")
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 ;; (when (fboundp 'font-lock-add-keywords)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 ;; (font-lock-add-keywords 'emacs-lisp-mode
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 ;; semantic-fw-font-lock-keywords))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 ;;; Interfacing with edebug
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 ;;
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (defun semantic-fw-add-edebug-spec ()
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (def-edebug-spec semantic-exit-on-input 'def-body))
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (add-hook 'edebug-setup-hook 'semantic-fw-add-edebug-spec)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (provide 'semantic/fw)
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528
05443eb58935 cedet/semantic.el: Change requires to use semantic/FOO format.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 ;;; semantic-fw.el ends here