annotate lisp/modes/outl-mouse.el @ 124:9b50b4588a93 r20-1b15

Import from CVS: tag r20-1b15
author cvs
date Mon, 13 Aug 2007 09:26:39 +0200
parents cca96a509cfe
children f53b5ca2e663
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; outl-mouse.el --- outline mode mouse commands for Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright 1994 (C) Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Keywords: outlines, mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
19 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
21 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; outl-mouse.el v1.3.8:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; Defines button one to hide blocks when clicked on outline-up-arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; and expand blocks when clicked on outline-down-arrow. Features are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; activated when outline-minor-mode or outline-mode are turned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; on. There is also a menu for each glyph on button 3.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; To use put:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; (require 'outl-mouse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; in your .emacs file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; If you use func-menu all the time and want outl-mouse on all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; time as well then put:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; (setq outline-sync-with-func-menu t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; outlining will then be turned on when func-menu is. Note that this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; requires a patch to func-menu 2.16 (in 19.10) to work:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;RCS file: func-menu.el,v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;retrieving revision 1.1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;diff -r1.1 func-menu.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;180a181,183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;> (defvar fume-found-function-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;> "*Hook to call after every function match.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;1137,1138c1140,1142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;< (if (listp funcname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;< (setq funclist (cons funcname funclist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;---
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;> (cond ((listp funcname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;> (setq funclist (cons funcname funclist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;> (save-excursion (run-hooks 'fume-found-function-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; If you want mac-style outlining then set outline-mac-style to t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; If you want the outline arrows on the left then set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; outline-glyphs-on-left to t. If you have xpm then arrows are much
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; better defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; This package uses func-menu to define outline regexps if they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;; not already defined. You should no longer need to use out-xtra.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; You can define the package to do something other than outlining by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; setting outline-fold-in-function and outline-fold-out-function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;; You can define the color of outline arrows, but only in your .emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; Only works in XEmacs 19.10 and onwards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; User definable variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
73 (defgroup outl-mouse nil
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
74 "Outline mouse mode commands for Emacs"
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
75 :prefix "outline-"
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
76 :group 'outlines
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
77 :group 'mouse)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
78
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
79
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
80 (defcustom outline-mac-style nil
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
81 "*If t then outline glyphs will be right and down arrows."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
82 :type 'boolean
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
83 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
85 (defcustom outline-glyphs-on-left nil
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
86 "*The position of outline glyphs on a line."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
87 :type 'boolean
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
88 :group 'outl-mouse)
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
89
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
90 (defcustom outline-glyph-colour "Gray75"
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
91 "*The colour of outlining arrows."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
92 :type 'color
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
93 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
95 (defcustom outline-glyph-shade-colour "Gray40"
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
96 "*The shadow colour of outlining arrows."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
97 :type 'color
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
98 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
100 (defcustom outline-glyph-lit-colour "Gray90"
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
101 "*The lit colour of outlining arrows."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
102 :type 'color
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
103 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defvar outline-fold-in-function 'outline-fold-in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 "Function to call for folding in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 The function should take an annotation argument.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (make-variable-buffer-local 'outline-fold-in-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (defvar outline-fold-out-function 'outline-fold-out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 "Function to call for folding out.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 The function should take an annotation argument.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (make-variable-buffer-local 'outline-fold-out-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
115 (defcustom outline-sync-with-func-menu nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "*If t then outline glyphs are permanently added by func-menu scans.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 If outline-minor-mode is turned off then turing it back on will have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 no effect. Instead the buffer should be rescanned from the function
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
119 menu."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
120 :type 'boolean
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
121 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
123 (defcustom outline-move-point-after-click t
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
124 "*If t then point is moved to the current heading when clicked."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
125 :type 'boolean
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
126 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
128 (defcustom outline-scanning-message "Adding glyphs... (%3d%%)"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 "*Progress message during the scanning of the buffer.
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
130 Set this to nil to inhibit progress messages."
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
131 :type 'string
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 120
diff changeset
132 :group 'outl-mouse)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; No user definable variables beyond this point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;;
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
137
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
138 ;; I'll bet there's a neat way to do this with specifiers -- a pity the
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
139 ;; sucks so badly on it. -sb
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
140 (defconst outline-up-arrow ; XEmacs
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
141 (make-glyph ; an up-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
142 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 static char * arrow[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 \" c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 \". c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 \"X c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 \"o c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 \"O c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 \" .X \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 \" .X \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 \" ..XX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 \" ..XX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 \" ..ooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 \" ..ooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 \" ..ooooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 \" ..ooooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 \"..OOOOOOXX\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
159 \"OOOOOOOOOO\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
160 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
161 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
162 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
163 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
164 (concat "\000\000\000\000\060\000\060\000\150\000"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
165 "\150\000\324\000\324\000\376\001\376\001"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
166 (t "^")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "Bitmap object for outline up glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
169 (defconst outline-up-arrow-mask ; XEmacs
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
170 (make-glyph ; an up-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
171 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 static char * arrow[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 \" c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 \". c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 \"X c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 \"o c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 \"O c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 \" .X \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 \" .X \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 \" ..XX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 \" ..XX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 \" ..ooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 \" ..ooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 \" ..ooooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 \" ..ooooXX \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 \"..OOOOOOXX\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
188 \"OOOOOOOOOO\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
189 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
190 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
191 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
192 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
193 (concat "\000\000\000\000\060\000\060\000\130\000"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
194 "\130\000\254\000\274\000\006\001\376\001"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
195 (t "+")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "Bitmap object for outline depressed up glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
198 (defconst outline-down-arrow ; XEmacs
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
199 (make-glyph ; a down-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
200 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 static char * down[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 \" c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 \". c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 \"X c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 \"o c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 \"O c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 \" \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 \".. XX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 \"o..OOOOXXo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 \"o..OOOOXXo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 \"oo..OOXXoo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 \"oo..OOXXoo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 \"ooo..XXooo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 \"ooo..XXooo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 \"oooo.Xoooo\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
217 \"oooo.Xoooo\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
218 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
219 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
220 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
221 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
222 (concat "\000\000\000\000\376\001\202\001\364\000"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
223 "\324\000\150\000\150\000\060\000\060\000"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
224 (t "v")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 "Bitmap object for outline down glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
227 (defconst outline-down-arrow-mask ; XEmacs
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
228 (make-glyph ; a down-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
229 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 static char * down[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 \" c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 \". c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 \"X c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 \"o c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 \"O c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 \" \",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 \".. XX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 \"o..OOOOXXo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 \"o..OOOOXXo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 \"oo..OOXXoo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 \"oo..OOXXoo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 \"ooo..XXooo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 \"ooo..XXooo\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 \"oooo.Xoooo\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
246 \"oooo.Xoooo\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
247 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
248 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
249 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
250 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
251 (concat "\000\000\000\000\376\001\376\001\254\000"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
252 "\254\000\130\000\130\000\060\000\060\000"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
253 (t "+")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "Bitmap object for outline depressed down glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (defconst outline-right-arrow
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
257 (make-glyph ; a right-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
258 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 static char * right[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 \" c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 \". c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 \"X c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 \"o c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 \"O c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 \" .XXXXXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 \" ...XXXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 \" ....XXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 \" oo....XX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 \" oooo....\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 \" ooooOOOO\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 \" ooOOOOXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 \" OOOOXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 \" OOOXXXXXX\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
275 \" OXXXXXXXX\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
276 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
277 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
278 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
279 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
280 (concat "\000\000\006\000\032\000\142\000\232\001"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
281 "\352\001\172\000\036\000\006\000\000\000"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
282 (t ">")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 "Bitmap object for outline right glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (defconst outline-right-arrow-mask
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
286 (make-glyph ; a right-arrow
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
287 (cond ((featurep 'xpm) (vector 'xpm :data (concat "/* XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 static char * right[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 \"10 10 5 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 \" c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 \". c " outline-glyph-shade-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 \"X c none\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 \"o c " outline-glyph-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 \"O c " outline-glyph-lit-colour "\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 \" .XXXXXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 \" ...XXXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 \" ....XXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 \" oo....XX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 \" oooo....\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 \" ooooOOOO\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 \" ooOOOOXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 \" OOOOXXXX\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 \" OOOXXXXXX\",
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
304 \" OXXXXXXXX\"};")))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
305 ((featurep 'x)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
306 (vector 'xbm
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
307 :data
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
308 (list 10 10
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
309 (concat "\000\000\006\000\036\000\176\000\346\001"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
310 "\236\001\146\000\036\000\006\000\000\000"))))
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 74
diff changeset
311 (t "+")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 "Bitmap object for outline depressed right glyph.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (defvar outline-glyph-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 '("Outline Commands"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ["Hide all" hide-body t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ["Hide all subtrees" hide-subtrees-same-level t]
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
318 ["Hide subtree" hide-subtree t]
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
319 ; ["Hide body" hide-body t]
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 48
diff changeset
320 "---"
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
321 ["Show all" show-all t]
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ["Show subtree" show-subtree t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ["Show body" show-entry t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ["Update buffer" outline-add-glyphs t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ["Rescan buffer" outline-rescan-buffer t])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 "Menu of commands for outline glyphs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (set-pixmap-contributes-to-line-height outline-down-arrow nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (set-pixmap-contributes-to-line-height outline-up-arrow nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (set-pixmap-contributes-to-line-height outline-down-arrow-mask nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (set-pixmap-contributes-to-line-height outline-up-arrow-mask nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (set-pixmap-contributes-to-line-height outline-right-arrow nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (set-pixmap-contributes-to-line-height outline-right-arrow-mask nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (require 'annotations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (require 'advice) ; help me doctor !
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (require 'outline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (require 'func-menu) ; for those most excellent regexps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (add-hook 'outline-mode-hook 'outline-mouse-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (add-hook 'outline-minor-mode-hook 'outline-mouse-hooks)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ;; I thought this was done already ...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (make-variable-buffer-local 'outline-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (make-variable-buffer-local 'outline-level)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (cond (outline-sync-with-func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (add-hook 'fume-found-function-hook 'outline-heading-add-glyph-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (setq-default fume-rescan-buffer-hook '(lambda ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (outline-minor-mode 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (defadvice fume-set-defaults (after fume-set-defaults-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "Advise fume-set-defaults to setup outline regexps."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (if (and (not (assq 'outline-regexp (buffer-local-variables)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 fume-function-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq outline-regexp (if (listp fume-function-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (car fume-function-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 fume-function-name-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (setq outline-level '(lambda () 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (defadvice outline-minor-mode (after outline-mode-mouse activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 "Advise outline-minor-mode to delete glyphs when switched off."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (if (not outline-minor-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (outline-delete-glyphs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (show-all))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 ;; advise all outline commands so that glyphs are synced after use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (defadvice show-all (after show-all-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 "Advise show-all to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (outline-sync-visible-sub-headings-in-region (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (defadvice hide-subtree (after hide-subtree-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 "Advise hide-subtree to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (outline-sync-visible-sub-headings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (defadvice hide-entry (after hide-entry-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 "Advise hide-entry to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (outline-sync-visible-sub-headings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (defadvice hide-body (after hide-body-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Advise hide-body to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (outline-sync-visible-sub-headings-in-region (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (defadvice show-subtree (after show-subtree-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 "Advise show-subtree to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (outline-sync-visible-sub-headings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (defadvice show-entry (after show-entry-ad activate)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 "Advise shown-entry to sync headings."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (outline-sync-visible-sub-headings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (defun outl-mouse-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 "Calls outline-mode, with outl-mouse extensions"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (outline-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (defun outl-mouse-minor-mode (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 "Toggles outline-minor-mode, with outl-mouse extensions"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (outline-minor-mode arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (defun hide-subtrees-same-level ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 "Hide all subtrees below the current level."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (hide-subtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (outline-forward-same-level 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (error nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (defun outline-mouse-hooks ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 "Hook for installing outlining with the mouse."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ;; use function menu regexps if not set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (fume-set-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; only add glyphs when we're not synced.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (if (not outline-sync-with-func-menu) (outline-add-glyphs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 ;; add C-a to local keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (let ((outline (cond ((keymapp (lookup-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 outline-minor-mode-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (lookup-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 outline-minor-mode-prefix))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (define-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 outline-minor-mode-prefix (make-sparse-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (lookup-key (current-local-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 outline-minor-mode-prefix)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (define-key outline "\C-a" 'outline-heading-add-glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (define-key outline-mode-map "\C-c\C-a" 'outline-heading-add-glyph)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (defun outline-add-glyphs ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 "Add annotations and glyphs to all heading lines that don't have them."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (and outline-scanning-message (message outline-scanning-message 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (if (not (outline-on-heading-p)) (outline-next-visible-heading-safe))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (outline-heading-add-glyph-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (and outline-scanning-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (message outline-scanning-message (fume-relative-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (outline-next-visible-heading-safe)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (and outline-scanning-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (message "%s done" (format outline-scanning-message 100)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (defun outline-delete-glyphs ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 "Remove annotations and glyphs from heading lines."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (mapcar 'outline-heading-delete-glyph (annotation-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (defun outline-rescan-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "Remove and insert all annotations."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (outline-delete-glyphs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (outline-add-glyphs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (outline-sync-visible-sub-headings-in-region (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (defun outline-heading-delete-glyph (ext)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "Delete annotation and glyph from a heading with annotation EXT."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (if (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (goto-char (extent-start-position ext))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (outline-on-heading-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (extent-property ext 'outline))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (delete-annotation ext))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (defun outline-heading-add-glyph ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 "Interactive version of outline-heading-add-glyph-1."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (outline-heading-add-glyph-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (defun outline-heading-add-glyph-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 "Add glyph to the end of heading line which point is on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 Returns nil if point is not on a heading or glyph already exists."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (if (or (not (outline-on-heading-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (outline-heading-has-glyph-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (save-excursion (forward-line) (outline-on-heading-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (outline-back-to-heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (let ((anot2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (make-annotation (if outline-mac-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 outline-right-arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 outline-down-arrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (save-excursion (if outline-glyphs-on-left nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (outline-end-of-heading))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 'text nil t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (if outline-mac-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 outline-right-arrow-mask
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 outline-down-arrow-mask)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (anot1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (make-annotation (if outline-mac-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 outline-down-arrow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 outline-up-arrow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (save-excursion (if outline-glyphs-on-left nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (outline-end-of-heading))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 'text nil t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (if outline-mac-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 outline-down-arrow-mask
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 outline-up-arrow-mask))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;; we cunningly make the annotation data point to its twin.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (set-annotation-data anot1 anot2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (set-extent-property anot1 'outline 'up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (set-annotation-action anot1 'outline-up-click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (set-annotation-menu anot1 outline-glyph-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (set-extent-priority anot1 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (set-annotation-data anot2 anot1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (set-extent-property anot2 'outline 'down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (set-annotation-menu anot2 outline-glyph-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (set-annotation-action anot2 'outline-down-click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (annotation-hide anot2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (defun outline-heading-has-glyph-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 "Return t if heading has an outline glyph."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (catch 'found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 '(lambda(a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (if (extent-property a 'outline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (throw 'found t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (annotations-in-region (save-excursion (outline-back-to-heading) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (save-excursion (outline-end-of-heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (+ 1 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (defun outline-sync-visible-sub-headings-in-region (pmin pmax)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "Make sure all anotations on headings in region PMIN PMAX are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 displayed correctly."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (mapcar '(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (goto-char (extent-start-position x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (cond ((and (eq (extent-property x 'outline) 'down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ;; skip things we can't see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (not (eq (preceding-char) ?\^M)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (if (outline-more-to-hide)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;; reveal my twin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (annotation-reveal (annotation-data x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (annotation-hide (annotation-data x)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (if (not (outline-hidden-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ;; hide my self
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (annotation-hide x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (annotation-reveal x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (annotations-in-region pmin pmax (current-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (defun outline-sync-visible-sub-headings ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 "Make sure all anotations on sub-headings below the one point is on are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 displayed correctly."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (outline-sync-visible-sub-headings-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (progn (outline-end-of-subtree) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (defun outline-fold-out (annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 "Fold out the current heading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ; (if (not (equal (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ; (save-excursion (outline-next-visible-heading 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ; (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ; (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ; (save-excursion (outline-next-heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ; (if (eobp) nil (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (if (save-excursion (outline-next-heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (eq (preceding-char) ?\^M))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (save-excursion (show-children))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (outline-sync-visible-sub-headings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; mess with single entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (if (outline-hidden-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (save-excursion (show-entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 ;; reveal my twin and hide me
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (annotation-hide annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (annotation-reveal (annotation-data annotation))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (defun outline-fold-in (annotation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 "Fold in the current heading."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ;; mess with single entries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (if (not (outline-hidden-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (save-excursion (hide-entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (if (not (outline-more-to-hide))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (annotation-hide annotation))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (annotation-reveal (annotation-data annotation)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 ;; otherwise look for more leaves
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (if (outline-more-to-hide t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (hide-subtree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (hide-leaves)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;; sync everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (outline-sync-visible-sub-headings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (defun outline-more-to-hide (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 "Return t if there are more visible sub-headings or text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 With ARG return t only if visible sub-headings have no visible text."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (if (not (outline-hidden-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (if arg nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (and (< (funcall outline-level) (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (outline-next-visible-heading 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (funcall outline-level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (error 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (if (and (not (outline-hidden-p)) arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 nil t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (defun outline-hidden-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 "Return t if point is on the header of a hidden subtree."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (let ((end-of-entry (save-excursion (outline-next-heading))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 ;; Make sure that the end of the entry really exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (if (not end-of-entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (setq end-of-entry (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (outline-back-to-heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;; If there are ANY ^M's, the entry is hidden.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (search-forward "\^M" end-of-entry t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (defun outline-next-visible-heading-safe ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 "Safely go to the next visible heading.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 nil is returned if there is none."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (outline-next-visible-heading 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (error nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (defun outline-up-click (data ev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 "Annotation action for clicking on an up arrow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 DATA is the annotation data. EV is the mouse click event."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (goto-char (extent-end-position (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (funcall outline-fold-in-function (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (if outline-move-point-after-click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (goto-char (extent-end-position (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (beginning-of-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ; This line demonstrates a bug in redisplay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (defun outline-down-click (data ev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 "Annotation action for clicking on a down arrow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 DATA is the annotation data. EV is the mouse click event."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (goto-char (extent-end-position (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (funcall outline-fold-out-function (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (if outline-move-point-after-click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (goto-char (extent-end-position (event-glyph-extent ev)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (beginning-of-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (provide 'outl-mouse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (provide 'outln-18) ; fool auctex - outline is ok now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 ;; Local Variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 ;; outline-regexp: ";;; \\|(def.."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 ;; End:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670