Mercurial > emacs
annotate lisp/cedet/semantic/util-modes.el @ 104476:1da44e87bf90
lisp/cedet/semantic/sort.el (semantic-tag-external-class-default)
(semantic-tag-external-member-children-default): Require
semantic/db-mode instead of checking if semanticdb-minor-mode-p is
bound.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 07 Sep 2009 16:34:35 +0000 |
parents | 22e5fec9a17e |
children | aa2a07e5db2f |
rev | line source |
---|---|
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1 ;;; semantic/util-modes.el --- Semantic minor modes |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Authors: Eric M. Ludlam <zappo@gnu.org> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; David Ponce <david@dponce.com> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: syntax |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; Semantic utility minor modes. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;;; Code: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (require 'semantic) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (eval-when-compile |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (require 'semantic/decorate) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;;; Compatibility |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (if (fboundp 'propertize) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (defalias 'semantic-propertize 'propertize) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (defsubst semantic-propertize (string &rest properties) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 "Return a copy of STRING with text properties added. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 Dummy implementation for compatibility which just return STRING and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ignore PROPERTIES." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 string) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;;; Group for all semantic enhancing modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (defgroup semantic-modes nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 "Minor modes associated with the Semantic architecture." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 :group 'semantic) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;;;; Semantic minor modes stuff |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (defcustom semantic-update-mode-line t |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 "*If non-nil, show enabled minor modes in the mode line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 Only minor modes that are not turned on globally are shown in the mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (set-default sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 ;; Update status of all Semantic enabled buffers |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (semantic-map-buffers |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 #'semantic-mode-line-update))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 (defcustom semantic-mode-line-prefix |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (semantic-propertize "S" 'face 'bold) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 "*Prefix added to minor mode indicators in the mode line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 :type 'string |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 :initialize 'custom-initialize-default) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (defvar semantic-minor-modes-status nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 "String showing Semantic minor modes which are locally enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 It is displayed in the mode line.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (make-variable-buffer-local 'semantic-minor-modes-status) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (defvar semantic-minor-mode-alist nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "Alist saying how to show Semantic minor modes in the mode line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 Like variable `minor-mode-alist'.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (defun semantic-mode-line-update () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 "Update display of Semantic minor modes in the mode line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 Only minor modes that are locally enabled are shown in the mode line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (setq semantic-minor-modes-status nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (if semantic-update-mode-line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (let ((ml semantic-minor-mode-alist) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 mm ms see) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (while ml |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (setq mm (car ml) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 ms (cadr mm) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 mm (car mm) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ml (cdr ml)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (when (and (symbol-value mm) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 ;; Only show local minor mode status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (not (memq mm semantic-init-hooks))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (and ms |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (symbolp ms) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (setq ms (symbol-value ms))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (and (stringp ms) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (not (member ms see)) ;; Don't duplicate same status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (setq see (cons ms see) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 ms (if (string-match "^[ ]*\\(.+\\)" ms) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (match-string 1 ms))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (setq semantic-minor-modes-status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (if semantic-minor-modes-status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (concat semantic-minor-modes-status "/" ms) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 ms))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (if semantic-minor-modes-status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (setq semantic-minor-modes-status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (concat |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 " " |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (if (string-match "^[ ]*\\(.+\\)" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 semantic-mode-line-prefix) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (match-string 1 semantic-mode-line-prefix) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 "S") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 "/" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 semantic-minor-modes-status)))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (defun semantic-desktop-ignore-this-minor-mode (buffer) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 "Installed as a minor-mode initializer for Desktop mode. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 BUFFER is the buffer to not initialize a Semantic minor mode in." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 (defun semantic-add-minor-mode (toggle name &optional keymap) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 "Register a new Semantic minor mode. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 TOGGLE is a symbol which is the name of a buffer-local variable that |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 is toggled on or off to say whether the minor mode is active or not. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 It is also an interactive function to toggle the mode. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 NAME specifies what will appear in the mode line when the minor mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 is active. NAME should be either a string starting with a space, or a |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 symbol whose value is such a string. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 Optional KEYMAP is the keymap for the minor mode that will be added to |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 `minor-mode-map-alist'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; Add a dymmy semantic minor mode to display the status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (or (assq 'semantic-minor-modes-status minor-mode-alist) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (setq minor-mode-alist (cons (list 'semantic-minor-modes-status |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 'semantic-minor-modes-status) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 minor-mode-alist))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (if (fboundp 'add-minor-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 ;; Emacs 21 & XEmacs |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (add-minor-mode toggle "" keymap) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 ;; Emacs 20 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (or (assq toggle minor-mode-alist) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (setq minor-mode-alist (cons (list toggle "") minor-mode-alist))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (or (not keymap) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (assq toggle minor-mode-map-alist) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (setq minor-mode-map-alist (cons (cons toggle keymap) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 minor-mode-map-alist)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 ;; Record how to display this minor mode in the mode line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (let ((mm (assq toggle semantic-minor-mode-alist))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (if mm |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (setcdr mm (list name)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (setq semantic-minor-mode-alist (cons (list toggle name) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 semantic-minor-mode-alist)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 ;; Semantic minor modes don't work w/ Desktop restore. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 ;; This line will disable this minor mode from being restored |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 ;; by Desktop. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (when (boundp 'desktop-minor-mode-handlers) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (add-to-list 'desktop-minor-mode-handlers |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (cons toggle 'semantic-desktop-ignore-this-minor-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (defun semantic-toggle-minor-mode-globally (mode &optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 "Toggle minor mode MODE in every Semantic enabled buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 Return non-nil if MODE is turned on in every Semantic enabled buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 If ARG is positive, enable, if it is negative, disable. If ARG is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 nil, then toggle. Otherwise do nothing. MODE must be a valid minor |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 mode defined in `minor-mode-alist' and must be too an interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 function used to toggle the mode." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (or (and (fboundp mode) (assq mode minor-mode-alist)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (error "Semantic minor mode %s not found" mode)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (if (not arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (if (memq mode semantic-init-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 (setq arg -1) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (setq arg 1))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 ;; Add or remove the MODE toggle function from |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 ;; `semantic-init-hooks'. Then turn MODE on or off in every |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; Semantic enabled buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (cond |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 ;; Turn off if ARG < 0 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 ((< arg 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (remove-hook 'semantic-init-hooks mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (semantic-map-buffers #'(lambda () (funcall mode -1))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 ;; Turn on if ARG > 0 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 ((> arg 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (add-hook 'semantic-init-hooks mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (semantic-map-buffers #'(lambda () (funcall mode 1))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ;; Otherwise just check MODE state |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (t |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (memq mode semantic-init-hooks)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 )) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 ;;;; Minor mode to highlight areas that a user edits. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
207 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (defun global-semantic-highlight-edits-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 "Toggle global use of option `semantic-highlight-edits-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 If ARG is positive, enable, if it is negative, disable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 If ARG is nil, then toggle." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (interactive "P") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (setq global-semantic-highlight-edits-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (semantic-toggle-minor-mode-globally |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 'semantic-highlight-edits-mode arg))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
217 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (defcustom global-semantic-highlight-edits-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 "*If non-nil enable global use of variable `semantic-highlight-edits-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 When this mode is enabled, changes made to a buffer are highlighted |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 until the buffer is reparsed." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 :group 'semantic-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (global-semantic-highlight-edits-mode (if val 1 -1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (defcustom semantic-highlight-edits-mode-hook nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 "*Hook run at the end of function `semantic-highlight-edits-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 :type 'hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (defface semantic-highlight-edits-face |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 '((((class color) (background dark)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 ;; Put this back to something closer to black later. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (:background "gray20")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (((class color) (background light)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (:background "gray90"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 "*Face used to show dirty tokens in `semantic-highlight-edits-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 :group 'semantic-faces) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (defun semantic-highlight-edits-new-change-hook-fcn (overlay) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 "Function set into `semantic-edits-new-change-hook'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 Argument OVERLAY is the overlay created to mark the change. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 This function will set the face property on this overlay." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (semantic-overlay-put overlay 'face 'semantic-highlight-edits-face)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (defvar semantic-highlight-edits-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (let ((km (make-sparse-keymap))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 km) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 "Keymap for highlight-edits minor mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (defvar semantic-highlight-edits-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 "Non-nil if highlight-edits minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 Use the command `semantic-highlight-edits-mode' to change this variable.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 (make-variable-buffer-local 'semantic-highlight-edits-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (defun semantic-highlight-edits-mode-setup () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 "Setup option `semantic-highlight-edits-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 The minor mode can be turned on only if semantic feature is available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 and the current buffer was set up for parsing. When minor mode is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 enabled parse the current buffer if needed. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (if semantic-highlight-edits-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (if (not (and (featurep 'semantic) (semantic-active-p))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ;; Disable minor mode if semantic stuff not available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (setq semantic-highlight-edits-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 (error "Buffer %s was not set up for parsing" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (buffer-name))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (semantic-make-local-hook 'semantic-edits-new-change-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 (add-hook 'semantic-edits-new-change-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 'semantic-highlight-edits-new-change-hook-fcn nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 ;; Remove hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (remove-hook 'semantic-edits-new-change-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 'semantic-highlight-edits-new-change-hook-fcn t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 semantic-highlight-edits-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
283 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 (defun semantic-highlight-edits-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 "Minor mode for highlighting changes made in a buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 Changes are tracked by semantic so that the incremental parser can work |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 properly. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 This mode will highlight those changes as they are made, and clear them |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 when the incremental parser accounts for those edits. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 With prefix argument ARG, turn on if positive, otherwise off. The |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 minor mode can be turned on only if semantic feature is available and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 the current buffer was set up for parsing. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 (interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 (list (or current-prefix-arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (if semantic-highlight-edits-mode 0 1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (setq semantic-highlight-edits-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (if arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (prefix-numeric-value arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (not semantic-highlight-edits-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (semantic-highlight-edits-mode-setup) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (run-hooks 'semantic-highlight-edits-mode-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (if (interactive-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 (message "highlight-edits minor mode %sabled" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (if semantic-highlight-edits-mode "en" "dis"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (semantic-mode-line-update) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 semantic-highlight-edits-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (semantic-add-minor-mode 'semantic-highlight-edits-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 "e" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 semantic-highlight-edits-mode-map) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 ;;;; Minor mode to show unmatched-syntax elements |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 ;;;; |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
319 |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
320 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (defun global-semantic-show-unmatched-syntax-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 "Toggle global use of option `semantic-show-unmatched-syntax-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 If ARG is positive, enable, if it is negative, disable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 If ARG is nil, then toggle." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (interactive "P") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 (setq global-semantic-show-unmatched-syntax-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (semantic-toggle-minor-mode-globally |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 'semantic-show-unmatched-syntax-mode arg))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
330 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (defcustom global-semantic-show-unmatched-syntax-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 "*If non-nil, enable global use of `semantic-show-unmatched-syntax-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 When this mode is enabled, syntax in the current buffer which the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 semantic parser cannot match is highlighted with a red underline." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 :group 'semantic-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (global-semantic-show-unmatched-syntax-mode (if val 1 -1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 (defcustom semantic-show-unmatched-syntax-mode-hook nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 "*Hook run at the end of function `semantic-show-unmatched-syntax-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 :type 'hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (defface semantic-unmatched-syntax-face |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 '((((class color) (background dark)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (:underline "red")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (((class color) (background light)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (:underline "red"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 "*Face used to show unmatched syntax in. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 The face is used in `semantic-show-unmatched-syntax-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 :group 'semantic-faces) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 (defsubst semantic-unmatched-syntax-overlay-p (overlay) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 "Return non-nil if OVERLAY is an unmatched syntax one." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (eq (semantic-overlay-get overlay 'semantic) 'unmatched)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (defun semantic-showing-unmatched-syntax-p () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 "Return non-nil if an unmatched syntax overlay was found in buffer." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (let ((ol (semantic-overlays-in (point-min) (point-max))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 found) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (while (and ol (not found)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (setq found (semantic-unmatched-syntax-overlay-p (car ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 ol (cdr ol))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 found)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (defun semantic-show-unmatched-lex-tokens-fetch () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 "Fetch a list of unmatched lexical tokens from the current buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 Uses the overlays which have accurate bounds, and rebuilds what was |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 originally passed in." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (let ((ol (semantic-overlays-in (point-min) (point-max))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (ustc nil)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 (while ol |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (if (semantic-unmatched-syntax-overlay-p (car ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 (setq ustc (cons (cons 'thing |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (cons (semantic-overlay-start (car ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 (semantic-overlay-end (car ol)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 ustc))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (setq ol (cdr ol))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 (nreverse ustc)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 (defun semantic-clean-unmatched-syntax-in-region (beg end) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 "Remove all unmatched syntax overlays between BEG and END." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 (let ((ol (semantic-overlays-in beg end))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 (while ol |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (if (semantic-unmatched-syntax-overlay-p (car ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (semantic-overlay-delete (car ol))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 (setq ol (cdr ol))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 (defsubst semantic-clean-unmatched-syntax-in-buffer () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 "Remove all unmatched syntax overlays found in current buffer." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 (semantic-clean-unmatched-syntax-in-region |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 (point-min) (point-max))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
398 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
399 (defsubst semantic-clean-token-of-unmatched-syntax (token) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
400 "Clean the area covered by TOKEN of unmatched syntax markers." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
401 (semantic-clean-unmatched-syntax-in-region |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
402 (semantic-tag-start token) (semantic-tag-end token))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
403 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
404 (defun semantic-show-unmatched-syntax (syntax) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
405 "Function set into `semantic-unmatched-syntax-hook'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
406 This will highlight elements in SYNTAX as unmatched syntax." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
407 ;; This is called when `semantic-show-unmatched-syntax-mode' is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
408 ;; enabled. Highlight the unmatched syntax, and then add a semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
409 ;; property to that overlay so we can add it to the official list of |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
410 ;; semantic supported overlays. This gets it cleaned up for errors, |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
411 ;; buffer cleaning, and the like. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
412 (semantic-clean-unmatched-syntax-in-buffer) ;Clear previous highlighting |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
413 (if syntax |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
414 (let (o) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
415 (while syntax |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
416 (setq o (semantic-make-overlay (semantic-lex-token-start (car syntax)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
417 (semantic-lex-token-end (car syntax)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
418 (semantic-overlay-put o 'semantic 'unmatched) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
419 (semantic-overlay-put o 'face 'semantic-unmatched-syntax-face) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
420 (setq syntax (cdr syntax)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
421 )) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
422 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
423 (defun semantic-next-unmatched-syntax (point &optional bound) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
424 "Find the next overlay for unmatched syntax after POINT. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
425 Do not search past BOUND if non-nil." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
426 (save-excursion |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
427 (goto-char point) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
428 (let ((os point) (ol nil)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
429 (while (and os (< os (or bound (point-max))) (not ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
430 (setq os (semantic-overlay-next-change os)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
431 (when os |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
432 ;; Get overlays at position |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
433 (setq ol (semantic-overlays-at os)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
434 ;; find the overlay that belongs to semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
435 ;; and starts at the found position. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
436 (while (and ol (listp ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
437 (and (semantic-unmatched-syntax-overlay-p (car ol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
438 (setq ol (car ol))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
439 (if (listp ol) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
440 (setq ol (cdr ol)))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
441 ol))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
442 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
443 (defvar semantic-show-unmatched-syntax-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
444 (let ((km (make-sparse-keymap))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
445 (define-key km "\C-c,`" 'semantic-show-unmatched-syntax-next) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
446 km) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
447 "Keymap for command `semantic-show-unmatched-syntax-mode'.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
448 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
449 (defvar semantic-show-unmatched-syntax-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
450 "Non-nil if show-unmatched-syntax minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
451 Use the command `semantic-show-unmatched-syntax-mode' to change this |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
452 variable.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
453 (make-variable-buffer-local 'semantic-show-unmatched-syntax-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
454 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
455 (defun semantic-show-unmatched-syntax-mode-setup () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
456 "Setup the `semantic-show-unmatched-syntax' minor mode. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
457 The minor mode can be turned on only if semantic feature is available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
458 and the current buffer was set up for parsing. When minor mode is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
459 enabled parse the current buffer if needed. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
460 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
461 (if semantic-show-unmatched-syntax-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
462 (if (not (and (featurep 'semantic) (semantic-active-p))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
463 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
464 ;; Disable minor mode if semantic stuff not available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
465 (setq semantic-show-unmatched-syntax-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
466 (error "Buffer %s was not set up for parsing" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
467 (buffer-name))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
468 ;; Add hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
469 (semantic-make-local-hook 'semantic-unmatched-syntax-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
470 (add-hook 'semantic-unmatched-syntax-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
471 'semantic-show-unmatched-syntax nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
472 (semantic-make-local-hook 'semantic-pre-clean-token-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
473 (add-hook 'semantic-pre-clean-token-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
474 'semantic-clean-token-of-unmatched-syntax nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
475 ;; Show unmatched syntax elements |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
476 (if (not (semantic--umatched-syntax-needs-refresh-p)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
477 (semantic-show-unmatched-syntax |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
478 (semantic-unmatched-syntax-tokens)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
479 ;; Remove hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
480 (remove-hook 'semantic-unmatched-syntax-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
481 'semantic-show-unmatched-syntax t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
482 (remove-hook 'semantic-pre-clean-token-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
483 'semantic-clean-token-of-unmatched-syntax t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
484 ;; Cleanup unmatched-syntax highlighting |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
485 (semantic-clean-unmatched-syntax-in-buffer)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
486 semantic-show-unmatched-syntax-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
487 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
488 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
489 (defun semantic-show-unmatched-syntax-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
490 "Minor mode to highlight unmatched lexical syntax tokens. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
491 When a parser executes, some elements in the buffer may not match any |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
492 parser rules. These text characters are considered unmatched syntax. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
493 Often time, the display of unmatched syntax can expose coding |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
494 problems before the compiler is run. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
495 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
496 With prefix argument ARG, turn on if positive, otherwise off. The |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
497 minor mode can be turned on only if semantic feature is available and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
498 the current buffer was set up for parsing. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
499 minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
500 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
501 \\{semantic-show-unmatched-syntax-mode-map}" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
502 (interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
503 (list (or current-prefix-arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
504 (if semantic-show-unmatched-syntax-mode 0 1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
505 (setq semantic-show-unmatched-syntax-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
506 (if arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
507 (> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
508 (prefix-numeric-value arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
509 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
510 (not semantic-show-unmatched-syntax-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
511 (semantic-show-unmatched-syntax-mode-setup) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
512 (run-hooks 'semantic-show-unmatched-syntax-mode-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
513 (if (interactive-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
514 (message "show-unmatched-syntax minor mode %sabled" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
515 (if semantic-show-unmatched-syntax-mode "en" "dis"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
516 (semantic-mode-line-update) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
517 semantic-show-unmatched-syntax-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
518 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
519 (semantic-add-minor-mode 'semantic-show-unmatched-syntax-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
520 "u" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
521 semantic-show-unmatched-syntax-mode-map) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
522 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
523 (defun semantic-show-unmatched-syntax-next () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
524 "Move forward to the next occurrence of unmatched syntax." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
525 (interactive) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
526 (let ((o (semantic-next-unmatched-syntax (point)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
527 (if o |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
528 (goto-char (semantic-overlay-start o))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
529 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
530 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
531 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
532 ;;;; Minor mode to display the parser state in the modeline. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
533 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
534 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
535 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
536 (defcustom global-semantic-show-parser-state-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
537 "*If non-nil enable global use of `semantic-show-parser-state-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
538 When enabled, the current parse state of the current buffer is displayed |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
539 in the mode line. See `semantic-show-parser-state-marker' for details |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
540 on what is displayed." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
541 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
542 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
543 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
544 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
545 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
546 (global-semantic-show-parser-state-mode (if val 1 -1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
547 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
548 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
549 (defun global-semantic-show-parser-state-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
550 "Toggle global use of option `semantic-show-parser-state-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
551 If ARG is positive, enable, if it is negative, disable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
552 If ARG is nil, then toggle." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
553 (interactive "P") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
554 (setq global-semantic-show-parser-state-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
555 (semantic-toggle-minor-mode-globally |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
556 'semantic-show-parser-state-mode arg))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
557 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
558 (defcustom semantic-show-parser-state-mode-hook nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
559 "*Hook run at the end of function `semantic-show-parser-state-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
560 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
561 :type 'hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
562 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
563 (defvar semantic-show-parser-state-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
564 (let ((km (make-sparse-keymap))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
565 km) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
566 "Keymap for show-parser-state minor mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
567 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
568 (defvar semantic-show-parser-state-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
569 "Non-nil if show-parser-state minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
570 Use the command `semantic-show-parser-state-mode' to change this variable.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
571 (make-variable-buffer-local 'semantic-show-parser-state-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
572 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
573 (defun semantic-show-parser-state-mode-setup () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
574 "Setup option `semantic-show-parser-state-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
575 The minor mode can be turned on only if semantic feature is available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
576 and the current buffer was set up for parsing. When minor mode is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
577 enabled parse the current buffer if needed. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
578 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
579 (if semantic-show-parser-state-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
580 (if (not (and (featurep 'semantic) (semantic-active-p))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
581 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
582 ;; Disable minor mode if semantic stuff not available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
583 (setq semantic-show-parser-state-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
584 (error "Buffer %s was not set up for parsing" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
585 (buffer-name))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
586 ;; Set up mode line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
587 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
588 (when (not |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
589 (memq 'semantic-show-parser-state-string mode-line-modified)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
590 (setq mode-line-modified |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
591 (append mode-line-modified |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
592 '(semantic-show-parser-state-string)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
593 ;; Add hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
594 (semantic-make-local-hook 'semantic-edits-new-change-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
595 (add-hook 'semantic-edits-new-change-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
596 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
597 (semantic-make-local-hook 'semantic-edits-incremental-reparse-failed-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
598 (add-hook 'semantic-edits-incremental-reparse-failed-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
599 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
600 (semantic-make-local-hook 'semantic-after-partial-cache-change-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
601 (add-hook 'semantic-after-partial-cache-change-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
602 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
603 (semantic-make-local-hook 'semantic-after-toplevel-cache-change-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
604 (add-hook 'semantic-after-toplevel-cache-change-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
605 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
606 (semantic-show-parser-state-marker) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
607 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
608 (semantic-make-local-hook 'semantic-before-auto-parse-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
609 (add-hook 'semantic-before-auto-parse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
610 'semantic-show-parser-state-auto-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
611 (semantic-make-local-hook 'semantic-after-auto-parse-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
612 (add-hook 'semantic-after-auto-parse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
613 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
614 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
615 (semantic-make-local-hook 'semantic-before-idle-scheduler-reparse-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
616 (add-hook 'semantic-before-idle-scheduler-reparse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
617 'semantic-show-parser-state-auto-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
618 (semantic-make-local-hook 'semantic-after-idle-scheduler-reparse-hooks) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
619 (add-hook 'semantic-after-idle-scheduler-reparse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
620 'semantic-show-parser-state-marker nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
621 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
622 ;; Remove parts of mode line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
623 (setq mode-line-modified |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
624 (delq 'semantic-show-parser-state-string mode-line-modified)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
625 ;; Remove hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
626 (remove-hook 'semantic-edits-new-change-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
627 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
628 (remove-hook 'semantic-edits-incremental-reparse-failed-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
629 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
630 (remove-hook 'semantic-after-partial-cache-change-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
631 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
632 (remove-hook 'semantic-after-toplevel-cache-change-hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
633 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
634 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
635 (remove-hook 'semantic-before-auto-parse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
636 'semantic-show-parser-state-auto-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
637 (remove-hook 'semantic-after-auto-parse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
638 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
639 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
640 (remove-hook 'semantic-before-idle-scheduler-reparse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
641 'semantic-show-parser-state-auto-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
642 (remove-hook 'semantic-after-idle-scheduler-reparse-hooks |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
643 'semantic-show-parser-state-marker t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
644 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
645 semantic-show-parser-state-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
646 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
647 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
648 (defun semantic-show-parser-state-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
649 "Minor mode for displaying parser cache state in the modeline. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
650 The cache can be in one of three states. They are |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
651 Up to date, Partial reprase needed, and Full reparse needed. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
652 The state is indicated in the modeline with the following characters: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
653 `-' -> The cache is up to date. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
654 `!' -> The cache requires a full update. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
655 `~' -> The cache needs to be incrementally parsed. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
656 `%' -> The cache is not currently parseable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
657 `@' -> Auto-parse in progress (not set here.) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
658 With prefix argument ARG, turn on if positive, otherwise off. The |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
659 minor mode can be turned on only if semantic feature is available and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
660 the current buffer was set up for parsing. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
661 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
662 (interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
663 (list (or current-prefix-arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
664 (if semantic-show-parser-state-mode 0 1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
665 (setq semantic-show-parser-state-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
666 (if arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
667 (> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
668 (prefix-numeric-value arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
669 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
670 (not semantic-show-parser-state-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
671 (semantic-show-parser-state-mode-setup) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
672 (run-hooks 'semantic-show-parser-state-mode-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
673 (if (interactive-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
674 (message "show-parser-state minor mode %sabled" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
675 (if semantic-show-parser-state-mode "en" "dis"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
676 (semantic-mode-line-update) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
677 semantic-show-parser-state-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
678 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
679 (semantic-add-minor-mode 'semantic-show-parser-state-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
680 "" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
681 semantic-show-parser-state-mode-map) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
682 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
683 (defvar semantic-show-parser-state-string nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
684 "String showing the parser state for this buffer. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
685 See `semantic-show-parser-state-marker' for details.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
686 (make-variable-buffer-local 'semantic-show-parser-state-string) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
687 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
688 (defun semantic-show-parser-state-marker (&rest ignore) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
689 "Set `semantic-show-parser-state-string' to indicate parser state. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
690 This marker is one of the following: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
691 `-' -> The cache is up to date. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
692 `!' -> The cache requires a full update. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
693 `~' -> The cache needs to be incrementally parsed. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
694 `%' -> The cache is not currently parseable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
695 `@' -> Auto-parse in progress (not set here.) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
696 Arguments IGNORE are ignored, and accepted so this can be used as a hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
697 in many situations." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
698 (setq semantic-show-parser-state-string |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
699 (cond ((semantic-parse-tree-needs-rebuild-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
700 "!") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
701 ((semantic-parse-tree-needs-update-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
702 "^") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
703 ((semantic-parse-tree-unparseable-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
704 "%") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
705 (t |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
706 "-"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
707 ;;(message "Setup mode line indicator to [%s]" semantic-show-parser-state-string) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
708 (semantic-mode-line-update)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
709 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
710 (defun semantic-show-parser-state-auto-marker () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
711 "Hook function run before an autoparse. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
712 Set up `semantic-show-parser-state-marker' to show `@' |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
713 to indicate a parse in progress." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
714 (unless (semantic-parse-tree-up-to-date-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
715 (setq semantic-show-parser-state-string "@") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
716 (semantic-mode-line-update) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
717 ;; For testing. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
718 ;;(sit-for 1) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
719 )) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
720 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
721 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
722 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
723 ;;;; Minor mode to make function decls sticky. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
724 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
725 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
726 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
727 (defun global-semantic-stickyfunc-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
728 "Toggle global use of option `semantic-stickyfunc-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
729 If ARG is positive, enable, if it is negative, disable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
730 If ARG is nil, then toggle." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
731 (interactive "P") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
732 (setq global-semantic-stickyfunc-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
733 (semantic-toggle-minor-mode-globally |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
734 'semantic-stickyfunc-mode arg))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
735 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
736 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
737 (defcustom global-semantic-stickyfunc-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
738 "*If non-nil, enable global use of `semantic-stickyfunc-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
739 This minor mode only works for Emacs 21 or later. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
740 When enabled, the header line is enabled, and the first line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
741 of the current function or method is displayed in it. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
742 This makes it appear that the first line of that tag is |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
743 `sticky' to the top of the window." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
744 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
745 :group 'semantic-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
746 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
747 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
748 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
749 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
750 (global-semantic-stickyfunc-mode (if val 1 -1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
751 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
752 (defcustom semantic-stickyfunc-mode-hook nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
753 "*Hook run at the end of function `semantic-stickyfunc-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
754 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
755 :type 'hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
756 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
757 (defvar semantic-stickyfunc-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
758 (let ((km (make-sparse-keymap))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
759 (define-key km [ header-line down-mouse-1 ] 'semantic-stickyfunc-menu) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
760 km) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
761 "Keymap for stickyfunc minor mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
762 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
763 (defvar semantic-stickyfunc-popup-menu nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
764 "Menu used if the user clicks on the header line used by stickyfunc mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
765 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
766 (easy-menu-define |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
767 semantic-stickyfunc-popup-menu |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
768 semantic-stickyfunc-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
769 "Stickyfunc Menu" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
770 '("Stickyfunc Mode" :visible (progn nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
771 [ "Copy Headerline Tag" senator-copy-tag |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
772 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
773 :help "Copy the current tag to the tag ring"] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
774 [ "Kill Headerline Tag" senator-kill-tag |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
775 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
776 :help "Kill tag text to the kill ring, and copy the tag to the tag ring" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
777 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
778 [ "Copy Headerline Tag to Register" senator-copy-tag-to-register |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
779 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
780 :help "Copy the current tag to a register" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
781 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
782 [ "Narrow To Headerline Tag" senator-narrow-to-defun |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
783 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
784 :help "Narrow to the bounds of the current tag."] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
785 [ "Fold Headerline Tag" senator-fold-tag-toggle |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
786 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
787 :style toggle |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
788 :selected (let ((tag (semantic-current-tag))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
789 (and tag (semantic-tag-folded-p tag))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
790 :help "Fold the current tag to one line" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
791 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
792 "---" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
793 [ "About This Header Line" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
794 (lambda () (interactive) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
795 (describe-function 'semantic-stickyfunc-mode)) t]) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
796 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
797 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
798 (defvar semantic-stickyfunc-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
799 "Non-nil if stickyfunc minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
800 Use the command `semantic-stickyfunc-mode' to change this variable.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
801 (make-variable-buffer-local 'semantic-stickyfunc-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
802 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
803 (defcustom semantic-stickyfunc-indent-string |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
804 (if (and window-system (not (featurep 'xemacs))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
805 (concat |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
806 (condition-case nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
807 ;; Test scroll bar location |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
808 (let ((charwidth (frame-char-width)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
809 (scrollpos (frame-parameter (selected-frame) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
810 'vertical-scroll-bars)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
811 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
812 (if (or (eq scrollpos 'left) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
813 ;; Now wait a minute. If you turn scroll-bar-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
814 ;; on, then off, the new value is t, not left. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
815 ;; Will this mess up older emacs where the default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
816 ;; was on the right? I don't think so since they don't |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
817 ;; support a header line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
818 (eq scrollpos t)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
819 (let ((w (when (boundp 'scroll-bar-width) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
820 (symbol-value 'scroll-bar-width)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
821 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
822 (if (not w) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
823 (setq w (frame-parameter (selected-frame) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
824 'scroll-bar-width))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
825 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
826 ;; in 21.2, the frame parameter is sometimes empty |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
827 ;; so we need to get the value here. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
828 (if (not w) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
829 (setq w (+ (get 'scroll-bar-width 'x-frame-parameter) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
830 ;; In 21.4, or perhaps 22.1 the x-frame |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
831 ;; parameter is different from the frame |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
832 ;; parameter by only 1 pixel. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
833 1))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
834 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
835 (if (not w) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
836 " " |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
837 (setq w (+ 2 w)) ; Some sort of border around |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
838 ; the scrollbar. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
839 (make-string (/ w charwidth) ? ))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
840 "")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
841 (error "")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
842 (condition-case nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
843 ;; Test fringe size. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
844 (let* ((f (window-fringes)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
845 (fw (car f)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
846 (numspace (/ fw (frame-char-width))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
847 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
848 (make-string numspace ? )) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
849 (error |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
850 ;; Well, the fancy new Emacs functions failed. Try older |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
851 ;; tricks. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
852 (condition-case nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
853 ;; I'm not so sure what's up with the 21.1-21.3 fringe. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
854 ;; It looks to be about 1 space wide. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
855 (if (get 'fringe 'face) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
856 " " |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
857 "") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
858 (error "")))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
859 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
860 ;; Not Emacs or a window system means no scrollbar or fringe, |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
861 ;; and perhaps not even a header line to worry about. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
862 "") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
863 "*String used to indent the stickyfunc header. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
864 Customize this string to match the space used by scrollbars and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
865 fringe so it does not appear that the code is moving left/right |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
866 when it lands in the sticky line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
867 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
868 :type 'string) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
869 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
870 (defvar semantic-stickyfunc-old-hlf nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
871 "Value of the header line when entering sticky func mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
872 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
873 (defconst semantic-stickyfunc-header-line-format |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
874 (cond ((featurep 'xemacs) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
875 nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
876 ((>= emacs-major-version 22) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
877 '(:eval (list |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
878 ;; Magic bit I found on emacswiki. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
879 (propertize " " 'display '((space :align-to 0))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
880 (semantic-stickyfunc-fetch-stickyline)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
881 ((= emacs-major-version 21) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
882 '(:eval (list semantic-stickyfunc-indent-string |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
883 (semantic-stickyfunc-fetch-stickyline)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
884 (t nil)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
885 "The header line format used by sticky func mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
886 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
887 (defun semantic-stickyfunc-mode-setup () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
888 "Setup option `semantic-stickyfunc-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
889 For semantic enabled buffers, make the function declaration for the top most |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
890 function \"sticky\". This is accomplished by putting the first line of |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
891 text for that function in Emacs 21's header line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
892 (if semantic-stickyfunc-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
893 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
894 (unless (and (featurep 'semantic) (semantic-active-p)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
895 ;; Disable minor mode if semantic stuff not available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
896 (setq semantic-stickyfunc-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
897 (error "Buffer %s was not set up for parsing" (buffer-name))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
898 (unless (boundp 'default-header-line-format) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
899 ;; Disable if there are no header lines to use. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
900 (setq semantic-stickyfunc-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
901 (error "Sticky Function mode requires Emacs 21")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
902 ;; Enable the mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
903 ;; Save previous buffer local value of header line format. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
904 (when (and (local-variable-p 'header-line-format (current-buffer)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
905 (not (eq header-line-format |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
906 semantic-stickyfunc-header-line-format))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
907 (set (make-local-variable 'semantic-stickyfunc-old-hlf) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
908 header-line-format)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
909 (setq header-line-format semantic-stickyfunc-header-line-format) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
910 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
911 ;; Disable sticky func mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
912 ;; Restore previous buffer local value of header line format if |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
913 ;; the current one is the sticky func one. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
914 (when (eq header-line-format semantic-stickyfunc-header-line-format) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
915 (kill-local-variable 'header-line-format) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
916 (when (local-variable-p 'semantic-stickyfunc-old-hlf (current-buffer)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
917 (setq header-line-format semantic-stickyfunc-old-hlf) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
918 (kill-local-variable 'semantic-stickyfunc-old-hlf)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
919 semantic-stickyfunc-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
920 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
921 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
922 (defun semantic-stickyfunc-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
923 "Minor mode to show the title of a tag in the header line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
924 Enables/disables making the header line of functions sticky. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
925 A function (or other tag class specified by |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
926 `semantic-stickyfunc-sticky-classes') has a header line, meaning the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
927 first line which describes the rest of the construct. This first |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
928 line is what is displayed in the Emacs 21 header line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
929 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
930 With prefix argument ARG, turn on if positive, otherwise off. The |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
931 minor mode can be turned on only if semantic feature is available and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
932 the current buffer was set up for parsing. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
933 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
934 (interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
935 (list (or current-prefix-arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
936 (if semantic-stickyfunc-mode 0 1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
937 (setq semantic-stickyfunc-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
938 (if arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
939 (> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
940 (prefix-numeric-value arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
941 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
942 (not semantic-stickyfunc-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
943 (semantic-stickyfunc-mode-setup) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
944 (run-hooks 'semantic-stickyfunc-mode-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
945 (if (interactive-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
946 (message "Stickyfunc minor mode %sabled" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
947 (if semantic-stickyfunc-mode "en" "dis"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
948 (semantic-mode-line-update) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
949 semantic-stickyfunc-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
950 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
951 (defvar semantic-stickyfunc-sticky-classes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
952 '(function type) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
953 "List of tag classes which sticky func will display in the header line.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
954 (make-variable-buffer-local 'semantic-stickyfunc-sticky-classes) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
955 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
956 (defun semantic-stickyfunc-tag-to-stick () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
957 "Return the tag to stick at the current point." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
958 (let ((tags (nreverse (semantic-find-tag-by-overlay (point))))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
959 ;; Get rid of non-matching tags. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
960 (while (and tags |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
961 (not (member |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
962 (semantic-tag-class (car tags)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
963 semantic-stickyfunc-sticky-classes)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
964 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
965 (setq tags (cdr tags))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
966 (car tags))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
967 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
968 (defun semantic-stickyfunc-fetch-stickyline () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
969 "Make the function at the top of the current window sticky. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
970 Capture it's function declaration, and place it in the header line. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
971 If there is no function, disable the header line." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
972 (let ((str |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
973 (save-excursion |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
974 (goto-char (window-start (selected-window))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
975 (forward-line -1) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
976 (end-of-line) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
977 ;; Capture this function |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
978 (let* ((tag (semantic-stickyfunc-tag-to-stick))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
979 ;; TAG is nil if there was nothing of the apropriate type there. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
980 (if (not tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
981 ;; Set it to be the text under the header line |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
982 (buffer-substring (point-at-bol) (point-at-eol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
983 ;; Get it |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
984 (goto-char (semantic-tag-start tag)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
985 ;; Klaus Berndl <klaus.berndl@sdm.de>: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
986 ;; goto the tag name; this is especially needed for languages |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
987 ;; like c++ where a often used style is like: |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
988 ;; void |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
989 ;; ClassX::methodM(arg1...) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
990 ;; { |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
991 ;; ... |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
992 ;; } |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
993 ;; Without going to the tag-name we would get"void" in the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
994 ;; header line which is IMHO not really useful |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
995 (search-forward (semantic-tag-name tag) nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
996 (buffer-substring (point-at-bol) (point-at-eol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
997 )))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
998 (start 0)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
999 (while (string-match "%" str start) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1000 (setq str (replace-match "%%" t t str 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1001 start (1+ (match-end 0))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1002 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1003 ;; In 21.4 (or 22.1) the heder doesn't expand tabs. Hmmmm. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1004 ;; We should replace them here. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1005 ;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1006 ;; This hack assumes that tabs are kept smartly at tab boundaries |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1007 ;; instead of in a tab boundary where it might only represent 4 spaces. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1008 (while (string-match "\t" str start) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1009 (setq str (replace-match " " t t str 0))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1010 str)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1011 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1012 (defun semantic-stickyfunc-menu (event) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1013 "Popup a menu that can help a user understand stickyfunc-mode. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1014 Argument EVENT describes the event that caused this function to be called." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1015 (interactive "e") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1016 (let* ((startwin (selected-window)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1017 (win (car (car (cdr event)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1018 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1019 (select-window win t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1020 (save-excursion |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1021 (goto-char (window-start win)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1022 (sit-for 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1023 (popup-menu semantic-stickyfunc-popup-menu event) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1024 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1025 (select-window startwin))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1026 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1027 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1028 (semantic-add-minor-mode 'semantic-stickyfunc-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1029 "" ;; Don't need indicator. It's quite visible |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1030 semantic-stickyfunc-mode-map) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1031 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1032 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1033 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1034 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1035 ;;;; Minor mode to make highlight the current function |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1036 ;;;; |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1037 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1038 ;; Highlight the first like of the function we are in if it is different |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1039 ;; from the the tag going off the top of the screen. |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1040 |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1041 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1042 (defun global-semantic-highlight-func-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1043 "Toggle global use of option `semantic-highlight-func-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1044 If ARG is positive, enable, if it is negative, disable. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1045 If ARG is nil, then toggle." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1046 (interactive "P") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1047 (setq global-semantic-highlight-func-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1048 (semantic-toggle-minor-mode-globally |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1049 'semantic-highlight-func-mode arg))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1050 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1051 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1052 (defcustom global-semantic-highlight-func-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1053 "*If non-nil, enable global use of `semantic-highlight-func-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1054 When enabled, the first line of the current tag is highlighted." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1055 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1056 :group 'semantic-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1057 :type 'boolean |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1058 :require 'semantic/util-modes |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1059 :initialize 'custom-initialize-default |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1060 :set (lambda (sym val) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1061 (global-semantic-highlight-func-mode (if val 1 -1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1062 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1063 (defcustom semantic-highlight-func-mode-hook nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1064 "*Hook run at the end of function `semantic-highlight-func-mode'." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1065 :group 'semantic |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1066 :type 'hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1067 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1068 (defvar semantic-highlight-func-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1069 (let ((km (make-sparse-keymap)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1070 (m3 (if (featurep 'xemacs) [ button3 ] [ mouse-3 ])) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1071 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1072 (define-key km m3 'semantic-highlight-func-menu) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1073 km) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1074 "Keymap for highlight-func minor mode.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1075 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1076 (defvar semantic-highlight-func-popup-menu nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1077 "Menu used if the user clicks on the header line used by `semantic-highlight-func-mode'.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1078 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1079 (easy-menu-define |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1080 semantic-highlight-func-popup-menu |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1081 semantic-highlight-func-mode-map |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1082 "Highlight-Func Menu" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1083 '("Highlight-Func Mode" :visible (progn nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1084 [ "Copy Tag" senator-copy-tag |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1085 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1086 :help "Copy the current tag to the tag ring"] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1087 [ "Kill Tag" senator-kill-tag |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1088 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1089 :help "Kill tag text to the kill ring, and copy the tag to the tag ring" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1090 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1091 [ "Copy Tag to Register" senator-copy-tag-to-register |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1092 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1093 :help "Copy the current tag to a register" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1094 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1095 [ "Narrow To Tag" senator-narrow-to-defun |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1096 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1097 :help "Narrow to the bounds of the current tag."] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1098 [ "Fold Tag" senator-fold-tag-toggle |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1099 :active (semantic-current-tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1100 :style toggle |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1101 :selected (let ((tag (semantic-stickyfunc-tag-to-stick))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1102 (and tag (semantic-tag-folded-p tag))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1103 :help "Fold the current tag to one line" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1104 ] |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1105 "---" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1106 [ "About This Tag" semantic-describe-tag t]) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1107 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1108 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1109 (defun semantic-highlight-func-menu (event) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1110 "Popup a menu that displays things to do to the current tag. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1111 Argument EVENT describes the event that caused this function to be called." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1112 (interactive "e") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1113 (let* ((startwin (selected-window)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1114 (win (semantic-event-window event)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1115 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1116 (select-window win t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1117 (save-excursion |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1118 ;(goto-char (window-start win)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1119 (mouse-set-point event) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1120 (sit-for 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1121 (semantic-popup-menu semantic-highlight-func-popup-menu) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1122 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1123 (select-window startwin))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1124 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1125 (defvar semantic-highlight-func-mode nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1126 "Non-nil if highlight-func minor mode is enabled. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1127 Use the command `semantic-highlight-func-mode' to change this variable.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1128 (make-variable-buffer-local 'semantic-highlight-func-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1129 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1130 (defvar semantic-highlight-func-ct-overlay nil |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1131 "Overlay used to highlight the tag the cursor is in.") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1132 (make-variable-buffer-local 'semantic-highlight-func-ct-overlay) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1133 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1134 (defface semantic-highlight-func-current-tag-face |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1135 '((((class color) (background dark)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1136 ;; Put this back to something closer to black later. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1137 (:background "gray20")) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1138 (((class color) (background light)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1139 (:background "gray90"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1140 "Face used to show the top of current function." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1141 :group 'semantic-faces) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1142 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1143 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1144 (defun semantic-highlight-func-mode-setup () |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1145 "Setup option `semantic-highlight-func-mode'. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1146 For semantic enabled buffers, highlight the first line of the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1147 current tag declaration." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1148 (if semantic-highlight-func-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1149 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1150 (unless (and (featurep 'semantic) (semantic-active-p)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1151 ;; Disable minor mode if semantic stuff not available |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1152 (setq semantic-highlight-func-mode nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1153 (error "Buffer %s was not set up for parsing" (buffer-name))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1154 ;; Setup our hook |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1155 (add-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1156 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1157 ;; Disable highlight func mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1158 (remove-hook 'post-command-hook 'semantic-highlight-func-highlight-current-tag t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1159 (semantic-highlight-func-highlight-current-tag t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1160 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1161 semantic-highlight-func-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1162 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1163 ;;;###autoload |
104414
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1164 (defun semantic-highlight-func-mode (&optional arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1165 "Minor mode to highlight the first line of the current tag. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1166 Enables/disables making the header line of functions sticky. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1167 A function (or other tag class specified by |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1168 `semantic-stickfunc-sticky-classes') is highlighted, meaning the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1169 first line which describes the rest of the construct. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1170 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1171 See `semantic-stickfunc-mode' for putting a function in the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1172 header line. This mode recycles the stickyfunc configuration |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1173 classes list. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1174 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1175 With prefix argument ARG, turn on if positive, otherwise off. The |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1176 minor mode can be turned on only if semantic feature is available and |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1177 the current buffer was set up for parsing. Return non-nil if the |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1178 minor mode is enabled." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1179 (interactive |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1180 (list (or current-prefix-arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1181 (if semantic-highlight-func-mode 0 1)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1182 (setq semantic-highlight-func-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1183 (if arg |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1184 (> |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1185 (prefix-numeric-value arg) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1186 0) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1187 (not semantic-highlight-func-mode))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1188 (semantic-highlight-func-mode-setup) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1189 (run-hooks 'semantic-highlight-func-mode-hook) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1190 (if (interactive-p) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1191 (message "Highlight-Func minor mode %sabled" |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1192 (if semantic-highlight-func-mode "en" "dis"))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1193 semantic-highlight-func-mode) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1194 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1195 (defun semantic-highlight-func-highlight-current-tag (&optional disable) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1196 "Highlight the current tag under point. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1197 Optional argument DISABLE will turn off any active highlight. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1198 If the current tag for this buffer is different from the last time this |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1199 function was called, move the overlay." |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1200 (when (and (not (minibufferp)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1201 (or (not semantic-highlight-func-ct-overlay) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1202 (eq (semantic-overlay-buffer |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1203 semantic-highlight-func-ct-overlay) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1204 (current-buffer)))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1205 (let* ((tag (semantic-stickyfunc-tag-to-stick)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1206 (ol semantic-highlight-func-ct-overlay)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1207 (when (not ol) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1208 ;; No overlay in this buffer. Make one. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1209 (setq ol (semantic-make-overlay (point-min) (point-min) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1210 (current-buffer) t nil)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1211 (semantic-overlay-put ol 'highlight-func t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1212 (semantic-overlay-put ol 'face 'semantic-highlight-func-current-tag-face) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1213 (semantic-overlay-put ol 'keymap semantic-highlight-func-mode-map) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1214 (semantic-overlay-put ol 'help-echo |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1215 "Current Function : mouse-3 - Context menu") |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1216 (setq semantic-highlight-func-ct-overlay ol) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1217 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1218 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1219 ;; TAG is nil if there was nothing of the apropriate type there. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1220 (if (or (not tag) disable) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1221 ;; No tag, make the overlay go away. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1222 (progn |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1223 (semantic-overlay-put ol 'tag nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1224 (semantic-overlay-move ol (point-min) (point-min) (current-buffer)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1225 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1226 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1227 ;; We have a tag, if it is the same, do nothing. |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1228 (unless (eq (semantic-overlay-get ol 'tag) tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1229 (save-excursion |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1230 (goto-char (semantic-tag-start tag)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1231 (search-forward (semantic-tag-name tag) nil t) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1232 (semantic-overlay-put ol 'tag tag) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1233 (semantic-overlay-move ol (point-at-bol) (point-at-eol)) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1234 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1235 ) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1236 ))) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1237 nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1238 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1239 (semantic-add-minor-mode 'semantic-highlight-func-mode |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1240 "" ;; Don't need indicator. It's quite visible |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1241 nil) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1242 |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1243 (provide 'semantic/util-modes) |
b2b72cdd9d90
cedet/semantic/db.el, cedet/semantic/decorate.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1244 |
104466
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1245 ;; Local variables: |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1246 ;; generated-autoload-file: "loaddefs.el" |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1247 ;; generated-autoload-feature: semantic/loaddefs |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1248 ;; generated-autoload-load-name: "semantic/util-modes" |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1249 ;; End: |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1250 |
22e5fec9a17e
lisp/cedet/semantic/util-modes.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents:
104416
diff
changeset
|
1251 ;;; semantic/util-modes.el ends here |