Mercurial > emacs
annotate lisp/cedet/semantic/decorate/mode.el @ 105377:7f4c7f5c0eba
Add arch tagline
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 02 Oct 2009 10:53:34 +0000 |
parents | 7f78a6035974 |
children | d0906291f75b |
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, |
4 ;; 2009 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: |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;;; Styles List |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (defcustom semantic-decoration-styles nil |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
47 "List of active decoration styles. |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 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
|
49 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
|
50 See also `define-semantic-decoration-style' which will automatically |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 add items to this list." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 :type '(repeat (cons (string :tag "Decoration Name") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (boolean :tag "Enabled"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 ) |
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 ;;; Misc. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (defsubst semantic-decorate-style-predicate (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "Return the STYLE's predicate function." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (intern (format "%s-p" style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (defsubst semantic-decorate-style-highlighter (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 "Return the STYLE's highlighter function." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (intern (format "%s-highlight" style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 ;;; Base decoration API |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (defsubst semantic-decoration-p (object) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 "Return non-nil if OBJECT is a tag decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (and (semantic-overlay-p object) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (semantic-overlay-get object 'semantic-decoration))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (defsubst semantic-decoration-set-property (deco property value) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 "Set the DECO decoration's PROPERTY to VALUE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (semantic-overlay-put deco property value) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (defsubst semantic-decoration-get-property (deco property) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 "Return the DECO decoration's PROPERTY value." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (semantic-overlay-get deco property)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (defsubst semantic-decoration-set-face (deco face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 "Set the face of the decoration DECO to FACE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (semantic-decoration-set-property deco 'face face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (defsubst semantic-decoration-face (deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 "Return the face of the decoration DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (semantic-decoration-get-property deco 'face)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (defsubst semantic-decoration-set-priority (deco priority) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 "Set the priority of the decoration DECO to PRIORITY. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (assert (natnump priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (semantic-decoration-set-property deco 'priority priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (defsubst semantic-decoration-priority (deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 "Return the priority of the decoration DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (semantic-decoration-get-property deco 'priority)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (defsubst semantic-decoration-move (deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 "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
|
107 Return DECO." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (assert (semantic-decoration-p deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (semantic-overlay-move deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 ;;; Tag decoration |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (defun semantic-decorate-tag (tag begin end &optional face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 "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
|
116 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
|
117 FACE. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 Return the overlay that makes up the new decoration." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (let ((deco (semantic-tag-create-secondary-overlay tag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 ;; 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
|
121 ;; save the highlighting information in the DB. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (semantic-overlay-put deco 'semantic-decoration t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (semantic-decoration-move deco begin end) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (semantic-decoration-set-face deco face) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 deco)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (defun semantic-decorate-clear-tag (tag &optional deco) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 "Remove decorations from TAG. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 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
|
130 (assert (or (null deco) (semantic-decoration-p deco))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 ;; Clear primary decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 ;; 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
|
133 ;; primary decorations like invisibility, etc. ? Maybe just |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; restoring default values will suffice? |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (semantic-unhighlight-tag tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (semantic-tag-delete-secondary-overlay |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 tag (or deco 'semantic-decoration))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 (defun semantic-decorate-tag-decoration (tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 "Return decoration found on TAG." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (semantic-tag-get-secondary-overlay tag 'semantic-decoration)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 ;;; Global setup of active decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (defun semantic-decorate-flush-decorations (&optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 "Flush decorations found in BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 BUFFER defaults to the current buffer. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 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
|
149 example, after tags have been refreshed." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (with-current-buffer (or buffer (current-buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (dolist (o (semantic-overlays-in (point-min) (point-max))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (and (semantic-decoration-p o) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (semantic-overlay-delete o))))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (defun semantic-decorate-clear-decorations (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 "Remove decorations found in tags in TAG-LIST." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (dolist (tag tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (semantic-decorate-clear-tag tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 ;; recurse over children |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (semantic-decorate-clear-decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (semantic-tag-components-with-overlays tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (defun semantic-decorate-add-decorations (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 "Add decorations to tags in TAG-LIST. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 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
|
166 (dolist (tag tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ;; Cleanup old decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (when (semantic-decorate-tag-decoration tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 ;; 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
|
170 ;; mid-way through their use. Remove the message. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 ;; 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
|
173 ;; 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
|
174 ;; situations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 ;;(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
|
176 (semantic-decorate-clear-tag tag)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 ;; Add new decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (dolist (style semantic-decoration-styles) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (let ((pred (semantic-decorate-style-predicate (car style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (high (semantic-decorate-style-highlighter (car style)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (and (cdr style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (fboundp pred) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (funcall pred tag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (fboundp high) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 (funcall high tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; Recurse on the children of all tags |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (semantic-decorate-add-decorations |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (semantic-tag-components-with-overlays tag)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 ;;; PENDING DECORATIONS |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 ;; 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
|
193 ;; 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
|
194 ;; 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
|
195 ;; 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
|
196 (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
|
197 "Normal hook run to perform pending decoration changes.") |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 |
104514
c65d65798b34
Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104513
diff
changeset
|
199 (semantic-varalias-obsolete 'semantic-decorate-pending-decoration-hooks |
c65d65798b34
Fix last change to use semantic-varalias-obsolete.
Chong Yidong <cyd@stupidchicken.com>
parents:
104513
diff
changeset
|
200 'semantic-decorate-pending-decoration-hook) |
104513
a6a812dd2d88
* cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents:
104506
diff
changeset
|
201 |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (defun semantic-decorate-add-pending-decoration (fcn &optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 "Add a pending decoration change represented by FCN. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 Applies only to the current BUFFER. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 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
|
206 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (when buffer (set-buffer buffer)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (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
|
209 (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
|
210 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (defun semantic-decorate-flush-pending-decorations (&optional buffer) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 "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
|
213 Flush functions from `semantic-decorate-pending-decoration-hook'." |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (save-excursion |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (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
|
216 (run-hooks 'semantic-decorate-pending-decoration-hook) |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 ;; 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
|
218 (setq semantic-decorate-pending-decoration-hook nil))) |
104451
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ;;; DECORATION MODE |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 ;; Generic mode for handling basic highlighting and decorations. |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (defcustom global-semantic-decoration-mode nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 "*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
|
228 When this mode is activated, decorations specified by |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 `semantic-decoration-styles'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 :group 'semantic-modes |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 :type 'boolean |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 :require 'semantic/decorate/mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 :initialize 'custom-initialize-default |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 :set (lambda (sym val) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (global-semantic-decoration-mode (if val 1 -1)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 |
104506
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
238 ;;;###autoload |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (defun global-semantic-decoration-mode (&optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 "Toggle global use of option `semantic-decoration-mode'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 Decoration mode turns on all active decorations as specified |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 by `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 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
|
244 If ARG is nil, then toggle." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (interactive "P") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (setq global-semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 (semantic-toggle-minor-mode-globally |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 'semantic-decoration-mode arg))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (defcustom semantic-decoration-mode-hook nil |
105260
bbd7017a25d9
CEDET (development tools) package merged.
Chong Yidong <cyd@stupidchicken.com>
parents:
104514
diff
changeset
|
251 "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
|
252 :group 'semantic |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 :type 'hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 ;;;;###autoload |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (defvar semantic-decoration-mode nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 "Non-nil if command `semantic-decoration-mode' is enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 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
|
259 (make-variable-buffer-local 'semantic-decoration-mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (defun semantic-decoration-mode-setup () |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 "Setup the `semantic-decoration-mode' minor mode. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 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
|
264 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
|
265 minor mode is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (if semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (if (not (and (featurep 'semantic) (semantic-active-p))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (progn |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ;; Disable minor mode if semantic stuff not available |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (setq semantic-decoration-mode nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 (error "Buffer %s was not set up for parsing" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (buffer-name))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 ;; Add hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (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
|
275 (add-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 'semantic-decorate-tags-after-partial-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (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
|
278 (add-hook 'semantic-after-toplevel-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 'semantic-decorate-tags-after-full-reparse nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 ;; Add decorations to available tags. The above hooks ensure |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 ;; 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
|
282 (semantic-decorate-add-decorations (semantic-fetch-available-tags)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 ) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 ;; Remove decorations from available tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 (semantic-decorate-clear-decorations (semantic-fetch-available-tags)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;; Cleanup any leftover crap too. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 ;; Remove hooks |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 (remove-hook 'semantic-after-partial-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 'semantic-decorate-tags-after-partial-reparse t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 (remove-hook 'semantic-after-toplevel-cache-change-hook |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 'semantic-decorate-tags-after-full-reparse t) |
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 semantic-decoration-mode) |
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-decoration-mode (&optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 "Minor mode for decorating tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 Decorations are specified in `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 You can define new decoration styles with |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 `define-semantic-decoration-style'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 minor mode is enabled." |
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 ;;\\{semantic-decoration-map}" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (interactive |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (list (or current-prefix-arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (if semantic-decoration-mode 0 1)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (setq semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (if arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 (> |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (prefix-numeric-value arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 0) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 (not semantic-decoration-mode))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 (semantic-decoration-mode-setup) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (run-hooks 'semantic-decoration-mode-hook) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (if (interactive-p) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (message "decoration-mode minor mode %sabled" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (if semantic-decoration-mode "en" "dis"))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (semantic-mode-line-update) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 semantic-decoration-mode) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (semantic-add-minor-mode 'semantic-decoration-mode |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 "" |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 nil) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 (defun semantic-decorate-tags-after-full-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 "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
|
330 TAG-LIST is the list of tags recently parsed. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 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
|
332 add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 Called from `semantic-after-toplevel-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 ;; Flush everything |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 (semantic-decorate-flush-decorations) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 ;; Add it back on |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 (semantic-decorate-add-decorations tag-list)) |
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 (defun semantic-decorate-tags-after-partial-reparse (tag-list) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 "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
|
341 TAG-LIST is the list of newly created tags. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 Call `semantic-decorate-add-decorations' to add decorations. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 Called from `semantic-after-partial-cache-change-hook'." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 (semantic-decorate-add-decorations tag-list)) |
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 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 ;;; Enable/Disable toggling |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 ;; |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (defun semantic-decoration-style-enabled-p (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 "Return non-nil if STYLE is currently enabled. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 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
|
352 (let ((pair (assoc style semantic-decoration-styles))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 (and pair (cdr pair)))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (defun semantic-toggle-decoration-style (name &optional arg) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 "Turn on/off the decoration style with NAME. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 Decorations are specified in `semantic-decoration-styles'. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 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
|
359 Return non-nil if the decoration style is enabled." |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (interactive |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (list (completing-read "Decoration style: " |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 semantic-decoration-styles nil t) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 current-prefix-arg)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (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
|
365 (unless (equal name "") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (let* ((style (assoc name semantic-decoration-styles)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (flag (if arg |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 (> (prefix-numeric-value arg) 0) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (not (cdr style))))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (unless (eq (cdr style) flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 ;; Store the new flag. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 (setcdr style flag) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 ;; Refresh decorations is `semantic-decoration-mode' is on. |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (when semantic-decoration-mode |
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 (semantic-decoration-mode 1)) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (when (interactive-p) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (message "Decoration style %s turned %s" (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (if flag "on" "off")))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 flag))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (defvar semantic-decoration-menu-cache nil |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 "Cache of the decoration menu.") |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (defun semantic-decoration-build-style-menu (style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 "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
|
387 (vector (car style) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 `(lambda () (interactive) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (semantic-toggle-decoration-style |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 ,(car style))) |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 :style 'toggle |
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 :selected `(semantic-decoration-style-enabled-p ,(car style)) |
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 |
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 |
104506
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
561 ;; Local variables: |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
562 ;; generated-autoload-file: "../loaddefs.el" |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
563 ;; generated-autoload-feature: semantic/loaddefs |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
564 ;; 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
|
565 ;; End: |
801834237f9c
* menu-bar.el: Remove ediff-misc from Tools menu.
Chong Yidong <cyd@stupidchicken.com>
parents:
104451
diff
changeset
|
566 |
105377 | 567 ;; arch-tag: c1ac7888-e323-4467-96d6-18eb2820ed58 |
104451
2858c6bcc446
lisp/cedet/semantic/decorate/include.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 ;;; semantic/decorate/mode.el ends here |