Mercurial > emacs
annotate lisp/cedet/pulse.el @ 104454:e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
lisp/cedet/semantic/idle.el (semantic-symref-hits-in-region): Require
semantic/symref/filter.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 21:09:25 +0000 |
parents | 4af663a1c4ab |
children | 32af6b5a433d |
rev | line source |
---|---|
104407
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; pulse.el --- Pulsing Overlays |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; This file is part of GNU Emacs. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; it under the terms of the GNU General Public License as published by |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; the Free Software Foundation, either version 3 of the License, or |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; (at your option) any later version. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; GNU Emacs is distributed in the hope that it will be useful, |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU General Public License for more details. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; You should have received a copy of the GNU General Public License |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;;; Commentary: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; Manage temporary pulsing of faces and overlays. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; This is a temporal decoration technique where something is to be |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; highlighted briefly. This adds a gentle pulsing style to the text |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; decorated this way. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 ;; Useful user functions: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 ;; `pulse-enable-integration-advice' - Turn on advice to make various |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;; Emacs commands pulse, such as `goto-line', or `find-tag'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 ;; The following are useful entry points: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 ;; `pulse' - Cause `pulse-highlight-face' to shift toward background color. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 ;; Assumes you are using a version of Emacs that supports pulsing. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;; `pulse-momentary-highlight-one-line' - Pulse a single line at POINT. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 ;; `pulse-momentary-highlight-region' - Pulse a region. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 ;; `pulse-momentary-highlight-overlay' - Pulse an overlay |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 ;; These three functions will just blink the specified area if |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 ;; the version of Emacs you are using doesn't support pulsing. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 ;; `pulse-line-hook-function' - A simple function that can be used in a |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 ;; hook that will pulse whatever line the cursor is on. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ;;; History: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 ;; The original pulse code was written for semantic tag highlighting. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 ;; It has been extracted, and adapted for general purpose pulsing. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 ;; Pulse is a part of CEDET. http://cedet.sf.net |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (defun pulse-available-p () |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 "Return non-nil if pulsing is available on the current frame." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (condition-case nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (let ((v (color-values (face-background 'default)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (numberp (car-safe v))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (error nil))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (defcustom pulse-flag (pulse-available-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 "*Non-nil means to pulse the overlay face for momentary highlighting. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 Pulsing involves a bright highlight that slowly shifts to the background |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 color. Non-nil just means to highlight with an unchanging color for a short |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 time. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 If `pulse-flag' is non-nil, but `pulse-available-p' is nil, then |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 this flag is ignored." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 :group 'pulse |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 :type 'boolean) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (defface pulse-highlight-start-face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 '((((class color) (background dark)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (:background "#AAAA33")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (((class color) (background light)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (:background "#FFFFAA"))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 "*Face used at beginning of a highight." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 :group 'pulse) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (defface pulse-highlight-face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 '((((class color) (background dark)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (:background "#AAAA33")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (((class color) (background light)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (:background "#FFFFAA"))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 "*Face used during a pulse for display. *DO NOT CUSTOMIZE* |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 Face used for temporary highlighting of tags for effect." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 :group 'pulse) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 ;;; Compatibility |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (defalias 'pulse-overlay-live-p 'overlay-buffer) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (defalias 'pulse-overlay-put 'overlay-put) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (defalias 'pulse-overlay-get 'overlay-get) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (defalias 'pulse-overlay-delete 'delete-overlay) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (defalias 'pulse-make-overlay 'make-overlay) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (when (featurep 'xemacs) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (defalias 'pulse-overlay-live-p |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (lambda (o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (and (extent-live-p o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (not (extent-detached-p o)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (bufferp (extent-buffer o))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (defalias 'pulse-overlay-put 'set-extent-property) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (defalias 'pulse-overlay-get 'extent-property) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (defalias 'pulse-overlay-delete 'delete-extent) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (defalias 'pulse-make-overlay 'make-extent)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 ;;; Code: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 (defun pulse-int-to-hex (int &optional nb-digits) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 "Convert integer argument INT to a #XXXXXXXXXXXX format hex string. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 Each X in the output string is a hexadecimal digit. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 NB-DIGITS is the number of hex digits. If INT is too large to be |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 represented with NB-DIGITS, then the result is truncated from the |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 left. So, for example, INT=256 and NB-DIGITS=2 returns \"00\", since |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 the hex equivalent of 256 decimal is 100, which is more than 2 digits. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 This function was blindly copied from hexrgb.el by Drew Adams. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 http://www.emacswiki.org/cgi-bin/wiki/hexrgb.el" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (setq nb-digits (or nb-digits 4)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (substring (format (concat "%0" (int-to-string nb-digits) "X") int) (- nb-digits))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (defun pulse-color-values-to-hex (values) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 "Convert list of rgb color VALUES to a hex string, #XXXXXXXXXXXX. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 Each X in the string is a hexadecimal digit. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 Input VALUES is as for the output of `x-color-values'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 This function was blindly copied from hexrgb.el by Drew Adams. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 http://www.emacswiki.org/cgi-bin/wiki/hexrgb.el" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (concat "#" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (pulse-int-to-hex (nth 0 values) 4) ; red |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (pulse-int-to-hex (nth 1 values) 4) ; green |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (pulse-int-to-hex (nth 2 values) 4))) ; blue |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (defcustom pulse-iterations 10 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 "Number of iterations in a pulse operation." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 :group 'pulse |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 :type 'number) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (defcustom pulse-delay .03 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 "Delay between face lightening iterations, as used by `sit-for'." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 :group 'pulse |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 :type 'number) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (defun pulse-lighten-highlight () |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 "Lighten the face by 1/`pulse-iterations' toward the background color. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 Return t if there is more drift to do, nil if completed." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (if (>= (get 'pulse-highlight-face :iteration) pulse-iterations) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (let* ((frame (color-values (face-background 'default))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (start (color-values (face-background |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (get 'pulse-highlight-face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 :startface)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (frac (list (/ (- (nth 0 frame) (nth 0 start)) pulse-iterations) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (/ (- (nth 1 frame) (nth 1 start)) pulse-iterations) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (/ (- (nth 2 frame) (nth 2 start)) pulse-iterations))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (it (get 'pulse-highlight-face :iteration)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (set-face-background 'pulse-highlight-face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (pulse-color-values-to-hex |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (list |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (+ (nth 0 start) (* (nth 0 frac) it)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (+ (nth 1 start) (* (nth 1 frac) it)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (+ (nth 2 start) (* (nth 2 frac) it))))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (put 'pulse-highlight-face :iteration (1+ it)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (if (>= (1+ it) pulse-iterations) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 t)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (defun pulse-reset-face (&optional face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 "Reset the pulse highlighting FACE." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (set-face-background 'pulse-highlight-face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (if face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (face-background face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (face-background 'pulse-highlight-start-face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 )) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (put 'pulse-highlight-face :startface (or face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 'pulse-highlight-start-face)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (put 'pulse-highlight-face :iteration 0)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (defun pulse (&optional face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 "Pulse the colors on our highlight face. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 If optional FACE is provide, reset the face to FACE color, |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 instead of `pulse-highlight-start-face'. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 Be sure to call `pulse-reset-face' after calling pulse." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (unwind-protect |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (progn |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (pulse-reset-face face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (while (and (pulse-lighten-highlight) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (sit-for pulse-delay)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 )) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (defun pulse-test (&optional no-error) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 "Test the lightening function for pulsing a line. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 When optional NO-ERROR Don't throw an error if we can't run tests." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (interactive) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (if (or (not pulse-flag) (not (pulse-available-p))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (if no-error |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (error (concat "Pulse test only works on versions of Emacs" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 " that support pulsing"))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 ;; Run the tests |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (when (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (message "<Press a key> Pulse one line.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (read-char)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (pulse-momentary-highlight-one-line (point)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (when (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (message "<Press a key> Pulse a region.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (read-char)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (pulse-momentary-highlight-region (point) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (save-excursion |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (condition-case nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (forward-char 30) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (error nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (point))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (when (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (message "<Press a key> Pulse line a specific color.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (read-char)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (pulse-momentary-highlight-one-line (point) 'modeline) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (when (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (message "<Press a key> Pulse a pre-existing overlay.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 (read-char)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (let* ((start (point-at-bol)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (end (save-excursion |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 (end-of-line) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 (when (not (eobp)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (forward-char 1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (point))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (o (pulse-make-overlay start end)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (pulse-momentary-highlight-overlay o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (if (pulse-overlay-live-p o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (pulse-overlay-delete o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (error "Non-temporary overlay was deleted!")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (when (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (message "Done!")))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 ;;; Convenience Functions |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (defvar pulse-momentary-overlay nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 "The current pulsing overlay.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (defun pulse-momentary-highlight-overlay (o &optional face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 "Pulse the overlay O, unhighlighting before next command. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 Optional argument FACE specifies the fact to do the highlighting." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 (pulse-overlay-put o 'original-face (pulse-overlay-get o 'face)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (add-to-list 'pulse-momentary-overlay o) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 (if (or (not pulse-flag) (not (pulse-available-p))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;; Provide a face... clear on next command |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 (progn |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 (pulse-overlay-put o 'face (or face 'pulse-highlight-start-face)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 (add-hook 'pre-command-hook |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 'pulse-momentary-unhighlight) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 ;; pulse it. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (unwind-protect |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (progn |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (pulse-overlay-put o 'face 'pulse-highlight-face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 ;; The pulse function puts FACE onto 'pulse-highlight-face. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 ;; Thus above we put our face on the overlay, but pulse |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 ;; with a reference face needed for the color. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (pulse face)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (pulse-momentary-unhighlight)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (defun pulse-momentary-unhighlight () |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 "Unhighlight a line recently highlighted." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 ;; If someone passes in an overlay, then pulse-momentary-overlay |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 ;; will still be nil, and won't need modifying. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 (when pulse-momentary-overlay |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 ;; clear the starting face |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (mapc |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 (lambda (ol) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 (pulse-overlay-put ol 'face (pulse-overlay-get ol 'original-face)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 (pulse-overlay-put ol 'original-face nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 ;; Clear the overlay if it needs deleting. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 (when (pulse-overlay-get ol 'pulse-delete) (pulse-overlay-delete ol))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 pulse-momentary-overlay) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 ;; Clear the variable. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 (setq pulse-momentary-overlay nil)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 ;; Reset the pulsing face. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 (pulse-reset-face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 ;; Remove this hook. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 (remove-hook 'pre-command-hook 'pulse-momentary-unhighlight) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (defun pulse-momentary-highlight-one-line (point &optional face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 "Highlight the line around POINT, unhighlighting before next command. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 Optional argument FACE specifies the face to do the highlighting." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (let ((start (point-at-bol)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 (end (save-excursion |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (end-of-line) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (when (not (eobp)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (forward-char 1)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (pulse-momentary-highlight-region start end face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 )) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (defun pulse-momentary-highlight-region (start end &optional face) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 "Highlight between START and END, unhighlighting before next command. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 Optional argument FACE specifies the fact to do the highlighting." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 (let ((o (pulse-make-overlay start end))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 ;; Mark it for deletion |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 (pulse-overlay-put o 'pulse-delete t) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (pulse-momentary-highlight-overlay o face))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 ;;; Random integration with other tools |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 ;; |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (defvar pulse-command-advice-flag nil |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 "Non-nil means pulse advice is active. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 To active pulse advice, use `pulse-enable-integration-advice'.") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 (defun pulse-toggle-integration-advice (arg) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 "Toggle activation of advised functions that will now pulse. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 Wint no ARG, toggle the pulse advice. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 With a negative ARG, disable pulse advice. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 With a positive ARG, enable pulse advice. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 Currently advised functions include: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 `goto-line' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 `exchange-point-and-mark' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 `find-tag' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 `tags-search' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 `tags-loop-continue' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 `pop-tag-mark' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 `imenu-default-goto-function' |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 Pulsing via `pulse-line-hook-function' has also been added to |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 the following hook: |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 `next-error-hook'" |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 (interactive "P") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 (if (null arg) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 (setq pulse-command-advice-flag (not pulse-command-advice-flag)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 (if (< (prefix-numeric-value arg) 0) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 (setq pulse-command-advice-flag nil) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 (setq pulse-command-advice-flag t) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (if pulse-command-advice-flag |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (message "Pulse advice enabled") |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (message "Pulse advice disabled")) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 ) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (defadvice goto-line (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 "Cause the line that is `goto'd to pulse when the cursor gets there." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 (when (and pulse-command-advice-flag (interactive-p)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (defadvice exchange-point-and-mark (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 "Cause the line that is `goto'd to pulse when the cursor gets there." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (when (and pulse-command-advice-flag (interactive-p) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (> (abs (- (point) (mark))) 400)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (defadvice find-tag (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 "After going to a tag, pulse the line the cursor lands on." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 (when (and pulse-command-advice-flag (interactive-p)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 (defadvice tags-search (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 "After going to a hit, pulse the line the cursor lands on." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
369 (when (and pulse-command-advice-flag (interactive-p)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
370 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
371 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
372 (defadvice tags-loop-continue (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
373 "After going to a hit, pulse the line the cursor lands on." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
374 (when (and pulse-command-advice-flag (interactive-p)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
375 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
376 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
377 (defadvice pop-tag-mark (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
378 "After going to a hit, pulse the line the cursor lands on." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
379 (when (and pulse-command-advice-flag (interactive-p)) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
380 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
381 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
382 (defadvice imenu-default-goto-function (after pulse-advice activate) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
383 "After going to a tag, pulse the line the cursor lands on." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
384 (when pulse-command-advice-flag |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
385 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
386 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
387 (defun pulse-line-hook-function () |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
388 "Function used in hooks to pulse the current line. |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
389 Only pulses the line if `pulse-command-advice-flag' is non-nil." |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
390 (when pulse-command-advice-flag |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
391 (pulse-momentary-highlight-one-line (point)))) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
392 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
393 (add-hook 'next-error-hook 'pulse-line-hook-function) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
394 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
395 (provide 'pulse) |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
396 |
4af663a1c4ab
cedet-cscope.el, cedet-edebug.el, cedet-global.el, cedet-idutils.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
397 ;;; pulse.el ends here |