Mercurial > hg > xemacs-beta
comparison lisp/packages/func-menu.el @ 151:59463afc5666 r20-3b2
Import from CVS: tag r20-3b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:37:19 +0200 |
parents | 34a5b81f86ba |
children | 929b76928fce |
comparison
equal
deleted
inserted
replaced
150:8ebb1c0f0f6f | 151:59463afc5666 |
---|---|
1 ;;; func-menu.el --- Jump to a function within a buffer. | 1 ;;; func-menu.el --- Jump to a function within a buffer. |
2 ;;; | 2 ;;; |
3 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl> | 3 ;;; David Hughes <d.hughes@videonetworks.com> |
4 ;;; Last modified: David Hughes 13th January 1997 | 4 ;;; Last modified: David Hughes 13th January 1997 |
5 ;;; Version: 2.45 | 5 ;;; Version: 2.45 |
6 ;;; Keywords: tools, c, lisp | 6 ;;; Keywords: tools, c, lisp |
7 ;;; | 7 ;;; |
8 ;;; This program is free software; you can redistribute it and/or modify | 8 ;;; This program is free software; you can redistribute it and/or modify |
63 ;;; | 63 ;;; |
64 ;;; Speedup for fume-cc-inside-comment | 64 ;;; Speedup for fume-cc-inside-comment |
65 ;;; Peter Pezaris <pez@dwwc.com> | 65 ;;; Peter Pezaris <pez@dwwc.com> |
66 ;;; | 66 ;;; |
67 ;;; Made menu placement more flexible | 67 ;;; Made menu placement more flexible |
68 ;;; Bob Weiner <weiner@infodock.com> | 68 ;;; Bob Weiner <weiner@altrasoft.com> |
69 ;;; | 69 ;;; |
70 ;;; Fortran90 regexp | 70 ;;; Fortran90 regexp |
71 ;;; John Turner <turner@xdiv.lanl.gov> | 71 ;;; John Turner <turner@xdiv.lanl.gov> |
72 ;;; | 72 ;;; |
73 ;;; Patch to error trap in fume-rescan-buffer | 73 ;;; Patch to error trap in fume-rescan-buffer |
74 ;;; Andy Piper <andyp@parallax.co.uk> | 74 ;;; Andy Piper <andyp@parallax.co.uk> |
75 ;;; | 75 ;;; |
76 ;;; Java support | 76 ;;; Java support |
77 ;;; Bob Weiner <weiner@infodock.com> | 77 ;;; Bob Weiner <weiner@altrasoft.com> |
78 ;;; Heddy Boubaker <boubaker@dgac.fr> | 78 ;;; Heddy Boubaker <boubaker@dgac.fr> |
79 ;;; | 79 ;;; |
80 ;;; Patch for fume-rescan-buffer{-trigger} | 80 ;;; Patch for fume-rescan-buffer{-trigger} |
81 ;;; Christoph Wedler <wedler@vivaldi.fmi.uni-passau.de> | 81 ;;; Christoph Wedler <wedler@vivaldi.fmi.uni-passau.de> |
82 ;;; | 82 ;;; |
171 ;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it> | 171 ;;; Paolo Frasconi <paolo@mcculloch.ing.unifi.it> |
172 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov> | 172 ;;; C. Michael Holloway <c.m.holloway@larc.nasa.gov> |
173 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr> | 173 ;;; Philippe Queinnec <queinnec@cenatls.cena.dgac.fr> |
174 ;;; | 174 ;;; |
175 ;;; Assembly support | 175 ;;; Assembly support |
176 ;;; Bob Weiner <weiner@infodock.com> | 176 ;;; Bob Weiner <weiner@altrasoft.com> |
177 ;;; | 177 ;;; |
178 ;;; Removal of cl dependencies | 178 ;;; Removal of cl dependencies |
179 ;;; Russell Ritchie <russell@gssec.bt.co.uk> | 179 ;;; Russell Ritchie <russell@gssec.bt.co.uk> |
180 ;;; | 180 ;;; |
181 ;;; C++ mode enhancemencements for func-menu | 181 ;;; C++ mode enhancemencements for func-menu |
218 (defgroup fume nil | 218 (defgroup fume nil |
219 "Jump to a function within a buffer." | 219 "Jump to a function within a buffer." |
220 :tag "Func Menu" | 220 :tag "Func Menu" |
221 :group 'tools) | 221 :group 'tools) |
222 | 222 |
223 (defconst fume-developer "David Hughes <ukchugd@ukpmr.cs.philips.nl>") | 223 (defconst fume-developer "David Hughes <d.hughes@videonetworks.com>") |
224 | 224 |
225 (defun fume-about () | 225 (defun fume-about () |
226 (interactive) | 226 (interactive) |
227 (sit-for 0) | 227 (sit-for 0) |
228 (message "Func-Menu version %s, © 1996 %s" fume-version fume-developer)) | 228 (message "Func-Menu version %s, © 1996 %s" fume-version fume-developer)) |
419 (defcustom fume-menubar-menu-name "Functions" | 419 (defcustom fume-menubar-menu-name "Functions" |
420 "*Set this to the string you want to appear in the menubar" | 420 "*Set this to the string you want to appear in the menubar" |
421 :type 'string | 421 :type 'string |
422 :group 'fume) | 422 :group 'fume) |
423 | 423 |
424 ;;; Bob Weiner <weiner@infodock.com> | 424 ;;; Bob Weiner <weiner@altrasoft.com> |
425 (defvar fume-menu-path nil | 425 (defvar fume-menu-path nil |
426 "Menubar menu under which the function menu should be installed. | 426 "Menubar menu under which the function menu should be installed. |
427 Nil means install it on the menubar itself. Otherwise, it should be a list | 427 Nil means install it on the menubar itself. Otherwise, it should be a list |
428 of strings, each string names a successively deeper menu under which the | 428 of strings, each string names a successively deeper menu under which the |
429 new menu should be located.") | 429 new menu should be located.") |
585 "Expression to get lisp function names") | 585 "Expression to get lisp function names") |
586 | 586 |
587 ;;; C | 587 ;;; C |
588 ;;; | 588 ;;; |
589 ;;; Danny Bar-Dov <danny@acet02.amil.co.il> | 589 ;;; Danny Bar-Dov <danny@acet02.amil.co.il> |
590 ;;; Bob Weiner <weiner@altrasoft.com> added #define macro support. | |
590 (defvar fume-function-name-regexp-c | 591 (defvar fume-function-name-regexp-c |
591 (concat | 592 (concat |
592 "^[a-zA-Z0-9_]+\\s-?" ; type specs; there can be no | 593 "^\\([a-zA-Z0-9]+\\|#define\\)\\s-?" ; type specs; there can be no |
593 "\\([a-zA-Z0-9_*]+\\s-+\\)?" ; more than 3 tokens, right? | 594 "\\([a-zA-Z0-9_*]+\\s-+\\)?" ; more than 3 tokens, right? |
594 "\\([a-zA-Z0-9_*]+\\s-+\\)?" | 595 "\\([a-zA-Z0-9_*]+\\s-+\\)?" |
595 "\\([*&]+\\s-*\\)?" ; pointer | 596 "\\([*&]+\\s-*\\)?" ; pointer |
596 "\\([a-zA-Z0-9_*]+\\)[ \t\n]*(" ; name | 597 "\\([a-zA-Z0-9_*]+\\)[ \t\n]*(" ; name |
597 ) | 598 ) |
603 ;;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu> | 604 ;;; Kevin R. Powell <powell@csl.ncsa.uiuc.edu> |
604 ;;; Mats Lidell <mats.lidell@eua.ericsson.se> | 605 ;;; Mats Lidell <mats.lidell@eua.ericsson.se> |
605 ;;; Mike Battaglia <mbattagl@spd.dsccc.com> | 606 ;;; Mike Battaglia <mbattagl@spd.dsccc.com> |
606 ;;; Oliver Schittko <schittko@fokus.gmd.de> | 607 ;;; Oliver Schittko <schittko@fokus.gmd.de> |
607 ;;; Tom Murray <tmurray@hpindck.cup.hp.com> | 608 ;;; Tom Murray <tmurray@hpindck.cup.hp.com> |
609 ;;; Bob Weiner <weiner@altrasoft.com> added #define macro support. | |
608 (defvar fume-function-name-regexp-c++ | 610 (defvar fume-function-name-regexp-c++ |
609 (cons | 611 (cons |
610 (concat | 612 (concat |
611 "^\\(template\\s +<[^>]+>\\s +\\)?" ; template formals | 613 "^\\(#define\\s-+\\|" |
614 "\\(template\\s-+<[^>]+>\\s-+\\)?" ; template formals | |
612 "\\([a-zA-Z0-9_*&<,>:]+\\s-+\\)?" ; type specs; there can be no | 615 "\\([a-zA-Z0-9_*&<,>:]+\\s-+\\)?" ; type specs; there can be no |
613 "\\([a-zA-Z0-9_*&<,>\"]+\\s-+\\)?" ; more than 3 tokens, right? | 616 "\\([a-zA-Z0-9_*&<,>\"]+\\s-+\\)?" ; more than 3 tokens, right? |
614 "\\([a-zA-Z0-9_*&<,>]+\\s-+\\)?" | 617 "\\([a-zA-Z0-9_*&<,>]+\\s-+\\)?\\)" |
615 "\\(\\([a-zA-Z0-9_&~:<,>*]\\|\\(\\s +::\\s +\\)\\)+\\)" | 618 "\\(\\([a-zA-Z0-9_&~:<,>*]\\|\\(\\s +::\\s +\\)\\)+\\)" |
616 "\\(o?perator\\s *.[^(]*\\)?\\(\\s-\\|\n\\)*(" ; name | 619 "\\(o?perator\\s *.[^(]*\\)?\\(\\s-\\|\n\\)*(" ; name |
617 ) 5) | 620 ) 6) |
618 "Expression to get C++ function names") | 621 "Expression to get C++ function names") |
619 | 622 |
620 ;;; FORTRAN | 623 ;;; FORTRAN |
621 ;;; | 624 ;;; |
622 ;;; Paul Emsley <paule@chem.gla.ac.uk> | 625 ;;; Paul Emsley <paule@chem.gla.ac.uk> |
1090 (memq (buffer-syntactic-context) '(comment block-comment))) | 1093 (memq (buffer-syntactic-context) '(comment block-comment))) |
1091 | 1094 |
1092 ;;; <jrm@odi.com> | 1095 ;;; <jrm@odi.com> |
1093 ;;; <ajp@eng.cam.ac.uk> | 1096 ;;; <ajp@eng.cam.ac.uk> |
1094 ;;; <schittko@fokus.gmd.de> | 1097 ;;; <schittko@fokus.gmd.de> |
1095 ;;; <ukchugd@ukpmr.cs.philips.nl> - speedup, David Hughes 24th November 1996 | 1098 ;;; <d.hughes@videonetworks.com> - speedup, David Hughes 24th November 1996 |
1096 ;;; | 1099 ;;; |
1097 (defun fume-match-find-next-function-name (buffer) | 1100 (defun fume-match-find-next-function-name (buffer) |
1098 ;; General next function name in BUFFER finder using match. | 1101 ;; General next function name in BUFFER finder using match. |
1099 ;; The regexp is assumed to be a two item list the car of which is the regexp | 1102 ;; The regexp is assumed to be a two item list the car of which is the regexp |
1100 ;; to use, and the cdr of which is the match position of the function name | 1103 ;; to use, and the cdr of which is the match position of the function name |
1123 (defun fume-find-next-perl-function-name (buffer) | 1126 (defun fume-find-next-perl-function-name (buffer) |
1124 "Searches for the next Perl function in BUFFER." | 1127 "Searches for the next Perl function in BUFFER." |
1125 (fume-find-next-sexp buffer)) | 1128 (fume-find-next-sexp buffer)) |
1126 | 1129 |
1127 ;;; Specialised routine to find the next Java function | 1130 ;;; Specialised routine to find the next Java function |
1128 ;;; Bob Weiner <weiner@infodock.com> | 1131 ;;; Bob Weiner <weiner@altrasoft.com> |
1129 ;;; Heddy Boubaker <boubaker@dgac.fr> | 1132 ;;; Heddy Boubaker <boubaker@dgac.fr> |
1130 ;;; | 1133 ;;; |
1131 (defun fume-find-next-java-function-name (buffer) | 1134 (defun fume-find-next-java-function-name (buffer) |
1132 "Searches for the next Java function in BUFFER." | 1135 "Searches for the next Java function in BUFFER." |
1133 (set-buffer buffer) | 1136 (set-buffer buffer) |
1138 (forward-sexp) | 1141 (forward-sexp) |
1139 (if (and (looking-at "[^;(]*{") | 1142 (if (and (looking-at "[^;(]*{") |
1140 (not (fume-cc-inside-comment))) | 1143 (not (fume-cc-inside-comment))) |
1141 ;; This is a method definition and we're not in a comment | 1144 ;; This is a method definition and we're not in a comment |
1142 (let ((str (buffer-substring beg end))) | 1145 (let ((str (buffer-substring beg end))) |
1143 ;; Bob Weiner <weiner@infodock.com> added exact match | 1146 ;; Bob Weiner <weiner@altrasoft.com> added exact match |
1144 ;; delimiters so function names that happen to contain | 1147 ;; delimiters so function names that happen to contain |
1145 ;; any of these terms are not eliminated. The old version | 1148 ;; any of these terms are not eliminated. The old version |
1146 ;; would ignore "notify()" since it contained "if". | 1149 ;; would ignore "notify()" since it contained "if". |
1147 (or (string-match "\\`\\(if\\|switch\\|catch\\|for\\|while\\)\\'" | 1150 (or (string-match "\\`\\(if\\|switch\\|catch\\|for\\|while\\)\\'" |
1148 str) | 1151 str) |
1427 (end (match-end (cdr fume-function-name-regexp-idl)))) | 1430 (end (match-end (cdr fume-function-name-regexp-idl)))) |
1428 (cons (buffer-substring beg end) beg)))) | 1431 (cons (buffer-substring beg end) beg)))) |
1429 | 1432 |
1430 | 1433 |
1431 ;;; Assembly | 1434 ;;; Assembly |
1432 ;;; Bob Weiner <weiner@infodock.com> | 1435 ;;; Bob Weiner <weiner@altrasoft.com> |
1433 ;;; | 1436 ;;; |
1434 (defun fume-find-next-asm-function-name (buffer) | 1437 (defun fume-find-next-asm-function-name (buffer) |
1435 "Searches for the next assembler function in BUFFER." | 1438 "Searches for the next assembler function in BUFFER." |
1436 (set-buffer buffer) | 1439 (set-buffer buffer) |
1437 ;; Search for the function | 1440 ;; Search for the function |
2112 (defvar fume-list-srcbuffer nil) | 2115 (defvar fume-list-srcbuffer nil) |
2113 (defvar fume-list-reused-win-p nil) | 2116 (defvar fume-list-reused-win-p nil) |
2114 (defvar fume-list-trampled-buffer nil) | 2117 (defvar fume-list-trampled-buffer nil) |
2115 | 2118 |
2116 ;;; Espen Skoglund <espensk@stud.cs.uit.no> | 2119 ;;; Espen Skoglund <espensk@stud.cs.uit.no> |
2117 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl> | 2120 ;;; David Hughes <d.hughes@videonetworks.com> |
2118 ;;; | 2121 ;;; |
2119 (defun fume-prompt-function-goto (&optional other-window-p) | 2122 (defun fume-prompt-function-goto (&optional other-window-p) |
2120 "Goto function prompted for in minibuffer (with completion). | 2123 "Goto function prompted for in minibuffer (with completion). |
2121 With prefix arg, jumps to function in a different window." | 2124 With prefix arg, jumps to function in a different window." |
2122 (interactive "P") | 2125 (interactive "P") |