Commits

didierv  committed f773ef9

Manual mode support in func-menu

  • Participants
  • Parent commits 8d09ac0

Comments (0)

Files changed (2)

+2000-08-04  Didier Verna  <didier@xemacs.org>
+
+	* func-menu.el: some reformatting of comments and copyright notice.
+	(fume-version): increase.
+	(fume-about): just give the version number.
+	(fume-function-name-regexp-manual): new variable (man pages support).
+	(fume-function-name-regexp-alist): Manual-mode addition.
+	(fume-find-next-manual-section): new function (man pages support).
+	(fume-find-function-name-method-alist): use it.
+
+
 2000-03-10  Felix Gatzemeier  <fxg@cs.RWTH-Aachen.De>
 
 	* man.el: Smoothed sectioning and retrieval.  In determining the

File func-menu.el

-;;; func-menu.el         --- Jump to a function within a buffer.
-;;;
-;;; David Hughes <d.hughes@videonetworks.com>
-;;; Last Modified: David Hughes 9th November 1998
-;;; Version: 2.63
-;;; Keywords: tools, c, lisp
-;;;
-;;; This program is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program; if not, write to the Free Software
-;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
+;;; func-menu.el --- Jump to a function within a buffer.
+
+;; Author:     David Hughes <d.hughes@videonetworks.com>
+;; Maintainer: The XEmacs Development Team <xemacs-beta@xemacs.org>
+;; Version: 2.65
+;; Keywords: tools, c, lisp
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
 ;;; Synched up with: Not in FSF.
