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