Hi,
I made a small addition to func-menu.el in perl mode. With the patch
it also scans for package declarations and appends the current
package name to the sub name. Eg: if you have a perl file:
package Foo;
sub foo {}
package Bar;
sub foo {}
It will show Foo::foo and Bar::foo in the menu. Hope
1) this is of any use to anyone else
2) this is the right place to submit the patch
--
Remco Wouts remco(a)xray.bmc.uu.se | Dept. of Biochemistry, Uppsala University
tel/fax:+46-18-4714914/511755 | PO Box 576, S-751 23 Uppsala, Sweden.
WinErr: 01C Uncertainty error - Uncertainty may be inadequate.
--- func-menu.el Mon Oct 21 11:11:10 2002
+++ func-menu.el Thu Dec 5 16:57:57 2002
@@ -795,7 +795,8 @@
;;
;; Alex Rezinsky <alexr(a)msil.sps.mot.com>
;; Michael Lamoureux <lamour(a)engin.umich.edu>
-(defvar fume-function-name-regexp-perl "^sub[ \t]+\\([A-Za-z0-9_]+\\)"
+(defvar fume-function-name-regexp-perl
+ "^\\(package\\|sub\\)[ \t]+\\([A-Za-z0-9_:]+\\)"
"Expression to get Perl function names.")
;; Ruby
@@ -1312,7 +1313,24 @@
;;
(defun fume-find-next-perl-function-name (buffer)
"Search for the next Perl function in BUFFER."
- (fume-find-next-sexp buffer))
+ (set-buffer buffer)
+ (if (not (boundp 'fume-perl-package))
+ (progn (make-variable-buffer-local 'fume-perl-package)
+ (setq fume-perl-package nil)))
+ (if (re-search-forward fume-function-name-regexp nil t)
+ (save-excursion
+ (let* ((retpnt (match-beginning 2))
+ (type (match-string 1))
+ (name (match-string 2)))
+ (cond ((string= type "package")
+ (setq fume-perl-package name)
+ (cons name retpnt))
+ ((string= type "sub")
+ (cons (if (eq fume-perl-package nil) name
+ (format "%s::%s" fume-perl-package name))
+ retpnt)))))))
+
+
;; Specialised routine to find the next Ruby function
;;