Mercurial > emacs
annotate lisp/cedet/semantic/decorate/mode.el @ 112278:ef719132ddfa
Nuke arch-tags.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 15 Jan 2011 15:16:57 -0800 |
parents | 417b1e4d63cd |
children |
rev | line source |
---|---|
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/decorate/mode.el --- Minor mode for decorating tags |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
105287 | 3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
4 ;; 2009, 2010, 2011 Free Software Foundation, Inc. |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: syntax |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; A minor mode for use in decorating tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; There are two types of decorations that can be performed on a tag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; You can either highlight the full tag, or you can add an |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; independent decoration on some part of the tag body. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; For independent decoration in particular, managing them so that they |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; do not get corrupted is challenging. This major mode and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; corresponding macros will make handling those types of decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; easier. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;;; Code: |
105789
6df5ff499103
* cedet/mode-local.el (make-obsolete-overload): Add `when' argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105760
diff
changeset
|
39 (eval-when-compile (require 'cl)) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (require 'semantic) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (require 'semantic/decorate) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (require 'semantic/tag-ls) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (require 'semantic/util-modes) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;;; Styles List |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (defcustom semantic-decoration-styles nil |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
48 "List of active decoration styles. |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 It is an alist of \(NAME . FLAG) elements, where NAME is a style name |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 and FLAG is non-nil if the style is enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 See also `define-semantic-decoration-style' which will automatically |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 add items to this list." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 :type '(repeat (cons (string :tag "Decoration Name") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (boolean :tag "Enabled"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;;; Misc. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (defsubst semantic-decorate-style-predicate (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 "Return the STYLE's predicate function." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (intern (format "%s-p" style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (defsubst semantic-decorate-style-highlighter (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 "Return the STYLE's highlighter function." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (intern (format "%s-highlight" style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 ;;; Base decoration API |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (defsubst semantic-decoration-p (object) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 "Return non-nil if OBJECT is a tag decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (and (semantic-overlay-p object) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (semantic-overlay-get object 'semantic-decoration))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (defsubst semantic-decoration-set-property (deco property value) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 "Set the DECO decoration's PROPERTY to VALUE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (semantic-overlay-put deco property value) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (defsubst semantic-decoration-get-property (deco property) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "Return the DECO decoration's PROPERTY value." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (semantic-overlay-get deco property)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (defsubst semantic-decoration-set-face (deco face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 "Set the face of the decoration DECO to FACE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (semantic-decoration-set-property deco 'face face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (defsubst semantic-decoration-face (deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 "Return the face of the decoration DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (semantic-decoration-get-property deco 'face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (defsubst semantic-decoration-set-priority (deco priority) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 "Set the priority of the decoration DECO to PRIORITY. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (assert (natnump priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (semantic-decoration-set-property deco 'priority priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (defsubst semantic-decoration-priority (deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 "Return the priority of the decoration DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (semantic-decoration-get-property deco 'priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (defsubst semantic-decoration-move (deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 "Move the decoration DECO on the region between BEGIN and END. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (semantic-overlay-move deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ;;; Tag decoration |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (defun semantic-decorate-tag (tag begin end &optional face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 "Add a new decoration on TAG on the region between BEGIN and END. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 If optional argument FACE is non-nil, set the decoration's face to |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 FACE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 Return the overlay that makes up the new decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (let ((deco (semantic-tag-create-secondary-overlay tag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 ;; We do not use the unlink property because we do not want to |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 ;; save the highlighting information in the DB. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (semantic-overlay-put deco 'semantic-decoration t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (semantic-decoration-move deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (semantic-decoration-set-face deco face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (defun semantic-decorate-clear-tag (tag &optional deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 "Remove decorations from TAG. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 If optional argument DECO is non-nil, remove only that decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (assert (or (null deco) (semantic-decoration-p deco))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;; Clear primary decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 ;; For now, just unhighlight the tag. How to deal with other |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; primary decorations like invisibility, etc. ? Maybe just |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 ;; restoring default values will suffice? |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (semantic-unhighlight-tag tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 (semantic-tag-delete-secondary-overlay |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 tag (or deco 'semantic-decoration))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 (defun semantic-decorate-tag-decoration (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 "Return decoration found on TAG." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (semantic-tag-get-secondary-overlay tag 'semantic-decoration)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;;; Global setup of active decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (defun semantic-decorate-flush-decorations (&optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 "Flush decorations found in BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 BUFFER defaults to the current buffer. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 Should be used to flush decorations that might remain in BUFFER, for |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 example, after tags have been refreshed." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (with-current-buffer (or buffer (current-buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (dolist (o (semantic-overlays-in (point-min) (point-max))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (and (semantic-decoration-p o) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (semantic-overlay-delete o))))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (defun semantic-decorate-clear-decorations (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 "Remove decorations found in tags in TAG-LIST." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (dolist (tag tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (semantic-decorate-clear-tag tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ;; recurse over children |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (semantic-decorate-clear-decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (semantic-tag-components-with-overlays tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (defun semantic-decorate-add-decorations (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 "Add decorations to tags in TAG-LIST. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 Also make sure old decorations in the area are completely flushed." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (dolist (tag tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 ;; Cleanup old decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (when (semantic-decorate-tag-decoration tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 ;; Note on below comment. This happens more as decorations are refreshed |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 ;; mid-way through their use. Remove the message. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 ;; It would be nice if this never happened, but it still does |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 ;; once in a while. Print a message to help flush these |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 ;; situations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 ;;(message "Decorations still on %s" (semantic-format-tag-name tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (semantic-decorate-clear-tag tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 ;; Add new decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (dolist (style semantic-decoration-styles) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (let ((pred (semantic-decorate-style-predicate (car style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (high (semantic-decorate-style-highlighter (car style)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (and (cdr style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (fboundp pred) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (funcall pred tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 (fboundp high) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 (funcall high tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 ;; Recurse on the children of all tags |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (semantic-decorate-add-decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (semantic-tag-components-with-overlays tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 ;;; PENDING DECORATIONS |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 ;; Activities in Emacs may cause a decoration to change state. Any |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 ;; such identified change ought to be setup as PENDING. This means |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 ;; that the next idle step will do the decoration change, but at the |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;; time of the state change, minimal work would be done. |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
197 (defvar semantic-decorate-pending-decoration-hook nil |
104514
c65d65798b34
Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104513
diff
changeset
|
198 "Normal hook run to perform pending decoration changes.") |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 |
104514
c65d65798b34
Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104513
diff
changeset
|
200 (semantic-varalias-obsolete 'semantic-decorate-pending-decoration-hooks |
105760
d0906291f75b
* cedet/semantic/fw.el (semantic-alias-obsolete)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105377
diff
changeset
|
201 'semantic-decorate-pending-decoration-hook "23.2") |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
202 |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (defun semantic-decorate-add-pending-decoration (fcn &optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 "Add a pending decoration change represented by FCN. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 Applies only to the current BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 The setting of FCN will be removed after it is run." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (when buffer (set-buffer buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (semantic-make-local-hook 'semantic-decorate-flush-pending-decorations) |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
210 (add-hook 'semantic-decorate-pending-decoration-hook fcn nil t))) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (defun semantic-decorate-flush-pending-decorations (&optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 "Flush any pending decorations for BUFFER. |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
214 Flush functions from `semantic-decorate-pending-decoration-hook'." |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (when buffer (set-buffer buffer)) |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
217 (run-hooks 'semantic-decorate-pending-decoration-hook) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 ;; Always reset the hooks |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
219 (setq semantic-decorate-pending-decoration-hook nil))) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 ;;; DECORATION MODE |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 ;; Generic mode for handling basic highlighting and decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 |
104506
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
227 ;;;###autoload |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
228 (define-minor-mode global-semantic-decoration-mode |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 "Toggle global use of option `semantic-decoration-mode'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 Decoration mode turns on all active decorations as specified |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
231 by `semantic-decoration-styles'." |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
232 :global t :group 'semantic :group 'semantic-modes |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
233 ;; Not needed because it's autoloaded instead. |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
234 ;; :require 'semantic/decorate/mode |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
235 (semantic-toggle-minor-mode-globally |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
236 'semantic-decoration-mode (if global-semantic-decoration-mode 1 -1))) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (defcustom semantic-decoration-mode-hook nil |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
239 "Hook run at the end of function `semantic-decoration-mode'." |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 :type 'hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
243 (define-minor-mode semantic-decoration-mode |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
244 "Minor mode for decorating tags. |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
245 Decorations are specified in `semantic-decoration-styles'. |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
246 You can define new decoration styles with |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
247 `define-semantic-decoration-style'. |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
248 With prefix argument ARG, turn on if positive, otherwise off. The |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
249 minor mode can be turned on only if semantic feature is available and |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
250 the current buffer was set up for parsing. Return non-nil if the |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 minor mode is enabled." |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
252 ;; |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
253 ;;\\{semantic-decoration-map}" |
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
254 nil nil nil |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (if semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (if (not (and (featurep 'semantic) (semantic-active-p))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (progn |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 ;; Disable minor mode if semantic stuff not available |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (setq semantic-decoration-mode nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (error "Buffer %s was not set up for parsing" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (buffer-name))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 ;; Add hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (semantic-make-local-hook 'semantic-after-partial-cache-change-hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (add-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 'semantic-decorate-tags-after-partial-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (semantic-make-local-hook 'semantic-after-toplevel-cache-change-hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (add-hook 'semantic-after-toplevel-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 'semantic-decorate-tags-after-full-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ;; Add decorations to available tags. The above hooks ensure |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 ;; that new tags will be decorated when they become available. |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
271 (semantic-decorate-add-decorations (semantic-fetch-available-tags))) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 ;; Remove decorations from available tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 ;; Cleanup any leftover crap too. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 ;; Remove hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (remove-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 'semantic-decorate-tags-after-partial-reparse t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (remove-hook 'semantic-after-toplevel-cache-change-hook |
108211
73a1ddc06d0e
Use a mode-line spec rather than a static string in Semantic.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108210
diff
changeset
|
280 'semantic-decorate-tags-after-full-reparse t))) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 (semantic-add-minor-mode 'semantic-decoration-mode |
108210
5143700578d0
Use define-minor-mode in CEDET where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
283 "") |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (defun semantic-decorate-tags-after-full-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 "Add decorations after a complete reparse of the current buffer. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 TAG-LIST is the list of tags recently parsed. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 Flush all existing decorations and call `semantic-decorate-add-decorations' to |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 Called from `semantic-after-toplevel-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 ;; Flush everything |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 ;; Add it back on |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (semantic-decorate-add-decorations tag-list)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (defun semantic-decorate-tags-after-partial-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 "Add decorations when new tags are created in the current buffer. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 TAG-LIST is the list of newly created tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 Call `semantic-decorate-add-decorations' to add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 Called from `semantic-after-partial-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (semantic-decorate-add-decorations tag-list)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 ;;; Enable/Disable toggling |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (defun semantic-decoration-style-enabled-p (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 "Return non-nil if STYLE is currently enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 Return nil if the style is disabled, or does not exist." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (let ((pair (assoc style semantic-decoration-styles))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (and pair (cdr pair)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 (defun semantic-toggle-decoration-style (name &optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 "Turn on/off the decoration style with NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 Decorations are specified in `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 With prefix argument ARG, turn on if positive, otherwise off. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 Return non-nil if the decoration style is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (interactive |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (list (completing-read "Decoration style: " |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 semantic-decoration-styles nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 current-prefix-arg)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (setq name (format "%s" name)) ;; Ensure NAME is a string. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (unless (equal name "") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (let* ((style (assoc name semantic-decoration-styles)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (flag (if arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (> (prefix-numeric-value arg) 0) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (not (cdr style))))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (unless (eq (cdr style) flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 ;; Store the new flag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 (setcdr style flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 ;; Refresh decorations is `semantic-decoration-mode' is on. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (when semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 (semantic-decoration-mode -1) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 (semantic-decoration-mode 1)) |
106197
019d906c8f48
* cedet/srecode/map.el (srecode-get-maps):
Chong Yidong <cyd@stupidchicken.com>
parents:
105842
diff
changeset
|
334 (when (called-interactively-p 'interactive) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (message "Decoration style %s turned %s" (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (if flag "on" "off")))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 flag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (defvar semantic-decoration-menu-cache nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 "Cache of the decoration menu.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 (defun semantic-decoration-build-style-menu (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 "Build a menu item for controlling a specific decoration STYLE." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (vector (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 `(lambda () (interactive) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (semantic-toggle-decoration-style |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ,(car style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 :style 'toggle |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 :selected `(semantic-decoration-style-enabled-p ,(car style)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 )) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (defun semantic-build-decoration-mode-menu (&rest ignore) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 "Create a menu listing all the known decorations for toggling. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 IGNORE any input arguments." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (or semantic-decoration-menu-cache |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (setq semantic-decoration-menu-cache |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (mapcar 'semantic-decoration-build-style-menu |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (reverse semantic-decoration-styles)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 ))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 ;;; Defining decoration styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (defmacro define-semantic-decoration-style (name doc &rest flags) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 "Define a new decoration style with NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 DOC is a documentation string describing the decoration style NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 It is appended to auto-generated doc strings. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 An Optional list of FLAGS can also be specified. Flags are: |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 :enabled <value> - specify the default enabled value for NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 This defines two new overload functions respectively called `NAME-p' |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 and `NAME-highlight', for which you must provide a default |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 implementation in respectively the functions `NAME-p-default' and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 `NAME-highlight-default'. Those functions are passed a tag. `NAME-p' |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 must return non-nil to indicate that the tag should be decorated by |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 `NAME-highlight'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 To put primary decorations on a tag `NAME-highlight' must use |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 functions like `semantic-set-tag-face', `semantic-set-tag-intangible', |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 etc., found in the semantic-decorate library. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 To add other kind of decorations on a tag, `NAME-highlight' must use |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 `semantic-decorate-tag', and other functions of the semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 decoration API found in this library." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (let ((predicate (semantic-decorate-style-predicate name)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (highlighter (semantic-decorate-style-highlighter name)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (defaultenable (if (plist-member flags :enabled) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (plist-get flags :enabled) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 t)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 `(progn |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 ;; Clear the menu cache so that new items are added when |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 ;; needed. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (setq semantic-decoration-menu-cache nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 ;; Create an override method to specify if a given tag belongs |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 ;; to this type of decoration |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (define-overloadable-function ,predicate (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 ,(format "Return non-nil to decorate TAG with `%s' style.\n%s" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 name doc)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 ;; Create an override method that will perform the highlight |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 ;; operation if the -p method returns non-nil. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 (define-overloadable-function ,highlighter (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 ,(format "Decorate TAG with `%s' style.\n%s" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 name doc)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 ;; Add this to the list of primary decoration modes. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 (add-to-list 'semantic-decoration-styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 (cons ',(symbol-name name) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 ,defaultenable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 ))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 ;;; Predefined decoration styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 ;;; Tag boundaries highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (define-semantic-decoration-style semantic-tag-boundary |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 "Place an overline in front of each long tag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 Does not provide overlines for prototypes.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 (defface semantic-tag-boundary-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (:overline "cyan")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 (:overline "blue"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 "*Face used to show long tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 Used by decoration style: `semantic-tag-boundary'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (defun semantic-tag-boundary-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 "Return non-nil if TAG is a type, or a non-prototype function." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (let ((c (semantic-tag-class tag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 (or |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 ;; All types get a line? |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (eq c 'type) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 ;; Functions which aren't prototypes get a line. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (and (eq c 'function) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (not (semantic-tag-get-attribute tag :prototype-flag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 ;; Note: The below restriction confused users. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 ;; Nothing smaller than a few lines |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 ;;(> (- (semantic-tag-end tag) (semantic-tag-start tag)) 150) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 ;; Random truth |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 )) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (defun semantic-tag-boundary-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 "Highlight the first line of TAG as a boundary." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (when (bufferp (semantic-tag-buffer tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 (with-current-buffer (semantic-tag-buffer tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (semantic-decorate-tag |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 tag |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (semantic-tag-start tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 (goto-char (semantic-tag-start tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 (end-of-line) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 (forward-char 1) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (point)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 'semantic-tag-boundary-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 )) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 ;;; Private member highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (define-semantic-decoration-style semantic-decoration-on-private-members |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 "Highlight class members that are designated as PRIVATE access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 :enabled nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (defface semantic-decoration-on-private-members-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 (:background "#200000")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 (:background "#8fffff"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 "*Face used to show privately scoped tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 Used by the decoration style: `semantic-decoration-on-private-members'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (defun semantic-decoration-on-private-members-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 "Highlight TAG as designated to have PRIVATE access. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 Use a primary decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (semantic-set-tag-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 tag 'semantic-decoration-on-private-members-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (defun semantic-decoration-on-private-members-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 "Return non-nil if TAG has PRIVATE access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 (and (member (semantic-tag-class tag) '(function variable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 (eq (semantic-tag-protection tag) 'private))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 ;;; Protected member highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 (defface semantic-decoration-on-protected-members-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (:background "#000020")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (:background "#fffff8"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 "*Face used to show protected scoped tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 Used by the decoration style: `semantic-decoration-on-protected-members'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 (define-semantic-decoration-style semantic-decoration-on-protected-members |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 "Highlight class members that are designated as PROTECTED access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 :enabled nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (defun semantic-decoration-on-protected-members-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 "Return non-nil if TAG has PROTECTED access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (and (member (semantic-tag-class tag) '(function variable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (eq (semantic-tag-protection tag) 'protected))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (defun semantic-decoration-on-protected-members-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 "Highlight TAG as designated to have PROTECTED access. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 Use a primary decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (semantic-set-tag-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 tag 'semantic-decoration-on-protected-members-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (provide 'semantic/decorate/mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 |
104506
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
518 ;; Local variables: |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
519 ;; generated-autoload-file: "../loaddefs.el" |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
520 ;; generated-autoload-load-name: "semantic/decorate/mode" |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
521 ;; End: |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
522 |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 ;;; semantic/decorate/mode.el ends here |