Mercurial > emacs
annotate lisp/cedet/semantic/decorate/mode.el @ 104483:785c1bb5253e
lisp/cedet/semantic/db-typecache.el (semanticdb-typecache)
(semanticdb-database-typecache): Autoload classes.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 07 Sep 2009 17:54:07 +0000 |
parents | 2858c6bcc446 |
children | 801834237f9c |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
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: |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (require 'semantic) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (require 'semantic/decorate) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (require 'semantic/tag-ls) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (require 'semantic/util-modes) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (eval-when-compile (require 'cl)) |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 "*List of active decoration styles. |
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. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (defvar semantic-decorate-pending-decoration-hooks nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 "Functions to call with pending decoration changes.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (defun semantic-decorate-add-pending-decoration (fcn &optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 "Add a pending decoration change represented by FCN. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 Applies only to the current BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 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
|
204 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (when buffer (set-buffer buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (semantic-make-local-hook 'semantic-decorate-flush-pending-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (add-hook 'semantic-decorate-pending-decoration-hooks fcn nil t))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 ;;;;###autoload |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (defun semantic-decorate-flush-pending-decorations (&optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 "Flush any pending decorations for BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 Flush functions from `semantic-decorate-pending-decoration-hooks'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (when buffer (set-buffer buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (run-hooks 'semantic-decorate-pending-decoration-hooks) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 ;; Always reset the hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (setq semantic-decorate-pending-decoration-hooks nil))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 ;;; DECORATION MODE |
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 ;; Generic mode for handling basic highlighting and decorations. |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (defcustom global-semantic-decoration-mode nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 "*If non-nil, enable global use of command `semantic-decoration-mode'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 When this mode is activated, decorations specified by |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 `semantic-decoration-styles'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 :group 'semantic-modes |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 :type 'boolean |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 :require 'semantic/decorate/mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 :initialize 'custom-initialize-default |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 :set (lambda (sym val) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (global-semantic-decoration-mode (if val 1 -1)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (defun global-semantic-decoration-mode (&optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 "Toggle global use of option `semantic-decoration-mode'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 Decoration mode turns on all active decorations as specified |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 by `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 If ARG is positive, enable, if it is negative, disable. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 If ARG is nil, then toggle." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (interactive "P") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (setq global-semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (semantic-toggle-minor-mode-globally |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 'semantic-decoration-mode arg))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (defcustom semantic-decoration-mode-hook nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 "*Hook run at the end of function `semantic-decoration-mode'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 :type 'hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 ;;;;###autoload |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 (defvar semantic-decoration-mode nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 "Non-nil if command `semantic-decoration-mode' is enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 Use the command `semantic-decoration-mode' to change this variable.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (make-variable-buffer-local 'semantic-decoration-mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 (defun semantic-decoration-mode-setup () |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 "Setup the `semantic-decoration-mode' minor mode. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 The minor mode can be turned on only if the semantic feature is available |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 and the current buffer was set up for parsing. Return non-nil if the |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 minor mode is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 (if semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (if (not (and (featurep 'semantic) (semantic-active-p))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (progn |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 ;; Disable minor mode if semantic stuff not available |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (setq semantic-decoration-mode nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 (error "Buffer %s was not set up for parsing" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (buffer-name))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 ;; Add hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (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
|
273 (add-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 'semantic-decorate-tags-after-partial-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 (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
|
276 (add-hook 'semantic-after-toplevel-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 'semantic-decorate-tags-after-full-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 ;; Add decorations to available tags. The above hooks ensure |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 ;; that new tags will be decorated when they become available. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 (semantic-decorate-add-decorations (semantic-fetch-available-tags)) |
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 ;; Remove decorations from available tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 ;; Cleanup any leftover crap too. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;; Remove hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (remove-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 'semantic-decorate-tags-after-partial-reparse t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (remove-hook 'semantic-after-toplevel-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 'semantic-decorate-tags-after-full-reparse t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 semantic-decoration-mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ;;;;###autoload |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (defun semantic-decoration-mode (&optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 "Minor mode for decorating tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 Decorations are specified in `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 You can define new decoration styles with |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 `define-semantic-decoration-style'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 With prefix argument ARG, turn on if positive, otherwise off. The |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 minor mode can be turned on only if semantic feature is available and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 the current buffer was set up for parsing. Return non-nil if the |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 minor mode is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 ;;\\{semantic-decoration-map}" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (interactive |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (list (or current-prefix-arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (if semantic-decoration-mode 0 1)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (setq semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (if arg |
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 (prefix-numeric-value arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 0) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (not semantic-decoration-mode))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (semantic-decoration-mode-setup) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (run-hooks 'semantic-decoration-mode-hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (if (interactive-p) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (message "decoration-mode minor mode %sabled" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (if semantic-decoration-mode "en" "dis"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (semantic-mode-line-update) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 semantic-decoration-mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (semantic-add-minor-mode 'semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 "" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (defun semantic-decorate-tags-after-full-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 "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
|
329 TAG-LIST is the list of tags recently parsed. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 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
|
331 add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 Called from `semantic-after-toplevel-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 ;; Flush everything |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 ;; Add it back on |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 (semantic-decorate-add-decorations tag-list)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (defun semantic-decorate-tags-after-partial-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 "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
|
340 TAG-LIST is the list of newly created tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 Call `semantic-decorate-add-decorations' to add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 Called from `semantic-after-partial-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 (semantic-decorate-add-decorations tag-list)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 ;;; Enable/Disable toggling |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (defun semantic-decoration-style-enabled-p (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 "Return non-nil if STYLE is currently enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 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
|
351 (let ((pair (assoc style semantic-decoration-styles))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (and pair (cdr pair)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (defun semantic-toggle-decoration-style (name &optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 "Turn on/off the decoration style with NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 Decorations are specified in `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 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
|
358 Return non-nil if the decoration style is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (interactive |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (list (completing-read "Decoration style: " |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 semantic-decoration-styles nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 current-prefix-arg)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (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
|
364 (unless (equal name "") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (let* ((style (assoc name semantic-decoration-styles)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (flag (if arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (> (prefix-numeric-value arg) 0) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (not (cdr style))))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (unless (eq (cdr style) flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 ;; Store the new flag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 (setcdr style flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 ;; Refresh decorations is `semantic-decoration-mode' is on. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 (when semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (semantic-decoration-mode -1) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (semantic-decoration-mode 1)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (when (interactive-p) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (message "Decoration style %s turned %s" (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (if flag "on" "off")))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 flag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 (defvar semantic-decoration-menu-cache nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 "Cache of the decoration menu.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (defun semantic-decoration-build-style-menu (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 "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
|
386 (vector (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 `(lambda () (interactive) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (semantic-toggle-decoration-style |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 ,(car style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 :style 'toggle |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 :selected `(semantic-decoration-style-enabled-p ,(car style)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 )) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 ;;;;###autoload |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (defun semantic-build-decoration-mode-menu (&rest ignore) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 "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
|
397 IGNORE any input arguments." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 (or semantic-decoration-menu-cache |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 (setq semantic-decoration-menu-cache |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 (mapcar 'semantic-decoration-build-style-menu |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (reverse semantic-decoration-styles)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 ))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 ;;; Defining decoration styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 (defmacro define-semantic-decoration-style (name doc &rest flags) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 "Define a new decoration style with NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 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
|
410 It is appended to auto-generated doc strings. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 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
|
412 :enabled <value> - specify the default enabled value for NAME. |
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 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
|
416 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
|
417 implementation in respectively the functions `NAME-p-default' and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 `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
|
419 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
|
420 `NAME-highlight'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 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
|
423 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
|
424 etc., found in the semantic-decorate library. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 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
|
427 `semantic-decorate-tag', and other functions of the semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 decoration API found in this library." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (let ((predicate (semantic-decorate-style-predicate name)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (highlighter (semantic-decorate-style-highlighter name)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (defaultenable (if (plist-member flags :enabled) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 (plist-get flags :enabled) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 t)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 `(progn |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 ;; 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
|
437 ;; needed. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (setq semantic-decoration-menu-cache nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 ;; 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
|
440 ;; to this type of decoration |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 (define-overloadable-function ,predicate (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 ,(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
|
443 name doc)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 ;; Create an override method that will perform the highlight |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 ;; operation if the -p method returns non-nil. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 (define-overloadable-function ,highlighter (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 ,(format "Decorate TAG with `%s' style.\n%s" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 name doc)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 ;; Add this to the list of primary decoration modes. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 (add-to-list 'semantic-decoration-styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 (cons ',(symbol-name name) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 ,defaultenable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 ))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 ;;; Predefined decoration styles |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 ;;; Tag boundaries highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 (define-semantic-decoration-style semantic-tag-boundary |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 "Place an overline in front of each long tag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 Does not provide overlines for prototypes.") |
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 (defface semantic-tag-boundary-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (:overline "cyan")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 (:overline "blue"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 "*Face used to show long tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 Used by decoration style: `semantic-tag-boundary'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 (defun semantic-tag-boundary-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 "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
|
475 (let ((c (semantic-tag-class tag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 (and |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (or |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 ;; All types get a line? |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 (eq c 'type) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 ;; Functions which aren't prototypes get a line. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 (and (eq c 'function) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (not (semantic-tag-get-attribute tag :prototype-flag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 ;; Note: The below restriction confused users. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 ;; Nothing smaller than a few lines |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 ;;(> (- (semantic-tag-end tag) (semantic-tag-start tag)) 150) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
488 ;; Random truth |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 )) |
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 (defun semantic-tag-boundary-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 "Highlight the first line of TAG as a boundary." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 (when (bufferp (semantic-tag-buffer tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 (with-current-buffer (semantic-tag-buffer tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 (semantic-decorate-tag |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 tag |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 (semantic-tag-start tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 (goto-char (semantic-tag-start tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 (end-of-line) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (forward-char 1) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (point)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 'semantic-tag-boundary-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 )) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 ;;; Private member highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 (define-semantic-decoration-style semantic-decoration-on-private-members |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 "Highlight class members that are designated as PRIVATE access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 :enabled nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (defface semantic-decoration-on-private-members-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 (:background "#200000")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 (:background "#8fffff"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 "*Face used to show privately scoped tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 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
|
520 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 (defun semantic-decoration-on-private-members-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 "Highlight TAG as designated to have PRIVATE access. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 Use a primary decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (semantic-set-tag-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 tag 'semantic-decoration-on-private-members-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 (defun semantic-decoration-on-private-members-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 "Return non-nil if TAG has PRIVATE access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 (and (member (semantic-tag-class tag) '(function variable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 (eq (semantic-tag-protection tag) 'private))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 ;;; Protected member highlighting |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
535 (defface semantic-decoration-on-protected-members-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 '((((class color) (background dark)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 (:background "#000020")) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 (((class color) (background light)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 (:background "#fffff8"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 "*Face used to show protected scoped tags in. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 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
|
542 :group 'semantic-faces) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 (define-semantic-decoration-style semantic-decoration-on-protected-members |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 "Highlight class members that are designated as PROTECTED access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 :enabled nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
548 (defun semantic-decoration-on-protected-members-p-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 "Return non-nil if TAG has PROTECTED access." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 (and (member (semantic-tag-class tag) '(function variable)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 (eq (semantic-tag-protection tag) 'protected))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (defun semantic-decoration-on-protected-members-highlight-default (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 "Highlight TAG as designated to have PROTECTED access. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 Use a primary decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 (semantic-set-tag-face |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 tag 'semantic-decoration-on-protected-members-face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 (provide 'semantic/decorate/mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 ;;; semantic/decorate/mode.el ends here |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 |