-;;;
-;;; Installation:
-;;; =============
-;;; (require 'func-menu)
-;;; (define-key global-map 'f8 'function-menu)
-;;; (add-hook 'find-file-hooks 'fume-add-menubar-entry)
-;;; (define-key global-map "\C-cl" 'fume-list-functions)
-;;; (define-key global-map "\C-cg" 'fume-prompt-function-goto)
-;;; (define-key global-map '(shift button3) 'mouse-function-menu)
-;;; (define-key global-map '(meta  button1) 'fume-mouse-function-goto)
-;;;
-;;; Description:
-;;; ============
-;;; Suppose you have a file with a lot of functions in it. Well, this package
-;;; makes it easy to jump to any of those functions. The names of the
-;;; functions in the current buffer are automatically put into a popup menu,
-;;; you select one of the function-names and the point is moved to that very
-;;; function. The mark is pushed on the mark-ring, so you can easily go back
-;;; to where you were. Alternatively, you can use enter the name of the
-;;; desired function via the minibuffer which offers completing read input. In
-;;; addition, the name of the function before point is optionally displayed in
-;;; the modeline.
-;;;
-;;; Support for non X Window versions of Emacs:
-;;; ===========================================
-;;; This package can also be used for non X versions of Emacs. In this case,
-;;; only modeline display and completing read input from the minibuffer are
-;;; possible.
-;;;
-;;; Modes supported:
-;;; ================
-;;; Ada, Assembly, BibTex, C++, C, Dired, Ehdm, ELisp, FORTRAN, Ksh, Latex,
-;;; Lelisp, Makefile, Maple, Modula2, Modula3, Outline, Objective-C, Pascal,
-;;; Perl, Postscript, Prolog, PVS, Python, SGML, Scheme, Tcl, Verilog
-;;;
-;;; Acknowledgements:
-;;; =================
-;;;
-;;; Protect integer concatenation with int-to-string
-;;; Anthony Rossini <arossini@biostat.washington.edu>
-;;;
-;;; Patch for jde-mode
-;;; Tony Lam <tonyl@Eng.Sun.COM>
-;;;
-;;; Patches to FORTRAN support
-;;; Bruce Ravel <ravel@phys.washington.edu>
-;;;
-;;; Idea for fume-goto-function-hook
-;;; Mark Gates <mgates@ncsa.uiuc.edu>
-;;;
-;;; Patch for backward compatibility with backquote
-;;; Bill Dubuque <wgd@martigny.ai.mit.edu>
-;;;
-;;; Objective-C support
-;;; Guillaume Laurent <glaurent@worldnet.fr>
-;;;
-;;; Fix to fume-function-name-regexp-c
-;;; Jonathan Edwards <edwards@intranet.com>
-;;;
-;;; Speedup for fume-cc-inside-comment
-;;; Peter Pezaris <pez@dwwc.com>
-;;;
-;;; Made menu placement more flexible and rewrote doc strings
-;;; Bob Weiner <weiner@altrasoft.com>
-;;;
-;;; Fortran90 regexp
-;;; John Turner <turner@xdiv.lanl.gov>
-;;;
-;;; Patch to error trap in fume-rescan-buffer
-;;; Andy Piper <andyp@parallax.co.uk>
-;;;
-;;; Java support
-;;; Bob Weiner <weiner@altrasoft.com>
-;;; Heddy Boubaker <boubaker@dgac.fr>
-;;;
-;;; Patch for fume-rescan-buffer{-trigger}
-;;; Christoph Wedler <wedler@vivaldi.fmi.uni-passau.de>
-;;;
-;;; Patch for fume-tickle-f-to-b
-;;; Michael Sperber <sperber@informatik.uni-tuebingen.de>
-;;;
-;;; Cleanup suggestions
-;;; Jonathan Stigelman <stig@hackvan.com>
-;;;
-;;; Idea for jumping directly with a mouse click
-;;; Marc Paquette <Marc.Paquette@Softimage.COM>
-;;;
-;;; Prolog mode additions based on functions for Postscript mode
-;;; Laszlo Teleki <laszlo@ipb.uni-bonn.de>
-;;;
-;;; Idea for displaying function name in modeline
-;;; Paul Filipski <filipski@blackhawk.com>
-;;;
-;;; Fame mode support
-;;; Cooper Vertz <cooper@prod2.imsi.com>
-;;;
-;;; Made fume-match-find-next-function-name iterative, not recursive, to avoid
-;;; blowing out the emacs stack on big files with lots of prototypes.
-;;; Joe Marshall <jrm@odi.com>
-;;;
-;;; Verilog support
-;;; Matt Sale <mdsale@icdc.delcoelect.com>
-;;;
-;;; Minibuffer interface & Pascal support
-;;; Espen Skoglund <espensk@stud.cs.uit.no>
-;;;
-;;; Python support
-;;; Shuichi Koga <skoga@virginia.edu>
-;;;
-;;; Maple support
-;;; Luc Tancredi <Luc.Tancredi@sophia.inria.fr>
-;;;
-;;; Combined Tcl and C++ function finder
-;;; Andy Piper <ajp@eng.cam.ac.uk>
-;;;
-;;; Perl Support
-;;; Alex Rezinsky <alexr@msil.sps.mot.com>
-;;; Michael Lamoureux <lamour@engin.umich.edu>
-;;;
-;;; Suggested mouse interface
-;;; Raymond L. Toy <toy@soho.crd.ge.com>
-;;;
-;;; Dired support
-;;; Improved modula support
-;;; Numerous code cleanups
-;;; Norbert Kiesel <norbert@i3.informatik.rwth-aachen.de>
-;;;
-;;; Makefile support
-;;; Suggested multi-choice sublisting
-;;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
-;;;
-;;; Suggestions for menubar entry
-;;; Andy Piper <ajp@eng.cam.ac.uk>
-;;;
-;;; Ada support
-;;; Scott Evans  <gse@ocsystems.com>
-;;; Mike Konerman <konerman@SSA.crane.navy.mil>
-;;; Michael Polo <mikep@polo.mn.org> <mikep@cfsmo.honeywell.com>
-;;;
-;;; Scheme, BibTeX, Ehdm & PVS support
-;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
-;;;
-;;; Modula support
-;;; Geoffrey Wyant <gwyant@cloyd.east.sun.com>
-;;;
-;;; SGML support; submenu indexing
-;;; Thomas Plass <thomas.plass@mid-heidelberg.de>
-;;;
-;;; Extensions to fume-function-name-regexp-lisp
-;;; Vladimir Alexiev <vladimir@cs.ualberta.ca>
-;;; Kari Heinola <kph@dpe.fi>
-;;; Milo A. Chan <chan@jpmorgan.com>
-;;; Jack Repenning <jackr@step7.informix.com>
-;;; Cedric Beust <Cedric.Beust@sophia.inria.fr>
-;;; Joachim Krumnow <krumnow@srsir02.ext.sap-ag.de>
-;;;
-;;; ksh support
-;;; Philippe Bondono <bondono@vnet.ibm.com>
-;;;
-;;; FORTRAN support
-;;; Paul Emsley <paule@chem.gla.ac.uk>
-;;; Raymond L. Toy <toy@soho.crd.ge.com>
-;;; Richard Cognot <cognot@elfgrc.co.uk>
-;;; Greg Sjaardema <gdsjaar@sandia.gov>
-;;;
-;;; Latex support
-;;; Wolfgang Mettbach <wolle@uni-paderborn.de>
-;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it>
-;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
-;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
-;;;
-;;; Assembly support
-;;; Bob Weiner <weiner@altrasoft.com>
-;;;
-;;; Removal of cl dependencies
-;;; Russell Ritchie <russell@gssec.bt.co.uk>
-;;;
-;;; C++ mode enhancemencements for func-menu
-;;; Andy Piper      <ajp@eng.cam.ac.uk>
-;;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu>
-;;; Mats Lidell     <mats.lidell@eua.ericsson.se>
-;;; Mike Battaglia  <mbattagl@spd.dsccc.com>
-;;; Oliver Schittko <schittko@fokus.gmd.de>
-;;; Tom Murray      <tmurray@hpindck.cup.hp.com>
-;;; Russell Ritchie <russell@gssec.bt.co.uk>
-;;;
-;;; Tcl mode additions for func-menu
-;;; Andy Piper <ajp@eng.cam.ac.uk>
-;;; Jean-Michel Augusto <augusto@eurecom.fr>
-;;; Dr P.G. Sjoerdsma <pgs1002@esc.cam.ac.uk>
-;;;
-;;; Postscript mode additions for func-menu
-;;; Leigh Klotz <klotz@adoc.xerox.com>
-;;;
-;;; Suggestions for popup menu positioning
-;;; Marc Gemis <makke@wins.uia.ac.be>
-;;;
-;;; Original FSF package
-;;; Ake Stenhoff <etxaksf@aom.ericsson.se>
 
-;;; Code
+;;; Commentary:
+
+;; Installation:
+;; =============
+;; (require 'func-menu)
+;; (define-key global-map 'f8 'function-menu)
+;; (add-hook 'find-file-hooks 'fume-add-menubar-entry)
+;; (define-key global-map "\C-cl" 'fume-list-functions)
+;; (define-key global-map "\C-cg" 'fume-prompt-function-goto)
+;; (define-key global-map '(shift button3) 'mouse-function-menu)
+;; (define-key global-map '(meta  button1) 'fume-mouse-function-goto)
+;;
+;; Description:
+;; ============
+;; Suppose you have a file with a lot of functions in it. Well, this package
+;; makes it easy to jump to any of those functions. The names of the
+;; functions in the current buffer are automatically put into a popup menu,
+;; you select one of the function-names and the point is moved to that very
+;; function. The mark is pushed on the mark-ring, so you can easily go back
+;; to where you were. Alternatively, you can use enter the name of the
+;; desired function via the minibuffer which offers completing read input. In
+;; addition, the name of the function before point is optionally displayed in
+;; the modeline.
+;;
+;; Support for non X Window versions of Emacs:
+;; ===========================================
+;; This package can also be used for non X versions of Emacs. In this case,
+;; only modeline display and completing read input from the minibuffer are
+;; possible.
+;;
+;; Modes supported:
+;; ================
+;; Ada, Assembly, BibTex, C++, C, Dired, Ehdm, ELisp, FORTRAN, Ksh, Latex,
+;; Lelisp, Makefile, Maple, Modula2, Modula3, Outline, Objective-C, Pascal,
+;; Perl, Postscript, Prolog, PVS, Python, SGML, Scheme, Tcl, Verilog, Manual
+;;
+;; Acknowledgements:
+;; =================
+;;
+;; Manual mode support
+;; Didier Verna <didier@xemacs.org>
+;;
+;; Protect integer concatenation with int-to-string
+;; Anthony Rossini <arossini@biostat.washington.edu>
+;;
+;; Patch for jde-mode
+;; Tony Lam <tonyl@Eng.Sun.COM>
+;;
+;; Patches to FORTRAN support
+;; Bruce Ravel <ravel@phys.washington.edu>
+;;
+;; Idea for fume-goto-function-hook
+;; Mark Gates <mgates@ncsa.uiuc.edu>
+;;
+;; Patch for backward compatibility with backquote
+;; Bill Dubuque <wgd@martigny.ai.mit.edu>
+;;
+;; Objective-C support
+;; Guillaume Laurent <glaurent@worldnet.fr>
+;;
+;; Fix to fume-function-name-regexp-c
+;; Jonathan Edwards <edwards@intranet.com>
+;;
+;; Speedup for fume-cc-inside-comment
+;; Peter Pezaris <pez@dwwc.com>
+;;
+;; Made menu placement more flexible and rewrote doc strings
+;; Bob Weiner <weiner@altrasoft.com>
+;;
+;; Fortran90 regexp
+;; John Turner <turner@xdiv.lanl.gov>
+;;
+;; Patch to error trap in fume-rescan-buffer
+;; Andy Piper <andyp@parallax.co.uk>
+;;
+;; Java support
+;; Bob Weiner <weiner@altrasoft.com>
+;; Heddy Boubaker <boubaker@dgac.fr>
+;;
+;; Patch for fume-rescan-buffer{-trigger}
+;; Christoph Wedler <wedler@vivaldi.fmi.uni-passau.de>
+;;
+;; Patch for fume-tickle-f-to-b
+;; Michael Sperber <sperber@informatik.uni-tuebingen.de>
+;;
+;; Cleanup suggestions
+;; Jonathan Stigelman <stig@hackvan.com>
+;;
+;; Idea for jumping directly with a mouse click
+;; Marc Paquette <Marc.Paquette@Softimage.COM>
+;;
+;; Prolog mode additions based on functions for Postscript mode
+;; Laszlo Teleki <laszlo@ipb.uni-bonn.de>
+;;
+;; Idea for displaying function name in modeline
+;; Paul Filipski <filipski@blackhawk.com>
+;;
+;; Fame mode support
+;; Cooper Vertz <cooper@prod2.imsi.com>
+;;
+;; Made fume-match-find-next-function-name iterative, not recursive, to avoid
+;; blowing out the emacs stack on big files with lots of prototypes.
+;; Joe Marshall <jrm@odi.com>
+;;
+;; Verilog support
+;; Matt Sale <mdsale@icdc.delcoelect.com>
+;;
+;; Minibuffer interface & Pascal support
+;; Espen Skoglund <espensk@stud.cs.uit.no>
+;;
+;; Python support
+;; Shuichi Koga <skoga@virginia.edu>
+;;
+;; Maple support
+;; Luc Tancredi <Luc.Tancredi@sophia.inria.fr>
+;;
+;; Combined Tcl and C++ function finder
+;; Andy Piper <ajp@eng.cam.ac.uk>
+;;
+;; Perl Support
+;; Alex Rezinsky <alexr@msil.sps.mot.com>
+;; Michael Lamoureux <lamour@engin.umich.edu>
+;;
+;; Suggested mouse interface
+;; Raymond L. Toy <toy@soho.crd.ge.com>
+;;
+;; Dired support
+;; Improved modula support
+;; Numerous code cleanups
+;; Norbert Kiesel <norbert@i3.informatik.rwth-aachen.de>
+;;
+;; Makefile support
+;; Suggested multi-choice sublisting
+;; Paul Filipski & Anthony Girardin <{filipski,girardin}@blackhawk.com>
+;;
+;; Suggestions for menubar entry
+;; Andy Piper <ajp@eng.cam.ac.uk>
+;;
+;; Ada support
+;; Scott Evans  <gse@ocsystems.com>
+;; Mike Konerman <konerman@SSA.crane.navy.mil>
+;; Michael Polo <mikep@polo.mn.org> <mikep@cfsmo.honeywell.com>
+;;
+;; Scheme, BibTeX, Ehdm & PVS support
+;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
+;;
+;; Modula support
+;; Geoffrey Wyant <gwyant@cloyd.east.sun.com>
+;;
+;; SGML support; submenu indexing
+;; Thomas Plass <thomas.plass@mid-heidelberg.de>
+;;
+;; Extensions to fume-function-name-regexp-lisp
+;; Vladimir Alexiev <vladimir@cs.ualberta.ca>
+;; Kari Heinola <kph@dpe.fi>
+;; Milo A. Chan <chan@jpmorgan.com>
+;; Jack Repenning <jackr@step7.informix.com>
+;; Cedric Beust <Cedric.Beust@sophia.inria.fr>
+;; Joachim Krumnow <krumnow@srsir02.ext.sap-ag.de>
+;;
+;; ksh support
+;; Philippe Bondono <bondono@vnet.ibm.com>
+;;
+;; FORTRAN support
+;; Paul Emsley <paule@chem.gla.ac.uk>
+;; Raymond L. Toy <toy@soho.crd.ge.com>
+;; Richard Cognot <cognot@elfgrc.co.uk>
+;; Greg Sjaardema <gdsjaar@sandia.gov>
+;;
+;; Latex support
+;; Wolfgang Mettbach <wolle@uni-paderborn.de>
+;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it>
+;; C. Michael Holloway <c.m.holloway@larc.nasa.gov>
+;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr>
+;;
+;; Assembly support
+;; Bob Weiner <weiner@altrasoft.com>
+;;
+;; Removal of cl dependencies
+;; Russell Ritchie <russell@gssec.bt.co.uk>
+;;
+;; C++ mode enhancemencements for func-menu
+;; Andy Piper      <ajp@eng.cam.ac.uk>
+;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu>
+;; Mats Lidell     <mats.lidell@eua.ericsson.se>
+;; Mike Battaglia  <mbattagl@spd.dsccc.com>
+;; Oliver Schittko <schittko@fokus.gmd.de>
+;; Tom Murray      <tmurray@hpindck.cup.hp.com>
+;; Russell Ritchie <russell@gssec.bt.co.uk>
+;;
+;; Tcl mode additions for func-menu
+;; Andy Piper <ajp@eng.cam.ac.uk>
+;; Jean-Michel Augusto <augusto@eurecom.fr>
+;; Dr P.G. Sjoerdsma <pgs1002@esc.cam.ac.uk>
+;;
+;; Postscript mode additions for func-menu
+;; Leigh Klotz <klotz@adoc.xerox.com>
+;;
+;; Suggestions for popup menu positioning
+;; Marc Gemis <makke@wins.uia.ac.be>
+;;
+;; Original FSF package
+;; Ake Stenhoff <etxaksf@aom.ericsson.se>
+
+;;; Code:
 
 (defmacro fume-bomb-proof (&rest forms)
   (` (condition-case () (progn (,@ forms)) (t nil))))
 ;;;;;;;;;;;;;;;;;;;;;;;;  Environment Initialisation  ;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defconst fume-version "2.63")
+(defconst fume-version "2.65")
 
-(defconst fume-developer "David Hughes <d.hughes@videonetworks.com>")
+(defconst fume-developer
+  "The XEmacs Development Team <xemacs-beta@xemacs.org>")
 
 (defun fume-about ()
   (interactive)
   (sit-for 0)
   (display-message
    'no-log
-   (format "Func-Menu version %s, ,A)(B 1998 %s" fume-version fume-developer)))
+   (format "Func-Menu version %s")))
 
 (defconst fume-running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
 
    "\\|"
    ;; White space at beginning.
    "^\\s-*"
-   ;; Type specs -- not used, because it would also include "end 
-   ;; function" lines and I don't use type specs before function 
+   ;; Type specs -- not used, because it would also include "end
+   ;; function" lines and I don't use type specs before function
    ;; statements anyway. Uncomment this line if you want that behavior.
    ;; "[a-zA-Z0-9*]*"
    ;;
   "^\\([a-zA-Z_.$][a-zA-Z0-9_.$]*\\)[ \t]*:"
   "Expression to get assembly label names")
 
+;;; Manual pages
+;;;
+;;; Didier Verna <didier@xemacs.org>
+(defvar fume-function-name-regexp-manual "^[A-Z][A-Z ]+$"
+  "*Expression to get Manual pages sections")
+
+
 ;;; This is where the mode specific regexp's are hooked in
 ;;;
 (defvar fume-function-name-regexp-alist
 
     ;; Assembly
     (asm-mode . fume-function-name-regexp-asm)
+
+    ;; Manual
+    (Manual-mode . fume-function-name-regexp-manual)
     )
 
   "The connection between a mode and the regexp that matches function names.")
       (cons (buffer-substring (match-beginning 1) (match-end 1))
             (match-beginning 1))))
 
+;;; Specialised routine to get the next manual section name in the buffer
+;;; Didier Verna <didier@xemacs.org>
+;;;
+(defun fume-find-next-manual-section (buffer)
+  (set-buffer buffer)
+  (if (re-search-forward fume-function-name-regexp nil t)
+      (let ((beg (match-beginning 0))
+	    (end (match-end 0)))
+	(cons (buffer-substring beg end) beg))))
+
 ;;; This is where you can hook in other languages which may need a different
 ;;; method to scan for function names. Otherwise, the default defun used is
 ;;; fume-find-next-function-name which is suitable for sexp-based languages
     (tcl-mode        . fume-match-find-next-function-name)
     (verilog-mode    . fume-find-next-verilog-function-name)
     (idl-mode        . fume-find-next-idl-function-name)
+    (Manual-mode     . fume-find-next-manual-section)
     )
 
   "The connection between a mode and the defun that finds function names.
 
 (provide 'func-menu)
 
-;;; end of file
+;;; func-menu.el ends here