annotate lisp/packages/func-menu.el @ 201:eb5470882647 r20-3b27

Import from CVS: tag r20-3b27
author cvs
date Mon, 13 Aug 2007 10:01:22 +0200
parents 489f57a838ef
children
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 ;;; func-menu.el --- Jump to a function within a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;;
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
3 ;;; David Hughes <d.hughes@videonetworks.com>
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
4 ;;; Last modified: David Hughes 13th January 1997
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
5 ;;; Version: 2.45
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; Keywords: tools, c, lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; it 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 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; but 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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; GNU 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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Installation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; =============
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; (require 'func-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; (define-key global-map 'f8 'function-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; (add-hook 'find-file-hooks 'fume-add-menubar-entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; (define-key global-map "\C-cl" 'fume-list-functions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; (define-key global-map "\C-cg" 'fume-prompt-function-goto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; (define-key global-map '(shift button3) 'mouse-function-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; (define-key global-map '(meta button1) 'fume-mouse-function-goto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; Description:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; ============
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Suppose you have a file with a lot of functions in it. Well, this package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; makes it easy to jump to any of those functions. The names of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; functions in the current buffer are automatically put into a popup menu,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; you select one of the function-names and the point is moved to that very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;; function. The mark is pushed on the mark-ring, so you can easily go back
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; to where you were. Alternatively, you can use enter the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; desired function via the minibuffer which offers completing read input. In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;; addition, the name of the function before point is optionally displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; the modeline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
46 ;;; Support for non X Window versions of Emacs:
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
47 ;;; ===========================================
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; This package can also be used for non X versions of Emacs. In this case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;;; only modeline display and completing read input from the minibuffer are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;; possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;;; Modes supported:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;; ================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;; Ada, Assembly, Bacis2, BibTex, C++, C, Dired, Ehdm, ELisp, FORTRAN, Ksh,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; Latex, Lelisp, Makefile, Maple, Modula2, Modula3, Outline, Pascal, Perl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; Postscript, Prolog, PVS, Python, SGML, Scheme, Tcl, Verilog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; Acknowledgements:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;;; =================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
61 ;;; Fix to fume-function-name-regexp-c
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
62 ;;; Jonathan Edwards <edwards@intranet.com>
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
63 ;;;
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
64 ;;; Speedup for fume-cc-inside-comment
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
65 ;;; Peter Pezaris <pez@dwwc.com>
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
66 ;;;
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
67 ;;; Made menu placement more flexible
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
68 ;;; Bob Weiner <weiner@altrasoft.com>
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
69 ;;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;;; Fortran90 regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; John Turner <turner@xdiv.lanl.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;; Patch to error trap in fume-rescan-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;;; Andy Piper <andyp@parallax.co.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;;; Java support
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
77 ;;; Bob Weiner <weiner@altrasoft.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ;;; Heddy Boubaker <boubaker@dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;; Patch for fume-rescan-buffer{-trigger}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;;; Christoph Wedler <wedler@vivaldi.fmi.uni-passau.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;; Patch for fume-tickle-f-to-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;;; Michael Sperber <sperber@informatik.uni-tuebingen.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;; Cleanup suggestions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;;; Jonathan Stigelman <stig@hackvan.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ;;; Idea for jumping directly with a mouse click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ;;; Marc Paquette <Marc.Paquette@Softimage.COM>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; Prolog mode additions based on functions for Postscript mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;; Laszlo Teleki <laszlo@ipb.uni-bonn.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;; Idea for displaying function name in modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;;; Paul Filipski <filipski@blackhawk.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;;; Fame mode support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ;;; Cooper Vertz <cooper@prod2.imsi.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ;;; Made fume-match-find-next-function-name iterative, not recursive, to avoid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ;;; blowing out the emacs stack on big files with lots of prototypes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ;;; Joe Marshall <jrm@odi.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;;; Verilog support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;;; Matt Sale <mdsale@icdc.delcoelect.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;;; Minibuffer interface & Pascal support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ;;; Espen Skoglund <espensk@stud.cs.uit.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;;; Python support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;;; Shuichi Koga <skoga@virginia.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;; Maple support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;; Luc Tancredi <Luc.Tancredi@sophia.inria.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;;; Combined Tcl and C++ function finder
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;;; Perl Support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;;; Alex Rezinsky <alexr@msil.sps.mot.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;;; Michael Lamoureux <lamour@engin.umich.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;;; Suggested mouse interface
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;;; Raymond L. Toy <toy@soho.crd.ge.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;; Dired support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ;;; Improved modula support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;;; Numerous code cleanups
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;;; Norbert Kiesel <norbert@i3.informatik.rwth-aachen.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;;; Makefile support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;;; Suggested multi-choice sublisting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ;;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ;;; Suggestions for menubar entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;;; Ada support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;; Scott Evans <gse@ocsystems.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;;; Michael Polo <mikep@polo.mn.org> <mikep@cfsmo.honeywell.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;;; Scheme, BibTeX, Ehdm & PVS support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;;; Modula support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;; Geoffrey Wyant <gwyant@cloyd.east.sun.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;; SGML support; submenu indexing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;; Thomas Plass <thomas.plass@mid-heidelberg.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;;; Extensions to fume-function-name-regexp-lisp
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
153 ;;; Vladimir Alexiev <vladimir@cs.ualberta.ca>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;;; Kari Heinola <kph@dpe.fi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;;; Milo A. Chan <chan@jpmorgan.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;;; Jack Repenning <jackr@step7.informix.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;;; Cedric Beust <Cedric.Beust@sophia.inria.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;;; Joachim Krumnow <krumnow@srsir02.ext.sap-ag.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;;; ksh support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;;; Philippe Bondono <bondono@vnet.ibm.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;;; FORTRAN support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;;; Paul Emsley <paule@chem.gla.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;;; Raymond L. Toy <toy@soho.crd.ge.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;;; Richard Cognot <cognot@elfgrc.co.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;; Greg Sjaardema <gdsjaar@sandia.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;;; Latex support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;;; Wolfgang Mettbach <wolle@uni-paderborn.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;; Assembly support
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
176 ;;; Bob Weiner <weiner@altrasoft.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;;; Removal of cl dependencies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;;; Russell Ritchie <russell@gssec.bt.co.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;;; C++ mode enhancemencements for func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;;; Mats Lidell <mats.lidell@eua.ericsson.se>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;;; Mike Battaglia <mbattagl@spd.dsccc.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;;; Oliver Schittko <schittko@fokus.gmd.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;;; Tom Murray <tmurray@hpindck.cup.hp.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;;; Russell Ritchie <russell@gssec.bt.co.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;;; Tcl mode additions for func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;;; Jean-Michel Augusto <augusto@eurecom.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;;; Dr P.G. Sjoerdsma <pgs1002@esc.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 ;;; Postscript mode additions for func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;;; Leigh Klotz <klotz@adoc.xerox.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;;; Suggestions for popup menu positioning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;; Marc Gemis <makke@wins.uia.ac.be>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;;; Original FSF package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;;; Ake Stenhoff <etxaksf@aom.ericsson.se>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;;; Code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (byte-compiler-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (optimize t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (warnings (- free-vars unresolved))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ;;;;;;;;;;;;;;;;;;;;;;;; Environment Initialisation ;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
215 (defconst fume-version "2.45")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
217 (defgroup fume nil
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
218 "Jump to a function within a buffer."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
219 :tag "Func Menu"
189
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 181
diff changeset
220 :group 'tools
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 181
diff changeset
221 :group 'c
489f57a838ef Import from CVS: tag r20-3b21
cvs
parents: 181
diff changeset
222 :group 'lisp)
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
223
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
224 (defconst fume-developer "David Hughes <d.hughes@videonetworks.com>")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (defun fume-about ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (sit-for 0)
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
229 (display-message 'no-log
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
230 (format "Func-Menu version %s, © 1996 %s" fume-version fume-developer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (defconst fume-running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (defmacro fume-defvar-local (var value &optional doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 "Defines SYMBOL as an advertised variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 Performs a defvar, then executes `make-variable-buffer-local' on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 the variable. Also sets the `permanent-local' property, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 `kill-all-local-variables' (called by major-mode setting commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 won't destroy func-menu control variables."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (` (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (if (, doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (defvar (, var) (, value) (, doc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (defvar (, var) (, value)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (make-variable-buffer-local '(, var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (put '(, var) 'permanent-local t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ;;;;;;;; Backward compatibility hacks for older versions of XEmacs ;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (or (fboundp 'defalias)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; poor man's defalias
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defun defalias (sym newdef)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "Set SYMBOL's function definition to NEWVAL, and return NEWVAL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 Associates the function with the current load file, if any."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (fset sym (symbol-function newdef))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (or (fboundp 'selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (defalias 'selected-frame 'selected-screen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (if (fboundp 'locate-window-from-coordinates)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; Older versions of XEmacs need a more robust version of 'event-window'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (defun fume-event-window (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (or (event-window event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (locate-window-from-coordinates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (selected-frame) (list (event-x event) (event-y event)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (locate-window-from-coordinates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (selected-frame) (list (event-x event) (1- (event-y event))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; In post 19.11 versions of XEmacs 'event-window' now works acceptably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (defalias 'fume-event-window 'event-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (or (fboundp 'shrink-window-if-larger-than-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;; Win-Emacs doesn't have this goodie
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defun shrink-window-if-larger-than-buffer (&optional window reqd-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "Shrink WINDOW to the smallest no of lines needed to display its buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 or to optional REQUIRED-HEIGHT if and only if that is larger. Does nothing if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 the buffer contains more lines than the present window height."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (let* ((OriginalWindow (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (TargetWindow (select-window (or window OriginalWindow))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (or (one-window-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (and reqd-height (>= reqd-height (window-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (< (window-height) (1+ (count-lines (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (let ((calc-reqd-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (if truncate-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (1+ (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (let ((count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 linew
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (windw (window-width)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq linew (1+ (progn (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (current-column)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 count (+ count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (/ linew windw)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (min (% linew windw) 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (beginning-of-line 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 count)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (setq reqd-height (1+ (max calc-reqd-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (1- window-min-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (or reqd-height 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (if (> (window-height) reqd-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let* (wc spare bonus share wins shrunkwins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (walk-windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 '(lambda (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (if (or (eq w TargetWindow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (> (1+ (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (1- (window-height w))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (setq wins (cons w wins))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (if (= (1+ (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (1- (window-height w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (setq shrunkwins (cons w shrunkwins)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 'nomini)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (setq wc (1- (length wins))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 spare (- (window-height TargetWindow) reqd-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 share (if (> wc 0) (/ spare wc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 bonus (if (> wc 0) (% spare wc))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 shrunkwins (if (zerop wc) nil shrunkwins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 wins (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (lambda (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (cons w (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (if (eq w TargetWindow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 reqd-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (+ (window-height w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 share
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (if (zerop bonus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (setq bonus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (1- bonus))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (window-start w)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 wins))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (let (ok (trys 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (while (and (not ok) (> trys 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (setq trys (1- trys))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (lambda (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (select-window (car info))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (enlarge-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (- (car (cdr info)) (window-height)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 wins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (setq ok t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (lambda (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (setq ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (and ok
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (<= (abs (- (car (cdr info))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (window-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (car info))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 wins)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (lambda (info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (select-window (car info))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (if (eq (car info) TargetWindow)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (shrink-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (- (window-height TargetWindow) reqd-height)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (set-window-start (car info) (car (cdr (cdr info))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 wins)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (lambda (w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (if (< (1+ (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (1- (window-height w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (shrink-window-if-larger-than-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 shrunkwins)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (select-window OriginalWindow))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (defconst fume-modeline-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (if (boundp 'modeline-buffer-identification)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 'modeline-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 'mode-line-buffer-identification))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (defconst fume-use-local-post-command-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (boundp 'local-post-command-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (cond ((fboundp 'add-submenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (defconst fume-add-submenu 'add-submenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (defun fume-munge-menu-args (menu-name submenu before)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
386 (list fume-menu-path (cons menu-name submenu) before)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (defconst fume-add-submenu 'add-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (defun fume-munge-menu-args (menu-name submenu before)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
390 (list fume-menu-path menu-name submenu before))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (defun fume-add-submenu (menu-name submenu before)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (apply fume-add-submenu (fume-munge-menu-args menu-name submenu before)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 102
diff changeset
395 ;; this seems to really be `should I try to change the menubar'
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (defconst fume-not-tty
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 102
diff changeset
397 (or (featurep 'menubar) ;; XEmacs
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 102
diff changeset
398 (featurep 'menu-bar))) ;; GNU Emacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;;;;;;;;;;;;;;;;;;;;;;;;;; Customizable Variables ;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
404 (defcustom fume-auto-position-popup t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 "*Set to nil if you don't want the menu to appear in the corner of the window
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
406 in which case it will track the mouse position instead."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
407 :type 'boolean
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
408 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (fume-defvar-local fume-display-in-modeline-p t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 "*Set to nil if you don't want the function name appearing in the modeline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 If your modeline is already full, then you can set this variable to something
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 besides nil or t and the current function will replace the normal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 modeline-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 Note, this is a buffer-local variable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (defvar fume-buffer-name "*Function List*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 "Name of buffer used to list functions when fume-list-functions called")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
421 (defcustom fume-menubar-menu-name "Functions"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
422 "*Set this to the string you want to appear in the menubar"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
423 :type 'string
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
424 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
426 ;;; Bob Weiner <weiner@altrasoft.com>
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
427 (defvar fume-menu-path nil
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
428 "Menubar menu under which the function menu should be installed.
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
429 Nil means install it on the menubar itself. Otherwise, it should be a list
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
430 of strings, each string names a successively deeper menu under which the
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
431 new menu should be located.")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
432
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
433 (defcustom fume-menubar-menu-location "Buffers"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "*Set this nil if you want the menu to appear last on the menubar.
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
435 Otherwise set this to the menu you want \"Functions\" to appear in front of."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
436 :type '(choice (const :tag "Last" nil) (string :format "%v"))
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
437 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
439 (defcustom fume-max-items 24
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
440 "*Maximum number of elements in a function (sub)menu."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
441 :type 'integer
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
442 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
444 (defcustom fume-fn-window-position 3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "*Number of lines from top of window at which to show function.
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
446 If nil, display function start from the centre of the window."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
447 :type '(choice (const :tag "Center" nil) integer)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
448 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
450 (defcustom fume-index-method 3
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 "*Set this to the method number you want used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 Methods currently supported:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 0 = if you want submenu names to be numbered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 1 = if you want submenu range indicated by first character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 2 = if you want submenu range indicated by first 12 characters
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
457 3 = if you want submenu range indicated by as many characters as needed"
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
458 :type '(radio (const :tag "Numbered" 0)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
459 (const :tag "Indicated by first character" 1)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
460 (const :tag "Indicated by first 12 characters" 2)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
461 (const :tag "Indicated by as many characters as needed" 3))
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
462 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
464 (defcustom fume-scanning-message "Scanning buffer... (%3d%%)"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 "*Set to nil if you don't want progress messages during manual scanning
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
466 of the buffer."
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
467 :type '(choice (const :tag "None" nil) string)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
468 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
470 (defcustom fume-rescanning-message nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 "*Set to non-nil if you want progress messages during automatic scanning
134
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
472 of the buffer. For example \"Re-Scanning buffer...\""
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
473 :type '(choice (const :tag "None" nil) string)
34a5b81f86ba Import from CVS: tag r20-2b1
cvs
parents: 116
diff changeset
474 :group 'fume)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (defvar fume-rescan-trigger-counter-buffer-size 10000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 "Used to tune the frequency of automatic checks on the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 The function fume-rescan-buffer-trigger only works whenever the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 variable fume-rescan-trigger-counter reaches zero, whereupon it gets reset to
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
480 the maximum of a) buffer-size/fume-rescan-trigger-counter-buffer-size
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
481 or b) fume-rescan-trigger-counter-min")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
482
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
483 (defvar fume-rescan-trigger-counter-min 50
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
484 "Used to tune the frequency of automatic checks on the buffer.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
485 The function fume-rescan-buffer-trigger only works whenever the value of the
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
486 variable fume-rescan-trigger-counter reaches zero, whereupon it gets reset to
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
487 the maximum of a) buffer-size/fume-rescan-trigger-counter-buffer-size
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
488 or b) fume-rescan-trigger-counter-min")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 fume-sort-function 'fume-sort-by-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 "*The function to use for sorting the function menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 Set this to nil if you don't want any sorting (faster).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 The items in the menu are then presented in the order they were found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 The function should take two arguments and return T if the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 element should come before the second. The arguments are cons cells;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (NAME . POSITION). Look at 'fume-sort-by-name' for an example.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 fume-rescan-buffer-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 "*Buffer local hook to call at the end of each buffer rescan")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;;; This hook is provided for outl-mouse and must not be made buffer local as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ;;; this appears to break outl-mouse for some reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (defvar fume-found-function-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 "*Hook to call after every function match.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ;;; Idea for jumping directly with a mouse click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;;; Marc Paquette <Marc.Paquette@Softimage.COM>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defvar fume-no-prompt-on-valid-default nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 "*Set non-nil if 'fume-prompt-function-goto' should jump without prompting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 when a valid default exists.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 ;;;;;;;;;;;;;;;;;;;;;;;;;; Buffer local variables ;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 fume-auto-rescan-buffer-p t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 "Buffer local variable which if non-nil permits automatic buffer rescanning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 by func-menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 Usage:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 By default, fume-auto-rescan-buffer-p is set to non-nil. If you feel that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 a given mode 'foo' is becoming too slow as a result of automatic rescanning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 by func-menu, then do something along the lines of the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (defun remove-func-menu-auto-rescan ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (setq fume-auto-rescan-buffer-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (add-hook 'foo-mode-hook 'remove-func-menu-auto-rescan)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 fume-funclist nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "The latest list of function names in the buffer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 fume-function-name-regexp nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 "The keywords to show in a menu")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 fume-find-next-function-name-method nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 "The function to use to find the next function name in the buffer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 fume-modeline-funclist nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 "The latest list of function names in the buffer to display in the modeline")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 fume-funclist-dirty-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 "Flags whether the buffer is in need of a fresh scan")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 fume-rescan-inhibit-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 "Internal variable only. DO NOT TOUCH.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (fume-defvar-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 fume-rescan-trigger-counter 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 "Used in large buffers to optimise checking frequency")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ;;;;;;;;;;;;;;;;;;;;; Mode specific regexp's and hooks ;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ;;; Every fume-function-name-regexp-<language> should uniquely identify a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;;; function for that certain language.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;;; Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
575 ;;; Vladimir Alexiev <vladimir@cs.ualberta.ca>
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 100
diff changeset
576 ;;; JTL: 24. Feb. 97 added "/" as part of function names
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (defvar fume-function-name-regexp-lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (concat
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
579 "^[ \t]*" ; Allow whitespace |(or (fboundp 'foo)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
580 ; for the construct | (defun foo ()
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
581 "(\\(def[^vc][a-z]*\\)" ; Allow (def* except (defvar, (defconst
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
582 "\\s-+" ; At least one whitespace
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 100
diff changeset
583 "'?[#:?/A-Za-z0-9_+>-]+" ; Allow (defalias 'foo 'bar)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
584 "\\s-*" ; Whitespace
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
585 "\\(nil\\|(\\)" ; nil or (arg list
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 "Expression to get lisp function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;;; C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;;; Danny Bar-Dov <danny@acet02.amil.co.il>
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
592 ;;; Bob Weiner <weiner@altrasoft.com> added #define macro support.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (defvar fume-function-name-regexp-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (concat
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
595 "^\\([a-zA-Z0-9]+\\|#define\\)\\s-?" ; type specs; there can be no
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
596 "\\([a-zA-Z0-9_*]+\\s-+\\)?" ; more than 3 tokens, right?
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 "\\([a-zA-Z0-9_*]+\\s-+\\)?"
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
598 "\\([*&]+\\s-*\\)?" ; pointer
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
599 "\\([a-zA-Z0-9_*]+\\)[ \t\n]*(" ; name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 "Expression to get C function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ;;; C++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ;;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ;;; Mats Lidell <mats.lidell@eua.ericsson.se>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;;; Mike Battaglia <mbattagl@spd.dsccc.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;;; Oliver Schittko <schittko@fokus.gmd.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;;; Tom Murray <tmurray@hpindck.cup.hp.com>
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
611 ;;; Bob Weiner <weiner@altrasoft.com> added #define macro support.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (defvar fume-function-name-regexp-c++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (concat
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
615 "^\\(#define\\s-+\\|"
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
616 "\\(template\\s-+<[^>]+>\\s-+\\)?" ; template formals
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 "\\([a-zA-Z0-9_*&<,>:]+\\s-+\\)?" ; type specs; there can be no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 "\\([a-zA-Z0-9_*&<,>\"]+\\s-+\\)?" ; more than 3 tokens, right?
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
619 "\\([a-zA-Z0-9_*&<,>]+\\s-+\\)?\\)"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 "\\(\\([a-zA-Z0-9_&~:<,>*]\\|\\(\\s +::\\s +\\)\\)+\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 "\\(o?perator\\s *.[^(]*\\)?\\(\\s-\\|\n\\)*(" ; name
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
622 ) 6)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 "Expression to get C++ function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;;; FORTRAN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;;; Paul Emsley <paule@chem.gla.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;;; Raymond L. Toy <toy@soho.crd.ge.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;;; Richard Cognot <cognot@elfgrc.co.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;;; Greg Sjaardema <gdsjaar@sandia.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (defvar fume-function-name-regexp-fortran
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 ;; >= six spaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 "^ \\s-*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;; type specs
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 171
diff changeset
636 "[a-zA-Z0-9*]*\\s-*"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 ;; continuation lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 "\\(\n [^ 0]\\s-*\\)*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 ;; function or subroutine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 "\\(entry\\|ENTRY\\|function\\|FUNCTION\\|subroutine\\|SUBROUTINE\\)\\s-*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ;; continuation lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 "\\(\n [^ 0]\\s-*\\)*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 "Expression to get Fortran 77 function and subroutine names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ;;; John Turner <turner@xdiv.lanl.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (defvar fume-function-name-regexp-fortran90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 ;; type specs
181
bfd6434d15b3 Import from CVS: tag r20-3b17
cvs
parents: 171
diff changeset
650 "[a-zA-Z0-9*]*\\s-*"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 ;; function or subroutine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 "\\(entry\\|ENTRY\\|function\\|FUNCTION\\|module\\|MODULE\\|subroutine\\|SUBROUTINE\\)\\s-*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 "Expression to get Fortran 90 function, module and subroutine names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 ;;; Modula
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (defvar fume-function-name-regexp-modula
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 "^\\s-*PROCEDURE\\s-+[A-Za-z0-9_-]+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 "Expression to get Modula function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 ;;; Bacis2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 ;;; CV MEDUSA's 4th generation language
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (defvar fume-function-name-regexp-bacis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 "module_define(!\\|define_constant(!\\|sys_sysdefine(!\\|<<dbgid +\\s-*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 "Expression to get Bacis2 function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 ;;; Maple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;;; Luc Tancredi <Luc.Tancredi@sophia.inria.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (defvar fume-function-name-regexp-maple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 "^[ \t]*[a-zA-Z0-9_]+[ \t]*:=[ \t]*proc[ \t]*("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 "Expression to get maple function/procedure names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 ;;; Tcl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;;; Andy Piper <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;;; Jean-Michel Augusto <augusto@eureecom.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 ;;; Dr P.G. Sjoerdsma <pgs1002@esc.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (defvar fume-function-name-regexp-tcl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (cons "^\\s *proc\\s +\\(\\S-+\\)\\s *{" 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 "Expression to get Tcl function Names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;;; Java
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;;; Heddy Boubaker <boubaker@dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (defvar fume-function-name-regexp-java
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 "\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)[\n \t\r]*\\((\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 "Expression to get Java methods names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;;; Perl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ;;; Alex Rezinsky <alexr@msil.sps.mot.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;;; Michael Lamoureux <lamour@engin.umich.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (defvar fume-function-name-regexp-perl "^sub[ \t]+\\([A-Za-z0-9_]+\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 "Expression to get Perl function Names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;;; Python support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ;;; Shuichi Koga <skoga@virginia.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (defvar fume-function-name-regexp-python
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 "^\\s-*\\(class\\|def\\)+\\s-*\\([A-Za-z0-9_]+\\)\\s-*[(:]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 "Expression to get Python class and function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 ;;; Postscript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;;; Leigh L. Klotz <klotz@adoc.xerox.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 (defvar fume-function-name-regexp-postscript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 "^/[^][ \t{}<>]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 "Expression to get postscript function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 ;;; Prolog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 ;;; Laszlo Teleki <laszlo@ipb.uni-bonn.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (defvar fume-function-name-regexp-prolog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 "^[a-z][a-zA-Z0-9_]+"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 "Expression to get prolog fact and clause names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 ;;; Ehdm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (defvar fume-function-name-regexp-ehdm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 "[A-Za-z0-9_]*:[ ]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 "\\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 "[Ll][Ee][Mm][Mm][Aa]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 "[Aa][Xx][Ii][Oo][Mm]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 "[Pp][Rr][Oo][Vv][Ee]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 "[Tt][Hh][Ee][Oo][Rr][Ee][Mm]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 "\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 "*Expression to get Ehdm function, theorems, axioms, lemmas, and proofs.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 ;;; PVS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 (defvar fume-function-name-regexp-pvs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 "\\([A-Za-z0-9_]*:[ ]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 "\\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 "[Ll][Ee][Mm][Mm][Aa]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 "[Aa][Xx][Ii][Oo][Mm]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 "[Tt][Hh][Ee][Oo][Rr][Ee][Mm]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 "[Ff][Or][Rr][Mm][Uu][La][Aa]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 "\\[.*\\]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 "\\)\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 "[A-Za-z0-9_]*(.*)[ ]*:"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 "*Expression to get PVS functions, theorems, axioms, lemmas")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 ;;; Tex, LaTex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (fume-defvar-local fume-tex-chapter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 (fume-defvar-local fume-tex-section 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (fume-defvar-local fume-tex-subsection 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (fume-defvar-local fume-tex-subsubsection 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 (defun fume-tex-rescan-buffer-hook ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (setq fume-tex-chapter 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 fume-tex-section 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 fume-tex-subsection 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 fume-tex-subsubsection 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 (defun fume-tweak-tex-mode ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (setq fume-sort-function nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (add-hook 'fume-rescan-buffer-hook 'fume-tex-rescan-buffer-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (add-hook 'tex-mode-hook 'fume-tweak-tex-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 (add-hook 'TeX-mode-hook 'fume-tweak-tex-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 ;;; Wolfgang Mettbach <wolle@uni-paderborn.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (add-hook 'latex-mode-hook 'fume-tweak-tex-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (add-hook 'LaTeX-mode-hook 'fume-tweak-tex-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 (defvar fume-section-name-regexp-latex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 "^\\s-*\\\\\\("
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 "\\(sub\\)*section\\|chapter\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 "\\*?\\(\\[[^]]*\\]\\)?{\\([^}]*\\)}"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 "Expression to get latex section names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 ;;; ksh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 ;;; Philippe Bondono <bondono@vnet.ibm.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (defvar fume-function-name-regexp-ksh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 "\\(^\\s-*function\\s-+[A-Za-z_][A-Za-z_0-9]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 "\\(^\\s-*[A-Za-z_][A-Za-z_0-9]*\\s-*()\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 "Expression to get ksh function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 ;;; Scheme
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (defvar fume-function-name-regexp-scheme
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 "^(define [ ]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 "Expression to get Scheme function names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 ;;; BibTeX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (defvar fume-function-name-regexp-bibtex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 ;; "^@[A-Za-z]*[({]\\([A-Za-z0-9:;&-]*\\),"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 ;; Christoph Wedler <wedler@fmi.uni-passau.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 ;; According to the LaTeX Companion, this should be
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 110
diff changeset
811 "^@[A-Za-z]*[({]\\([A-Za-z][^ \t\n\"#%'(),={}]*\\),"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 "Expression to get bibtex citation headers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 ;;; SGML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 ;;; Thomas Plass <thomas.plass@mid-heidelberg.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (defvar fume-function-name-regexp-sgml
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 "Expression to find declaration of SGML element or entity")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 ;;; Ada
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 ;;; Michael Polo <mikep@polo.mn.org> <mikep@cfsmo.honeywell.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 (defvar fume-function-name-regexp-ada
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (cons "^[ \t]*\\(procedure\\|PROCEDURE\\|function\\|FUNCTION\\)[ \n\t]+\\([a-zA-Z0-9_]+\\|\"[^\"]\"\\)" 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 "Expression to find declaration of Ada function")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 ;;; ignore prototypes, 'renames', 'is new' to eliminate clutter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ;;; Scott Evans <gse@ocsystems.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 (defvar fume-function-name-regexp-ada-ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 "[ \n\t]*\\(([^()]+)[ \n\t]*\\)?\\(return[ \t\n]+[^ \t\n;]+[ \n\t]*\\)?\\(;\\|is[ \n\t]+new[ \n\t]\\|renames\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 "ignore if ada function name matches this string")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 ;;; Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ;;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 (defvar fume-function-name-regexp-make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 "^\\(\\(\\$\\s(\\)?\\(\\w\\|\\.\\)+\\(:sh\\)?\\(\\s)\\)?\\)\\s *\\(::?\\|\\+?=\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 "Expression to get makefile target names")
171
929b76928fce Import from CVS: tag r20-3b12
cvs
parents: 151
diff changeset
841 ;;(add-hook 'makefile-mode-hook 'fume-add-menubar-entry)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 ;;; Directory Listings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 ;;; Norbert Kiesel <norbert@i3.informatik.rwth-aachen.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 ;;; regexp stolen from font-lock-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 (defvar fume-function-name-regexp-dired
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 "^. +d.*\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\) +[0-9]+ +[0-9:]+ \\(.*\\)$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 "Expression to get directory names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 ;;; Pascal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 ;;; Espen Skoglund <espensk@stud.cs.uit.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 (defvar fume-function-name-regexp-pascal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 "^\\(function\\|procedure\\)[ \t]+\\([_a-zA-Z][_a-zA-Z0-9]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 "Expression to get function/procedure names in pascal.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 ;;; Fame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 ;;; Cooper Vertz <cooper@prod2.imsi.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (defvar fume-function-name-regexp-fame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 "^\\(function\\|procedure\\)[ \t]+\\([#\\$%_a-zA-Z][#\\$%_a-zA-Z0-9]*\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 "Expression to get function/procedure names in fame.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 ;;; Verilog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 ;;; Matt Sale <mdsale@icdc.delcoelect.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (defvar fume-function-name-regexp-verilog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 "^\\(task\\|function\\|module\\|primitive\\)[ \t]+\\([A-Za-z0-9_+-]*\\)[ \t]*(?"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 "Expression to get verilog module names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
874 ;;; Idl
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
875 ;;;
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
876 ;;; Lubos Pochman <lubos@rsinc.com>
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
877 (defvar fume-function-name-regexp-idl
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
878 (cons "^\\s *\\([pP][rR][oO]\\|[fF][uU][nN][cC][tT][iI][oO][nN]\\)\\s +\\([A-Za-z][A-Za-z0-9_$]*\\)" 2)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
879 "Expression to get Idl function Names")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 ;;; Assembly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (defvar fume-function-name-regexp-asm
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 "^\\([a-zA-Z_.$][a-zA-Z0-9_.$]*\\)[ \t]*:"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 "Expression to get assembly label names")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 ;;; This is where the mode specific regexp's are hooked in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (defvar fume-function-name-regexp-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 '(;; Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (emacs-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 (common-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 (fi:common-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 (fi:emacs-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (fi:franz-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (fi:inferior-common-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (fi:inferior-franz-lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (fi:lisp-listener-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 (lisp-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (lisp-interaction-mode . fume-function-name-regexp-lisp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 ;; C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 (c-mode . fume-function-name-regexp-c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 (elec-c-mode . fume-function-name-regexp-c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (c++-c-mode . fume-function-name-regexp-c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 ;; C++
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 (c++-mode . fume-function-name-regexp-c++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 ;; Fortran
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 (fortran-mode . fume-function-name-regexp-fortran)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 (f90-mode . fume-function-name-regexp-fortran90)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; Modula
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 (modula-2-mode . fume-function-name-regexp-modula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (modula-3-mode . fume-function-name-regexp-modula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 ;; Bacis2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (bacis-mode . fume-function-name-regexp-bacis)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 ;; Maple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (maple-mode . fume-function-name-regexp-maple)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;; Perl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 (perl-mode . fume-function-name-regexp-perl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 ;; Java
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (java-mode . fume-function-name-regexp-java)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ;; Python
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (alice-mode . fume-function-name-regexp-python)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 (python-mode . fume-function-name-regexp-python)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ;; Postscript
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (postscript-mode . fume-function-name-regexp-postscript)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;; Prolog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 (prolog-mode . fume-function-name-regexp-prolog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;; Tcl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 (tcl-mode . fume-function-name-regexp-tcl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 ;; ksh
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (ksh-mode . fume-function-name-regexp-ksh)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;; LaTeX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 (latex-mode . fume-section-name-regexp-latex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 (LaTeX-mode . fume-section-name-regexp-latex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 ;; Scheme
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 (scheme-mode . fume-function-name-regexp-scheme)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 ;; BibTeX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (bibtex-mode . fume-function-name-regexp-bibtex)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;; Ehdm & PVS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (ehdm-mode . fume-function-name-regexp-ehdm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 (pvs-mode . fume-function-name-regexp-pvs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ;; SGML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (sgml-mode . fume-function-name-regexp-sgml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 ;; Ada
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (ada-mode . fume-function-name-regexp-ada)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 ;; Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 (makefile-mode . fume-function-name-regexp-make)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 ;; Dired
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (dired-mode . fume-function-name-regexp-dired)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ;; Pascal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (pascal-mode . fume-function-name-regexp-pascal)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 ;; Fame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (fame-mode . fume-function-name-regexp-fame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 ;; Verilog
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (verilog-mode . fume-function-name-regexp-verilog)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
980 ;; Idl
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
981 (idl-mode . fume-function-name-regexp-idl)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
982
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 ;; Assembly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (asm-mode . fume-function-name-regexp-asm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 "The connection between a mode and the regexp that matches function names.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 ;;;;;;;;;;;;;;;;;;;;; Mode specific finding functions ;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 ;;; Default routine : Note, most modes will need a specialised routine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 (defun fume-find-next-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 "Searches for the next function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (let ((char (progn
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1001 (if (string-match
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1002 "[({[]"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1003 (char-to-string (char-after (1- (point)))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1004 (backward-char)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1005 (forward-word -1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (goto-char (scan-sexps (point) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 (skip-chars-forward "[ \t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (following-char)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 ;; Skip this function name if it is a prototype declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (if (and (eq char ?\;) (not (eq major-mode 'emacs-lisp-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (fume-find-next-function-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 ;; Get the function name and position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (let (beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (forward-sexp -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (cons (buffer-substring beg (point)) beg))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 ;;; General purpose sexp find function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (defun fume-find-next-sexp (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 "Searches for the next sexp type function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (let ((beg (save-excursion (forward-sexp -1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (cons (buffer-substring beg (point)) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 ;;; Specialised routine to get the next ehdm entity in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (defun fume-find-next-ehdm-entity (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 (let ((beg (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 (end (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 ;;; Specialised routine to get the next PVS entity in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (defun fume-find-next-pvs-entity (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (let ((beg (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (end (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (goto-char (1- end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (if (looking-at ":")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (setq end (1- end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 ;;; Specialised routine to get the next C function name in the buffer.
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1053 ;;; Modified 16/12/96: Jerome Bertorelle <bertorel@telspace.alcatel.fr>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (defun fume-find-next-c-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 "Searches for the next C function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 (let ((char (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (backward-up-list 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (goto-char (scan-sexps (point) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (skip-chars-forward "[ \t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 (following-char)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 ;; Skip this function name if it is a prototype declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (if (eq char ?\;)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1068 (fume-find-next-c-function-name buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (let (beg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 ;; Get the function name and position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (forward-sexp -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 (setq name (buffer-substring beg (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 ;; ghastly crock for DEFUN declarations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 (cond ((string-match "^DEFUN\\s-*" name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (forward-word 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (forward-word -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (cond ((re-search-forward "\"," nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (re-search-backward "\"," nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (setq name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (format "%s %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (buffer-substring beg (point))))))))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1087 ;; kludge to avoid 'void' etc in menu
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1088 (if (string-match "^void$\\|^if$\\|^switch$\\|^while$" name)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1089 (fume-find-next-c-function-name buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (cons name beg)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1092 ;;; Peter Pezaris <pez@dwwc.com>
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1093 ;;;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (defun fume-cc-inside-comment ()
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1095 (memq (buffer-syntactic-context) '(comment block-comment)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 ;;; <jrm@odi.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 ;;; <ajp@eng.cam.ac.uk>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 ;;; <schittko@fokus.gmd.de>
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
1100 ;;; <d.hughes@videonetworks.com> - speedup, David Hughes 24th November 1996
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (defun fume-match-find-next-function-name (buffer)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1103 ;; General next function name in BUFFER finder using match.
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1104 ;; The regexp is assumed to be a two item list the car of which is the regexp
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1105 ;; to use, and the cdr of which is the match position of the function name
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (set-buffer buffer)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1107 (let ((r (car fume-function-name-regexp))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1108 (p (cdr fume-function-name-regexp)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1109 (catch 'found
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1110 (while (re-search-forward r nil t)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1111 (catch 'skip
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1112 (if (fume-cc-inside-comment) (throw 'skip t))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1113 (save-excursion
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1114 (re-search-backward r nil t)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1115 (if (string= "typedef" (fume-what-looking-at)) (throw 'skip t))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1116 (re-search-forward r nil t))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1117 (backward-up-list 1)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1118 (save-excursion
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1119 (goto-char (scan-sexps (point) 1))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1120 (if (eq ?\; (following-char)) (throw 'skip t))) ; skip prototypes
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1121 (throw
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1122 'found
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1123 (cons (buffer-substring (setq p (match-beginning p)) (point)) p))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1124 nil)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 ;;; Specialised routine to find the next Perl function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (defun fume-find-next-perl-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 "Searches for the next Perl function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (fume-find-next-sexp buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 ;;; Specialised routine to find the next Java function
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
1133 ;;; Bob Weiner <weiner@altrasoft.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 ;;; Heddy Boubaker <boubaker@dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (defun fume-find-next-java-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 "Searches for the next Java function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 (let ((beg (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (end (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 (goto-char (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 (if (and (looking-at "[^;(]*{")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (not (fume-cc-inside-comment)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1146 ;; This is a method definition and we're not in a comment
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 (let ((str (buffer-substring beg end)))
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
1148 ;; Bob Weiner <weiner@altrasoft.com> added exact match
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1149 ;; delimiters so function names that happen to contain
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1150 ;; any of these terms are not eliminated. The old version
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1151 ;; would ignore "notify()" since it contained "if".
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1152 (or (string-match "\\`\\(if\\|switch\\|catch\\|for\\|while\\)\\'"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1153 str)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1154 ;; These constructs look like method definitions but are not
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (cons str beg)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 (fume-find-next-java-function-name buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 ;;; Specialised routine to find the next Python function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 ;;; Shuichi Koga <skoga@virginia.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 (defun fume-find-next-python-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 "Searches for the next python function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (let* ((retpnt (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 (retname (buffer-substring retpnt (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (goto-char (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 (cond ((looking-at "\\s-+def")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 "^class\\s-*\\([A-Za-z0-9_]+\\)\\s-*[(:]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (setq retname
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 retname))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (cons retname retpnt)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 ;;; Specialised routine to find the next Modula function or subroutine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (defun fume-find-next-modula-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 "Searches for the next modula function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 (fume-find-next-sexp buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 ;;; Specialised routine to find the next directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 ;;; Norbert Kiesel <norbert@i3.informatik.rwth-aachen.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 (defun fume-find-next-directory-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 "Searches for the next directory in dired BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 (let ((beg (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 (end (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 ;;; Specialised routine to find the next Fortran function or subroutine
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 (defun fume-find-next-fortran-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 "Searches for the next Fortran function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 (let ((pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 ;; name may have "_" but must start with a letter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (name-regexp "\\s-+[a-zA-Z]+[_a-zA-Z0-9*]*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 (eol (save-excursion (end-of-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 (skip-chars-backward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 (if (re-search-forward name-regexp eol t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 ;; name is ok; so return it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 (cons (buffer-substring pos (point)) pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 ;; rubbish found; skip to next function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (fume-find-next-fortran-function-name buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 ;;; Specialised routine to get the next postscript function name in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 ;;; Leigh L. Klotz <klotz@adoc.xerox.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (defun fume-find-next-postscript-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 "Searches for the next postscript function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 (let ((beg (progn (beginning-of-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 ;; keep including sexps as long as they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 ;; start with / or [.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 (if (looking-at "\\s-+\\(/\\|\\[\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (forward-sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 (cons (buffer-substring beg (point)) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 ;;; Specialised routine to get the next prolog fact/clause name in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 ;;; Laszlo Teleki <laszlo@ipb.uni-bonn.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 (defun fume-find-next-prolog-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 "Searches for the next prolog fact or clause in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 (let ((beg (progn (beginning-of-line 1) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 (cons (buffer-substring beg (point)) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 ;;; Specialised routine to get the next bacis2 procedure name in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (defun fume-find-next-bacis-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 "Searches for the next Bacis2 function in BUFFER"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (let ((pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (name (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 (symbol-function (intern "focus-get-function-name")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 (error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (if (null name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 (fume-find-next-bacis-function-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 ;; jump past possible function dbgid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 (format "<<dbgid +\\s-*%s%s" name "\\s-*>>") nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 (cons name pos)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 ;;; Specialized routine to get the next Maple function name in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 ;;; Luc Tancredi <Luc.Tancredi@sophia.inria.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 (defun fume-find-next-maple-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 "Searches for the next maple function in BUFFER"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 (let ((beg (progn (backward-up-list 1) (forward-sexp -2) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (forward-sexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (cons (buffer-substring beg (point)) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 ;;; Specialised routine to get the next latex section name in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 ;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (defun fume-find-next-latex-section-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 "Searches for the next latex section in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (let* ((secname (buffer-substring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (beg (match-beginning 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (name (buffer-substring beg (match-end 4))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (cond ((string= secname "chapter")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 (setq fume-tex-chapter (1+ fume-tex-chapter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 fume-tex-section 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 fume-tex-subsection 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 fume-tex-subsubsection 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 name (concat fume-tex-chapter " " (upcase name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 ((string= secname "section")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (setq fume-tex-section (1+ fume-tex-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 name (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (if (> fume-tex-chapter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (concat fume-tex-chapter ".") "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 fume-tex-section " " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 fume-tex-subsection 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 fume-tex-subsubsection 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 ((string= secname "subsection")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 (setq fume-tex-subsection (1+ fume-tex-subsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 name (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 (if (> fume-tex-chapter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (concat fume-tex-chapter ".") "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 fume-tex-section "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 fume-tex-subsection " " name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 fume-tex-subsubsection 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 ((string= secname "subsubsection")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (setq fume-tex-subsubsection (1+ fume-tex-subsubsection)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 name (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 (if (> fume-tex-chapter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 (concat fume-tex-chapter ".") "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 fume-tex-section "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 fume-tex-subsection "."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 fume-tex-subsubsection " " name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 ((string= secname "subsubsection")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 (setq name (concat " " name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (cons name beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 ;;; Specialised routine to get the next ksh function in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 ;;; Philippe Bondono <bondono@vnet.ibm.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (defun fume-find-next-ksh-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 "Searches for the ksh type function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (let (name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (beg (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (cond ((re-search-backward "\\(^\\|\\s-\\)function\\s-" beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 "\\(function\\s-+\\)\\([A-Za-z_][A-Za-z_0-9]*\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 (setq beg (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 name (buffer-substring beg (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 "\\(^\\|\\s-\\)\\([A-Za-z_][A-Za-z_0-9]*\\)" beg t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 (setq beg (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 name (buffer-substring beg (match-end 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 (if (null name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (fume-find-next-ksh-function-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (cons name beg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 ;;; Specialised routine to get the next Scheme function in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 (defun fume-find-next-scheme-function (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 "Searches for the next Scheme function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 (let ((beg (progn (if (looking-at "(") (forward-char 1)) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 (end (save-excursion (forward-sexp) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 ;;; Specialised routine to get the next BibTeX citation in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 (defun fume-find-next-bibtex-citation (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 "Searches for the next BibTeX citation in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 (let ((beg (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 (end (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 ;;; Specialised routine to get the next SGML declaration in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 ;;; Thomas Plass <thomas.plass@mid-heidelberg.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (defun fume-find-next-sgml-element-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 "Searches for the next SGML declaration in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (let ((type (buffer-substring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 (beg (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (name (buffer-substring (match-beginning 2) (match-end 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (if (string= (downcase type) "element")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (setq name (format "%-17s%3s" name "EL"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (setq name (format "%-17s%3s" name "ENT")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (cons name beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 ;;; Specialised routine to get the next ada function in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 ;;; Michael Polo <mikep@polo.mn.org> <mikep@cfsmo.honeywell.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (defun fume-find-next-ada-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 "Searches for the next ada function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (if (re-search-forward (car fume-function-name-regexp-ada) nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (let ((beg (match-beginning (cdr fume-function-name-regexp-ada)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 (end (match-end (cdr fume-function-name-regexp-ada))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 (if (looking-at fume-function-name-regexp-ada-ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (fume-find-next-ada-function-name buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 (cons (buffer-substring beg end) beg)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 ;;; Makefiles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 ;;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 (defun fume-find-next-function-name-make (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 "Searches for the next make item in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 (let ((beg (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 (end (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 ;;; Find next pascal function in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 ;;; Espen Skoglund <espensk@stud.cs.uit.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (defun fume-find-next-pascal-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 "Searches for the next pascal procedure in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (let ((beg (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 (end (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 ;;; Verilog support
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 ;;; Matt Sale <mdsale@icdc.delcoelect.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (defun fume-find-next-verilog-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 "Searches for the next verilog module in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 (let ((beg (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 (end (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (cons (buffer-substring beg end) beg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1424 ;;; Specialised routine to get the next idl function in the buffer
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1425 ;;;
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1426 ;;; Lubos Pochman <lubos@rsinc.com>
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1427 (defun fume-find-next-idl-function-name (buffer)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1428 "Searches for the next idl function in BUFFER."
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1429 (set-buffer buffer)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1430 (if (re-search-forward (car fume-function-name-regexp-idl) nil t)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1431 (let ((beg (match-beginning (cdr fume-function-name-regexp-idl)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1432 (end (match-end (cdr fume-function-name-regexp-idl))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1433 (cons (buffer-substring beg end) beg))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1434
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1435
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ;;; Assembly
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
1437 ;;; Bob Weiner <weiner@altrasoft.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (defun fume-find-next-asm-function-name (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 "Searches for the next assembler function in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 ;; Search for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (if (re-search-forward fume-function-name-regexp nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 (cons (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (match-beginning 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 ;;; This is where you can hook in other languages which may need a different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 ;;; method to scan for function names. Otherwise, the default defun used is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 ;;; fume-find-next-function-name which is suitable for sexp-based languages
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 ;;; such as C, C++ and elisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 (defconst fume-find-function-name-method-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 '((ada-mode . fume-find-next-ada-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 (alice-mode . fume-find-next-python-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 (asm-mode . fume-find-next-asm-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 (bacis-mode . fume-find-next-bacis-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 (bibtex-mode . fume-find-next-bibtex-citation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 (c++-mode . fume-match-find-next-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 (c-mode . fume-find-next-c-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (dired-mode . fume-find-next-directory-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 (ehdm-mode . fume-find-next-ehdm-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 (fame-mode . fume-find-next-pascal-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 (fortran-mode . fume-find-next-fortran-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (f90-mode . fume-find-next-fortran-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (ksh-mode . fume-find-next-ksh-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 (latex-mode . fume-find-next-latex-section-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (LaTeX-mode . fume-find-next-latex-section-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (makefile-mode . fume-find-next-function-name-make)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 (maple-mode . fume-find-next-maple-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (modula-2-mode . fume-find-next-modula-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 (modula-3-mode . fume-find-next-modula-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 (pascal-mode . fume-find-next-pascal-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 (perl-mode . fume-find-next-perl-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (java-mode . fume-find-next-java-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 (postscript-mode . fume-find-next-postscript-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (prolog-mode . fume-find-next-prolog-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 (pvs-mode . fume-find-next-pvs-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 (python-mode . fume-find-next-python-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (scheme-mode . fume-find-next-scheme-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 (sgml-mode . fume-find-next-sgml-element-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 (tcl-mode . fume-match-find-next-function-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (verilog-mode . fume-find-next-verilog-function-name)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1483 (idl-mode . fume-find-next-idl-function-name)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 "The connection between a mode and the defun that finds function names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 If no connection is in this alist for a given mode, a default method is used")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 ;;;;;;;;;;;;;;;;;;;;;;;; General utility functions ;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1493 ;;; modeline refresh routine
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1495 (or (fboundp 'redraw-modeline)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1496 (defun redraw-modeline () (set-buffer-modified-p (buffer-modified-p))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ;;; Smart mouse positioning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 (if (fboundp 'window-edges) ; old method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 (defun fume-set-mouse-position ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (set-mouse-position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 (selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (nth 0 (window-edges)) (nth 1 (window-edges))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 (defun fume-set-mouse-position () ; new method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (set-mouse-position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 (selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (nth 0 (window-pixel-edges))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 (nth 1 (window-pixel-edges)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 ;;; Sets 'fume-function-name-regexp' to something appropriate for the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 ;;; mode for this buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 (defun fume-set-defaults ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 "Returns nil if unsuccessful in setting up buffer-local defaults.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 Otherwise returns fume-function-name-regexp"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 (setq fume-function-name-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (symbol-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 (cdr-safe (assoc major-mode fume-function-name-regexp-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (if fume-function-name-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 (setq fume-find-next-function-name-method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (or (cdr-safe (assoc major-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 fume-find-function-name-method-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 'fume-find-next-function-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 fume-function-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 ;;; Routines to add/remove/update function menu from menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1529 (defun fume-add-menubar-entry ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 (save-window-excursion (function-menu t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1533 (defun fume-remove-menubar-entry ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 (cond ((and fume-running-xemacs current-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (delete-menu-item (list fume-menubar-menu-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 ;; force update of the menubar
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1538 (redraw-modeline))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1540 (defun fume-update-menubar-entry ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 "Returns t if menubar was updated. Nil otherwise"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (and fume-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 fume-not-tty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (assoc fume-menubar-menu-name current-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 (fume-add-menubar-entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1548 (defun fume-trim-string (string)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 "Returns STRING with leading and trailing whitespace removed."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (if (string-match "^[ \t]*" (setq string (format "%s" string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (setq string (substring string (match-end 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (if (string-match "[ \t]*$" string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (setq string (substring string 0 (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 (defvar fume-syntax-table nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1558 (defun fume-what-looking-at (&optional check-primary-selection-p)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1559 (or (and check-primary-selection-p
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1560 primary-selection-extent
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1561 (condition-case ()
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1562 (prog1 (buffer-substring (region-beginning) (region-end))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1563 (and zmacs-regions (zmacs-deactivate-region) (sit-for 0)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1564 (error nil)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1565 (let (name
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1566 (orig-syntax-table (copy-syntax-table (syntax-table))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1567 (if fume-syntax-table
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1568 ()
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1569 (setq fume-syntax-table (copy-syntax-table))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1570 (modify-syntax-entry ?: "w" fume-syntax-table))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1571 (unwind-protect
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1572 (progn
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1573 (set-syntax-table fume-syntax-table)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1574 (save-excursion
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1575 (while (looking-at "\\sw\\|\\s_") (forward-char 1))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1576 (if (re-search-backward "\\sw\\|\\s_" nil t)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1577 (let ((beg (progn (forward-char 1) (point))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1578 (forward-sexp -1)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1579 (while (looking-at "\\s'") (forward-char 1))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1580 (setq name (buffer-substring beg (point)))))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1581 (set-syntax-table orig-syntax-table)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1582 name))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1584 ;;; Find function name that point is in
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1585 ;;; (trick is to start from the end)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1587 (defun fume-function-before-point ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 (if (or fume-modeline-funclist (fume-rescan-buffer) fume-modeline-funclist)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1589 (let ((p (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (catch 'found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 (mapcar (function
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1593 (lambda (x)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1594 (goto-char (cdr x))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 (beginning-of-line 1)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1596 (if (>= p (point)) (throw 'found (car x)))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1597 fume-modeline-funclist) nil)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 ;;; Routines to add a buffer local post command hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1601 (defun fume-post-command-hook-p (hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 (memq hook (if fume-use-local-post-command-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 local-post-command-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 post-command-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1606 (defun fume-add-post-command-hook (hook &optional append)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 (or (fume-post-command-hook-p hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (cond (fume-use-local-post-command-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 (add-hook 'local-post-command-hook hook append))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 ((fboundp 'make-local-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 (make-local-hook 'post-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (add-hook 'post-command-hook hook append t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 ;; NOT make-variable-buffer-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (make-local-variable 'post-command-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 (add-hook 'post-command-hook hook append)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1618 (defun fume-remove-post-command-hook (hook)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (and (fume-post-command-hook-p hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 (cond (fume-use-local-post-command-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 (remove-hook 'local-post-command-hook hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 ((fboundp 'make-local-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 (remove-hook 'post-command-hook hook t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 (remove-hook 'post-command-hook hook)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 ;;; Routine to install the modeline feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1629 (defun fume-maybe-install-modeline-feature ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 (cond ((and fume-display-in-modeline-p (fume-set-defaults))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 (or fume-modeline-funclist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 (fume-post-command-hook-p 'fume-tickle-modeline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 (fume-rescan-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 (fume-add-post-command-hook 'fume-tickle-modeline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 (fume-remove-post-command-hook 'fume-maybe-install-modeline-feature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 (fume-tickle-modeline-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (fume-tickle-modeline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 t ; return success flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (defun fume-toggle-modeline-display ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 "Toggles whether func-menu displays function names in the modeline"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 (setq fume-display-in-modeline-p (not fume-display-in-modeline-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 (if (interactive-p) (fume-tickle-modeline)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 ;;; Routine to display function before point in the modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (defun fume-tickle-modeline ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (let ((fname (and fume-display-in-modeline-p (fume-function-before-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 (set fume-modeline-buffer-identification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 (cond ((and fume-display-in-modeline-p (not (null fname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 (setq fname (format "`%s'" (fume-trim-string fname)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 (if (eq fume-display-in-modeline-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 (list fume-modeline-buffer-identification-1 " " fname)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 fname))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 fume-modeline-buffer-identification-0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 (cond ((not fume-display-in-modeline-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 (fume-remove-post-command-hook 'fume-tickle-modeline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 (fume-add-post-command-hook 'fume-maybe-install-modeline-feature)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1662 ;; force update of the modeline
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1663 (redraw-modeline))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (fume-defvar-local fume-modeline-buffer-identification-0 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 "Storage for original modeline-buffer-identification")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 (fume-defvar-local fume-modeline-buffer-identification-1 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 "Storage for munged modeline-buffer-identification")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 (defun fume-tickle-f-to-b (str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 ;; Change modeline format of "XEmacs: %f" to "XEmacs: %b" in order to make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 ;; extra room for the function name which is going to be appended to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 ;; modeline-buffer-identification component of the modeline-format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 (cond ((consp str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 (if (extentp (car str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 (cons (car str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 (fume-tickle-f-to-b (cdr str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 (mapcar (function fume-tickle-f-to-b) str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 ((not (stringp str))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 ((string-match "%[0-9]*f" str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 (let ((newstr (copy-sequence str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (aset newstr (1- (match-end 0)) (string-to-char "b"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 newstr))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (t str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (defun fume-tickle-modeline-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (or fume-modeline-buffer-identification-0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (setq fume-modeline-buffer-identification-0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (symbol-value fume-modeline-buffer-identification)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 (setq fume-modeline-buffer-identification-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 (fume-tickle-f-to-b fume-modeline-buffer-identification-0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 ;;; Routine to toggle auto recanning of the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 (defun fume-toggle-auto-rescanning ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 (message "Func-Menu buffer auto-rescanning turned %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 (if (setq fume-auto-rescan-buffer-p (not fume-auto-rescan-buffer-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 "ON" "OFF"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (sit-for 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 ;;; Routine to create a shallow separate copy of a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (if (fboundp 'copy-tree) ; not built-in in all emacsen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (defalias 'fume-shallow-copy-list 'copy-tree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 (defun fume-shallow-copy-list (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 (mapcar (function (lambda (i) (cons (car i) (cdr i)))) list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 ;;; Sort function to sort items depending on their function-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 ;;; An item looks like (NAME . POSITION).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1713 (defun fume-sort-by-name (item1 item2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (or (string-lessp (car item1) (car item2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 (string-equal (car item1) (car item2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 ;;; Sort function to sort items depending on their position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1719 (defun fume-sort-by-position (item1 item2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 (<= (cdr item1) (cdr item2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 ;;; Support function to calculate relative position in buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1724 (defun fume-relative-position ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 (let ((pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (total (buffer-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 (if (> total 50000)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 ;; Avoid overflow from multiplying by 100!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 (/ (1- pos) (max (/ total 100) 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (/ (* 100 (1- pos))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (max total 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 ;;; Split LIST into sublists of max length N
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 ;;; Example (fume-split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1736 (defun fume-split (list n)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (let ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 sublist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 (remain list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 (while remain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (if (= n (setq sublist (cons (car remain) sublist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 remain (cdr remain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 ;; We have finished a sublist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (setq result (cons (nreverse sublist) result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 sublist nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 i 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 ;; There might be a sublist (if the length of LIST mod n is != 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 ;; that has to be added to the result list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 (if sublist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 (setq result (cons (nreverse sublist) result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 (nreverse result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 ;;; Routines to create indexes for submenus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 ;;; Method 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 (defun fume-index-sublist-method-0 (sublist count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 (concat "Function sublist #" count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 ;;; Method 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 ;;; Thomas Plass <thomas.plass@mid-heidelberg.de>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 (defun fume-index-sublist-method-1 (sublist &rest count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 (let ((s (substring (car (car sublist)) 0 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 (e (substring (car (nth (1- (length sublist)) sublist)) 0 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 (format "Function sublist (%s%s)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 s (if (string-equal s e) "<>" (format "<>-%s<>" e)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 ;;; Method 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 ;;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 (defun fume-index-sublist-method-2 (sublist &rest count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 (let ((s (substring (car (car sublist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 (min (length (car (car sublist))) 12)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (e (substring (car (nth (1- (length sublist)) sublist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (min (length (car (nth (1- (length sublist)) sublist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 12))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (format "%s%s" s (if (string-equal s e) "<>" (format "<> ... %s<>" e)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 ;;; Method 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (defun fume-index-sublist-method-3-1 (sublist ix limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (let ((s1 (substring (car (car sublist)) 0 (min limit ix)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (s2 (substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (car (nth (1- (length sublist)) sublist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 0 (min (length (car (nth (1- (length sublist)) sublist))) ix))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 (cons s1 s2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 (defun fume-index-sublist-method-3 (sublist &rest count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 (let* ((cmplength 12)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 (limit (length (car (car sublist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (result (fume-index-sublist-method-3-1 sublist cmplength limit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (str1 (car result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 (str2 (cdr result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 (while (and (string-equal str1 str2) (< cmplength limit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 (setq cmplength (1+ cmplength)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 result (fume-index-sublist-method-3-1 sublist cmplength limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 str1 (car result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 str2 (cdr result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 (cond ((not (string-equal str1 str2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 (format "%s<> ... %s<>" str1 str2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 ((< cmplength limit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 (format "%s<>" str1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 (format "%s ..." str1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 ;;; Buffer rescanning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 (defun fume-rescan-buffer-trigger ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 "Automatically spots when a buffer rescan becomes necessary"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 (if fume-auto-rescan-buffer-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (if (> fume-rescan-trigger-counter 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 (setq fume-rescan-trigger-counter (1- fume-rescan-trigger-counter))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 (setq fume-rescan-trigger-counter
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
1821 (max fume-rescan-trigger-counter-min
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 82
diff changeset
1822 (/ (buffer-size) fume-rescan-trigger-counter-buffer-size)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 (if (or fume-funclist-dirty-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 (let (find fnam)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (and fume-function-name-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 (setq fnam (fume-function-before-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (setq find (symbol-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 'fume-find-next-function-name-method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 (progn (end-of-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 fume-function-name-regexp nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (if (eq find 'fume-find-next-latex-section-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (let ((lnam
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 (car (fume-find-next-latex-section-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (fume-tex-rescan-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (not (string-equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 (substring fnam
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (string-match " " fnam))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (substring lnam
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (string-match " " lnam)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (not (string-equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 fnam
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (car (funcall find (current-buffer)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (error nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 (let ((fume-scanning-message nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 (fume-rescan-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1851 (defun fume-install-rescan-buffer-trigger ()
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (cond ((not (fume-post-command-hook-p 'fume-rescan-buffer-trigger))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 (fume-add-post-command-hook 'fume-rescan-buffer-trigger 'append)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 ;; Make narrow-to-region tickle func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 (or (fboundp 'fume-narrow-to-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 (fset 'fume-narrow-to-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (symbol-function 'narrow-to-region)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 (defun narrow-to-region (b e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 "Restrict editing in this buffer to the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 The rest of the text becomes temporarily invisible and untouchable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 but is not deleted; if you save the buffer in a file, the invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 text is included in the file. C-x n w makes all visible again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 See also `save-restriction'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 When calling from a program, pass two arguments; positions (integers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 or markers) bounding the text that should remain visible"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 (fume-narrow-to-region b e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 (if fume-funclist (setq fume-funclist-dirty-p t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 ;; Make widen tickle func-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 (or (fboundp 'fume-widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (fset 'fume-widen (symbol-function 'widen)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 (defun widen ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 "Remove restrictions (narrowing) from current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 This allows the buffer's full text to be seen and edited."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 (fume-widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 (if fume-funclist (setq fume-funclist-dirty-p t))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 (defun fume-rescan-buffer (&optional popmenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 "Rescans the buffer for function names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 If optional arg POPMENU is non-nil, brings up the function-menu."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 (let ((find (symbol-value 'fume-find-next-function-name-method))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 (fnam)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 (flst '())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 (buffer-to-scan (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 (cond (fume-scanning-message
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
1891 (display-message 'progress (format fume-scanning-message 0)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 (fume-rescanning-message
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
1893 (display-message 'progress fume-rescanning-message)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 (while (setq fnam
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 (funcall find buffer-to-scan)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 ;; test for more possible fns after this error trap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 (if (consp fume-function-name-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 (car fume-function-name-regexp) nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 (and fume-function-name-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 fume-function-name-regexp nil t)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (cond ((listp fnam)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 (setq flst (cons fnam flst))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 (if fume-found-function-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 (save-excursion (run-hooks 'fume-found-function-hook)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 (if fume-scanning-message
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
1912 (display-message 'progress (format fume-scanning-message (fume-relative-position)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 (cond (fume-scanning-message
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
1914 (display-message 'progress (format "%s done" (format fume-scanning-message 100))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 (fume-rescanning-message
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
1916 (display-message 'progress (format "%s done" fume-rescanning-message))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 ;; make a copy of flst sorted by position in buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 (setq fume-modeline-funclist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 (nreverse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 (sort (fume-shallow-copy-list flst) 'fume-sort-by-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 (if fume-sort-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 (setq fume-funclist (sort flst fume-sort-function))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 (setq fume-funclist (nreverse flst)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 (if fume-rescan-buffer-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 (run-hooks 'fume-rescan-buffer-hook))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 (if popmenu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 (function-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 (let ((fume-rescan-inhibit-p t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 (fume-update-menubar-entry)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 ;; Reset dirty flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 (setq fume-funclist-dirty-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1933 (defun fume-scan-buffer ()
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1934 (or fume-funclist (progn (fume-set-defaults) (fume-rescan-buffer))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1935
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 ;;; Routine to position cursor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (defun fume-goto-function (fn pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 "Position cursor at function FN at location POS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (let ((orig-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 (case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 (match-fn (cond ((string-match "DEFUN " fn) ; Emacs DEFUN declaration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (substring fn (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 ((string-match "^[ \t]*" fn) ; strip leading spaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 (substring fn (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 fn))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (goto-char pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 (or (looking-at match-fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 (let ((fume-scanning-message nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 (fume-rescan-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 (setq pos (cdr-safe (assoc fn fume-funclist))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 (if pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 (goto-char pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 ;; possibly set mark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 (or (= orig-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 (push-mark orig-pos (null fume-scanning-message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 (if (numberp fume-fn-window-position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 (set-window-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 (beginning-of-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 (- 1 (min (- (window-height) 2) fume-fn-window-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (recenter)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 (ding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 (message "%s not found" fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (function-menu))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 ;;;;;;;;;;;;;;;;;; The main entry points for this package ;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 ;;; Interface to function-menu for mouse bindings only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 (defun mouse-function-menu (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 "Wrapper for mouse button bindings for function-menu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 (let ((currwin (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 (select-window (fume-event-window event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 (let ((fume-auto-position-popup nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 (call-interactively 'function-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 (error (select-window currwin)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 ;;; Interface for Key bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 ;;;
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1993 (defun function-menu (&optional use-menubar return-only)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 "Pop up a menu of functions for selection with the mouse.
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1995 Jumps to the selected function. A mark is set at the old position,
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1996 so you can easily go back with C-u \\[set-mark-command].
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 With a prefix arg adds the menu to the current menubar.
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
1999 Optional second argument, RETURN-ONLY if non-nil simply returns
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2000 the basic menu of functions."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 (setq use-menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 (and use-menubar fume-running-xemacs fume-not-tty current-menubar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 (catch 'no-functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 (or (fume-set-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 (if (not (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 (throw 'no-functions t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 (error "func-menu does not support the mode \"%s\"" mode-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 ;; Create a list for this buffer only if there isn't any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 (or fume-funclist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 (if fume-rescan-inhibit-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 (fume-remove-menubar-entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (fume-rescan-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 (or fume-funclist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 (if (not (interactive-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (throw 'no-functions t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 (error "No functions found in this buffer.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 ;; Rescan buffer trigger
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 (fume-install-rescan-buffer-trigger)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 ;; Function name in modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 (fume-maybe-install-modeline-feature)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 ;; The rest of this routine works only for (Lucid) XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 (cond (fume-running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 ;; Create the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 (let* ((count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 (index-method
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (intern (format "fume-index-sublist-method-%d"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 fume-index-method)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 function-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 (function-menu-items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 (lambda (sublist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 (setq count (1+ count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 (cons (format "%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 (funcall index-method sublist count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (lambda (menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 (vector (format "%s" (car menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 (list 'fume-goto-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 (car menu) (cdr menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 sublist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 (fume-split fume-funclist fume-max-items))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 (or (> count 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 (setq function-menu-items (cdr (car function-menu-items))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2056 (if return-only
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2057 nil
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2058 (setq function-menu
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2059 (` ((,@ function-menu-items)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2060 "----"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2061 ["Display full list of functions"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2062 fume-list-functions t]
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2063 [(, (concat "Rescan buffer : " (buffer-name)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2064 (fume-rescan-buffer (, (null use-menubar))) t]
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2065 "----"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2066 ["Toggle modeline display"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2067 fume-toggle-modeline-display t]
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2068 ["Toggle buffer auto rescanning"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2069 fume-toggle-auto-rescanning t]
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2070 ["About Func-Menu" fume-about t])))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2072 (cond (use-menubar
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2073 (fume-remove-menubar-entry)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2074 (set-buffer-menubar (copy-sequence current-menubar))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2075 (fume-add-submenu
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2076 fume-menubar-menu-name
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2077 (` ((,@ function-menu)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2078 "----"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2079 ["Remove Function Menu from menubar"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2080 fume-remove-menubar-entry t]))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2081 fume-menubar-menu-location))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2083 ((and fume-not-tty ; trap tty segmentation faults...
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2084 (not (popup-up-p)))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2085 (or (fume-update-menubar-entry)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2086 (setq function-menu
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2087 (cons
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2088 ["Put Function Menu into menubar"
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2089 (function-menu t) t]
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2090 (cons "----" function-menu))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2092 (if fume-auto-position-popup
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2093 (fume-set-mouse-position))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2095 (popup-menu
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2096 (cons fume-menubar-menu-name function-menu)))))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2097
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2098 ;; Return basic function menu for display by another function
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2099 function-menu-items)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 (defun fume-mouse-function-goto (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 "Goto function clicked on or prompt in minibuffer (with completion)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 (interactive "@e")
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2104 (let ((orig-pos (point)))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2105 (goto-char (event-point event))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2106 (let ((fume-no-prompt-on-valid-default t))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2107 (fume-prompt-function-goto))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2108 (or (= orig-pos (point))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2109 (push-mark orig-pos (null fume-scanning-message)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 ;;;;;;;;;;;;;;;; Keyboard access to func-menu for tty users ;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 ;;; Internal variables only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 (defvar fume-list-srcbuffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 (defvar fume-list-reused-win-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 (defvar fume-list-trampled-buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 ;;; Espen Skoglund <espensk@stud.cs.uit.no>
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 134
diff changeset
2122 ;;; David Hughes <d.hughes@videonetworks.com>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 (defun fume-prompt-function-goto (&optional other-window-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 "Goto function prompted for in minibuffer (with completion).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 With prefix arg, jumps to function in a different window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 (interactive "P")
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2128 (let* ((default-name (fume-what-looking-at t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 (OrigBuffer (current-buffer))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2130 (flistMode (eq major-mode 'fume-list-mode))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2131 (no-prompt (or flistMode fume-no-prompt-on-valid-default))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2132 (TargetBuffer (if flistMode fume-list-srcbuffer OrigBuffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 (switch-to-buffer TargetBuffer)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2134 (fume-scan-buffer) ;; Create funclist and set defaults if required
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 (let* (;; verify default-name is a valid function name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 (default-exists-p (assoc default-name fume-funclist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 ;; Prompt for function name in minibuffer, unless there is a valid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 ;; function name at point & fume-no-prompt-on-valid-default set to t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 (function-name
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2140 (if (and default-exists-p no-prompt)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 ""
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2142 (let ((this-command last-command)) ; preserve last-command
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2143 (completing-read
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2144 (format "Goto function%s%s: "
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2145 (if other-window-p " other window" "")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2146 (if default-exists-p
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2147 (concat " (" default-name ")")
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2148 ""))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2149 fume-funclist nil t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 ;; Use default function name if just RET was pressed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 (function-name (if (and default-exists-p (string= "" function-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 default-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 function-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 (switch-to-buffer OrigBuffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 ;; Goto function or just return if function name is empty string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 (cond ((not (string= "" function-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 (if other-window-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 (cond ((prog1 (one-window-p)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2159 (if (not (windowp other-window-p))
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2160 (switch-to-buffer-other-window TargetBuffer)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2161 (select-window other-window-p)
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2162 (switch-to-buffer TargetBuffer)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 (other-window 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 (shrink-window-if-larger-than-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 (other-window 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 (switch-to-buffer TargetBuffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 (fume-goto-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 function-name (cdr (assoc function-name fume-funclist))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 (defun fume-prompt-function-goto-one-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 (fume-prompt-function-goto))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (defun fume-prompt-function-goto-other-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 (interactive)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2177 (fume-prompt-function-goto t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2179 (defun fume-list-functions-show-fn-other-window (&optional window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 (select-window
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2183 (prog1 (selected-window) (fume-prompt-function-goto (or window t)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2185 (defun fume-list-functions-show-prev-fn-other-window (&optional window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 (forward-line -1)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2188 (fume-list-functions-show-fn-other-window window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2190 (defun fume-list-functions-show-next-fn-other-window (&optional window)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 (beginning-of-line)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2194 (fume-list-functions-show-fn-other-window window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 (defun fume-list-functions-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 (fume-about)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 (sit-for 1)
201
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2200 (display-message 'prompt
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2201 (format "SPC=%s, p=%s, n=%s, o=%s, G=%s, RET=%s, q=%s"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2202 "this"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2203 "previous"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2204 "next"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2205 "other win"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2206 "one win"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2207 "this win"
eb5470882647 Import from CVS: tag r20-3b27
cvs
parents: 189
diff changeset
2208 "quit")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 (defun fume-list-functions-quit ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 (if (eq major-mode 'fume-list-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 (kill-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 (if fume-list-reused-win-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 (switch-to-buffer fume-list-trampled-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 (or (one-window-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (delete-window (selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 (if (not (eq (current-buffer) fume-list-srcbuffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 (select-window (get-buffer-window fume-list-srcbuffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 (switch-to-buffer fume-list-srcbuffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226 (error nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 (defun fume-list-mouse-select (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 (let (ws cb cp (wc (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 (mouse-set-point event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 (fume-prompt-function-goto-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 (setq ws (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 (beginning-of-line (- 1 fume-fn-window-position)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 cb (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 cp (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237 (set-window-configuration wc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 (switch-to-buffer cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 (set-window-start (selected-window) ws)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 (goto-char cp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (defvar fume-list-mode-map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 (or fume-list-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 (let ((map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (define-key map "q" 'fume-list-functions-quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 (define-key map "h" 'fume-list-functions-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (define-key map "?" 'fume-list-functions-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (define-key map "g" 'fume-prompt-function-goto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (define-key map "\C-m" 'fume-prompt-function-goto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 (define-key map "G" 'fume-prompt-function-goto-one-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 (define-key map "o" 'fume-prompt-function-goto-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252 (define-key map " " 'fume-list-functions-show-fn-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 (define-key map "p" 'fume-list-functions-show-prev-fn-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 (define-key map "n" 'fume-list-functions-show-next-fn-other-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255 (if fume-not-tty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (define-key map [(button2)] 'fume-list-mouse-select))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (setq fume-list-mode-map map)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (defvar fume-list-mode-hook nil "*Hook to run after fume-list-mode entered")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 (defun fume-list-functions (&optional this-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 "Creates a temporary buffer listing functions found in the current buffer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 (interactive "P")
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2264 (fume-scan-buffer) ;; Create funclist and set defaults if required
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 (let ((func-near-point (format "^%s$" (fume-function-before-point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 (cond ((or fume-function-name-regexp (fume-maybe-install-modeline-feature))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 (let ((srcbuffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 (set-buffer (get-buffer-create fume-buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 (let (buffer-read-only) (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (use-local-map fume-list-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 (setq buffer-read-only t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 mode-name "Func-Menu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 major-mode 'fume-list-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 fume-list-srcbuffer srcbuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 fume-list-reused-win-p (not (one-window-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 (if fume-not-tty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 (setq mode-motion-hook 'mode-motion-highlight-symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 (run-hooks 'fume-list-mode-hook)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280 (or fume-funclist (fume-rescan-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 (if fume-funclist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 (lambda (p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 (set-buffer fume-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 (let (buffer-read-only)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 (if (= (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (insert (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 (insert (concat "\n" (car p))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 (goto-char (point-min))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 fume-funclist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 (cond ((interactive-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 (if current-prefix-arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 (switch-to-buffer fume-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 (switch-to-buffer-other-window fume-buffer-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 (setq fume-list-trampled-buffer (other-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 (or fume-list-reused-win-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 (shrink-window-if-larger-than-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (cond (func-near-point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 (re-search-forward func-near-point nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 (beginning-of-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 (fume-list-functions-help))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306 (error "Func-Menu is not operative in this buffer")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 (provide 'func-menu)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2309
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 70
diff changeset
2310 ;;; end of file